summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/Makefile.frag10
-rw-r--r--ext/standard/array.c4543
-rw-r--r--ext/standard/assert.c347
-rw-r--r--ext/standard/base64.c266
-rw-r--r--ext/standard/base64.h38
-rw-r--r--ext/standard/basic_functions.c6038
-rw-r--r--ext/standard/basic_functions.h264
-rw-r--r--ext/standard/browscap.c545
-rw-r--r--ext/standard/config.m4586
-rw-r--r--ext/standard/config.w3228
-rw-r--r--ext/standard/crc32.c53
-rw-r--r--ext/standard/crc32.h109
-rw-r--r--ext/standard/credits.c140
-rw-r--r--ext/standard/credits.h42
-rw-r--r--ext/standard/credits_ext.h86
-rw-r--r--ext/standard/credits_sapi.h32
-rw-r--r--ext/standard/crypt.c318
-rw-r--r--ext/standard/crypt_blowfish.c909
-rw-r--r--ext/standard/crypt_blowfish.h32
-rw-r--r--ext/standard/crypt_freesec.c808
-rw-r--r--ext/standard/crypt_freesec.h49
-rw-r--r--ext/standard/crypt_sha256.c759
-rw-r--r--ext/standard/crypt_sha512.c828
-rw-r--r--ext/standard/css.c55
-rw-r--r--ext/standard/css.h26
-rw-r--r--ext/standard/cyr_convert.c296
-rw-r--r--ext/standard/cyr_convert.h29
-rw-r--r--ext/standard/datetime.c128
-rw-r--r--ext/standard/datetime.h31
-rw-r--r--ext/standard/dir.c601
-rw-r--r--ext/standard/dl.c298
-rw-r--r--ext/standard/dl.h34
-rw-r--r--ext/standard/dns.c1048
-rw-r--r--ext/standard/dns_win32.c506
-rw-r--r--ext/standard/exec.c498
-rw-r--r--ext/standard/exec.h41
-rw-r--r--ext/standard/file.c2459
-rw-r--r--ext/standard/file.h141
-rw-r--r--ext/standard/filestat.c1240
-rw-r--r--ext/standard/filters.c2152
-rw-r--r--ext/standard/flock_compat.c239
-rw-r--r--ext/standard/flock_compat.h66
-rw-r--r--ext/standard/formatted_print.c793
-rw-r--r--ext/standard/fsock.c141
-rw-r--r--ext/standard/fsock.h42
-rw-r--r--ext/standard/ftok.c71
-rw-r--r--ext/standard/ftp_fopen_wrapper.c1204
-rw-r--r--ext/standard/head.c321
-rw-r--r--ext/standard/head.h36
-rw-r--r--ext/standard/html.c1708
-rw-r--r--ext/standard/html.h62
-rw-r--r--ext/standard/html_tables.h6235
-rw-r--r--ext/standard/html_tables/ents_basic.txt5
-rw-r--r--ext/standard/html_tables/ents_basic_apos.txt5
-rw-r--r--ext/standard/html_tables/ents_html401.txt253
-rw-r--r--ext/standard/html_tables/ents_html5.txt2125
-rw-r--r--ext/standard/html_tables/ents_xhtml.txt253
-rw-r--r--ext/standard/html_tables/html_table_gen.php812
-rw-r--r--ext/standard/html_tables/mappings/8859-1.TXT303
-rw-r--r--ext/standard/html_tables/mappings/8859-15.TXT303
-rw-r--r--ext/standard/html_tables/mappings/8859-5.TXT303
-rw-r--r--ext/standard/html_tables/mappings/CP1251.TXT274
-rw-r--r--ext/standard/html_tables/mappings/CP1252.TXT274
-rw-r--r--ext/standard/html_tables/mappings/CP866.TXT275
-rw-r--r--ext/standard/html_tables/mappings/KOI8-R.TXT302
-rw-r--r--ext/standard/html_tables/mappings/ROMAN.TXT370
-rw-r--r--ext/standard/http.c253
-rw-r--r--ext/standard/http_fopen_wrapper.c962
-rw-r--r--ext/standard/image.c1441
-rw-r--r--ext/standard/incomplete_class.c183
-rw-r--r--ext/standard/info.c1336
-rw-r--r--ext/standard/info.h92
-rw-r--r--ext/standard/iptc.c375
-rw-r--r--ext/standard/lcg.c132
-rw-r--r--ext/standard/levenshtein.c142
-rw-r--r--ext/standard/link.c232
-rw-r--r--ext/standard/link_win32.c248
-rw-r--r--ext/standard/mail.c414
-rw-r--r--ext/standard/math.c1295
-rw-r--r--ext/standard/md5.c389
-rw-r--r--ext/standard/md5.h55
-rw-r--r--ext/standard/metaphone.c480
-rw-r--r--ext/standard/microtime.c166
-rw-r--r--ext/standard/microtime.h32
-rw-r--r--ext/standard/pack.c953
-rw-r--r--ext/standard/pack.h28
-rw-r--r--ext/standard/pageinfo.c201
-rw-r--r--ext/standard/pageinfo.h35
-rw-r--r--ext/standard/php_array.h130
-rw-r--r--ext/standard/php_assert.h32
-rw-r--r--ext/standard/php_browscap.h29
-rw-r--r--ext/standard/php_crypt.h40
-rw-r--r--ext/standard/php_crypt_r.c428
-rw-r--r--ext/standard/php_crypt_r.h59
-rw-r--r--ext/standard/php_dir.h44
-rw-r--r--ext/standard/php_dns.h81
-rw-r--r--ext/standard/php_ext_syslog.h41
-rw-r--r--ext/standard/php_filestat.h115
-rw-r--r--ext/standard/php_fopen_wrapper.c409
-rw-r--r--ext/standard/php_fopen_wrappers.h33
-rw-r--r--ext/standard/php_ftok.h28
-rw-r--r--ext/standard/php_http.h46
-rw-r--r--ext/standard/php_image.h66
-rw-r--r--ext/standard/php_incomplete_class.h68
-rw-r--r--ext/standard/php_iptc.h27
-rw-r--r--ext/standard/php_lcg.h43
-rw-r--r--ext/standard/php_link.h33
-rw-r--r--ext/standard/php_mail.h30
-rw-r--r--ext/standard/php_math.h173
-rw-r--r--ext/standard/php_metaphone.h26
-rw-r--r--ext/standard/php_rand.h60
-rw-r--r--ext/standard/php_smart_str.h195
-rw-r--r--ext/standard/php_smart_str_public.h32
-rw-r--r--ext/standard/php_standard.h72
-rw-r--r--ext/standard/php_string.h167
-rw-r--r--ext/standard/php_type.h41
-rw-r--r--ext/standard/php_uuencode.h37
-rw-r--r--ext/standard/php_var.h169
-rw-r--r--ext/standard/php_versioning.h30
-rw-r--r--ext/standard/proc_open.c982
-rw-r--r--ext/standard/proc_open.h52
-rw-r--r--ext/standard/quot_print.c289
-rw-r--r--ext/standard/quot_print.h30
-rw-r--r--ext/standard/rand.c383
-rw-r--r--ext/standard/scanf.c1233
-rw-r--r--ext/standard/scanf.h49
-rw-r--r--ext/standard/sha1.c412
-rw-r--r--ext/standard/sha1.h41
-rw-r--r--ext/standard/soundex.c115
-rw-r--r--ext/standard/streamsfuncs.c1638
-rw-r--r--ext/standard/streamsfuncs.h77
-rw-r--r--ext/standard/string.c5667
-rw-r--r--ext/standard/strnatcmp.c189
-rw-r--r--ext/standard/syslog.c201
-rw-r--r--ext/standard/tests/array/001.phpt157
-rw-r--r--ext/standard/tests/array/002.phpt684
-rw-r--r--ext/standard/tests/array/003.phpt104
-rw-r--r--ext/standard/tests/array/004.phpt59
-rw-r--r--ext/standard/tests/array/005.phpt291
-rw-r--r--ext/standard/tests/array/006.phpt49
-rw-r--r--ext/standard/tests/array/007.phpt553
-rw-r--r--ext/standard/tests/array/008.phpt310
-rw-r--r--ext/standard/tests/array/009.phpt535
-rw-r--r--ext/standard/tests/array/array_change_key_case.phpt817
-rw-r--r--ext/standard/tests/array/array_change_key_case_errors.phpt28
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation.phpt51
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation2.phpt288
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation3.phpt197
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation4.phpt138
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation5.phpt46
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation6.phpt72
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation7.phpt64
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation8.phpt133
-rw-r--r--ext/standard/tests/array/array_chunk.phpt21
-rw-r--r--ext/standard/tests/array/array_chunk2.phpt146
-rw-r--r--ext/standard/tests/array/array_chunk_basic1.phpt138
-rw-r--r--ext/standard/tests/array/array_chunk_basic2.phpt222
-rw-r--r--ext/standard/tests/array/array_chunk_error.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation1.phpt325
-rw-r--r--ext/standard/tests/array/array_chunk_variation10.phpt159
-rw-r--r--ext/standard/tests/array/array_chunk_variation11.phpt93
-rw-r--r--ext/standard/tests/array/array_chunk_variation12.phpt159
-rw-r--r--ext/standard/tests/array/array_chunk_variation13.phpt92
-rw-r--r--ext/standard/tests/array/array_chunk_variation14.phpt159
-rw-r--r--ext/standard/tests/array/array_chunk_variation15.phpt159
-rw-r--r--ext/standard/tests/array/array_chunk_variation16.phpt238
-rw-r--r--ext/standard/tests/array/array_chunk_variation17.phpt238
-rw-r--r--ext/standard/tests/array/array_chunk_variation18.phpt338
-rw-r--r--ext/standard/tests/array/array_chunk_variation19.phpt1018
-rw-r--r--ext/standard/tests/array/array_chunk_variation2.phpt427
-rw-r--r--ext/standard/tests/array/array_chunk_variation20.phpt1199
-rw-r--r--ext/standard/tests/array/array_chunk_variation21.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation22.phpt92
-rw-r--r--ext/standard/tests/array/array_chunk_variation23.phpt441
-rw-r--r--ext/standard/tests/array/array_chunk_variation24.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation25.phpt441
-rw-r--r--ext/standard/tests/array/array_chunk_variation26.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation27.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation28.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation29.phpt92
-rw-r--r--ext/standard/tests/array/array_chunk_variation3.phpt268
-rw-r--r--ext/standard/tests/array/array_chunk_variation30.phpt159
-rw-r--r--ext/standard/tests/array/array_chunk_variation31.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation32.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation4.phpt120
-rw-r--r--ext/standard/tests/array/array_chunk_variation5.phpt148
-rw-r--r--ext/standard/tests/array/array_chunk_variation6.phpt135
-rw-r--r--ext/standard/tests/array/array_chunk_variation7.phpt89
-rw-r--r--ext/standard/tests/array/array_chunk_variation8.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation9.phpt92
-rw-r--r--ext/standard/tests/array/array_combine.phpt122
-rw-r--r--ext/standard/tests/array/array_combine_basic.phpt52
-rw-r--r--ext/standard/tests/array/array_combine_error1.phpt48
-rw-r--r--ext/standard/tests/array/array_combine_error2.phpt52
-rw-r--r--ext/standard/tests/array/array_combine_variation1.phpt198
-rw-r--r--ext/standard/tests/array/array_combine_variation2.phpt198
-rw-r--r--ext/standard/tests/array/array_combine_variation3.phpt278
-rw-r--r--ext/standard/tests/array/array_combine_variation4.phpt191
-rw-r--r--ext/standard/tests/array/array_combine_variation5.phpt185
-rw-r--r--ext/standard/tests/array/array_combine_variation6.phpt53
-rw-r--r--ext/standard/tests/array/array_count_values.phpt94
-rw-r--r--ext/standard/tests/array/array_count_values2.phpt43
-rw-r--r--ext/standard/tests/array/array_count_values_error.phpt50
-rw-r--r--ext/standard/tests/array/array_count_values_variation.phpt51
-rw-r--r--ext/standard/tests/array/array_diff_1.phpt15
-rw-r--r--ext/standard/tests/array/array_diff_assoc.phpt49
-rw-r--r--ext/standard/tests/array/array_diff_assoc_basic.phpt90
-rw-r--r--ext/standard/tests/array/array_diff_assoc_error.phpt41
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation1.phpt234
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation10.phpt50
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation2.phpt235
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation3.phpt206
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation4.phpt177
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation5.phpt148
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation6.phpt196
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation7.phpt101
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation8.phpt49
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation9.phpt141
-rw-r--r--ext/standard/tests/array/array_diff_basic.phpt116
-rw-r--r--ext/standard/tests/array/array_diff_error.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_key.phpt250
-rw-r--r--ext/standard/tests/array/array_diff_key2.phpt44
-rw-r--r--ext/standard/tests/array/array_diff_key_basic.phpt19
-rw-r--r--ext/standard/tests/array/array_diff_key_error.phpt36
-rw-r--r--ext/standard/tests/array/array_diff_key_variation1.phpt310
-rw-r--r--ext/standard/tests/array/array_diff_key_variation2.phpt311
-rw-r--r--ext/standard/tests/array/array_diff_key_variation3.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_key_variation4.phpt61
-rw-r--r--ext/standard/tests/array/array_diff_key_variation5.phpt34
-rw-r--r--ext/standard/tests/array/array_diff_key_variation6.phpt36
-rw-r--r--ext/standard/tests/array/array_diff_key_variation7.phpt59
-rw-r--r--ext/standard/tests/array/array_diff_key_variation8.phpt54
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_basic.phpt28
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_error.phpt62
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation1.phpt244
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation10.phpt47
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation11.phpt45
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation12.phpt60
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation13.phpt68
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation14.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation2.phpt244
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation3.phpt263
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation4.phpt246
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation5.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation6.phpt58
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation7.phpt47
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation8.phpt62
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation9.phpt62
-rw-r--r--ext/standard/tests/array/array_diff_ukey_basic.phpt24
-rw-r--r--ext/standard/tests/array/array_diff_ukey_error.phpt55
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation1.phpt318
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation10.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation11.phpt44
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation2.phpt322
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation3.phpt240
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation5.phpt54
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation6.phpt65
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation7.phpt42
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation8.phpt42
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation9.phpt59
-rw-r--r--ext/standard/tests/array/array_diff_variation1.phpt208
-rw-r--r--ext/standard/tests/array/array_diff_variation10.phpt44
-rw-r--r--ext/standard/tests/array/array_diff_variation2.phpt207
-rw-r--r--ext/standard/tests/array/array_diff_variation3.phpt190
-rw-r--r--ext/standard/tests/array/array_diff_variation4.phpt184
-rw-r--r--ext/standard/tests/array/array_diff_variation5.phpt119
-rw-r--r--ext/standard/tests/array/array_diff_variation6.phpt46
-rw-r--r--ext/standard/tests/array/array_diff_variation7.phpt95
-rw-r--r--ext/standard/tests/array/array_diff_variation8.phpt207
-rw-r--r--ext/standard/tests/array/array_diff_variation9.phpt156
-rw-r--r--ext/standard/tests/array/array_fill.phpt366
-rw-r--r--ext/standard/tests/array/array_fill_basic.phpt96
-rw-r--r--ext/standard/tests/array/array_fill_error.phpt61
-rw-r--r--ext/standard/tests/array/array_fill_keys.phpt44
-rw-r--r--ext/standard/tests/array/array_fill_keys_error.phpt45
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation1.phpt79
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation2.phpt81
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation3.phpt54
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation4.phpt91
-rw-r--r--ext/standard/tests/array/array_fill_object.phpt434
-rw-r--r--ext/standard/tests/array/array_fill_object_2_4.phpt434
-rw-r--r--ext/standard/tests/array/array_fill_variation1.phpt247
-rw-r--r--ext/standard/tests/array/array_fill_variation1_64bit.phpt247
-rw-r--r--ext/standard/tests/array/array_fill_variation2.phpt206
-rw-r--r--ext/standard/tests/array/array_fill_variation3.phpt110
-rw-r--r--ext/standard/tests/array/array_fill_variation4.phpt168
-rw-r--r--ext/standard/tests/array/array_fill_variation5.phpt291
-rw-r--r--ext/standard/tests/array/array_filter.phpt93
-rw-r--r--ext/standard/tests/array/array_filter_basic.phpt55
-rw-r--r--ext/standard/tests/array/array_filter_error.phpt50
-rw-r--r--ext/standard/tests/array/array_filter_object.phpt155
-rw-r--r--ext/standard/tests/array/array_filter_variation1.phpt195
-rw-r--r--ext/standard/tests/array/array_filter_variation2.phpt184
-rw-r--r--ext/standard/tests/array/array_filter_variation3.phpt216
-rw-r--r--ext/standard/tests/array/array_filter_variation4.phpt97
-rw-r--r--ext/standard/tests/array/array_filter_variation5.phpt109
-rw-r--r--ext/standard/tests/array/array_filter_variation6.phpt94
-rw-r--r--ext/standard/tests/array/array_filter_variation7.phpt80
-rw-r--r--ext/standard/tests/array/array_filter_variation8.phpt151
-rw-r--r--ext/standard/tests/array/array_filter_variation9.phpt72
-rw-r--r--ext/standard/tests/array/array_flip.phpt37
-rw-r--r--ext/standard/tests/array/array_flip_basic.phpt71
-rw-r--r--ext/standard/tests/array/array_flip_error.phpt34
-rw-r--r--ext/standard/tests/array/array_flip_variation1.phpt179
-rw-r--r--ext/standard/tests/array/array_flip_variation2.phptbin0 -> 2179 bytes
-rw-r--r--ext/standard/tests/array/array_flip_variation3.phptbin0 -> 2823 bytes
-rw-r--r--ext/standard/tests/array/array_flip_variation4.phpt90
-rw-r--r--ext/standard/tests/array/array_flip_variation5.phpt82
-rw-r--r--ext/standard/tests/array/array_intersect_1.phpt364
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_basic.phpt69
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_error.phpt36
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation1.phpt281
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation10.phpt54
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation2.phpt282
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation3.phpt243
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation5.phpt173
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation6.phpt173
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation7.phpt212
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation8.phpt212
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation9.phpt152
-rw-r--r--ext/standard/tests/array/array_intersect_basic.phpt80
-rw-r--r--ext/standard/tests/array/array_intersect_error.phpt35
-rw-r--r--ext/standard/tests/array/array_intersect_key.phpt209
-rw-r--r--ext/standard/tests/array/array_intersect_key_basic.phpt19
-rw-r--r--ext/standard/tests/array/array_intersect_key_error.phpt36
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation1.phpt314
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation2.phpt315
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation3.phpt235
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation4.phpt60
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation5.phpt41
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation6.phpt37
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation7.phpt63
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation8.phpt64
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_basic.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_error.phpt60
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation1.phpt323
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation10.phpt55
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation11.phpt42
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation2.phpt323
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation3.phpt244
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation4.phpt257
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation5.phpt58
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation6.phpt46
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation7.phpt54
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation8.phpt51
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation9.phpt39
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_basic.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_error.phpt56
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation1.phpt320
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation10.phpt43
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation2.phpt320
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation3.phpt290
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation4.phpt321
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation5.phpt63
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation6.phpt51
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation7.phpt63
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation8.phpt39
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation9.phpt61
-rw-r--r--ext/standard/tests/array/array_intersect_variation1.phpt280
-rw-r--r--ext/standard/tests/array/array_intersect_variation10.phpt53
-rw-r--r--ext/standard/tests/array/array_intersect_variation2.phpt281
-rw-r--r--ext/standard/tests/array/array_intersect_variation3.phpt342
-rw-r--r--ext/standard/tests/array/array_intersect_variation4.phpt349
-rw-r--r--ext/standard/tests/array/array_intersect_variation5.phpt192
-rw-r--r--ext/standard/tests/array/array_intersect_variation6.phpt192
-rw-r--r--ext/standard/tests/array/array_intersect_variation7.phpt211
-rw-r--r--ext/standard/tests/array/array_intersect_variation8.phpt219
-rw-r--r--ext/standard/tests/array/array_intersect_variation9.phpt255
-rw-r--r--ext/standard/tests/array/array_key_exists.phpt292
-rw-r--r--ext/standard/tests/array/array_key_exists_basic.phpt29
-rw-r--r--ext/standard/tests/array/array_key_exists_error.phpt44
-rw-r--r--ext/standard/tests/array/array_key_exists_object1.phpt80
-rw-r--r--ext/standard/tests/array/array_key_exists_object2.phpt84
-rw-r--r--ext/standard/tests/array/array_key_exists_variation1.phpt203
-rw-r--r--ext/standard/tests/array/array_key_exists_variation2.phpt225
-rw-r--r--ext/standard/tests/array/array_key_exists_variation3.phpt60
-rw-r--r--ext/standard/tests/array/array_key_exists_variation4.phpt31
-rw-r--r--ext/standard/tests/array/array_key_exists_variation5.phpt39
-rw-r--r--ext/standard/tests/array/array_key_exists_variation6.phpt96
-rw-r--r--ext/standard/tests/array/array_key_exists_variation7.phpt36
-rw-r--r--ext/standard/tests/array/array_key_exists_variation8.phpt547
-rw-r--r--ext/standard/tests/array/array_keys_basic.phpt27
-rw-r--r--ext/standard/tests/array/array_keys_error.phpt42
-rw-r--r--ext/standard/tests/array/array_keys_variation_001.phpt147
-rw-r--r--ext/standard/tests/array/array_keys_variation_002.phpt52
-rw-r--r--ext/standard/tests/array/array_keys_variation_002_64bit.phpt56
-rw-r--r--ext/standard/tests/array/array_keys_variation_003.phpt116
-rw-r--r--ext/standard/tests/array/array_keys_variation_004.phpt68
-rw-r--r--ext/standard/tests/array/array_keys_variation_005.phpt40
-rw-r--r--ext/standard/tests/array/array_map_001.phpt23
-rw-r--r--ext/standard/tests/array/array_map_basic.phpt70
-rw-r--r--ext/standard/tests/array/array_map_error.phpt73
-rw-r--r--ext/standard/tests/array/array_map_object1.phpt206
-rw-r--r--ext/standard/tests/array/array_map_object2.phpt46
-rw-r--r--ext/standard/tests/array/array_map_object3.phpt92
-rw-r--r--ext/standard/tests/array/array_map_variation1.phpt56
-rw-r--r--ext/standard/tests/array/array_map_variation10.phpt120
-rw-r--r--ext/standard/tests/array/array_map_variation11.phpt52
-rw-r--r--ext/standard/tests/array/array_map_variation12.phpt60
-rw-r--r--ext/standard/tests/array/array_map_variation13.phpt107
-rw-r--r--ext/standard/tests/array/array_map_variation14.phpt125
-rw-r--r--ext/standard/tests/array/array_map_variation15.phpt30
-rw-r--r--ext/standard/tests/array/array_map_variation16.phpt73
-rw-r--r--ext/standard/tests/array/array_map_variation17.phpt158
-rw-r--r--ext/standard/tests/array/array_map_variation18.phpt205
-rw-r--r--ext/standard/tests/array/array_map_variation19.phpt40
-rw-r--r--ext/standard/tests/array/array_map_variation2.phpt213
-rw-r--r--ext/standard/tests/array/array_map_variation3.phpt227
-rw-r--r--ext/standard/tests/array/array_map_variation4.phpt179
-rw-r--r--ext/standard/tests/array/array_map_variation5.phpt181
-rw-r--r--ext/standard/tests/array/array_map_variation6.phpt72
-rw-r--r--ext/standard/tests/array/array_map_variation7.phpt122
-rw-r--r--ext/standard/tests/array/array_map_variation8.phpt81
-rw-r--r--ext/standard/tests/array/array_map_variation9.phpt88
-rw-r--r--ext/standard/tests/array/array_merge.phpt762
-rw-r--r--ext/standard/tests/array/array_merge_basic.phpt58
-rw-r--r--ext/standard/tests/array/array_merge_error.phpt30
-rw-r--r--ext/standard/tests/array/array_merge_recursive_basic1.phpt97
-rw-r--r--ext/standard/tests/array/array_merge_recursive_basic2.phpt94
-rw-r--r--ext/standard/tests/array/array_merge_recursive_error.phpt25
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation1.phpt303
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation10.phpt174
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation2.phpt199
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation3.phpt761
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation4.phpt424
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation5.phpt404
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation6.phpt113
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation7.phpt82
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation8.phpt73
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation9.phpt117
-rw-r--r--ext/standard/tests/array/array_merge_variation1.phpt231
-rw-r--r--ext/standard/tests/array/array_merge_variation10.phpt70
-rw-r--r--ext/standard/tests/array/array_merge_variation2.phpt230
-rw-r--r--ext/standard/tests/array/array_merge_variation3.phpt379
-rw-r--r--ext/standard/tests/array/array_merge_variation4.phpt368
-rw-r--r--ext/standard/tests/array/array_merge_variation5.phpt61
-rw-r--r--ext/standard/tests/array/array_merge_variation6.phpt53
-rw-r--r--ext/standard/tests/array/array_merge_variation7.phpt65
-rw-r--r--ext/standard/tests/array/array_merge_variation8.phpt74
-rw-r--r--ext/standard/tests/array/array_merge_variation9.phpt99
-rw-r--r--ext/standard/tests/array/array_multisort_basic1.phpt60
-rw-r--r--ext/standard/tests/array/array_multisort_basic2.phpt44
-rw-r--r--ext/standard/tests/array/array_multisort_case.phpt73
-rw-r--r--ext/standard/tests/array/array_multisort_error.phpt44
-rw-r--r--ext/standard/tests/array/array_multisort_incase.phpt73
-rw-r--r--ext/standard/tests/array/array_multisort_natural.phpt61
-rw-r--r--ext/standard/tests/array/array_multisort_natural_case.phpt73
-rw-r--r--ext/standard/tests/array/array_multisort_natural_incase.phpt73
-rw-r--r--ext/standard/tests/array/array_multisort_variation1.phpt207
-rw-r--r--ext/standard/tests/array/array_multisort_variation10.phpt20
-rw-r--r--ext/standard/tests/array/array_multisort_variation11.phpt21
-rw-r--r--ext/standard/tests/array/array_multisort_variation2.phpt228
-rw-r--r--ext/standard/tests/array/array_multisort_variation3.phpt208
-rw-r--r--ext/standard/tests/array/array_multisort_variation4.phpt58
-rw-r--r--ext/standard/tests/array/array_multisort_variation5.phpt53
-rw-r--r--ext/standard/tests/array/array_multisort_variation6.phpt53
-rw-r--r--ext/standard/tests/array/array_multisort_variation7.phpt68
-rw-r--r--ext/standard/tests/array/array_multisort_variation8.phpt74
-rw-r--r--ext/standard/tests/array/array_multisort_variation9.phpt78
-rw-r--r--ext/standard/tests/array/array_next_error1.phpt13
-rw-r--r--ext/standard/tests/array/array_next_error2.phpt12
-rw-r--r--ext/standard/tests/array/array_pad.phpt101
-rw-r--r--ext/standard/tests/array/array_pad_error.phpt53
-rw-r--r--ext/standard/tests/array/array_pad_variation1.phpt270
-rw-r--r--ext/standard/tests/array/array_pad_variation2.phpt256
-rw-r--r--ext/standard/tests/array/array_pad_variation3.phpt869
-rw-r--r--ext/standard/tests/array/array_pad_variation4.phpt60
-rw-r--r--ext/standard/tests/array/array_pad_variation5.phpt140
-rw-r--r--ext/standard/tests/array/array_pad_variation6.phpt668
-rw-r--r--ext/standard/tests/array/array_pad_variation7.phpt127
-rw-r--r--ext/standard/tests/array/array_pop.phpt220
-rw-r--r--ext/standard/tests/array/array_pop_errors.phpt64
-rw-r--r--ext/standard/tests/array/array_pop_variation.phpt55
-rw-r--r--ext/standard/tests/array/array_product_error.phpt45
-rw-r--r--ext/standard/tests/array/array_product_variation1.phpt58
-rw-r--r--ext/standard/tests/array/array_product_variation2.phpt22
-rw-r--r--ext/standard/tests/array/array_product_variation3.phpt48
-rw-r--r--ext/standard/tests/array/array_product_variation4.phpt29
-rw-r--r--ext/standard/tests/array/array_product_variation5.phpt223
-rw-r--r--ext/standard/tests/array/array_push.phpt282
-rw-r--r--ext/standard/tests/array/array_push_basic.phpt63
-rw-r--r--ext/standard/tests/array/array_push_error1.phpt30
-rw-r--r--ext/standard/tests/array/array_push_error2.phpt34
-rw-r--r--ext/standard/tests/array/array_push_variation1.phpt225
-rw-r--r--ext/standard/tests/array/array_push_variation2.phpt178
-rw-r--r--ext/standard/tests/array/array_push_variation3.phpt70
-rw-r--r--ext/standard/tests/array/array_push_variation5.phpt36
-rw-r--r--ext/standard/tests/array/array_push_variation6.phpt159
-rw-r--r--ext/standard/tests/array/array_rand.phpt51
-rw-r--r--ext/standard/tests/array/array_rand_basic1.phpt53
-rw-r--r--ext/standard/tests/array/array_rand_basic2.phpt58
-rw-r--r--ext/standard/tests/array/array_rand_error.phpt38
-rw-r--r--ext/standard/tests/array/array_rand_variation1.phpt217
-rw-r--r--ext/standard/tests/array/array_rand_variation2.phpt215
-rw-r--r--ext/standard/tests/array/array_rand_variation3.phpt150
-rw-r--r--ext/standard/tests/array/array_rand_variation4.phpt168
-rw-r--r--ext/standard/tests/array/array_rand_variation5.phpt75
-rw-r--r--ext/standard/tests/array/array_rand_variation6.phpt104
-rw-r--r--ext/standard/tests/array/array_reduce.phpt79
-rw-r--r--ext/standard/tests/array/array_reduce_error.phpt41
-rw-r--r--ext/standard/tests/array/array_reduce_variation1.phpt44
-rw-r--r--ext/standard/tests/array/array_reduce_variation2.phpt35
-rw-r--r--ext/standard/tests/array/array_reduce_variation3.phpt36
-rw-r--r--ext/standard/tests/array/array_replace.phpt122
-rw-r--r--ext/standard/tests/array/array_reverse_basic1.phpt72
-rw-r--r--ext/standard/tests/array/array_reverse_basic2.phpt60
-rw-r--r--ext/standard/tests/array/array_reverse_error.phpt40
-rw-r--r--ext/standard/tests/array/array_reverse_variation1.phpt340
-rw-r--r--ext/standard/tests/array/array_reverse_variation2.phpt414
-rw-r--r--ext/standard/tests/array/array_reverse_variation3.phpt602
-rw-r--r--ext/standard/tests/array/array_reverse_variation4.phpt377
-rw-r--r--ext/standard/tests/array/array_reverse_variation5.phpt399
-rw-r--r--ext/standard/tests/array/array_reverse_variation6.phpt209
-rw-r--r--ext/standard/tests/array/array_search.phptbin0 -> 539 bytes
-rw-r--r--ext/standard/tests/array/array_search1.phpt35
-rw-r--r--ext/standard/tests/array/array_search_errors.phpt44
-rw-r--r--ext/standard/tests/array/array_search_variation1.phpt641
-rw-r--r--ext/standard/tests/array/array_search_variation2.phpt102
-rw-r--r--ext/standard/tests/array/array_search_variation3.phpt58
-rw-r--r--ext/standard/tests/array/array_search_variation4.phpt74
-rw-r--r--ext/standard/tests/array/array_shift_basic.phpt54
-rw-r--r--ext/standard/tests/array/array_shift_error.phpt40
-rw-r--r--ext/standard/tests/array/array_shift_variation1.phpt218
-rw-r--r--ext/standard/tests/array/array_shift_variation2.phpt208
-rw-r--r--ext/standard/tests/array/array_shift_variation3.phpt188
-rw-r--r--ext/standard/tests/array/array_shift_variation4.phpt109
-rw-r--r--ext/standard/tests/array/array_shift_variation5.phpt45
-rw-r--r--ext/standard/tests/array/array_shift_variation6.phpt83
-rw-r--r--ext/standard/tests/array/array_shift_variation7.phpt34
-rw-r--r--ext/standard/tests/array/array_shift_variation8.phpt50
-rw-r--r--ext/standard/tests/array/array_shuffle_basic.phpt99
-rw-r--r--ext/standard/tests/array/array_slice.phpt1459
-rw-r--r--ext/standard/tests/array/array_slice_basic.phpt51
-rw-r--r--ext/standard/tests/array/array_slice_error.phpt43
-rw-r--r--ext/standard/tests/array/array_slice_variation1.phpt61
-rw-r--r--ext/standard/tests/array/array_slice_variation10.phpt44
-rw-r--r--ext/standard/tests/array/array_slice_variation11.phpt227
-rw-r--r--ext/standard/tests/array/array_slice_variation2.phpt311
-rw-r--r--ext/standard/tests/array/array_slice_variation3.phpt213
-rw-r--r--ext/standard/tests/array/array_slice_variation4.phpt327
-rw-r--r--ext/standard/tests/array/array_slice_variation5.phpt191
-rw-r--r--ext/standard/tests/array/array_slice_variation6.phpt150
-rw-r--r--ext/standard/tests/array/array_slice_variation7.phpt300
-rw-r--r--ext/standard/tests/array/array_slice_variation8.phpt56
-rw-r--r--ext/standard/tests/array/array_slice_variation9.phpt50
-rw-r--r--ext/standard/tests/array/array_splice_basic.phpt117
-rw-r--r--ext/standard/tests/array/array_splice_errors.phpt41
-rw-r--r--ext/standard/tests/array/array_splice_variation1.phpt109
-rw-r--r--ext/standard/tests/array/array_splice_variation2.phpt27
-rw-r--r--ext/standard/tests/array/array_splice_variation3.phpt856
-rw-r--r--ext/standard/tests/array/array_splice_variation4.phpt69
-rw-r--r--ext/standard/tests/array/array_sum.phpt30
-rw-r--r--ext/standard/tests/array/array_sum_basic.phpt37
-rw-r--r--ext/standard/tests/array/array_sum_error.phpt34
-rw-r--r--ext/standard/tests/array/array_sum_variation1.phpt179
-rw-r--r--ext/standard/tests/array/array_sum_variation2.phpt49
-rw-r--r--ext/standard/tests/array/array_sum_variation3.phpt54
-rw-r--r--ext/standard/tests/array/array_sum_variation4.phpt34
-rw-r--r--ext/standard/tests/array/array_sum_variation5.phpt37
-rw-r--r--ext/standard/tests/array/array_sum_variation6.phpt33
-rw-r--r--ext/standard/tests/array/array_sum_variation7.phpt86
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_basic.phpt41
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_error.phpt42
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation.phpt36
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation5.phpt60
-rw-r--r--ext/standard/tests/array/array_udiff_basic.phpt36
-rw-r--r--ext/standard/tests/array/array_udiff_error.phpt42
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_basic.phpt45
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_error.phpt44
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation1.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation2.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation3.phpt254
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation6.phpt58
-rw-r--r--ext/standard/tests/array/array_udiff_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_udiff_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_udiff_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_variation5.phpt55
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_basic.phpt36
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_basic2.phpt36
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_error.phpt43
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation5.phpt54
-rw-r--r--ext/standard/tests/array/array_uintersect_basic.phpt41
-rw-r--r--ext/standard/tests/array/array_uintersect_error.phpt45
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_basic.phpt40
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_error.phpt45
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation3.phpt254
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt56
-rw-r--r--ext/standard/tests/array/array_uintersect_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_variation2.phpt227
-rw-r--r--ext/standard/tests/array/array_uintersect_variation3.phpt251
-rw-r--r--ext/standard/tests/array/array_uintersect_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_variation5.phpt58
-rw-r--r--ext/standard/tests/array/array_unique_basic.phpt48
-rw-r--r--ext/standard/tests/array/array_unique_error.phpt36
-rw-r--r--ext/standard/tests/array/array_unique_variation1.phpt195
-rw-r--r--ext/standard/tests/array/array_unique_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_unique_variation3.phpt134
-rw-r--r--ext/standard/tests/array/array_unique_variation4.phpt131
-rw-r--r--ext/standard/tests/array/array_unique_variation5.phpt33
-rw-r--r--ext/standard/tests/array/array_unique_variation6.phpt44
-rw-r--r--ext/standard/tests/array/array_unique_variation7.phpt33
-rw-r--r--ext/standard/tests/array/array_unique_variation8.phpt72
-rw-r--r--ext/standard/tests/array/array_unshift.phpt40
-rw-r--r--ext/standard/tests/array/array_unshift_basic1.phpt63
-rw-r--r--ext/standard/tests/array/array_unshift_basic2.phpt71
-rw-r--r--ext/standard/tests/array/array_unshift_error.phpt34
-rw-r--r--ext/standard/tests/array/array_unshift_object.phpt287
-rw-r--r--ext/standard/tests/array/array_unshift_variation1.phpt338
-rw-r--r--ext/standard/tests/array/array_unshift_variation2.phpt1061
-rw-r--r--ext/standard/tests/array/array_unshift_variation3.phpt571
-rw-r--r--ext/standard/tests/array/array_unshift_variation4.phpt390
-rw-r--r--ext/standard/tests/array/array_unshift_variation5.phpt398
-rw-r--r--ext/standard/tests/array/array_unshift_variation6.phpt196
-rw-r--r--ext/standard/tests/array/array_unshift_variation7.phpt216
-rw-r--r--ext/standard/tests/array/array_unshift_variation8.phpt214
-rw-r--r--ext/standard/tests/array/array_unshift_variation9.phpt309
-rw-r--r--ext/standard/tests/array/array_user_key_compare.phpt19
-rw-r--r--ext/standard/tests/array/array_values.phptbin0 -> 3060 bytes
-rw-r--r--ext/standard/tests/array/array_values_basic.phpt40
-rw-r--r--ext/standard/tests/array/array_values_error.phpt42
-rw-r--r--ext/standard/tests/array/array_values_errors.phpt36
-rw-r--r--ext/standard/tests/array/array_values_variation.phpt76
-rw-r--r--ext/standard/tests/array/array_values_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_values_variation2.phpt215
-rw-r--r--ext/standard/tests/array/array_values_variation3.phpt200
-rw-r--r--ext/standard/tests/array/array_values_variation4.phpt99
-rw-r--r--ext/standard/tests/array/array_values_variation5.phpt46
-rw-r--r--ext/standard/tests/array/array_values_variation6.phpt54
-rw-r--r--ext/standard/tests/array/array_values_variation7.phpt55
-rw-r--r--ext/standard/tests/array/array_values_variation_64bit.phpt74
-rw-r--r--ext/standard/tests/array/array_walk.phpt50
-rw-r--r--ext/standard/tests/array/array_walk_basic1.phpt80
-rw-r--r--ext/standard/tests/array/array_walk_basic2.phpt105
-rw-r--r--ext/standard/tests/array/array_walk_error1.phpt48
-rw-r--r--ext/standard/tests/array/array_walk_error2.phpt59
-rw-r--r--ext/standard/tests/array/array_walk_object1.phpt67
-rw-r--r--ext/standard/tests/array/array_walk_object2.phpt104
-rw-r--r--ext/standard/tests/array/array_walk_objects.phpt44
-rw-r--r--ext/standard/tests/array/array_walk_rec_objects.phpt44
-rw-r--r--ext/standard/tests/array/array_walk_recursive.phpt26
-rw-r--r--ext/standard/tests/array/array_walk_recursive1.phpt56
-rw-r--r--ext/standard/tests/array/array_walk_recursive_basic1.phpt80
-rw-r--r--ext/standard/tests/array/array_walk_recursive_basic2.phpt105
-rw-r--r--ext/standard/tests/array/array_walk_recursive_error1.phpt49
-rw-r--r--ext/standard/tests/array/array_walk_recursive_error2.phpt59
-rw-r--r--ext/standard/tests/array/array_walk_recursive_object1.phpt65
-rw-r--r--ext/standard/tests/array/array_walk_recursive_object2.phpt106
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation1.phpt250
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation2.phpt268
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation3.phpt123
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation4.phpt76
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation5.phpt64
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation6.phpt147
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation7.phpt93
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation8.phpt42
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation9.phpt99
-rw-r--r--ext/standard/tests/array/array_walk_variation1.phpt250
-rw-r--r--ext/standard/tests/array/array_walk_variation2.phpt268
-rw-r--r--ext/standard/tests/array/array_walk_variation3.phpt123
-rw-r--r--ext/standard/tests/array/array_walk_variation4.phpt87
-rw-r--r--ext/standard/tests/array/array_walk_variation5.phpt64
-rw-r--r--ext/standard/tests/array/array_walk_variation6.phpt143
-rw-r--r--ext/standard/tests/array/array_walk_variation7.phpt93
-rw-r--r--ext/standard/tests/array/array_walk_variation8.phpt42
-rw-r--r--ext/standard/tests/array/array_walk_variation9.phpt99
-rw-r--r--ext/standard/tests/array/arsort_basic.phpt245
-rw-r--r--ext/standard/tests/array/arsort_error.phpt79
-rw-r--r--ext/standard/tests/array/arsort_object1.phpt90
-rw-r--r--ext/standard/tests/array/arsort_object2.phpt94
-rw-r--r--ext/standard/tests/array/arsort_variation1.phpt399
-rw-r--r--ext/standard/tests/array/arsort_variation10.phpt114
-rw-r--r--ext/standard/tests/array/arsort_variation11.phptbin0 -> 3384 bytes
-rw-r--r--ext/standard/tests/array/arsort_variation2.phpt308
-rw-r--r--ext/standard/tests/array/arsort_variation3.phpt326
-rw-r--r--ext/standard/tests/array/arsort_variation4.phpt79
-rw-r--r--ext/standard/tests/array/arsort_variation5.phpt247
-rw-r--r--ext/standard/tests/array/arsort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/arsort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/arsort_variation8.phpt180
-rw-r--r--ext/standard/tests/array/arsort_variation9.phpt258
-rw-r--r--ext/standard/tests/array/asort_basic.phpt245
-rw-r--r--ext/standard/tests/array/asort_error.phpt79
-rw-r--r--ext/standard/tests/array/asort_object1.phpt245
-rw-r--r--ext/standard/tests/array/asort_object2.phpt253
-rw-r--r--ext/standard/tests/array/asort_variation1.phpt399
-rw-r--r--ext/standard/tests/array/asort_variation10.phpt114
-rw-r--r--ext/standard/tests/array/asort_variation11.phptbin0 -> 3374 bytes
-rw-r--r--ext/standard/tests/array/asort_variation2.phpt308
-rw-r--r--ext/standard/tests/array/asort_variation3.phpt326
-rw-r--r--ext/standard/tests/array/asort_variation4.phpt79
-rw-r--r--ext/standard/tests/array/asort_variation5.phpt247
-rw-r--r--ext/standard/tests/array/asort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/asort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/asort_variation8.phpt180
-rw-r--r--ext/standard/tests/array/asort_variation9.phpt258
-rw-r--r--ext/standard/tests/array/bug12776.phpt25
-rw-r--r--ext/standard/tests/array/bug14580.phpt11
-rw-r--r--ext/standard/tests/array/bug20381.phpt79
-rw-r--r--ext/standard/tests/array/bug20865.phpt11
-rw-r--r--ext/standard/tests/array/bug21182.phpt12
-rw-r--r--ext/standard/tests/array/bug21918.phpt55
-rw-r--r--ext/standard/tests/array/bug21998.phpt24
-rw-r--r--ext/standard/tests/array/bug22088.phpt33
-rw-r--r--ext/standard/tests/array/bug22463.phpt29
-rw-r--r--ext/standard/tests/array/bug23581.phpt44
-rw-r--r--ext/standard/tests/array/bug23788.phpt24
-rw-r--r--ext/standard/tests/array/bug24198.phpt25
-rw-r--r--ext/standard/tests/array/bug24220.phpt91
-rw-r--r--ext/standard/tests/array/bug24766.phpt45
-rw-r--r--ext/standard/tests/array/bug24897.phpt21
-rw-r--r--ext/standard/tests/array/bug24980.phpt53
-rw-r--r--ext/standard/tests/array/bug25359.phpt32
-rw-r--r--ext/standard/tests/array/bug25708.phpt223
-rw-r--r--ext/standard/tests/array/bug25758.phpt14
-rw-r--r--ext/standard/tests/array/bug26458.phptbin0 -> 406 bytes
-rw-r--r--ext/standard/tests/array/bug28739.phpt58
-rw-r--r--ext/standard/tests/array/bug28974.phpt89
-rw-r--r--ext/standard/tests/array/bug29253.phpt13
-rw-r--r--ext/standard/tests/array/bug29493.phpt115
-rw-r--r--ext/standard/tests/array/bug30074.phpt15
-rw-r--r--ext/standard/tests/array/bug30266.phpt37
-rw-r--r--ext/standard/tests/array/bug30833.phpt35
-rw-r--r--ext/standard/tests/array/bug31158.phpt17
-rw-r--r--ext/standard/tests/array/bug31213.phpt57
-rw-r--r--ext/standard/tests/array/bug32021.phpt14
-rw-r--r--ext/standard/tests/array/bug33382.phpt27
-rw-r--r--ext/standard/tests/array/bug33989.phpt10
-rw-r--r--ext/standard/tests/array/bug34066.phpt804
-rw-r--r--ext/standard/tests/array/bug34066_1.phpt731
-rw-r--r--ext/standard/tests/array/bug34227.phpt100
-rw-r--r--ext/standard/tests/array/bug34982.phpt40
-rw-r--r--ext/standard/tests/array/bug35014.phpt35
-rw-r--r--ext/standard/tests/array/bug35014_64bit.phpt35
-rw-r--r--ext/standard/tests/array/bug35022.phpt21
-rw-r--r--ext/standard/tests/array/bug35821.phpt34
-rw-r--r--ext/standard/tests/array/bug36975.phpt62
-rw-r--r--ext/standard/tests/array/bug38464.phpt20
-rw-r--r--ext/standard/tests/array/bug39576.phpt52
-rw-r--r--ext/standard/tests/array/bug40191.phpt21
-rw-r--r--ext/standard/tests/array/bug40709.phpt27
-rw-r--r--ext/standard/tests/array/bug41121.phpt128
-rw-r--r--ext/standard/tests/array/bug41686.phpt56
-rw-r--r--ext/standard/tests/array/bug42177.phpt34
-rw-r--r--ext/standard/tests/array/bug42233.phpt33
-rw-r--r--ext/standard/tests/array/bug42838.phpt24
-rw-r--r--ext/standard/tests/array/bug42850.phpt59
-rw-r--r--ext/standard/tests/array/bug43495.phpt21
-rw-r--r--ext/standard/tests/array/bug43505.phpt36
-rw-r--r--ext/standard/tests/array/bug43541.phpt22
-rw-r--r--ext/standard/tests/array/bug44181.phpt19
-rw-r--r--ext/standard/tests/array/bug44182.phpt19
-rw-r--r--ext/standard/tests/array/bug44929.phpt35
-rw-r--r--ext/standard/tests/array/bug45312.phpt40
-rw-r--r--ext/standard/tests/array/bug46873.phpt12
-rw-r--r--ext/standard/tests/array/bug48224.phpt15
-rw-r--r--ext/standard/tests/array/bug48484.phpt8
-rw-r--r--ext/standard/tests/array/bug48854.phpt43
-rw-r--r--ext/standard/tests/array/bug50006.phpt29
-rw-r--r--ext/standard/tests/array/bug50006_1.phpt29
-rw-r--r--ext/standard/tests/array/bug50006_2.phpt29
-rw-r--r--ext/standard/tests/array/bug51552.phpt23
-rw-r--r--ext/standard/tests/array/bug52534.phpt14
-rw-r--r--ext/standard/tests/array/bug52719.phpt15
-rw-r--r--ext/standard/tests/array/bug54459.phpt215
-rw-r--r--ext/standard/tests/array/bug61058.phpt8
-rw-r--r--ext/standard/tests/array/bug61730.phpt37
-rw-r--r--ext/standard/tests/array/compact.phpt24
-rw-r--r--ext/standard/tests/array/compact_basic.phpt85
-rw-r--r--ext/standard/tests/array/compact_error.phpt31
-rw-r--r--ext/standard/tests/array/compact_variation1.phpt54
-rw-r--r--ext/standard/tests/array/compact_variation2.phpt40
-rw-r--r--ext/standard/tests/array/compare_function.inc13
-rw-r--r--ext/standard/tests/array/count_basic.phpt45
-rw-r--r--ext/standard/tests/array/count_error.phpt41
-rw-r--r--ext/standard/tests/array/count_recursive.phpt235
-rw-r--r--ext/standard/tests/array/count_variation1.phpt170
-rw-r--r--ext/standard/tests/array/count_variation2.phpt187
-rw-r--r--ext/standard/tests/array/count_variation3.phpt39
-rw-r--r--ext/standard/tests/array/current_basic.phpt32
-rw-r--r--ext/standard/tests/array/current_error.phpt40
-rw-r--r--ext/standard/tests/array/current_variation1.phpt217
-rw-r--r--ext/standard/tests/array/current_variation2.phpt155
-rw-r--r--ext/standard/tests/array/current_variation3.phpt42
-rw-r--r--ext/standard/tests/array/current_variation4.phpt71
-rw-r--r--ext/standard/tests/array/current_variation5.phpt58
-rw-r--r--ext/standard/tests/array/data.inc13
-rw-r--r--ext/standard/tests/array/each.phptbin0 -> 9570 bytes
-rw-r--r--ext/standard/tests/array/each_basic.phpt74
-rw-r--r--ext/standard/tests/array/each_error.phpt43
-rw-r--r--ext/standard/tests/array/each_variation1.phpt222
-rw-r--r--ext/standard/tests/array/each_variation2.phpt248
-rw-r--r--ext/standard/tests/array/each_variation3.phpt253
-rw-r--r--ext/standard/tests/array/each_variation4.phpt59
-rw-r--r--ext/standard/tests/array/each_variation5.phpt96
-rw-r--r--ext/standard/tests/array/each_variation6.phpt51
-rw-r--r--ext/standard/tests/array/end.phpt237
-rw-r--r--ext/standard/tests/array/end_64bit.phpt238
-rw-r--r--ext/standard/tests/array/end_basic.phpt46
-rw-r--r--ext/standard/tests/array/end_error.phpt39
-rw-r--r--ext/standard/tests/array/end_variation1.phpt220
-rw-r--r--ext/standard/tests/array/end_variation2.phpt43
-rw-r--r--ext/standard/tests/array/end_variation3.phpt41
-rw-r--r--ext/standard/tests/array/extract_error.phpt59
-rw-r--r--ext/standard/tests/array/extract_safety.phpt24
-rw-r--r--ext/standard/tests/array/extract_variation1.phpt27
-rw-r--r--ext/standard/tests/array/extract_variation10.phpt13
-rw-r--r--ext/standard/tests/array/extract_variation11.phpt13
-rw-r--r--ext/standard/tests/array/extract_variation2.phpt69
-rw-r--r--ext/standard/tests/array/extract_variation3.phpt69
-rw-r--r--ext/standard/tests/array/extract_variation4.phpt69
-rw-r--r--ext/standard/tests/array/extract_variation5.phpt57
-rw-r--r--ext/standard/tests/array/extract_variation6.phpt28
-rw-r--r--ext/standard/tests/array/extract_variation7.phpt23
-rw-r--r--ext/standard/tests/array/extract_variation8.phpt26
-rw-r--r--ext/standard/tests/array/extract_variation9.phpt20
-rw-r--r--ext/standard/tests/array/in_array_errors.phpt45
-rw-r--r--ext/standard/tests/array/in_array_variation1.phpt642
-rw-r--r--ext/standard/tests/array/in_array_variation2.phpt102
-rw-r--r--ext/standard/tests/array/in_array_variation3.phpt61
-rw-r--r--ext/standard/tests/array/in_array_variation4.phpt77
-rw-r--r--ext/standard/tests/array/key_basic.phpt47
-rw-r--r--ext/standard/tests/array/key_error.phpt39
-rw-r--r--ext/standard/tests/array/key_exists_basic.phpt15
-rw-r--r--ext/standard/tests/array/key_exists_error.phpt23
-rw-r--r--ext/standard/tests/array/key_exists_variation1.phpt15
-rw-r--r--ext/standard/tests/array/key_exists_variation2.phpt72
-rw-r--r--ext/standard/tests/array/key_variation1.phpt220
-rw-r--r--ext/standard/tests/array/key_variation2.phpt155
-rw-r--r--ext/standard/tests/array/key_variation3.phpt43
-rw-r--r--ext/standard/tests/array/key_variation4.phpt63
-rw-r--r--ext/standard/tests/array/krsort_basic.phpt245
-rw-r--r--ext/standard/tests/array/krsort_error.phpt78
-rw-r--r--ext/standard/tests/array/krsort_object.phpt242
-rw-r--r--ext/standard/tests/array/krsort_variation1.phpt397
-rw-r--r--ext/standard/tests/array/krsort_variation10.phpt98
-rw-r--r--ext/standard/tests/array/krsort_variation11.phpt81
-rw-r--r--ext/standard/tests/array/krsort_variation2.phpt307
-rw-r--r--ext/standard/tests/array/krsort_variation3.phpt262
-rw-r--r--ext/standard/tests/array/krsort_variation4.phpt114
-rw-r--r--ext/standard/tests/array/krsort_variation5.phpt235
-rw-r--r--ext/standard/tests/array/krsort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/krsort_variation7.phpt177
-rw-r--r--ext/standard/tests/array/krsort_variation8.phptbin0 -> 3328 bytes
-rw-r--r--ext/standard/tests/array/krsort_variation9.phpt257
-rw-r--r--ext/standard/tests/array/ksort_basic.phpt243
-rw-r--r--ext/standard/tests/array/ksort_error.phpt78
-rw-r--r--ext/standard/tests/array/ksort_object.phpt241
-rw-r--r--ext/standard/tests/array/ksort_variation1.phpt397
-rw-r--r--ext/standard/tests/array/ksort_variation10.phpt113
-rw-r--r--ext/standard/tests/array/ksort_variation11.phpt98
-rw-r--r--ext/standard/tests/array/ksort_variation2.phpt307
-rw-r--r--ext/standard/tests/array/ksort_variation3.phpt262
-rw-r--r--ext/standard/tests/array/ksort_variation4.phpt81
-rw-r--r--ext/standard/tests/array/ksort_variation5.phpt235
-rw-r--r--ext/standard/tests/array/ksort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/ksort_variation7.phpt177
-rw-r--r--ext/standard/tests/array/ksort_variation8.phptbin0 -> 3295 bytes
-rw-r--r--ext/standard/tests/array/ksort_variation9.phpt256
-rw-r--r--ext/standard/tests/array/locale_sort.phpt62
-rw-r--r--ext/standard/tests/array/max.phpt41
-rw-r--r--ext/standard/tests/array/max_basic.phpt42
-rw-r--r--ext/standard/tests/array/max_basiclong_64bit.phpt35
-rw-r--r--ext/standard/tests/array/max_error.phpt32
-rw-r--r--ext/standard/tests/array/max_variation1.phpt37
-rw-r--r--ext/standard/tests/array/max_variation2.phpt55
-rw-r--r--ext/standard/tests/array/min.phpt41
-rw-r--r--ext/standard/tests/array/min_basic.phpt37
-rw-r--r--ext/standard/tests/array/min_basiclong_64bit.phpt35
-rw-r--r--ext/standard/tests/array/min_error.phpt32
-rw-r--r--ext/standard/tests/array/min_variation1.phpt37
-rw-r--r--ext/standard/tests/array/min_variation2.phpt50
-rw-r--r--ext/standard/tests/array/natcasesort_basic.phpt57
-rw-r--r--ext/standard/tests/array/natcasesort_error.phpt40
-rw-r--r--ext/standard/tests/array/natcasesort_object1.phpt99
-rw-r--r--ext/standard/tests/array/natcasesort_object2.phpt99
-rw-r--r--ext/standard/tests/array/natcasesort_variation1.phpt223
-rw-r--r--ext/standard/tests/array/natcasesort_variation10.phpt52
-rw-r--r--ext/standard/tests/array/natcasesort_variation11.phpt232
-rw-r--r--ext/standard/tests/array/natcasesort_variation2.phpt227
-rw-r--r--ext/standard/tests/array/natcasesort_variation3.phpt135
-rw-r--r--ext/standard/tests/array/natcasesort_variation4.phpt91
-rw-r--r--ext/standard/tests/array/natcasesort_variation5.phpt49
-rw-r--r--ext/standard/tests/array/natcasesort_variation6.phpt56
-rw-r--r--ext/standard/tests/array/natcasesort_variation7.phpt74
-rw-r--r--ext/standard/tests/array/natcasesort_variation8.phpt46
-rw-r--r--ext/standard/tests/array/natcasesort_variation9.phpt110
-rw-r--r--ext/standard/tests/array/natsort_basic.phpt35
-rw-r--r--ext/standard/tests/array/next_basic.phpt35
-rw-r--r--ext/standard/tests/array/next_error.phpt39
-rw-r--r--ext/standard/tests/array/next_variation1.phpt219
-rw-r--r--ext/standard/tests/array/next_variation2.phpt45
-rw-r--r--ext/standard/tests/array/prev_basic.phpt53
-rw-r--r--ext/standard/tests/array/prev_error1.phpt39
-rw-r--r--ext/standard/tests/array/prev_error2.phpt28
-rw-r--r--ext/standard/tests/array/prev_error3.phpt19
-rw-r--r--ext/standard/tests/array/prev_variation1.phpt219
-rw-r--r--ext/standard/tests/array/prev_variation2.phpt49
-rw-r--r--ext/standard/tests/array/range.phpt448
-rw-r--r--ext/standard/tests/array/range_errors.phpt99
-rw-r--r--ext/standard/tests/array/range_variation.phpt626
-rw-r--r--ext/standard/tests/array/range_variation1.phpt60
-rw-r--r--ext/standard/tests/array/range_variation1_64bit.phpt60
-rw-r--r--ext/standard/tests/array/reset_basic.phpt45
-rw-r--r--ext/standard/tests/array/reset_error.phpt39
-rw-r--r--ext/standard/tests/array/reset_variation1.phpt219
-rw-r--r--ext/standard/tests/array/reset_variation2.phpt34
-rw-r--r--ext/standard/tests/array/reset_variation3.phpt56
-rw-r--r--ext/standard/tests/array/rsort_basic.phpt241
-rw-r--r--ext/standard/tests/array/rsort_error.phpt51
-rw-r--r--ext/standard/tests/array/rsort_object1.phpt243
-rw-r--r--ext/standard/tests/array/rsort_object2.phpt258
-rw-r--r--ext/standard/tests/array/rsort_variation1.phpt514
-rw-r--r--ext/standard/tests/array/rsort_variation10.phpt108
-rw-r--r--ext/standard/tests/array/rsort_variation11.phptbin0 -> 2695 bytes
-rw-r--r--ext/standard/tests/array/rsort_variation2.phpt484
-rw-r--r--ext/standard/tests/array/rsort_variation3.phpt325
-rw-r--r--ext/standard/tests/array/rsort_variation4.phpt62
-rw-r--r--ext/standard/tests/array/rsort_variation5.phpt226
-rw-r--r--ext/standard/tests/array/rsort_variation6.phpt120
-rw-r--r--ext/standard/tests/array/rsort_variation7.phpt96
-rw-r--r--ext/standard/tests/array/rsort_variation8.phpt180
-rw-r--r--ext/standard/tests/array/rsort_variation9.phpt259
-rw-r--r--ext/standard/tests/array/shuffle_basic1.phpt150
-rw-r--r--ext/standard/tests/array/shuffle_basic2.phpt89
-rw-r--r--ext/standard/tests/array/shuffle_error.phpt54
-rw-r--r--ext/standard/tests/array/shuffle_variation1.phpt214
-rw-r--r--ext/standard/tests/array/shuffle_variation2.phpt212
-rw-r--r--ext/standard/tests/array/shuffle_variation3.phpt233
-rw-r--r--ext/standard/tests/array/shuffle_variation4.phpt231
-rw-r--r--ext/standard/tests/array/shuffle_variation5.phpt120
-rw-r--r--ext/standard/tests/array/sizeof_basic1.phpt60
-rw-r--r--ext/standard/tests/array/sizeof_basic2.phpt99
-rw-r--r--ext/standard/tests/array/sizeof_error.phpt41
-rw-r--r--ext/standard/tests/array/sizeof_object1.phpt55
-rw-r--r--ext/standard/tests/array/sizeof_object2.phpt138
-rw-r--r--ext/standard/tests/array/sizeof_variation1.phpt215
-rw-r--r--ext/standard/tests/array/sizeof_variation2.phpt163
-rw-r--r--ext/standard/tests/array/sizeof_variation3.phpt34
-rw-r--r--ext/standard/tests/array/sizeof_variation4.phpt350
-rw-r--r--ext/standard/tests/array/sizeof_variation5.phpt132
-rw-r--r--ext/standard/tests/array/sort_basic.phpt246
-rw-r--r--ext/standard/tests/array/sort_error.phpt79
-rw-r--r--ext/standard/tests/array/sort_object1.phpt242
-rw-r--r--ext/standard/tests/array/sort_object2.phpt256
-rw-r--r--ext/standard/tests/array/sort_variation1.phpt398
-rw-r--r--ext/standard/tests/array/sort_variation10.phpt112
-rw-r--r--ext/standard/tests/array/sort_variation11.phptbin0 -> 3144 bytes
-rw-r--r--ext/standard/tests/array/sort_variation2.phpt311
-rw-r--r--ext/standard/tests/array/sort_variation3.phpt328
-rw-r--r--ext/standard/tests/array/sort_variation4.phpt79
-rw-r--r--ext/standard/tests/array/sort_variation5.phpt238
-rw-r--r--ext/standard/tests/array/sort_variation6.phpt123
-rw-r--r--ext/standard/tests/array/sort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/sort_variation8.phpt178
-rw-r--r--ext/standard/tests/array/sort_variation9.phpt259
-rw-r--r--ext/standard/tests/array/uasort_basic1.phpt116
-rw-r--r--ext/standard/tests/array/uasort_basic2.phpt102
-rw-r--r--ext/standard/tests/array/uasort_error.phpt81
-rw-r--r--ext/standard/tests/array/uasort_object1.phpt150
-rw-r--r--ext/standard/tests/array/uasort_object2.phpt187
-rw-r--r--ext/standard/tests/array/uasort_variation1.phpt188
-rw-r--r--ext/standard/tests/array/uasort_variation10.phpt74
-rw-r--r--ext/standard/tests/array/uasort_variation11.phpt82
-rw-r--r--ext/standard/tests/array/uasort_variation2.phpt212
-rw-r--r--ext/standard/tests/array/uasort_variation3.phptbin0 -> 2584 bytes
-rw-r--r--ext/standard/tests/array/uasort_variation4.phpt150
-rw-r--r--ext/standard/tests/array/uasort_variation5.phpt145
-rw-r--r--ext/standard/tests/array/uasort_variation6.phpt115
-rw-r--r--ext/standard/tests/array/uasort_variation7.phpt60
-rw-r--r--ext/standard/tests/array/uasort_variation8.phpt78
-rw-r--r--ext/standard/tests/array/uasort_variation9.phpt81
-rw-r--r--ext/standard/tests/array/uksort_basic.phpt26
-rw-r--r--ext/standard/tests/array/uksort_error.phpt45
-rw-r--r--ext/standard/tests/array/uksort_variation1.phpt224
-rw-r--r--ext/standard/tests/array/uksort_variation2.phpt224
-rw-r--r--ext/standard/tests/array/unexpected_array_mod_bug.phpt21
-rw-r--r--ext/standard/tests/array/usort_basic.phpt119
-rw-r--r--ext/standard/tests/array/usort_error1.phpt41
-rw-r--r--ext/standard/tests/array/usort_error2.phpt56
-rw-r--r--ext/standard/tests/array/usort_object1.phpt141
-rw-r--r--ext/standard/tests/array/usort_object2.phpt165
-rw-r--r--ext/standard/tests/array/usort_variation1.phpt236
-rw-r--r--ext/standard/tests/array/usort_variation10.phpt79
-rw-r--r--ext/standard/tests/array/usort_variation2.phpt242
-rw-r--r--ext/standard/tests/array/usort_variation3.phpt115
-rw-r--r--ext/standard/tests/array/usort_variation4.phpt155
-rw-r--r--ext/standard/tests/array/usort_variation5.phpt143
-rw-r--r--ext/standard/tests/array/usort_variation6.phpt139
-rw-r--r--ext/standard/tests/array/usort_variation7.phpt61
-rw-r--r--ext/standard/tests/array/usort_variation8.phpt85
-rw-r--r--ext/standard/tests/array/usort_variation9.phpt66
-rw-r--r--ext/standard/tests/array/var_export.phpt13
-rw-r--r--ext/standard/tests/array/var_export2.phpt13
-rw-r--r--ext/standard/tests/array/var_export3.phpt24
-rw-r--r--ext/standard/tests/assert/assert.phpt44
-rw-r--r--ext/standard/tests/assert/assert02.phpt48
-rw-r--r--ext/standard/tests/assert/assert03.phpt39
-rw-r--r--ext/standard/tests/assert/assert04.phpt48
-rw-r--r--ext/standard/tests/assert/assert_basic.phpt30
-rw-r--r--ext/standard/tests/assert/assert_basic1.phpt29
-rw-r--r--ext/standard/tests/assert/assert_basic2.phpt37
-rw-r--r--ext/standard/tests/assert/assert_basic3.phpt25
-rw-r--r--ext/standard/tests/assert/assert_basic4.phpt37
-rw-r--r--ext/standard/tests/assert/assert_basic5.phpt32
-rw-r--r--ext/standard/tests/assert/assert_basic6.phpt26
-rw-r--r--ext/standard/tests/assert/assert_closures.phpt16
-rw-r--r--ext/standard/tests/assert/assert_error.phpt27
-rw-r--r--ext/standard/tests/assert/assert_error1.phpt45
-rw-r--r--ext/standard/tests/assert/assert_error2.phpt30
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt21
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt21
-rw-r--r--ext/standard/tests/assert/assert_variation.phpt131
-rw-r--r--ext/standard/tests/bug49244.phpt32
-rw-r--r--ext/standard/tests/class_object/AutoInterface.inc5
-rw-r--r--ext/standard/tests/class_object/AutoLoaded.inc5
-rw-r--r--ext/standard/tests/class_object/AutoTest.inc13
-rw-r--r--ext/standard/tests/class_object/AutoTrait.inc5
-rw-r--r--ext/standard/tests/class_object/class_exists_basic_001.phpt55
-rw-r--r--ext/standard/tests/class_object/class_exists_error_001.phpt42
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_001.phpt187
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_002.phpt198
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_003.phpt18
-rw-r--r--ext/standard/tests/class_object/forward_static_call_001.phpt83
-rw-r--r--ext/standard/tests/class_object/forward_static_call_002.phpt21
-rw-r--r--ext/standard/tests/class_object/forward_static_call_003.phpt51
-rw-r--r--ext/standard/tests/class_object/get_class_error_001.phpt28
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_001.phpt63
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_002.phpt178
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_003.phpt76
-rw-r--r--ext/standard/tests/class_object/get_class_methods_error_001.phpt41
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_001.phpt177
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_002.phpt27
-rw-r--r--ext/standard/tests/class_object/get_class_variation_001.phpt212
-rw-r--r--ext/standard/tests/class_object/get_class_variation_002.phpt18
-rw-r--r--ext/standard/tests/class_object/get_class_vars_error.phpt38
-rw-r--r--ext/standard/tests/class_object/get_class_vars_variation1.phpt181
-rw-r--r--ext/standard/tests/class_object/get_class_vars_variation2.phpt168
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_basic_001.phpt47
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_error_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_variation1.phpt37
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt47
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt37
-rw-r--r--ext/standard/tests/class_object/get_declared_traits_basic_001.phpt56
-rw-r--r--ext/standard/tests/class_object/get_declared_traits_error_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_declared_traits_variation1.phpt41
-rw-r--r--ext/standard/tests/class_object/get_object_vars_basic_001.phpt107
-rw-r--r--ext/standard/tests/class_object/get_object_vars_basic_002.phpt64
-rw-r--r--ext/standard/tests/class_object/get_object_vars_error_001.phpt37
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_002.phpt47
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_003.phpt210
-rw-r--r--ext/standard/tests/class_object/get_parent_class_error_001.phpt29
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_002.phpt179
-rw-r--r--ext/standard/tests/class_object/interface_exists_error.phpt38
-rw-r--r--ext/standard/tests/class_object/interface_exists_variation1.phpt184
-rw-r--r--ext/standard/tests/class_object/interface_exists_variation2.phpt204
-rw-r--r--ext/standard/tests/class_object/interface_exists_variation3.phpt35
-rw-r--r--ext/standard/tests/class_object/interface_exists_variation4.phpt27
-rw-r--r--ext/standard/tests/class_object/is_a.phpt378
-rw-r--r--ext/standard/tests/class_object/is_a_error_001.phpt54
-rw-r--r--ext/standard/tests/class_object/is_a_variation_001.phpt163
-rw-r--r--ext/standard/tests/class_object/is_a_variation_002.phpt175
-rw-r--r--ext/standard/tests/class_object/is_a_variation_003.phpt25
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_error_001.phpt58
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_001.phpt176
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_002.phpt176
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_003.phpt26
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_004.phpt176
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_001.phpt83
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_002.phpt33
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_003.phpt22
-rw-r--r--ext/standard/tests/class_object/method_exists_error_001.phpt40
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_001.phpt175
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_002.phpt176
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_003.phpt26
-rw-r--r--ext/standard/tests/class_object/property_exists_error.phpt47
-rw-r--r--ext/standard/tests/class_object/property_exists_variation1.phpt33
-rw-r--r--ext/standard/tests/class_object/trait_class_exists_variation_003.phpt18
-rw-r--r--ext/standard/tests/class_object/trait_exists_basic_001.phpt57
-rw-r--r--ext/standard/tests/class_object/trait_exists_error_001.phpt42
-rw-r--r--ext/standard/tests/class_object/trait_exists_variation_001.phpt187
-rw-r--r--ext/standard/tests/class_object/trait_exists_variation_002.phpt198
-rw-r--r--ext/standard/tests/dir/chdir_basic.phpt53
-rw-r--r--ext/standard/tests/dir/chdir_error1.phpt39
-rw-r--r--ext/standard/tests/dir/chdir_error2.phpt26
-rw-r--r--ext/standard/tests/dir/chdir_variation1.phpt235
-rw-r--r--ext/standard/tests/dir/chdir_variation2.phpt104
-rw-r--r--ext/standard/tests/dir/closedir_basic.phpt56
-rw-r--r--ext/standard/tests/dir/closedir_error.phpt45
-rw-r--r--ext/standard/tests/dir/closedir_variation1.phpt212
-rw-r--r--ext/standard/tests/dir/closedir_variation2.phpt51
-rw-r--r--ext/standard/tests/dir/closedir_variation3.phpt44
-rw-r--r--ext/standard/tests/dir/dir_basic.phpt86
-rw-r--r--ext/standard/tests/dir/dir_error.phpt34
-rw-r--r--ext/standard/tests/dir/dir_variation1-win32.phpt170
-rw-r--r--ext/standard/tests/dir/dir_variation1.phpt166
-rw-r--r--ext/standard/tests/dir/dir_variation2.phpt223
-rw-r--r--ext/standard/tests/dir/dir_variation3.phpt204
-rw-r--r--ext/standard/tests/dir/dir_variation4.phpt72
-rw-r--r--ext/standard/tests/dir/dir_variation5-win32.phpt37
-rw-r--r--ext/standard/tests/dir/dir_variation5.phpt35
-rw-r--r--ext/standard/tests/dir/dir_variation6-win32.phpt61
-rw-r--r--ext/standard/tests/dir/dir_variation6.phpt57
-rw-r--r--ext/standard/tests/dir/dir_variation7.phpt94
-rw-r--r--ext/standard/tests/dir/dir_variation8-win32.phpt68
-rw-r--r--ext/standard/tests/dir/dir_variation8.phpt60
-rw-r--r--ext/standard/tests/dir/dir_variation9-win32.phpt125
-rw-r--r--ext/standard/tests/dir/dir_variation9.phpt117
-rw-r--r--ext/standard/tests/dir/getcwd_basic.phpt34
-rw-r--r--ext/standard/tests/dir/getcwd_error.phpt29
-rw-r--r--ext/standard/tests/dir/opendir_basic.phpt62
-rw-r--r--ext/standard/tests/dir/opendir_error1.phpt47
-rw-r--r--ext/standard/tests/dir/opendir_error2-win32.phpt47
-rw-r--r--ext/standard/tests/dir/opendir_error2.phpt43
-rw-r--r--ext/standard/tests/dir/opendir_variation1-win32.phpt248
-rw-r--r--ext/standard/tests/dir/opendir_variation1.phpt224
-rw-r--r--ext/standard/tests/dir/opendir_variation2.phpt239
-rw-r--r--ext/standard/tests/dir/opendir_variation3.phpt50
-rw-r--r--ext/standard/tests/dir/opendir_variation4.phpt107
-rw-r--r--ext/standard/tests/dir/opendir_variation5.phpt103
-rw-r--r--ext/standard/tests/dir/opendir_variation6-win32.phpt75
-rw-r--r--ext/standard/tests/dir/opendir_variation6.phpt67
-rw-r--r--ext/standard/tests/dir/opendir_variation7.phpt127
-rw-r--r--ext/standard/tests/dir/readdir_basic.phpt73
-rw-r--r--ext/standard/tests/dir/readdir_error.phpt43
-rw-r--r--ext/standard/tests/dir/readdir_variation1.phpt210
-rw-r--r--ext/standard/tests/dir/readdir_variation2.phpt48
-rw-r--r--ext/standard/tests/dir/readdir_variation3.phpt68
-rw-r--r--ext/standard/tests/dir/readdir_variation4.phpt178
-rw-r--r--ext/standard/tests/dir/readdir_variation5.phpt144
-rw-r--r--ext/standard/tests/dir/readdir_variation6.phpt80
-rw-r--r--ext/standard/tests/dir/readdir_variation7.phpt28
-rw-r--r--ext/standard/tests/dir/rewinddir_basic.phpt96
-rw-r--r--ext/standard/tests/dir/rewinddir_error.phpt42
-rw-r--r--ext/standard/tests/dir/rewinddir_variation1.phpt211
-rw-r--r--ext/standard/tests/dir/rewinddir_variation2.phpt45
-rw-r--r--ext/standard/tests/dir/rewinddir_variation3.phpt43
-rw-r--r--ext/standard/tests/dir/scandir_basic.phpt70
-rw-r--r--ext/standard/tests/dir/scandir_error1.phpt47
-rw-r--r--ext/standard/tests/dir/scandir_error2-win32.phpt51
-rw-r--r--ext/standard/tests/dir/scandir_error2.phpt47
-rw-r--r--ext/standard/tests/dir/scandir_variation1-win32.phpt289
-rw-r--r--ext/standard/tests/dir/scandir_variation1.phpt259
-rw-r--r--ext/standard/tests/dir/scandir_variation10.phpt79
-rw-r--r--ext/standard/tests/dir/scandir_variation2.phpt283
-rw-r--r--ext/standard/tests/dir/scandir_variation3.phpt238
-rw-r--r--ext/standard/tests/dir/scandir_variation4.phpt169
-rw-r--r--ext/standard/tests/dir/scandir_variation5.phpt98
-rw-r--r--ext/standard/tests/dir/scandir_variation6-win32.phpt84
-rw-r--r--ext/standard/tests/dir/scandir_variation6.phpt76
-rw-r--r--ext/standard/tests/dir/scandir_variation7.phpt169
-rw-r--r--ext/standard/tests/dir/scandir_variation8.phpt154
-rw-r--r--ext/standard/tests/dir/scandir_variation9.phpt72
-rw-r--r--ext/standard/tests/directory/DirectoryClass_basic_001.phpt65
-rw-r--r--ext/standard/tests/directory/DirectoryClass_error_001.phpt59
-rw-r--r--ext/standard/tests/directory/directory_constants-win32.phpt26
-rw-r--r--ext/standard/tests/directory/directory_constants.phpt26
-rw-r--r--ext/standard/tests/file/001-win32.phpt100
-rw-r--r--ext/standard/tests/file/001.phpt146
-rw-r--r--ext/standard/tests/file/002.phpt52
-rw-r--r--ext/standard/tests/file/003.phpt41
-rw-r--r--ext/standard/tests/file/004.phpt61
-rw-r--r--ext/standard/tests/file/005_basic.phpt54
-rw-r--r--ext/standard/tests/file/005_error.phpt126
-rw-r--r--ext/standard/tests/file/005_variation-win32.phpt221
-rw-r--r--ext/standard/tests/file/005_variation.phpt260
-rw-r--r--ext/standard/tests/file/005_variation2-win32.phpt119
-rw-r--r--ext/standard/tests/file/005_variation2.phpt113
-rw-r--r--ext/standard/tests/file/006_basic.phpt58
-rw-r--r--ext/standard/tests/file/006_error.phpt107
-rw-r--r--ext/standard/tests/file/006_variation1.phpt2627
-rw-r--r--ext/standard/tests/file/006_variation2.phpt186
-rw-r--r--ext/standard/tests/file/007_basic.phpt412
-rw-r--r--ext/standard/tests/file/007_error.phpt185
-rw-r--r--ext/standard/tests/file/007_variation1.phpt54
-rw-r--r--ext/standard/tests/file/007_variation10.phpt58
-rw-r--r--ext/standard/tests/file/007_variation11-win32.phpt76
-rw-r--r--ext/standard/tests/file/007_variation11.phpt76
-rw-r--r--ext/standard/tests/file/007_variation12-win32.phpt78
-rw-r--r--ext/standard/tests/file/007_variation12.phpt78
-rw-r--r--ext/standard/tests/file/007_variation13-win32.phpt65
-rw-r--r--ext/standard/tests/file/007_variation13.phpt65
-rw-r--r--ext/standard/tests/file/007_variation14.phpt62
-rw-r--r--ext/standard/tests/file/007_variation15.phpt58
-rw-r--r--ext/standard/tests/file/007_variation16.phpt60
-rw-r--r--ext/standard/tests/file/007_variation17.phpt54
-rw-r--r--ext/standard/tests/file/007_variation18.phpt58
-rw-r--r--ext/standard/tests/file/007_variation19.phpt71
-rw-r--r--ext/standard/tests/file/007_variation2.phpt58
-rw-r--r--ext/standard/tests/file/007_variation20.phpt73
-rw-r--r--ext/standard/tests/file/007_variation21.phpt60
-rw-r--r--ext/standard/tests/file/007_variation22.phpt62
-rw-r--r--ext/standard/tests/file/007_variation23.phpt58
-rw-r--r--ext/standard/tests/file/007_variation24.phpt60
-rw-r--r--ext/standard/tests/file/007_variation3.phpt71
-rw-r--r--ext/standard/tests/file/007_variation4.phpt73
-rw-r--r--ext/standard/tests/file/007_variation5.phpt60
-rw-r--r--ext/standard/tests/file/007_variation6.phpt62
-rw-r--r--ext/standard/tests/file/007_variation7.phpt58
-rw-r--r--ext/standard/tests/file/007_variation8.phpt60
-rw-r--r--ext/standard/tests/file/007_variation9.phpt54
-rw-r--r--ext/standard/tests/file/basename-win32.phpt341
-rw-r--r--ext/standard/tests/file/basename.phptbin0 -> 8229 bytes
-rw-r--r--ext/standard/tests/file/basename_basic-win32.phpt101
-rw-r--r--ext/standard/tests/file/basename_basic.phpt101
-rw-r--r--ext/standard/tests/file/basename_error.phpt38
-rw-r--r--ext/standard/tests/file/basename_variation1-win32.phpt238
-rw-r--r--ext/standard/tests/file/basename_variation1.phpt238
-rw-r--r--ext/standard/tests/file/basename_variation2-win32.phpt253
-rw-r--r--ext/standard/tests/file/basename_variation2.phpt253
-rw-r--r--ext/standard/tests/file/basename_variation3.phpt185
-rw-r--r--ext/standard/tests/file/basename_variation4.phpt188
-rw-r--r--ext/standard/tests/file/bug12556.phpt48
-rw-r--r--ext/standard/tests/file/bug20424.phpt10
-rw-r--r--ext/standard/tests/file/bug22382.phpt25
-rw-r--r--ext/standard/tests/file/bug22414.phpt38
-rw-r--r--ext/standard/tests/file/bug24313.phpt16
-rw-r--r--ext/standard/tests/file/bug24482.phpt37
-rw-r--r--ext/standard/tests/file/bug26003.phptbin0 -> 225 bytes
-rw-r--r--ext/standard/tests/file/bug26615.phpt20
-rw-r--r--ext/standard/tests/file/bug26938.phpt33
-rw-r--r--ext/standard/tests/file/bug27508.phpt80
-rw-r--r--ext/standard/tests/file/bug27619.phpt18
-rw-r--r--ext/standard/tests/file/bug30362.phpt26
-rw-r--r--ext/standard/tests/file/bug30362.txt1
-rw-r--r--ext/standard/tests/file/bug32160.phpt14
-rw-r--r--ext/standard/tests/file/bug32160.txt1
-rw-r--r--ext/standard/tests/file/bug35740.phpt14
-rw-r--r--ext/standard/tests/file/bug35781.phpt24
-rw-r--r--ext/standard/tests/file/bug37158.phpt39
-rw-r--r--ext/standard/tests/file/bug37864.phpt12
-rw-r--r--ext/standard/tests/file/bug38086.phpt55
-rw-r--r--ext/standard/tests/file/bug38086.txt5
-rw-r--r--ext/standard/tests/file/bug38450.phpt114
-rw-r--r--ext/standard/tests/file/bug38450_1.phpt114
-rw-r--r--ext/standard/tests/file/bug38450_2.phpt114
-rw-r--r--ext/standard/tests/file/bug38450_3.phpt105
-rw-r--r--ext/standard/tests/file/bug39367.phpt33
-rw-r--r--ext/standard/tests/file/bug39538.phpt39
-rw-r--r--ext/standard/tests/file/bug39551.phpt24
-rw-r--r--ext/standard/tests/file/bug39673.phpt40
-rw-r--r--ext/standard/tests/file/bug39863.phpt23
-rw-r--r--ext/standard/tests/file/bug40374.phpt17
-rw-r--r--ext/standard/tests/file/bug40501.csv2
-rw-r--r--ext/standard/tests/file/bug40501.phpt20
-rw-r--r--ext/standard/tests/file/bug41655_1.phpt15
-rw-r--r--ext/standard/tests/file/bug41655_2.phpt15
-rw-r--r--ext/standard/tests/file/bug41693.phpt13
-rw-r--r--ext/standard/tests/file/bug41815.phpt27
-rw-r--r--ext/standard/tests/file/bug41874.phpt15
-rw-r--r--ext/standard/tests/file/bug41874_1.phpt16
-rw-r--r--ext/standard/tests/file/bug41874_2.phpt17
-rw-r--r--ext/standard/tests/file/bug41874_3.phpt16
-rw-r--r--ext/standard/tests/file/bug43008.phpt19
-rw-r--r--ext/standard/tests/file/bug43137.phpt20
-rw-r--r--ext/standard/tests/file/bug43216.phpt8
-rw-r--r--ext/standard/tests/file/bug43248.phpt8
-rw-r--r--ext/standard/tests/file/bug43353-win32.phpt25
-rw-r--r--ext/standard/tests/file/bug43353.phpt25
-rw-r--r--ext/standard/tests/file/bug43522.phpt25
-rw-r--r--ext/standard/tests/file/bug44034.phpt41
-rw-r--r--ext/standard/tests/file/bug44607.phpt24
-rw-r--r--ext/standard/tests/file/bug44805.phpt30
-rw-r--r--ext/standard/tests/file/bug45181.phpt16
-rw-r--r--ext/standard/tests/file/bug45303.phpt13
-rw-r--r--ext/standard/tests/file/bug45985.phpt14
-rw-r--r--ext/standard/tests/file/bug46347.phpt24
-rw-r--r--ext/standard/tests/file/bug47767.phpt50
-rw-r--r--ext/standard/tests/file/bug49047.phpt17
-rw-r--r--ext/standard/tests/file/bug51094.phpt22
-rw-r--r--ext/standard/tests/file/bug52624.phpt12
-rw-r--r--ext/standard/tests/file/bug52820.phpt71
-rw-r--r--ext/standard/tests/file/bug53241.phpt23
-rw-r--r--ext/standard/tests/file/bug53848.phpt25
-rw-r--r--ext/standard/tests/file/bug55124.phpt18
-rw-r--r--ext/standard/tests/file/bug60120.phpt74
-rw-r--r--ext/standard/tests/file/bug61961.phpt14
-rw-r--r--ext/standard/tests/file/bug63512.phpt33
-rw-r--r--ext/standard/tests/file/chgrp.phpt15
-rw-r--r--ext/standard/tests/file/chmod_basic-win32.phpt545
-rw-r--r--ext/standard/tests/file/chmod_basic.phpt35
-rw-r--r--ext/standard/tests/file/chmod_error.phpt47
-rw-r--r--ext/standard/tests/file/chmod_variation1.phpt34
-rw-r--r--ext/standard/tests/file/chmod_variation2-win32.phpt74
-rw-r--r--ext/standard/tests/file/chmod_variation2.phpt92
-rw-r--r--ext/standard/tests/file/chmod_variation3.phpt209
-rw-r--r--ext/standard/tests/file/chmod_variation4.phpt201
-rw-r--r--ext/standard/tests/file/chown.phpt15
-rw-r--r--ext/standard/tests/file/chroot_001.phpt30
-rw-r--r--ext/standard/tests/file/clearstatcache_001.phpt43
-rw-r--r--ext/standard/tests/file/clearstatcache_error.phpt19
-rw-r--r--ext/standard/tests/file/copy_basic.phpt58
-rw-r--r--ext/standard/tests/file/copy_error.phpt39
-rw-r--r--ext/standard/tests/file/copy_variation1.phpt145
-rw-r--r--ext/standard/tests/file/copy_variation10.phpt37
-rw-r--r--ext/standard/tests/file/copy_variation11.phpt71
-rw-r--r--ext/standard/tests/file/copy_variation12-win32.phpt47
-rw-r--r--ext/standard/tests/file/copy_variation12.phpt51
-rw-r--r--ext/standard/tests/file/copy_variation13.phpt57
-rw-r--r--ext/standard/tests/file/copy_variation14.phpt48
-rw-r--r--ext/standard/tests/file/copy_variation15.phpt64
-rw-r--r--ext/standard/tests/file/copy_variation16-win32.phpt144
-rw-r--r--ext/standard/tests/file/copy_variation16.phpt143
-rw-r--r--ext/standard/tests/file/copy_variation17.phpt76
-rw-r--r--ext/standard/tests/file/copy_variation18.phpt56
-rw-r--r--ext/standard/tests/file/copy_variation2-win32.phpt218
-rw-r--r--ext/standard/tests/file/copy_variation2.phpt237
-rw-r--r--ext/standard/tests/file/copy_variation3-win32.phpt109
-rw-r--r--ext/standard/tests/file/copy_variation3.phpt110
-rw-r--r--ext/standard/tests/file/copy_variation4.phptbin0 -> 4966 bytes
-rw-r--r--ext/standard/tests/file/copy_variation5-win32.phpt111
-rw-r--r--ext/standard/tests/file/copy_variation5.phpt106
-rw-r--r--ext/standard/tests/file/copy_variation6-win32.phpt143
-rw-r--r--ext/standard/tests/file/copy_variation6.phpt142
-rw-r--r--ext/standard/tests/file/copy_variation7.phpt86
-rw-r--r--ext/standard/tests/file/copy_variation8.phpt176
-rw-r--r--ext/standard/tests/file/copy_variation9.phpt75
-rw-r--r--ext/standard/tests/file/directory_wrapper_fstat_basic.phpt13
-rw-r--r--ext/standard/tests/file/dirname_basic-win32.phpt93
-rw-r--r--ext/standard/tests/file/dirname_basic.phpt94
-rw-r--r--ext/standard/tests/file/dirname_error.phpt40
-rw-r--r--ext/standard/tests/file/dirname_variation1.phpt190
-rw-r--r--ext/standard/tests/file/disk.phpt48
-rw-r--r--ext/standard/tests/file/disk_free_space_basic.phpt70
-rw-r--r--ext/standard/tests/file/disk_free_space_error-win32.phpt75
-rw-r--r--ext/standard/tests/file/disk_free_space_error.phpt67
-rw-r--r--ext/standard/tests/file/disk_free_space_variation.phpt139
-rw-r--r--ext/standard/tests/file/disk_total_space_basic.phpt48
-rw-r--r--ext/standard/tests/file/disk_total_space_error-win32.phpt56
-rw-r--r--ext/standard/tests/file/disk_total_space_error.phpt52
-rw-r--r--ext/standard/tests/file/disk_total_space_variation.phpt123
-rw-r--r--ext/standard/tests/file/fclose_variation1.phpt15
-rw-r--r--ext/standard/tests/file/feof_basic.phpt101
-rw-r--r--ext/standard/tests/file/fflush_basic.phpt58
-rw-r--r--ext/standard/tests/file/fflush_error.phpt90
-rw-r--r--ext/standard/tests/file/fflush_variation1-win32.phpt531
-rw-r--r--ext/standard/tests/file/fflush_variation1.phpt532
-rw-r--r--ext/standard/tests/file/fflush_variation2.phpt443
-rw-r--r--ext/standard/tests/file/fflush_variation3.phpt383
-rw-r--r--ext/standard/tests/file/fflush_variation4.phpt53
-rw-r--r--ext/standard/tests/file/fgetc_basic.phpt543
-rw-r--r--ext/standard/tests/file/fgetc_error.phpt73
-rw-r--r--ext/standard/tests/file/fgetc_variation1.phpt94
-rw-r--r--ext/standard/tests/file/fgetc_variation2.phpt52
-rw-r--r--ext/standard/tests/file/fgetc_variation3.phpt117
-rw-r--r--ext/standard/tests/file/fgetc_variation4.phpt290
-rw-r--r--ext/standard/tests/file/fgetcsv.phpt158
-rw-r--r--ext/standard/tests/file/fgetcsv_error.phpt96
-rw-r--r--ext/standard/tests/file/fgetcsv_variation1.phpt1412
-rw-r--r--ext/standard/tests/file/fgetcsv_variation10.phpt1295
-rw-r--r--ext/standard/tests/file/fgetcsv_variation11.phpt1835
-rw-r--r--ext/standard/tests/file/fgetcsv_variation12.phpt957
-rw-r--r--ext/standard/tests/file/fgetcsv_variation13.phpt189
-rw-r--r--ext/standard/tests/file/fgetcsv_variation14.phpt239
-rw-r--r--ext/standard/tests/file/fgetcsv_variation15.phpt940
-rw-r--r--ext/standard/tests/file/fgetcsv_variation16.phpt944
-rw-r--r--ext/standard/tests/file/fgetcsv_variation17.phpt1565
-rw-r--r--ext/standard/tests/file/fgetcsv_variation18.phpt690
-rw-r--r--ext/standard/tests/file/fgetcsv_variation19.phpt841
-rw-r--r--ext/standard/tests/file/fgetcsv_variation2.phpt1413
-rw-r--r--ext/standard/tests/file/fgetcsv_variation20.phpt191
-rw-r--r--ext/standard/tests/file/fgetcsv_variation21.phpt191
-rw-r--r--ext/standard/tests/file/fgetcsv_variation22.phpt614
-rw-r--r--ext/standard/tests/file/fgetcsv_variation23.phpt48
-rw-r--r--ext/standard/tests/file/fgetcsv_variation24.phpt671
-rw-r--r--ext/standard/tests/file/fgetcsv_variation25.phpt935
-rw-r--r--ext/standard/tests/file/fgetcsv_variation26.phpt441
-rw-r--r--ext/standard/tests/file/fgetcsv_variation27.phpt935
-rw-r--r--ext/standard/tests/file/fgetcsv_variation28.phpt935
-rw-r--r--ext/standard/tests/file/fgetcsv_variation29.phpt615
-rw-r--r--ext/standard/tests/file/fgetcsv_variation3.phpt933
-rw-r--r--ext/standard/tests/file/fgetcsv_variation30.phpt614
-rw-r--r--ext/standard/tests/file/fgetcsv_variation31.phpt616
-rw-r--r--ext/standard/tests/file/fgetcsv_variation4.phpt932
-rw-r--r--ext/standard/tests/file/fgetcsv_variation5.phpt934
-rw-r--r--ext/standard/tests/file/fgetcsv_variation6.phpt2350
-rw-r--r--ext/standard/tests/file/fgetcsv_variation7.phpt1292
-rw-r--r--ext/standard/tests/file/fgetcsv_variation8.phpt1058
-rw-r--r--ext/standard/tests/file/fgetcsv_variation9.phpt1056
-rw-r--r--ext/standard/tests/file/fgets_basic.phpt318
-rw-r--r--ext/standard/tests/file/fgets_error.phpt108
-rw-r--r--ext/standard/tests/file/fgets_socket_variation1.phpt56
-rw-r--r--ext/standard/tests/file/fgets_socket_variation2.phpt63
-rw-r--r--ext/standard/tests/file/fgets_variation1.phpt116
-rw-r--r--ext/standard/tests/file/fgets_variation2.phpt63
-rw-r--r--ext/standard/tests/file/fgets_variation3.phpt500
-rw-r--r--ext/standard/tests/file/fgets_variation4-win32.phpt574
-rw-r--r--ext/standard/tests/file/fgets_variation4.phpt574
-rw-r--r--ext/standard/tests/file/fgets_variation5.phpt302
-rw-r--r--ext/standard/tests/file/fgets_variation6-win32.phpt372
-rw-r--r--ext/standard/tests/file/fgets_variation6.phpt372
-rw-r--r--ext/standard/tests/file/fgetss.phpt83
-rw-r--r--ext/standard/tests/file/fgetss1.phpt69
-rw-r--r--ext/standard/tests/file/fgetss_basic1.phpt135
-rw-r--r--ext/standard/tests/file/fgetss_basic2-win32.phpt216
-rw-r--r--ext/standard/tests/file/fgetss_basic2.phpt214
-rw-r--r--ext/standard/tests/file/fgetss_error.phpt106
-rw-r--r--ext/standard/tests/file/fgetss_variation1-win32.phpt172
-rw-r--r--ext/standard/tests/file/fgetss_variation1.phpt168
-rw-r--r--ext/standard/tests/file/fgetss_variation2.phpt434
-rw-r--r--ext/standard/tests/file/fgetss_variation3-win32.phpt571
-rw-r--r--ext/standard/tests/file/fgetss_variation3.phpt567
-rw-r--r--ext/standard/tests/file/fgetss_variation4.phpt168
-rw-r--r--ext/standard/tests/file/fgetss_variation5-win32.phpt220
-rw-r--r--ext/standard/tests/file/fgetss_variation5.phpt217
-rw-r--r--ext/standard/tests/file/file.inc650
-rw-r--r--ext/standard/tests/file/file_basic.phpt77
-rw-r--r--ext/standard/tests/file/file_error.phpt48
-rw-r--r--ext/standard/tests/file/file_exists_error.phpt40
-rw-r--r--ext/standard/tests/file/file_exists_variation1.phpt30
-rw-r--r--ext/standard/tests/file/file_get_contents_basic.phpt41
-rw-r--r--ext/standard/tests/file/file_get_contents_basic001.phpt21
-rw-r--r--ext/standard/tests/file/file_get_contents_error.phpt67
-rw-r--r--ext/standard/tests/file/file_get_contents_error001.phpt19
-rw-r--r--ext/standard/tests/file/file_get_contents_error002.phpt18
-rw-r--r--ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt50
-rw-r--r--ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt71
-rw-r--r--ext/standard/tests/file/file_get_contents_file_put_contents_variation1.phpt116
-rw-r--r--ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt57
-rw-r--r--ext/standard/tests/file/file_get_contents_variation1.phpt51
-rw-r--r--ext/standard/tests/file/file_get_contents_variation2.phpt52
-rw-r--r--ext/standard/tests/file/file_get_contents_variation3.phpt218
-rw-r--r--ext/standard/tests/file/file_get_contents_variation4.phpt251
-rw-r--r--ext/standard/tests/file/file_get_contents_variation5.phpt222
-rw-r--r--ext/standard/tests/file/file_get_contents_variation6.phpt215
-rw-r--r--ext/standard/tests/file/file_get_contents_variation7-win32.phpt115
-rw-r--r--ext/standard/tests/file/file_get_contents_variation7.phpt104
-rw-r--r--ext/standard/tests/file/file_get_contents_variation8-win32.phpt98
-rw-r--r--ext/standard/tests/file/file_get_contents_variation8.phpt88
-rw-r--r--ext/standard/tests/file/file_get_contents_variation9.phpt56
-rw-r--r--ext/standard/tests/file/file_put_contents.phpt32
-rw-r--r--ext/standard/tests/file/file_put_contents_variation1.phpt43
-rw-r--r--ext/standard/tests/file/file_put_contents_variation2.phpt167
-rw-r--r--ext/standard/tests/file/file_put_contents_variation3.phpt250
-rw-r--r--ext/standard/tests/file/file_put_contents_variation4.phpt51
-rw-r--r--ext/standard/tests/file/file_put_contents_variation5.phpt51
-rw-r--r--ext/standard/tests/file/file_put_contents_variation6.phpt56
-rw-r--r--ext/standard/tests/file/file_put_contents_variation7-win32.phpt130
-rw-r--r--ext/standard/tests/file/file_put_contents_variation7.phpt119
-rw-r--r--ext/standard/tests/file/file_put_contents_variation8-win32.phpt98
-rw-r--r--ext/standard/tests/file/file_put_contents_variation8.phptbin0 -> 2388 bytes
-rw-r--r--ext/standard/tests/file/file_put_contents_variation9.phpt70
-rw-r--r--ext/standard/tests/file/file_variation.phpt160
-rw-r--r--ext/standard/tests/file/file_variation2.phpt210
-rw-r--r--ext/standard/tests/file/file_variation3.phpt294
-rw-r--r--ext/standard/tests/file/file_variation4.phpt291
-rw-r--r--ext/standard/tests/file/file_variation5-win32.phpt74
-rw-r--r--ext/standard/tests/file/file_variation5.phpt94
-rw-r--r--ext/standard/tests/file/file_variation6.phpt261
-rw-r--r--ext/standard/tests/file/file_variation7.phpt87
-rw-r--r--ext/standard/tests/file/file_variation8-win32.phpt142
-rw-r--r--ext/standard/tests/file/file_variation8.phpt128
-rw-r--r--ext/standard/tests/file/file_variation9.phpt89
-rw-r--r--ext/standard/tests/file/filegroup_basic.phpt69
-rw-r--r--ext/standard/tests/file/filegroup_error.phpt44
-rw-r--r--ext/standard/tests/file/filegroup_variation1.phpt47
-rw-r--r--ext/standard/tests/file/filegroup_variation2.phpt71
-rw-r--r--ext/standard/tests/file/filegroup_variation3.phpt85
-rw-r--r--ext/standard/tests/file/fileinode_basic.phpt36
-rw-r--r--ext/standard/tests/file/fileinode_error.phpt44
-rw-r--r--ext/standard/tests/file/fileinode_variation.phpt112
-rw-r--r--ext/standard/tests/file/fileinode_variation1.phpt48
-rw-r--r--ext/standard/tests/file/fileinode_variation2.phpt72
-rw-r--r--ext/standard/tests/file/fileinode_variation3.phpt86
-rw-r--r--ext/standard/tests/file/fileowner_basic.phpt51
-rw-r--r--ext/standard/tests/file/fileowner_error.phpt44
-rw-r--r--ext/standard/tests/file/fileowner_variation1.phpt48
-rw-r--r--ext/standard/tests/file/fileowner_variation2.phpt72
-rw-r--r--ext/standard/tests/file/fileowner_variation3.phpt86
-rw-r--r--ext/standard/tests/file/fileperms_variation1.phpt47
-rw-r--r--ext/standard/tests/file/fileperms_variation2.phpt71
-rw-r--r--ext/standard/tests/file/fileperms_variation3.phpt85
-rw-r--r--ext/standard/tests/file/filesize_basic.phpt39
-rw-r--r--ext/standard/tests/file/filesize_error.phpt41
-rw-r--r--ext/standard/tests/file/filesize_variation1-win32.phpt45
-rw-r--r--ext/standard/tests/file/filesize_variation1.phpt45
-rw-r--r--ext/standard/tests/file/filesize_variation2-win32.phpt83
-rw-r--r--ext/standard/tests/file/filesize_variation2.phpt83
-rw-r--r--ext/standard/tests/file/filesize_variation3-win32.phpt70
-rw-r--r--ext/standard/tests/file/filesize_variation3.phpt70
-rw-r--r--ext/standard/tests/file/filesize_variation4-win32.phpt109
-rw-r--r--ext/standard/tests/file/filesize_variation4.phpt111
-rw-r--r--ext/standard/tests/file/filesize_variation5.phpt34
-rw-r--r--ext/standard/tests/file/filestat.phpt63
-rw-r--r--ext/standard/tests/file/filetype_basic.phpt22
-rw-r--r--ext/standard/tests/file/filetype_error.phpt39
-rw-r--r--ext/standard/tests/file/filetype_variation.phpt78
-rw-r--r--ext/standard/tests/file/filetype_variation2.phpt29
-rw-r--r--ext/standard/tests/file/filetype_variation3.phpt29
-rw-r--r--ext/standard/tests/file/flock.phpt64
-rw-r--r--ext/standard/tests/file/flock_basic.phpt44
-rw-r--r--ext/standard/tests/file/flock_error.phpt112
-rw-r--r--ext/standard/tests/file/flock_variation.phpt371
-rw-r--r--ext/standard/tests/file/fnmatch_basic.phpt49
-rw-r--r--ext/standard/tests/file/fnmatch_error.phpt57
-rw-r--r--ext/standard/tests/file/fnmatch_variation.phpt505
-rw-r--r--ext/standard/tests/file/fopen_include_path.inc92
-rw-r--r--ext/standard/tests/file/fopen_variation1.phpt14
-rw-r--r--ext/standard/tests/file/fopen_variation10-win32.phpt149
-rw-r--r--ext/standard/tests/file/fopen_variation11-win32.phpt147
-rw-r--r--ext/standard/tests/file/fopen_variation12.phpt52
-rw-r--r--ext/standard/tests/file/fopen_variation13.phpt56
-rw-r--r--ext/standard/tests/file/fopen_variation14-win32.phpt189
-rw-r--r--ext/standard/tests/file/fopen_variation14.phpt134
-rw-r--r--ext/standard/tests/file/fopen_variation15-win32.phpt193
-rw-r--r--ext/standard/tests/file/fopen_variation15.phpt138
-rw-r--r--ext/standard/tests/file/fopen_variation16.phpt75
-rw-r--r--ext/standard/tests/file/fopen_variation17.phpt74
-rw-r--r--ext/standard/tests/file/fopen_variation19.phpt110
-rw-r--r--ext/standard/tests/file/fopen_variation3.phpt218
-rw-r--r--ext/standard/tests/file/fopen_variation4.phpt251
-rw-r--r--ext/standard/tests/file/fopen_variation5.phpt151
-rw-r--r--ext/standard/tests/file/fopen_variation6.phpt44
-rw-r--r--ext/standard/tests/file/fopen_variation7.phpt66
-rw-r--r--ext/standard/tests/file/fopen_variation8.phpt150
-rw-r--r--ext/standard/tests/file/fopen_variation9.phpt66
-rw-r--r--ext/standard/tests/file/fopencookie.phpt88
-rw-r--r--ext/standard/tests/file/fpassthru_basic.phpt128
-rw-r--r--ext/standard/tests/file/fpassthru_error.phpt40
-rw-r--r--ext/standard/tests/file/fpassthru_variation.phpt114
-rw-r--r--ext/standard/tests/file/fpassthru_variation1.phpt224
-rw-r--r--ext/standard/tests/file/fputcsv.phpt105
-rw-r--r--ext/standard/tests/file/fputcsv_002.phpt43
-rw-r--r--ext/standard/tests/file/fputcsv_error.phpt97
-rw-r--r--ext/standard/tests/file/fputcsv_variation1.phpt834
-rw-r--r--ext/standard/tests/file/fputcsv_variation10.phpt336
-rw-r--r--ext/standard/tests/file/fputcsv_variation11.phpt834
-rw-r--r--ext/standard/tests/file/fputcsv_variation12.phpt835
-rw-r--r--ext/standard/tests/file/fputcsv_variation13.phpt1051
-rw-r--r--ext/standard/tests/file/fputcsv_variation14.phpt357
-rw-r--r--ext/standard/tests/file/fputcsv_variation2.phpt942
-rw-r--r--ext/standard/tests/file/fputcsv_variation3.phpt942
-rw-r--r--ext/standard/tests/file/fputcsv_variation4.phpt942
-rw-r--r--ext/standard/tests/file/fputcsv_variation5.phpt834
-rw-r--r--ext/standard/tests/file/fputcsv_variation6.phpt837
-rw-r--r--ext/standard/tests/file/fputcsv_variation7.phpt837
-rw-r--r--ext/standard/tests/file/fputcsv_variation8.phpt837
-rw-r--r--ext/standard/tests/file/fputcsv_variation9.phpt1268
-rw-r--r--ext/standard/tests/file/fread_basic.phpt640
-rw-r--r--ext/standard/tests/file/fread_error.phpt114
-rw-r--r--ext/standard/tests/file/fread_fwrite_basic.phpt72
-rw-r--r--ext/standard/tests/file/fread_socket_variation1.phpt16
-rw-r--r--ext/standard/tests/file/fread_variation1.phpt657
-rw-r--r--ext/standard/tests/file/fread_variation2.phpt656
-rw-r--r--ext/standard/tests/file/fread_variation3-win32.phpt498
-rw-r--r--ext/standard/tests/file/fread_variation3.phpt498
-rw-r--r--ext/standard/tests/file/fread_variation4-win32.phpt469
-rw-r--r--ext/standard/tests/file/fread_variation4.phpt469
-rw-r--r--ext/standard/tests/file/fscanf.phpt100
-rw-r--r--ext/standard/tests/file/fscanf_error.phpt99
-rw-r--r--ext/standard/tests/file/fscanf_variation1.phpt50
-rw-r--r--ext/standard/tests/file/fscanf_variation10.phpt222
-rw-r--r--ext/standard/tests/file/fscanf_variation11.phpt713
-rw-r--r--ext/standard/tests/file/fscanf_variation12.phpt946
-rw-r--r--ext/standard/tests/file/fscanf_variation13.phpt246
-rw-r--r--ext/standard/tests/file/fscanf_variation14.phpt1079
-rw-r--r--ext/standard/tests/file/fscanf_variation15.phpt863
-rw-r--r--ext/standard/tests/file/fscanf_variation16.phpt221
-rw-r--r--ext/standard/tests/file/fscanf_variation17.phpt712
-rw-r--r--ext/standard/tests/file/fscanf_variation18.phpt1014
-rw-r--r--ext/standard/tests/file/fscanf_variation19.phpt250
-rw-r--r--ext/standard/tests/file/fscanf_variation2.phpt1008
-rw-r--r--ext/standard/tests/file/fscanf_variation20.phpt1012
-rw-r--r--ext/standard/tests/file/fscanf_variation21.phpt863
-rw-r--r--ext/standard/tests/file/fscanf_variation22.phpt221
-rw-r--r--ext/standard/tests/file/fscanf_variation23.phpt712
-rw-r--r--ext/standard/tests/file/fscanf_variation24.phpt994
-rw-r--r--ext/standard/tests/file/fscanf_variation25.phpt294
-rw-r--r--ext/standard/tests/file/fscanf_variation26.phpt356
-rw-r--r--ext/standard/tests/file/fscanf_variation27.phpt1013
-rw-r--r--ext/standard/tests/file/fscanf_variation28.phpt863
-rw-r--r--ext/standard/tests/file/fscanf_variation29.phpt222
-rw-r--r--ext/standard/tests/file/fscanf_variation3.phpt865
-rw-r--r--ext/standard/tests/file/fscanf_variation30.phpt713
-rw-r--r--ext/standard/tests/file/fscanf_variation31.phpt946
-rw-r--r--ext/standard/tests/file/fscanf_variation32.phpt251
-rw-r--r--ext/standard/tests/file/fscanf_variation33.phpt1019
-rw-r--r--ext/standard/tests/file/fscanf_variation34.phpt869
-rw-r--r--ext/standard/tests/file/fscanf_variation35.phpt217
-rw-r--r--ext/standard/tests/file/fscanf_variation36.phpt708
-rw-r--r--ext/standard/tests/file/fscanf_variation37.phpt946
-rw-r--r--ext/standard/tests/file/fscanf_variation38.phpt246
-rw-r--r--ext/standard/tests/file/fscanf_variation39.phpt1014
-rw-r--r--ext/standard/tests/file/fscanf_variation4.phpt218
-rw-r--r--ext/standard/tests/file/fscanf_variation40.phpt865
-rw-r--r--ext/standard/tests/file/fscanf_variation41.phpt217
-rw-r--r--ext/standard/tests/file/fscanf_variation42.phpt708
-rw-r--r--ext/standard/tests/file/fscanf_variation43.phpt946
-rw-r--r--ext/standard/tests/file/fscanf_variation44.phpt246
-rw-r--r--ext/standard/tests/file/fscanf_variation45.phpt1008
-rw-r--r--ext/standard/tests/file/fscanf_variation46.phpt859
-rw-r--r--ext/standard/tests/file/fscanf_variation47.phpt217
-rw-r--r--ext/standard/tests/file/fscanf_variation48.phpt707
-rw-r--r--ext/standard/tests/file/fscanf_variation49.phpt946
-rw-r--r--ext/standard/tests/file/fscanf_variation5.phpt708
-rw-r--r--ext/standard/tests/file/fscanf_variation50.phpt246
-rw-r--r--ext/standard/tests/file/fscanf_variation51.phpt153
-rw-r--r--ext/standard/tests/file/fscanf_variation52.phpt178
-rw-r--r--ext/standard/tests/file/fscanf_variation53.phpt229
-rw-r--r--ext/standard/tests/file/fscanf_variation54.phpt101
-rw-r--r--ext/standard/tests/file/fscanf_variation55.phpt1691
-rw-r--r--ext/standard/tests/file/fscanf_variation6.phpt946
-rw-r--r--ext/standard/tests/file/fscanf_variation7.phpt246
-rw-r--r--ext/standard/tests/file/fscanf_variation8.phpt1614
-rw-r--r--ext/standard/tests/file/fscanf_variation9.phpt1015
-rw-r--r--ext/standard/tests/file/fseek_dir_basic.phpt96
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_basic1.phpt453
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt464
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt463
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error1.phpt99
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error2.phpt95
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error3.phpt95
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation1.phpt428
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt437
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt437
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation3.phpt478
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt483
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt483
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation5.phpt474
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt483
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt483
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation7.phpt477
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt484
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt484
-rw-r--r--ext/standard/tests/file/fseek_variation1.phpt198
-rw-r--r--ext/standard/tests/file/fseek_variation2.phpt159
-rw-r--r--ext/standard/tests/file/fseek_variation3.phpt54
-rw-r--r--ext/standard/tests/file/fstat.phpt74
-rw-r--r--ext/standard/tests/file/fstat_basic.phpt65
-rw-r--r--ext/standard/tests/file/fstat_error.phpt22
-rw-r--r--ext/standard/tests/file/fstat_variation1.phpt34
-rw-r--r--ext/standard/tests/file/fstat_variation2.phpt31
-rw-r--r--ext/standard/tests/file/fstat_variation3.phpt42
-rw-r--r--ext/standard/tests/file/fstat_variation4.phpt35
-rw-r--r--ext/standard/tests/file/fstat_variation5.phpt31
-rw-r--r--ext/standard/tests/file/fstat_variation6.phpt46
-rw-r--r--ext/standard/tests/file/fstat_variation7.phpt35
-rw-r--r--ext/standard/tests/file/fstat_variation8.phpt33
-rw-r--r--ext/standard/tests/file/ftruncate.phptbin0 -> 1077 bytes
-rw-r--r--ext/standard/tests/file/ftruncate_error.phpt124
-rw-r--r--ext/standard/tests/file/ftruncate_variation1-win32.phpt461
-rw-r--r--ext/standard/tests/file/ftruncate_variation1.phpt461
-rw-r--r--ext/standard/tests/file/ftruncate_variation2-win32.phpt462
-rw-r--r--ext/standard/tests/file/ftruncate_variation2.phpt462
-rw-r--r--ext/standard/tests/file/ftruncate_variation3-win32.phpt461
-rw-r--r--ext/standard/tests/file/ftruncate_variation3.phpt461
-rw-r--r--ext/standard/tests/file/ftruncate_variation4-win32.phpt462
-rw-r--r--ext/standard/tests/file/ftruncate_variation4.phpt462
-rw-r--r--ext/standard/tests/file/ftruncate_variation5-win32.phpt463
-rw-r--r--ext/standard/tests/file/ftruncate_variation5.phpt463
-rw-r--r--ext/standard/tests/file/ftruncate_variation6-win32.phpt482
-rw-r--r--ext/standard/tests/file/ftruncate_variation6.phpt482
-rw-r--r--ext/standard/tests/file/ftruncate_variation7-win32.phpt463
-rw-r--r--ext/standard/tests/file/ftruncate_variation7.phpt463
-rw-r--r--ext/standard/tests/file/fwrite.phpt52
-rw-r--r--ext/standard/tests/file/fwrite_basic-win32.phpt424
-rw-r--r--ext/standard/tests/file/fwrite_basic.phpt424
-rw-r--r--ext/standard/tests/file/fwrite_error.phpt121
-rw-r--r--ext/standard/tests/file/fwrite_variation1-win32.phpt235
-rw-r--r--ext/standard/tests/file/fwrite_variation1.phpt233
-rw-r--r--ext/standard/tests/file/fwrite_variation2-win32.phpt304
-rw-r--r--ext/standard/tests/file/fwrite_variation2.phpt303
-rw-r--r--ext/standard/tests/file/fwrite_variation3-win32.phpt380
-rw-r--r--ext/standard/tests/file/fwrite_variation3.phpt381
-rw-r--r--ext/standard/tests/file/fwrite_variation4-win32.phpt275
-rw-r--r--ext/standard/tests/file/fwrite_variation4.phpt275
-rw-r--r--ext/standard/tests/file/fwrite_variation5.phpt173
-rw-r--r--ext/standard/tests/file/get_current_user.phpt15
-rw-r--r--ext/standard/tests/file/glob_basic.phpt82
-rw-r--r--ext/standard/tests/file/glob_error.phpt53
-rw-r--r--ext/standard/tests/file/glob_error_002-win32.phpt27
-rw-r--r--ext/standard/tests/file/glob_variation-win32.phpt465
-rw-r--r--ext/standard/tests/file/glob_variation.phpt465
-rw-r--r--ext/standard/tests/file/glob_variation2.phpt57
-rw-r--r--ext/standard/tests/file/include_streams.phpt130
-rw-r--r--ext/standard/tests/file/include_userstream_001.phpt82
-rw-r--r--ext/standard/tests/file/include_userstream_002.phpt106
-rw-r--r--ext/standard/tests/file/include_userstream_003.phpt121
-rw-r--r--ext/standard/tests/file/is_dir_basic.phpt43
-rw-r--r--ext/standard/tests/file/is_dir_error.phpt35
-rw-r--r--ext/standard/tests/file/is_dir_variation1.phpt42
-rw-r--r--ext/standard/tests/file/is_dir_variation2.phpt96
-rw-r--r--ext/standard/tests/file/is_dir_variation3.phpt51
-rw-r--r--ext/standard/tests/file/is_dir_variation4.phpt89
-rw-r--r--ext/standard/tests/file/is_executable_basic-win32.phpt1064
-rw-r--r--ext/standard/tests/file/is_executable_basic.phpt1076
-rw-r--r--ext/standard/tests/file/is_executable_error.phpt29
-rw-r--r--ext/standard/tests/file/is_executable_variation1.phpt92
-rw-r--r--ext/standard/tests/file/is_executable_variation2.phpt110
-rw-r--r--ext/standard/tests/file/is_executable_variation3.phpt69
-rw-r--r--ext/standard/tests/file/is_file_basic.phpt48
-rw-r--r--ext/standard/tests/file/is_file_error.phpt51
-rw-r--r--ext/standard/tests/file/is_file_variation1.phpt57
-rw-r--r--ext/standard/tests/file/is_file_variation2.phpt46
-rw-r--r--ext/standard/tests/file/is_file_variation3.phpt60
-rw-r--r--ext/standard/tests/file/is_file_variation4.phpt78
-rw-r--r--ext/standard/tests/file/is_readable_basic-win32.phpt1066
-rw-r--r--ext/standard/tests/file/is_readable_basic.phpt1076
-rw-r--r--ext/standard/tests/file/is_readable_error.phpt29
-rw-r--r--ext/standard/tests/file/is_readable_variation1.phpt105
-rw-r--r--ext/standard/tests/file/is_readable_variation2.phpt109
-rw-r--r--ext/standard/tests/file/is_readable_variation3.phpt68
-rw-r--r--ext/standard/tests/file/is_uploaded_file_basic.phpt48
-rw-r--r--ext/standard/tests/file/is_writable_basic.phpt1588
-rw-r--r--ext/standard/tests/file/is_writable_error.phpt45
-rw-r--r--ext/standard/tests/file/is_writable_variation1.phpt125
-rw-r--r--ext/standard/tests/file/is_writable_variation2.phpt126
-rw-r--r--ext/standard/tests/file/is_writable_variation3.phpt78
-rw-r--r--ext/standard/tests/file/lchgrp_basic.phpt36
-rw-r--r--ext/standard/tests/file/lchown_basic.phpt44
-rw-r--r--ext/standard/tests/file/lchown_error.phpt78
-rw-r--r--ext/standard/tests/file/link_win32.phpt26
-rw-r--r--ext/standard/tests/file/lstat_stat_basic.phpt317
-rw-r--r--ext/standard/tests/file/lstat_stat_error.phpt79
-rw-r--r--ext/standard/tests/file/lstat_stat_variation1.phpt61
-rw-r--r--ext/standard/tests/file/lstat_stat_variation10.phpt59
-rw-r--r--ext/standard/tests/file/lstat_stat_variation11.phpt60
-rw-r--r--ext/standard/tests/file/lstat_stat_variation12.phpt66
-rw-r--r--ext/standard/tests/file/lstat_stat_variation13.phpt58
-rw-r--r--ext/standard/tests/file/lstat_stat_variation14.phpt62
-rw-r--r--ext/standard/tests/file/lstat_stat_variation15.phpt64
-rw-r--r--ext/standard/tests/file/lstat_stat_variation16.phpt58
-rw-r--r--ext/standard/tests/file/lstat_stat_variation17.phpt57
-rw-r--r--ext/standard/tests/file/lstat_stat_variation18.phpt176
-rw-r--r--ext/standard/tests/file/lstat_stat_variation19.phpt285
-rw-r--r--ext/standard/tests/file/lstat_stat_variation2.phpt62
-rw-r--r--ext/standard/tests/file/lstat_stat_variation20.phpt287
-rw-r--r--ext/standard/tests/file/lstat_stat_variation21.phpt65
-rw-r--r--ext/standard/tests/file/lstat_stat_variation22.phpt54
-rw-r--r--ext/standard/tests/file/lstat_stat_variation3.phpt62
-rw-r--r--ext/standard/tests/file/lstat_stat_variation4.phpt65
-rw-r--r--ext/standard/tests/file/lstat_stat_variation5.phpt66
-rw-r--r--ext/standard/tests/file/lstat_stat_variation6.phpt79
-rw-r--r--ext/standard/tests/file/lstat_stat_variation7.phpt57
-rw-r--r--ext/standard/tests/file/lstat_stat_variation8.phpt62
-rw-r--r--ext/standard/tests/file/lstat_stat_variation9.phpt68
-rw-r--r--ext/standard/tests/file/mkdir-001.phpt36
-rw-r--r--ext/standard/tests/file/mkdir-002.phpt55
-rw-r--r--ext/standard/tests/file/mkdir-003.phpt30
-rw-r--r--ext/standard/tests/file/mkdir-004.phpt24
-rw-r--r--ext/standard/tests/file/mkdir-005.phpt25
-rw-r--r--ext/standard/tests/file/mkdir-006.phpt20
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_error.phpt58
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt1613
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation1.phpt1579
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation2.phpt80
-rw-r--r--ext/standard/tests/file/mkdir_variation1-win32.phpt122
-rw-r--r--ext/standard/tests/file/mkdir_variation1.phpt121
-rw-r--r--ext/standard/tests/file/mkdir_variation2.phpt189
-rw-r--r--ext/standard/tests/file/mkdir_variation3.phpt208
-rw-r--r--ext/standard/tests/file/mkdir_variation4.phpt220
-rw-r--r--ext/standard/tests/file/mkdir_variation5-win32.phpt105
-rw-r--r--ext/standard/tests/file/mkdir_variation5.phpt98
-rw-r--r--ext/standard/tests/file/move_uploaded_file_basic.phpt76
-rw-r--r--ext/standard/tests/file/parse_ini_file.phpt489
-rw-r--r--ext/standard/tests/file/parse_ini_file_error.phpt47
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation1.phpt68
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation2.phpt111
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation3.phpt104
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation4.phpt211
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation5.phpt254
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation6-win32.phpt143
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation6.phpt129
-rw-r--r--ext/standard/tests/file/pathinfo_basic.phpt401
-rw-r--r--ext/standard/tests/file/pathinfo_basic1-win32.phpt609
-rw-r--r--ext/standard/tests/file/pathinfo_basic1.phpt610
-rw-r--r--ext/standard/tests/file/pathinfo_basic2-win32.phpt270
-rw-r--r--ext/standard/tests/file/pathinfo_basic2.phpt273
-rw-r--r--ext/standard/tests/file/pathinfo_error.phpt24
-rw-r--r--ext/standard/tests/file/pathinfo_variation1.phpt190
-rw-r--r--ext/standard/tests/file/pathinfo_variation2.phpt197
-rw-r--r--ext/standard/tests/file/pathinfo_variation3.phpt80
-rw-r--r--ext/standard/tests/file/pathinfo_variaton.phpt442
-rw-r--r--ext/standard/tests/file/pclose_variation1.phpt232
-rw-r--r--ext/standard/tests/file/php_fd_wrapper_01.phpt11
-rw-r--r--ext/standard/tests/file/php_fd_wrapper_02.phpt11
-rw-r--r--ext/standard/tests/file/php_fd_wrapper_03.phpt22
-rw-r--r--ext/standard/tests/file/php_fd_wrapper_04.phpt20
-rw-r--r--ext/standard/tests/file/popen_pclose_basic-win32.phpt75
-rw-r--r--ext/standard/tests/file/popen_pclose_basic.phpt103
-rw-r--r--ext/standard/tests/file/popen_pclose_error-sunos.phpt55
-rw-r--r--ext/standard/tests/file/popen_pclose_error-win32-debug.phpt63
-rw-r--r--ext/standard/tests/file/popen_pclose_error-win32.phpt59
-rw-r--r--ext/standard/tests/file/popen_pclose_error.phpt56
-rw-r--r--ext/standard/tests/file/proc_open01.phpt69
-rw-r--r--ext/standard/tests/file/readfile_basic-win32.phpt530
-rw-r--r--ext/standard/tests/file/readfile_basic.phpt530
-rw-r--r--ext/standard/tests/file/readfile_error.phpt61
-rw-r--r--ext/standard/tests/file/readfile_variation1.phpt46
-rw-r--r--ext/standard/tests/file/readfile_variation10-win32.phpt87
-rw-r--r--ext/standard/tests/file/readfile_variation10.phptbin0 -> 1869 bytes
-rw-r--r--ext/standard/tests/file/readfile_variation2.phpt87
-rw-r--r--ext/standard/tests/file/readfile_variation3.phpt63
-rw-r--r--ext/standard/tests/file/readfile_variation4.phpt251
-rw-r--r--ext/standard/tests/file/readfile_variation5.phpt221
-rw-r--r--ext/standard/tests/file/readfile_variation6.phpt50
-rw-r--r--ext/standard/tests/file/readfile_variation7.phpt50
-rw-r--r--ext/standard/tests/file/readfile_variation8-win32.phpt109
-rw-r--r--ext/standard/tests/file/readfile_variation9.phpt99
-rw-r--r--ext/standard/tests/file/readlink_realpath_basic1.phpt111
-rw-r--r--ext/standard/tests/file/readlink_realpath_basic2.phpt86
-rw-r--r--ext/standard/tests/file/readlink_realpath_error.phpt73
-rw-r--r--ext/standard/tests/file/readlink_realpath_variation1.phpt99
-rw-r--r--ext/standard/tests/file/readlink_realpath_variation2.phpt104
-rw-r--r--ext/standard/tests/file/readlink_realpath_variation3.phpt77
-rw-r--r--ext/standard/tests/file/readlink_variation1.phpt78
-rw-r--r--ext/standard/tests/file/realpath_basic-win32.phpt89
-rw-r--r--ext/standard/tests/file/realpath_basic2.phpt13
-rw-r--r--ext/standard/tests/file/realpath_basic3.phpt86
-rw-r--r--ext/standard/tests/file/realpath_basic4.phpt29
-rw-r--r--ext/standard/tests/file/realpath_cache.phpt30
-rw-r--r--ext/standard/tests/file/realpath_cache_win32.phpt38
-rw-r--r--ext/standard/tests/file/realpath_error-win32.phpt29
-rw-r--r--ext/standard/tests/file/realpath_variation-win32.phpt102
-rw-r--r--ext/standard/tests/file/realpath_variation2.phpt74
-rw-r--r--ext/standard/tests/file/rename_basic.phpt45
-rw-r--r--ext/standard/tests/file/rename_error.phpt35
-rw-r--r--ext/standard/tests/file/rename_variation-win32.phpt87
-rw-r--r--ext/standard/tests/file/rename_variation.phpt72
-rw-r--r--ext/standard/tests/file/rename_variation1-win32.phpt81
-rw-r--r--ext/standard/tests/file/rename_variation1.phpt71
-rw-r--r--ext/standard/tests/file/rename_variation10.phpt253
-rw-r--r--ext/standard/tests/file/rename_variation11-win32.phpt128
-rw-r--r--ext/standard/tests/file/rename_variation12-win32.phpt121
-rw-r--r--ext/standard/tests/file/rename_variation12.phpt121
-rw-r--r--ext/standard/tests/file/rename_variation13-win32.phptbin0 -> 5058 bytes
-rw-r--r--ext/standard/tests/file/rename_variation13.phpt133
-rw-r--r--ext/standard/tests/file/rename_variation2-win32.phpt61
-rw-r--r--ext/standard/tests/file/rename_variation2.phpt65
-rw-r--r--ext/standard/tests/file/rename_variation3-win32.phpt84
-rw-r--r--ext/standard/tests/file/rename_variation3.phpt60
-rw-r--r--ext/standard/tests/file/rename_variation4.phpt51
-rw-r--r--ext/standard/tests/file/rename_variation5.phpt96
-rw-r--r--ext/standard/tests/file/rename_variation6-win32.phpt40
-rw-r--r--ext/standard/tests/file/rename_variation6.phpt36
-rw-r--r--ext/standard/tests/file/rename_variation7-win32.phpt36
-rw-r--r--ext/standard/tests/file/rename_variation7.phpt31
-rw-r--r--ext/standard/tests/file/rename_variation8-win32.phpt70
-rw-r--r--ext/standard/tests/file/rename_variation8.phpt71
-rw-r--r--ext/standard/tests/file/rename_variation9.phpt53
-rw-r--r--ext/standard/tests/file/rmdir_variation1-win32.phpt127
-rw-r--r--ext/standard/tests/file/rmdir_variation1.phpt127
-rw-r--r--ext/standard/tests/file/rmdir_variation2.phpt244
-rw-r--r--ext/standard/tests/file/rmdir_variation3-win32.phpt108
-rw-r--r--ext/standard/tests/file/rmdir_variation3.phpt96
-rw-r--r--ext/standard/tests/file/stat_basic-win32.phpt192
-rw-r--r--ext/standard/tests/file/stat_error-win32.phpt55
-rw-r--r--ext/standard/tests/file/stat_variation1-win32.phpt94
-rw-r--r--ext/standard/tests/file/stat_variation2-win32.phpt65
-rw-r--r--ext/standard/tests/file/stat_variation3-win32.phpt80
-rw-r--r--ext/standard/tests/file/stat_variation4-win32.phpt93
-rw-r--r--ext/standard/tests/file/stat_variation5-win32.phpt66
-rw-r--r--ext/standard/tests/file/stat_variation6-win32.phpt92
-rw-r--r--ext/standard/tests/file/stat_variation7-win32.phpt298
-rw-r--r--ext/standard/tests/file/stat_variation8-win32.phpt77
-rw-r--r--ext/standard/tests/file/statcache-corruption.phpt13
-rw-r--r--ext/standard/tests/file/statpage.phpt20
-rw-r--r--ext/standard/tests/file/stream_001.phpt24
-rw-r--r--ext/standard/tests/file/stream_002.phpt53
-rw-r--r--ext/standard/tests/file/stream_copy_to_stream.phpt154
-rw-r--r--ext/standard/tests/file/stream_enclosed.phpt20
-rw-r--r--ext/standard/tests/file/stream_get_line.phpt18
-rw-r--r--ext/standard/tests/file/stream_rfc2397_001.phpt22
-rw-r--r--ext/standard/tests/file/stream_rfc2397_002.phpt182
-rwxr-xr-xext/standard/tests/file/stream_rfc2397_003.gifbin0 -> 273 bytes
-rw-r--r--ext/standard/tests/file/stream_rfc2397_003.phpt38
-rw-r--r--ext/standard/tests/file/stream_rfc2397_004.phpt32
-rw-r--r--ext/standard/tests/file/stream_rfc2397_005.phpt38
-rw-r--r--ext/standard/tests/file/stream_rfc2397_006.phpt33
-rw-r--r--ext/standard/tests/file/stream_rfc2397_007.phpt143
-rw-r--r--ext/standard/tests/file/stream_supports_lock.phpt46
-rw-r--r--ext/standard/tests/file/symlink.phpt78
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_basic1.phpt114
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_basic2.phpt90
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt115
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt114
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation1.phpt136
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt51
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation3.phpt146
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation4.phpt120
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation5.phpt75
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt107
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation7.phpt94
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation8.phpt83
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt121
-rw-r--r--ext/standard/tests/file/symlink_to_symlink.phpt50
-rw-r--r--ext/standard/tests/file/tempnam_error.phpt48
-rw-r--r--ext/standard/tests/file/tempnam_variation1-win32.phpt103
-rw-r--r--ext/standard/tests/file/tempnam_variation1.phpt116
-rw-r--r--ext/standard/tests/file/tempnam_variation2-win32.phpt163
-rw-r--r--ext/standard/tests/file/tempnam_variation2.phpt163
-rw-r--r--ext/standard/tests/file/tempnam_variation3-win32.phpt115
-rw-r--r--ext/standard/tests/file/tempnam_variation3.phpt122
-rw-r--r--ext/standard/tests/file/tempnam_variation4.phpt1092
-rw-r--r--ext/standard/tests/file/tempnam_variation5-win32.phpt54
-rw-r--r--ext/standard/tests/file/tempnam_variation5.phpt52
-rw-r--r--ext/standard/tests/file/tempnam_variation6-win32.phpt62
-rw-r--r--ext/standard/tests/file/tempnam_variation6.phpt60
-rw-r--r--ext/standard/tests/file/tempnam_variation7-win32.phpt113
-rw-r--r--ext/standard/tests/file/tempnam_variation7.phpt118
-rw-r--r--ext/standard/tests/file/tempnam_variation8-win32.phpt147
-rw-r--r--ext/standard/tests/file/test.csv17
-rw-r--r--ext/standard/tests/file/test2.csv1
-rw-r--r--ext/standard/tests/file/test3.csvbin0 -> 8 bytes
-rw-r--r--ext/standard/tests/file/touch.phpt58
-rw-r--r--ext/standard/tests/file/touch_basic-win32.phpt96
-rw-r--r--ext/standard/tests/file/touch_basic.phpt97
-rw-r--r--ext/standard/tests/file/touch_error.phpt22
-rw-r--r--ext/standard/tests/file/touch_variation1.phpt39
-rw-r--r--ext/standard/tests/file/touch_variation2.phpt24
-rw-r--r--ext/standard/tests/file/touch_variation3-win32.phpt199
-rw-r--r--ext/standard/tests/file/touch_variation3.phpt199
-rw-r--r--ext/standard/tests/file/touch_variation4-win32.phpt199
-rw-r--r--ext/standard/tests/file/touch_variation4.phpt199
-rw-r--r--ext/standard/tests/file/touch_variation5-win32.phpt230
-rw-r--r--ext/standard/tests/file/touch_variation5.phpt230
-rw-r--r--ext/standard/tests/file/touch_variation6-win32.phpt242
-rw-r--r--ext/standard/tests/file/umask_basic.phpt2079
-rw-r--r--ext/standard/tests/file/umask_error.phpt26
-rw-r--r--ext/standard/tests/file/umask_variation1.phpt761
-rw-r--r--ext/standard/tests/file/umask_variation2.phpt899
-rw-r--r--ext/standard/tests/file/umask_variation3.phpt237
-rw-r--r--ext/standard/tests/file/unlink_basic.phpt43
-rw-r--r--ext/standard/tests/file/unlink_error-win32.phpt110
-rw-r--r--ext/standard/tests/file/unlink_error.phpt110
-rw-r--r--ext/standard/tests/file/unlink_variation1-win32.phpt85
-rw-r--r--ext/standard/tests/file/unlink_variation1.phpt92
-rw-r--r--ext/standard/tests/file/unlink_variation10.phpt106
-rw-r--r--ext/standard/tests/file/unlink_variation2-win32.phpt43
-rw-r--r--ext/standard/tests/file/unlink_variation2.phpt37
-rw-r--r--ext/standard/tests/file/unlink_variation3.phpt60
-rw-r--r--ext/standard/tests/file/unlink_variation4.phpt37
-rw-r--r--ext/standard/tests/file/unlink_variation5.phpt2087
-rw-r--r--ext/standard/tests/file/unlink_variation6.phpt41
-rw-r--r--ext/standard/tests/file/unlink_variation7.phpt246
-rw-r--r--ext/standard/tests/file/unlink_variation8-win32.phpt113
-rw-r--r--ext/standard/tests/file/unlink_variation8.phpt206
-rw-r--r--ext/standard/tests/file/unlink_variation9-win32.phpt117
-rw-r--r--ext/standard/tests/file/userdirstream.phpt51
-rw-r--r--ext/standard/tests/file/userfilters.phpt37
-rw-r--r--ext/standard/tests/file/userstreams.phpt325
-rw-r--r--ext/standard/tests/file/userstreams_002.phpt94
-rw-r--r--ext/standard/tests/file/userstreams_003.phpt153
-rw-r--r--ext/standard/tests/file/userstreams_004.phpt58
-rw-r--r--ext/standard/tests/file/userstreams_005.phpt63
-rw-r--r--ext/standard/tests/file/userstreams_006.phpt38
-rw-r--r--ext/standard/tests/file/userstreams_007.phpt49
-rw-r--r--ext/standard/tests/file/userwrapper.phpt83
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859.phpt63
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859_2.phpt63
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859_3.phpt37
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859_4.phpt65
-rw-r--r--ext/standard/tests/file/windows_acls/common.inc199
-rw-r--r--ext/standard/tests/file/windows_acls/tiny.bat1
-rw-r--r--ext/standard/tests/file/windows_acls/tiny.exebin0 -> 133 bytes
-rw-r--r--ext/standard/tests/file/windows_links/bug48746.phpt58
-rw-r--r--ext/standard/tests/file/windows_links/bug48746_1.phpt59
-rw-r--r--ext/standard/tests/file/windows_links/bug48746_2.phpt69
-rw-r--r--ext/standard/tests/file/windows_links/bug48746_3.phpt50
-rw-r--r--ext/standard/tests/file/windows_links/common.inc23
-rw-r--r--ext/standard/tests/filters/001.phpt31
-rw-r--r--ext/standard/tests/filters/basic.phpt44
-rw-r--r--ext/standard/tests/filters/bug22538.phpt44
-rw-r--r--ext/standard/tests/filters/bug35916.phpt42
-rw-r--r--ext/standard/tests/filters/bug46164-1.phpt22
-rw-r--r--ext/standard/tests/filters/bug46164-2.phpt24
-rw-r--r--ext/standard/tests/filters/bug50363.phpt17
-rw-r--r--ext/standard/tests/filters/chunked_001.phpt35
-rw-r--r--ext/standard/tests/filters/filter_errors.inc37
-rw-r--r--ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt18
-rw-r--r--ext/standard/tests/filters/filter_errors_user.phpt179
-rw-r--r--ext/standard/tests/filters/filter_errors_zlib_inflate.phpt14
-rw-r--r--ext/standard/tests/filters/php_user_filter_01.phpt17
-rw-r--r--ext/standard/tests/filters/php_user_filter_02.phpt12
-rw-r--r--ext/standard/tests/filters/php_user_filter_03.phpt12
-rw-r--r--ext/standard/tests/filters/read.phpt72
-rw-r--r--ext/standard/tests/filters/stream_filter_remove_basic.phpt47
-rw-r--r--ext/standard/tests/filters/stream_filter_remove_error.phpt80
-rw-r--r--ext/standard/tests/general_functions/001.phpt67
-rw-r--r--ext/standard/tests/general_functions/002.phpt11
-rw-r--r--ext/standard/tests/general_functions/003.phpt58
-rw-r--r--ext/standard/tests/general_functions/004.data4
-rw-r--r--ext/standard/tests/general_functions/004.phpt16
-rw-r--r--ext/standard/tests/general_functions/005.phpt24
-rw-r--r--ext/standard/tests/general_functions/006.phpt11
-rw-r--r--ext/standard/tests/general_functions/007.phpt24
-rw-r--r--ext/standard/tests/general_functions/008.phpt40
-rw-r--r--ext/standard/tests/general_functions/009.phpt24
-rw-r--r--ext/standard/tests/general_functions/010.phpt19
-rw-r--r--ext/standard/tests/general_functions/bug25038.phpt32
-rw-r--r--ext/standard/tests/general_functions/bug27678.phpt16
-rw-r--r--ext/standard/tests/general_functions/bug29038.phpt74
-rw-r--r--ext/standard/tests/general_functions/bug31190.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug32647.phpt61
-rw-r--r--ext/standard/tests/general_functions/bug34794.phpt34
-rw-r--r--ext/standard/tests/general_functions/bug35229.phpt30
-rw-r--r--ext/standard/tests/general_functions/bug36011.phpt46
-rw-r--r--ext/standard/tests/general_functions/bug39322.phpt45
-rw-r--r--ext/standard/tests/general_functions/bug40398.phpt84
-rw-r--r--ext/standard/tests/general_functions/bug40752.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug41037.phpt23
-rw-r--r--ext/standard/tests/general_functions/bug41445.phpt75
-rw-r--r--ext/standard/tests/general_functions/bug41445_1.phpt54
-rw-r--r--ext/standard/tests/general_functions/bug41518.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug41970.phpt27
-rw-r--r--ext/standard/tests/general_functions/bug42272.phpt11
-rw-r--r--ext/standard/tests/general_functions/bug43293_1.phpt25
-rw-r--r--ext/standard/tests/general_functions/bug43293_2.phpt13
-rw-r--r--ext/standard/tests/general_functions/bug43293_3.phpt30
-rw-r--r--ext/standard/tests/general_functions/bug44295-win.phpt29
-rw-r--r--ext/standard/tests/general_functions/bug44295.phpt29
-rw-r--r--ext/standard/tests/general_functions/bug44394.phpt18
-rw-r--r--ext/standard/tests/general_functions/bug44394_2.phpt35
-rw-r--r--ext/standard/tests/general_functions/bug44461.phpt18
-rw-r--r--ext/standard/tests/general_functions/bug44487.phpt24
-rw-r--r--ext/standard/tests/general_functions/bug44667.phpt33
-rw-r--r--ext/standard/tests/general_functions/bug46587.phpt16
-rw-r--r--ext/standard/tests/general_functions/bug47027.phpt12
-rw-r--r--ext/standard/tests/general_functions/bug47857.phpt23
-rw-r--r--ext/standard/tests/general_functions/bug47859.phpt42
-rw-r--r--ext/standard/tests/general_functions/bug48660.phpt58
-rw-r--r--ext/standard/tests/general_functions/bug48768.phpt31
-rw-r--r--ext/standard/tests/general_functions/bug49056.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug49692.ini4
-rw-r--r--ext/standard/tests/general_functions/bug49692.phpt20
-rw-r--r--ext/standard/tests/general_functions/bug49847.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug50690.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug50732.phpt12
-rw-r--r--ext/standard/tests/general_functions/bug52138.data11
-rw-r--r--ext/standard/tests/general_functions/bug52138.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug55371.phpt10
-rw-r--r--ext/standard/tests/general_functions/bug60227_1.phpt20
-rw-r--r--ext/standard/tests/general_functions/bug60227_2.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug60227_3.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug60227_4.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug60723.phpt19
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt59
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt208
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt210
-rw-r--r--ext/standard/tests/general_functions/call_user_func_return.phpt44
-rw-r--r--ext/standard/tests/general_functions/call_user_method.phpt20
-rw-r--r--ext/standard/tests/general_functions/call_user_method_002.phpt12
-rw-r--r--ext/standard/tests/general_functions/callbacks_001.phpt108
-rw-r--r--ext/standard/tests/general_functions/callbacks_002.phpt16
-rw-r--r--ext/standard/tests/general_functions/closures_001.phpt11
-rw-r--r--ext/standard/tests/general_functions/closures_002.phpt25
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_b.phptbin0 -> 5004 bytes
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phptbin0 -> 5004 bytes
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_e.phpt23
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_o.phpt841
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_v.phpt204
-rw-r--r--ext/standard/tests/general_functions/dl-cve-2007-4887.phpt12
-rw-r--r--ext/standard/tests/general_functions/error_get_last.phpt43
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt31
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_basic.phpt31
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_error.phpt73
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt140
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_variation1.phpt140
-rw-r--r--ext/standard/tests/general_functions/escapeshellcmd-win32.phpt49
-rw-r--r--ext/standard/tests/general_functions/floatval.phpt207
-rw-r--r--ext/standard/tests/general_functions/floatval_basic.phpt172
-rw-r--r--ext/standard/tests/general_functions/floatval_error.phpt40
-rw-r--r--ext/standard/tests/general_functions/floatval_variation1.phpt154
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_basic.phpt24
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_error.phpt27
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation1.phpt46
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation2.phpt35
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation3.phpt42
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation4.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation5.phpt35
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation6.phpt44
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation7.phpt39
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation8.phpt17
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation9.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_defined_constants_basic.phpt39
-rw-r--r--ext/standard/tests/general_functions/get_defined_constants_error.phpt25
-rw-r--r--ext/standard/tests/general_functions/get_defined_vars_basic.phpt152
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_basic.phpt23
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_error.phpt40
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_variation.phpt137
-rw-r--r--ext/standard/tests/general_functions/get_include_path_basic.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_included_files.phpt63
-rw-r--r--ext/standard/tests/general_functions/get_included_files_inc1.inc3
-rw-r--r--ext/standard/tests/general_functions/get_included_files_inc2.inc4
-rw-r--r--ext/standard/tests/general_functions/get_included_files_inc3.inc4
-rw-r--r--ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt23
-rw-r--r--ext/standard/tests/general_functions/get_loaded_extensions_error.phpt26
-rw-r--r--ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt26
-rw-r--r--ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt27
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_basic.phpt20
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_error.phpt34
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_variation1.phpt74
-rw-r--r--ext/standard/tests/general_functions/getmypid_basic.phpt20
-rw-r--r--ext/standard/tests/general_functions/getopt.phpt24
-rw-r--r--ext/standard/tests/general_functions/getopt_002.phpt42
-rw-r--r--ext/standard/tests/general_functions/getopt_003.phpt57
-rw-r--r--ext/standard/tests/general_functions/getopt_004.phpt29
-rw-r--r--ext/standard/tests/general_functions/getopt_005.phpt32
-rw-r--r--ext/standard/tests/general_functions/getrusage.phpt23
-rw-r--r--ext/standard/tests/general_functions/getrusage_basic.phpt33
-rw-r--r--ext/standard/tests/general_functions/getrusage_error.phpt73
-rw-r--r--ext/standard/tests/general_functions/getrusage_variation1.phpt142
-rw-r--r--ext/standard/tests/general_functions/getservbyname_basic.phpt31
-rw-r--r--ext/standard/tests/general_functions/getservbyname_error.phpt21
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation1.phpt40
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation10.phpt42
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation11.phpt30
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation12.phpt29
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation13.phpt38
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation14.phpt33
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation2.phpt29
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation3.phpt36
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation4.phpt31
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation5.phpt29
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation6.phpt38
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation7.phpt33
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation8.phpt40
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation9.phpt34
-rw-r--r--ext/standard/tests/general_functions/getservbyport_basic.phpt27
-rw-r--r--ext/standard/tests/general_functions/getservbyport_error.phpt21
-rw-r--r--ext/standard/tests/general_functions/getservbyport_variation1.phpt40
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt906
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_error.phpt56
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation1.phpt589
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation2.phpt1005
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation3.phpt1002
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation4.phpt1201
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation5.phpt714
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation6.phpt846
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation7.phpt844
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation8.phpt595
-rw-r--r--ext/standard/tests/general_functions/head.phpt53
-rw-r--r--ext/standard/tests/general_functions/highlight_heredoc.phpt21
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt76
-rw-r--r--ext/standard/tests/general_functions/import_request1.phpt101
-rw-r--r--ext/standard/tests/general_functions/import_request2.phpt27
-rw-r--r--ext/standard/tests/general_functions/import_request3.phpt27
-rw-r--r--ext/standard/tests/general_functions/include_path.phpt75
-rw-r--r--ext/standard/tests/general_functions/ini_get_all.phpt64
-rw-r--r--ext/standard/tests/general_functions/intval.phpt306
-rw-r--r--ext/standard/tests/general_functions/intval_variation1.phpt203
-rw-r--r--ext/standard/tests/general_functions/intval_variation2.phpt195
-rw-r--r--ext/standard/tests/general_functions/is_array.phpt213
-rw-r--r--ext/standard/tests/general_functions/is_bool.phpt294
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic1.phpt109
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic2.phpt787
-rw-r--r--ext/standard/tests/general_functions/is_callable_error.phpt35
-rw-r--r--ext/standard/tests/general_functions/is_callable_variation1.phpt208
-rw-r--r--ext/standard/tests/general_functions/is_callable_variation2.phpt154
-rw-r--r--ext/standard/tests/general_functions/is_float.phpt440
-rw-r--r--ext/standard/tests/general_functions/is_float_64bit.phpt437
-rw-r--r--ext/standard/tests/general_functions/is_int.phpt465
-rw-r--r--ext/standard/tests/general_functions/is_int_64bit.phpt462
-rw-r--r--ext/standard/tests/general_functions/is_null.phpt296
-rw-r--r--ext/standard/tests/general_functions/is_numeric.phpt387
-rw-r--r--ext/standard/tests/general_functions/is_object.phpt227
-rw-r--r--ext/standard/tests/general_functions/is_resource.phpt10
-rw-r--r--ext/standard/tests/general_functions/is_resource_basic.phpt92
-rw-r--r--ext/standard/tests/general_functions/is_resource_error.phpt34
-rw-r--r--ext/standard/tests/general_functions/is_scalar.phpt240
-rw-r--r--ext/standard/tests/general_functions/is_string.phpt303
-rw-r--r--ext/standard/tests/general_functions/isset_basic1.phpt66
-rw-r--r--ext/standard/tests/general_functions/isset_basic2.phpt60
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_basic.phpt42
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_error.phpt32
-rw-r--r--ext/standard/tests/general_functions/ob_get_length_basic.phpt51
-rw-r--r--ext/standard/tests/general_functions/ob_start_closures.phpt39
-rw-r--r--ext/standard/tests/general_functions/parse_ini_basic.data132
-rw-r--r--ext/standard/tests/general_functions/parse_ini_basic.phpt283
-rw-r--r--ext/standard/tests/general_functions/parse_ini_booleans.data27
-rw-r--r--ext/standard/tests/general_functions/parse_ini_booleans.phpt69
-rw-r--r--ext/standard/tests/general_functions/parse_ini_file.phpt218
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_001.phpt479
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_002.phpt168
-rw-r--r--ext/standard/tests/general_functions/php_uname_basic.phpt35
-rw-r--r--ext/standard/tests/general_functions/php_uname_error.phpt56
-rw-r--r--ext/standard/tests/general_functions/php_uname_variation1.phpt112
-rw-r--r--ext/standard/tests/general_functions/phpcredits.phpt54
-rw-r--r--ext/standard/tests/general_functions/phpcredits2.phpt30
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt76
-rw-r--r--ext/standard/tests/general_functions/phpinfo2.phpt31
-rw-r--r--ext/standard/tests/general_functions/print_r.phpt1736
-rw-r--r--ext/standard/tests/general_functions/print_r_64bit.phpt1737
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic.phpt31
-rw-r--r--ext/standard/tests/general_functions/proc_nice_error.phpt28
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation1.phpt48
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation2.phpt37
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation3.phpt48
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation5.phpt40
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation6.phpt56
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation7.phpt49
-rw-r--r--ext/standard/tests/general_functions/proc_open.phpt28
-rw-r--r--ext/standard/tests/general_functions/proc_open02.phpt72
-rw-r--r--ext/standard/tests/general_functions/putenv.phpt28
-rw-r--r--ext/standard/tests/general_functions/rand.phpt63
-rw-r--r--ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt46
-rw-r--r--ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt37
-rw-r--r--ext/standard/tests/general_functions/sleep_basic.phpt44
-rw-r--r--ext/standard/tests/general_functions/sleep_error.phpt44
-rw-r--r--ext/standard/tests/general_functions/strval.phpt317
-rw-r--r--ext/standard/tests/general_functions/sys_getloadavg.phpt27
-rw-r--r--ext/standard/tests/general_functions/type.phpt351
-rw-r--r--ext/standard/tests/general_functions/uniqid_basic.phpt72
-rw-r--r--ext/standard/tests/general_functions/uniqid_error.phpt46
-rw-r--r--ext/standard/tests/general_functions/usleep_basic.phpt43
-rw-r--r--ext/standard/tests/general_functions/usleep_error.phpt45
-rw-r--r--ext/standard/tests/general_functions/var_dump.phpt1574
-rw-r--r--ext/standard/tests/general_functions/var_dump_64bit.phpt1574
-rw-r--r--ext/standard/tests/general_functions/var_export-locale.phpt1061
-rw-r--r--ext/standard/tests/general_functions/var_export_basic1.phpt141
-rw-r--r--ext/standard/tests/general_functions/var_export_basic2.phpt76
-rw-r--r--ext/standard/tests/general_functions/var_export_basic3.phpt175
-rw-r--r--ext/standard/tests/general_functions/var_export_basic4.phpt147
-rw-r--r--ext/standard/tests/general_functions/var_export_basic5.phpt277
-rw-r--r--ext/standard/tests/general_functions/var_export_basic6.phpt310
-rw-r--r--ext/standard/tests/general_functions/var_export_basic7.phpt59
-rw-r--r--ext/standard/tests/general_functions/var_export_basic8.phpt71
-rw-r--r--ext/standard/tests/general_functions/var_export_basic9.phpt11
-rw-r--r--ext/standard/tests/general_functions/var_export_error1.phpt38
-rw-r--r--ext/standard/tests/general_functions/var_export_error2.phpt19
-rw-r--r--ext/standard/tests/general_functions/var_export_error3.phpt19
-rw-r--r--ext/standard/tests/http/bug38802.phpt174
-rw-r--r--ext/standard/tests/http/bug43510.phpt30
-rw-r--r--ext/standard/tests/http/bug48929.phpt58
-rw-r--r--ext/standard/tests/http/bug53198.phpt57
-rw-r--r--ext/standard/tests/http/bug60570.phpt53
-rw-r--r--ext/standard/tests/http/ignore_errors.phpt126
-rw-r--r--ext/standard/tests/http/server.inc92
-rw-r--r--ext/standard/tests/image/200x100.bmpbin0 -> 60054 bytes
-rw-r--r--ext/standard/tests/image/200x100.gifbin0 -> 1031 bytes
-rw-r--r--ext/standard/tests/image/200x100.jpgbin0 -> 991 bytes
-rw-r--r--ext/standard/tests/image/200x100.pngbin0 -> 683 bytes
-rw-r--r--ext/standard/tests/image/200x100.swfbin0 -> 71 bytes
-rw-r--r--ext/standard/tests/image/200x100.tifbin0 -> 1142 bytes
-rw-r--r--ext/standard/tests/image/200x100_unknown.unknown1
-rw-r--r--ext/standard/tests/image/246x247.pngbin0 -> 360 bytes
-rw-r--r--ext/standard/tests/image/2x2mm.tifbin0 -> 118 bytes
-rw-r--r--ext/standard/tests/image/384x385.pngbin0 -> 267 bytes
-rw-r--r--ext/standard/tests/image/75x50.wbmpbin0 -> 504 bytes
-rw-r--r--ext/standard/tests/image/75x50.xbm59
-rw-r--r--ext/standard/tests/image/blank_file.bmp0
-rw-r--r--ext/standard/tests/image/bug13213.jpgbin0 -> 596 bytes
-rw-r--r--ext/standard/tests/image/bug13213.phpt23
-rw-r--r--ext/standard/tests/image/getimagesize.phpt211
-rw-r--r--ext/standard/tests/image/getimagesize_246x247.phpt42
-rw-r--r--ext/standard/tests/image/getimagesize_384x385.phpt42
-rw-r--r--ext/standard/tests/image/getimagesize_basic.phpt219
-rw-r--r--ext/standard/tests/image/getimagesize_error1.phpt38
-rw-r--r--ext/standard/tests/image/getimagesize_jpgapp.phpt37
-rw-r--r--ext/standard/tests/image/getimagesize_swc.phpt25
-rw-r--r--ext/standard/tests/image/getimagesize_tif_mm.phpt39
-rw-r--r--ext/standard/tests/image/getimagesize_variation1.phpt185
-rw-r--r--ext/standard/tests/image/getimagesize_variation2.phpt167
-rw-r--r--ext/standard/tests/image/getimagesize_variation3.phpt70
-rw-r--r--ext/standard/tests/image/getimagesize_variation4.phpt38
-rw-r--r--ext/standard/tests/image/getimagesize_variation_003.phpt70
-rw-r--r--ext/standard/tests/image/getimagesize_variation_005.phpt38
-rw-r--r--ext/standard/tests/image/getimagesize_wbmp.phpt39
-rw-r--r--ext/standard/tests/image/getimagesize_xbm.phpt39
-rw-r--r--ext/standard/tests/image/getimagesizefromstring1.phpt49
-rw-r--r--ext/standard/tests/image/image_type_to_extension.phpt103
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type.phpt53
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_basic.phpt63
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_error.phpt35
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation1.phpt152
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation2.phpt80
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation3.phpt79
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation4.phpt29
-rw-r--r--ext/standard/tests/image/iptcembed_001.phpt18
-rw-r--r--ext/standard/tests/image/skipif_imagetype.inc15
-rw-r--r--ext/standard/tests/image/test.gifbin0 -> 2523 bytes
-rw-r--r--ext/standard/tests/image/test.txt1
-rwxr-xr-xext/standard/tests/image/test13pix.swfbin0 -> 589 bytes
-rw-r--r--ext/standard/tests/image/test1bpix.bmpbin0 -> 690138 bytes
-rw-r--r--ext/standard/tests/image/test1pix.bmpbin0 -> 58 bytes
-rw-r--r--ext/standard/tests/image/test1pix.jp2bin0 -> 243 bytes
-rw-r--r--ext/standard/tests/image/test1pix.jpcbin0 -> 127 bytes
-rw-r--r--ext/standard/tests/image/test1pix.jpgbin0 -> 523 bytes
-rw-r--r--ext/standard/tests/image/test2pix.gifbin0 -> 35 bytes
-rw-r--r--ext/standard/tests/image/test4pix.gifbin0 -> 42 bytes
-rw-r--r--ext/standard/tests/image/test4pix.iffbin0 -> 114 bytes
-rw-r--r--ext/standard/tests/image/test4pix.pngbin0 -> 148 bytes
-rw-r--r--ext/standard/tests/image/test4pix.psdbin0 -> 1247 bytes
-rwxr-xr-xext/standard/tests/image/test4pix.swfbin0 -> 609 bytes
-rw-r--r--ext/standard/tests/image/test4pix.tifbin0 -> 312 bytes
-rw-r--r--ext/standard/tests/image/testAPP.jpgbin0 -> 12174 bytes
-rw-r--r--ext/standard/tests/mail/bug51604.phpt35
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_basic.phpt25
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt25
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_error.phpt66
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_variation1.phpt193
-rw-r--r--ext/standard/tests/mail/mail_basic.phpt60
-rw-r--r--ext/standard/tests/mail/mail_basic2.phpt48
-rw-r--r--ext/standard/tests/mail/mail_basic3.phpt35
-rw-r--r--ext/standard/tests/mail/mail_basic4.phpt36
-rw-r--r--ext/standard/tests/mail/mail_basic5.phpt34
-rw-r--r--ext/standard/tests/mail/mail_basic_alt1-win32.phpt95
-rw-r--r--ext/standard/tests/mail/mail_basic_alt2-win32.phpt93
-rw-r--r--ext/standard/tests/mail/mail_basic_alt3-win32.phpt93
-rw-r--r--ext/standard/tests/mail/mail_basic_alt4-win32.phpt94
-rw-r--r--ext/standard/tests/mail/mail_error.phpt44
-rw-r--r--ext/standard/tests/mail/mail_include.inc150
-rw-r--r--ext/standard/tests/mail/mail_skipif.inc26
-rw-r--r--ext/standard/tests/mail/mail_variation1.phpt30
-rw-r--r--ext/standard/tests/mail/mail_variation2.phpt43
-rw-r--r--ext/standard/tests/mail/mail_variation_alt1-win32.phpt92
-rw-r--r--ext/standard/tests/mail/mail_variation_alt2-win32.phpt92
-rw-r--r--ext/standard/tests/mail/mail_variation_alt3-win32.phpt91
-rw-r--r--ext/standard/tests/math/abs.phpt24
-rw-r--r--ext/standard/tests/math/abs_basic.phpt51
-rw-r--r--ext/standard/tests/math/abs_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/abs_error.phpt39
-rw-r--r--ext/standard/tests/math/abs_variation.phpt135
-rw-r--r--ext/standard/tests/math/acos_basic.phpt69
-rw-r--r--ext/standard/tests/math/acos_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/acos_error.phpt29
-rw-r--r--ext/standard/tests/math/acos_variation.phpt56
-rw-r--r--ext/standard/tests/math/acosh_basic.phpt41
-rw-r--r--ext/standard/tests/math/acosh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/acosh_error.phpt29
-rw-r--r--ext/standard/tests/math/acosh_variation.phpt56
-rw-r--r--ext/standard/tests/math/allowed_rounding_error.inc18
-rw-r--r--ext/standard/tests/math/asin_basic.phpt68
-rw-r--r--ext/standard/tests/math/asin_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/asin_error.phpt29
-rw-r--r--ext/standard/tests/math/asin_variation.phpt56
-rw-r--r--ext/standard/tests/math/asinh_basic.phpt40
-rw-r--r--ext/standard/tests/math/asinh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/asinh_error.phpt29
-rw-r--r--ext/standard/tests/math/asinh_variation.phpt56
-rw-r--r--ext/standard/tests/math/atan2_basic.phpt185
-rw-r--r--ext/standard/tests/math/atan2_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/atan2_error.phpt14
-rw-r--r--ext/standard/tests/math/atan2_variation1.phpt187
-rw-r--r--ext/standard/tests/math/atan2_variation2.phpt186
-rw-r--r--ext/standard/tests/math/atan_basic.phpt40
-rw-r--r--ext/standard/tests/math/atan_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/atan_error.phpt29
-rw-r--r--ext/standard/tests/math/atan_variation.phpt56
-rw-r--r--ext/standard/tests/math/atanh_basic.phpt41
-rw-r--r--ext/standard/tests/math/atanh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/atanh_error.phpt29
-rw-r--r--ext/standard/tests/math/atanh_variation.phpt56
-rw-r--r--ext/standard/tests/math/base_convert_basic.phpt316
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt43
-rw-r--r--ext/standard/tests/math/base_convert_variation1.phpt159
-rw-r--r--ext/standard/tests/math/base_convert_variation2.phpt193
-rw-r--r--ext/standard/tests/math/base_convert_variation3.phpt193
-rw-r--r--ext/standard/tests/math/bindec_basic.phpt55
-rw-r--r--ext/standard/tests/math/bindec_basic_64bit.phpt55
-rw-r--r--ext/standard/tests/math/bindec_basiclong_64bit.phpt51
-rw-r--r--ext/standard/tests/math/bindec_error.phpt37
-rw-r--r--ext/standard/tests/math/bindec_variation1.phpt158
-rw-r--r--ext/standard/tests/math/bindec_variation1_64bit.phpt158
-rw-r--r--ext/standard/tests/math/bug21523.phpt12
-rw-r--r--ext/standard/tests/math/bug24142.phpt20
-rw-r--r--ext/standard/tests/math/bug25665.phpt16
-rw-r--r--ext/standard/tests/math/bug25694.phpt37
-rw-r--r--ext/standard/tests/math/bug27646.phpt48
-rw-r--r--ext/standard/tests/math/bug28228.phpt14
-rw-r--r--ext/standard/tests/math/bug30069.phpt12
-rw-r--r--ext/standard/tests/math/bug30695.phpt54
-rw-r--r--ext/standard/tests/math/bug45712.phpt75
-rw-r--r--ext/standard/tests/math/bug62112.phptbin0 -> 143 bytes
-rw-r--r--ext/standard/tests/math/ceil_basic.phpt70
-rw-r--r--ext/standard/tests/math/ceil_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/ceil_error.phpt33
-rw-r--r--ext/standard/tests/math/ceil_variation1.phpt128
-rw-r--r--ext/standard/tests/math/constants.phpt48
-rw-r--r--ext/standard/tests/math/constants_basic.phpt65
-rw-r--r--ext/standard/tests/math/cos_basic.phpt92
-rw-r--r--ext/standard/tests/math/cos_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/cos_error.phpt29
-rw-r--r--ext/standard/tests/math/cos_variation.phpt56
-rw-r--r--ext/standard/tests/math/cosh_basic.phpt61
-rw-r--r--ext/standard/tests/math/cosh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/cosh_error.phpt29
-rw-r--r--ext/standard/tests/math/cosh_variation.phpt56
-rw-r--r--ext/standard/tests/math/decbin_basic.phpt39
-rw-r--r--ext/standard/tests/math/decbin_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/decbin_error.phpt37
-rw-r--r--ext/standard/tests/math/decbin_variation1.phpt179
-rw-r--r--ext/standard/tests/math/decbin_variation1_64bit.phpt179
-rw-r--r--ext/standard/tests/math/dechex_basic.phpt38
-rw-r--r--ext/standard/tests/math/dechex_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/dechex_error.phpt26
-rw-r--r--ext/standard/tests/math/dechex_variation1.phpt179
-rw-r--r--ext/standard/tests/math/dechex_variation1_64bit.phpt179
-rw-r--r--ext/standard/tests/math/decoct_basic.phpt38
-rw-r--r--ext/standard/tests/math/decoct_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/decoct_error.phpt25
-rw-r--r--ext/standard/tests/math/decoct_variation1.phpt180
-rw-r--r--ext/standard/tests/math/decoct_variation1_64bit.phpt180
-rw-r--r--ext/standard/tests/math/deg2rad_basic.phpt67
-rw-r--r--ext/standard/tests/math/deg2rad_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/deg2rad_error.phpt31
-rw-r--r--ext/standard/tests/math/deg2rad_variation.phpt56
-rw-r--r--ext/standard/tests/math/exp_basic.phpt71
-rw-r--r--ext/standard/tests/math/exp_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/exp_error.phpt14
-rw-r--r--ext/standard/tests/math/exp_variation1.phpt187
-rw-r--r--ext/standard/tests/math/expm1_basic.phpt79
-rw-r--r--ext/standard/tests/math/expm1_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/expm1_error.phpt30
-rw-r--r--ext/standard/tests/math/expm1_variation1.phpt199
-rw-r--r--ext/standard/tests/math/floor_basic.phpt108
-rw-r--r--ext/standard/tests/math/floor_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/floor_error.phpt33
-rw-r--r--ext/standard/tests/math/floor_variation1.phpt128
-rw-r--r--ext/standard/tests/math/floorceil.phpt44
-rw-r--r--ext/standard/tests/math/fmod_basic.phpt209
-rw-r--r--ext/standard/tests/math/fmod_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/fmod_error.phpt17
-rw-r--r--ext/standard/tests/math/fmod_variation1.phpt184
-rw-r--r--ext/standard/tests/math/fmod_variation2.phpt184
-rw-r--r--ext/standard/tests/math/getrandmax_basic.phpt9
-rw-r--r--ext/standard/tests/math/getrandmax_error.phpt9
-rw-r--r--ext/standard/tests/math/hexdec.phpt24
-rw-r--r--ext/standard/tests/math/hexdec_basic.phpt50
-rw-r--r--ext/standard/tests/math/hexdec_basic_64bit.phpt93
-rw-r--r--ext/standard/tests/math/hexdec_basiclong_64bit.phpt51
-rw-r--r--ext/standard/tests/math/hexdec_error.phpt36
-rw-r--r--ext/standard/tests/math/hexdec_variation1.phpt168
-rw-r--r--ext/standard/tests/math/hexdec_variation1_64bit.phpt168
-rw-r--r--ext/standard/tests/math/hypot_basic.phpt444
-rw-r--r--ext/standard/tests/math/hypot_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/hypot_error.phpt33
-rw-r--r--ext/standard/tests/math/hypot_variation1.phpt185
-rw-r--r--ext/standard/tests/math/hypot_variation2.phpt185
-rw-r--r--ext/standard/tests/math/is_finite_basic.phpt41
-rw-r--r--ext/standard/tests/math/is_finite_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/is_finite_error.phpt13
-rw-r--r--ext/standard/tests/math/is_finite_variation1.phpt184
-rw-r--r--ext/standard/tests/math/is_infinite_basic.phpt42
-rw-r--r--ext/standard/tests/math/is_infinite_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/is_infinite_error.phpt12
-rw-r--r--ext/standard/tests/math/is_infinite_variation1.phpt184
-rw-r--r--ext/standard/tests/math/is_nan_basic.phpt45
-rw-r--r--ext/standard/tests/math/is_nan_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/is_nan_error.phpt16
-rw-r--r--ext/standard/tests/math/is_nan_variation1.phpt184
-rw-r--r--ext/standard/tests/math/lcg_value_basic.phpt56
-rw-r--r--ext/standard/tests/math/log.phpt42
-rw-r--r--ext/standard/tests/math/log10_basic.phpt55
-rw-r--r--ext/standard/tests/math/log10_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/log10_error.phpt31
-rw-r--r--ext/standard/tests/math/log10_variation.phpt56
-rw-r--r--ext/standard/tests/math/log1p_basic.phpt78
-rw-r--r--ext/standard/tests/math/log1p_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/log1p_error.phpt29
-rw-r--r--ext/standard/tests/math/log1p_variation1.phpt191
-rw-r--r--ext/standard/tests/math/log_basic.phpt60
-rw-r--r--ext/standard/tests/math/log_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/log_error.phpt16
-rw-r--r--ext/standard/tests/math/log_variation1.phpt184
-rw-r--r--ext/standard/tests/math/log_variation2.phpt202
-rw-r--r--ext/standard/tests/math/mt_getrandmax_basic.phpt8
-rw-r--r--ext/standard/tests/math/mt_getrandmax_error.phpt9
-rw-r--r--ext/standard/tests/math/mt_rand_basic.phpt102
-rw-r--r--ext/standard/tests/math/mt_rand_error.phpt19
-rw-r--r--ext/standard/tests/math/mt_rand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/mt_rand_variation2.phpt184
-rw-r--r--ext/standard/tests/math/mt_srand_basic.phpt24
-rw-r--r--ext/standard/tests/math/mt_srand_error.phpt20
-rw-r--r--ext/standard/tests/math/mt_srand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/number_format_basic.phpt97
-rw-r--r--ext/standard/tests/math/number_format_multichar.phpt77
-rw-r--r--ext/standard/tests/math/octdec_basic.phpt49
-rw-r--r--ext/standard/tests/math/octdec_basic_64bit.phpt55
-rw-r--r--ext/standard/tests/math/octdec_basiclong_64bit.phpt51
-rw-r--r--ext/standard/tests/math/octdec_error.phpt37
-rw-r--r--ext/standard/tests/math/octdec_variation1.phpt164
-rw-r--r--ext/standard/tests/math/pi_basic.phpt14
-rw-r--r--ext/standard/tests/math/pow.phpt149
-rw-r--r--ext/standard/tests/math/pow_basic.phpt270
-rw-r--r--ext/standard/tests/math/pow_basic2.phpt52
-rw-r--r--ext/standard/tests/math/pow_basic_64bit.phpt270
-rw-r--r--ext/standard/tests/math/pow_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/pow_error.phpt19
-rw-r--r--ext/standard/tests/math/pow_variation1.phpt176
-rw-r--r--ext/standard/tests/math/pow_variation1_64bit.phpt176
-rw-r--r--ext/standard/tests/math/pow_variation2.phpt172
-rw-r--r--ext/standard/tests/math/rad2deg_basic.phpt65
-rw-r--r--ext/standard/tests/math/rad2deg_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/rad2deg_error.phpt31
-rw-r--r--ext/standard/tests/math/rad2deg_variation.phpt56
-rw-r--r--ext/standard/tests/math/rand_basic.phpt103
-rw-r--r--ext/standard/tests/math/rand_error.phpt18
-rw-r--r--ext/standard/tests/math/rand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/rand_variation2.phpt184
-rw-r--r--ext/standard/tests/math/round.phpt37
-rw-r--r--ext/standard/tests/math/round_basic.phpt192
-rw-r--r--ext/standard/tests/math/round_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/round_error.phpt31
-rw-r--r--ext/standard/tests/math/round_large_exp.phpt30
-rw-r--r--ext/standard/tests/math/round_modes.phpt38
-rw-r--r--ext/standard/tests/math/round_prerounding.phpt10
-rw-r--r--ext/standard/tests/math/round_variation1.phpt173
-rw-r--r--ext/standard/tests/math/round_variation2.phpt187
-rw-r--r--ext/standard/tests/math/sin_basic.phpt92
-rw-r--r--ext/standard/tests/math/sin_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/sin_error.phpt29
-rw-r--r--ext/standard/tests/math/sin_variation.phpt56
-rw-r--r--ext/standard/tests/math/sinh_basic.phpt60
-rw-r--r--ext/standard/tests/math/sinh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/sinh_error.phpt29
-rw-r--r--ext/standard/tests/math/sinh_variation.phpt56
-rw-r--r--ext/standard/tests/math/sqrt_basic.phpt18
-rw-r--r--ext/standard/tests/math/sqrt_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/sqrt_error.phpt31
-rw-r--r--ext/standard/tests/math/sqrt_variation.phpt60
-rw-r--r--ext/standard/tests/math/srand_basic.phpt34
-rw-r--r--ext/standard/tests/math/srand_error.phpt32
-rw-r--r--ext/standard/tests/math/srand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/tan_basic.phpt41
-rw-r--r--ext/standard/tests/math/tan_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/tan_error.phpt29
-rw-r--r--ext/standard/tests/math/tan_variation.phpt56
-rw-r--r--ext/standard/tests/math/tanh_basic.phpt60
-rw-r--r--ext/standard/tests/math/tanh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/tanh_error.phpt29
-rw-r--r--ext/standard/tests/math/tanh_variation.phpt56
-rw-r--r--ext/standard/tests/misc/browscap.ini16927
-rw-r--r--ext/standard/tests/misc/browsernames.inc51
-rw-r--r--ext/standard/tests/misc/get_browser_basic.phpt1468
-rw-r--r--ext/standard/tests/misc/get_browser_error.phpt119
-rw-r--r--ext/standard/tests/misc/get_browser_variation1.phpt1399
-rw-r--r--ext/standard/tests/misc/syslog_basic.phpt13
-rw-r--r--ext/standard/tests/misc/syslog_parameters.phpt22
-rw-r--r--ext/standard/tests/misc/time_nanosleep_basic.phpt25
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error1.phpt14
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error2.phpt14
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error3.phpt17
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error4.phpt17
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error5.phpt14
-rw-r--r--ext/standard/tests/misc/time_sleep_until_basic.phpt32
-rw-r--r--ext/standard/tests/misc/time_sleep_until_error1.phpt15
-rw-r--r--ext/standard/tests/misc/time_sleep_until_error2.phpt14
-rw-r--r--ext/standard/tests/misc/time_sleep_until_error3.phpt14
-rw-r--r--ext/standard/tests/network/bug20134.phpt24
-rw-r--r--ext/standard/tests/network/bug41347.phpt9
-rw-r--r--ext/standard/tests/network/closelog_basic.phpt23
-rw-r--r--ext/standard/tests/network/closelog_error.phpt27
-rw-r--r--ext/standard/tests/network/fsockopen_basic.phpt54
-rw-r--r--ext/standard/tests/network/fsockopen_error.phpt75
-rw-r--r--ext/standard/tests/network/fsockopen_variation1.phpt32
-rw-r--r--ext/standard/tests/network/fsockopen_variation2.phpt48
-rw-r--r--ext/standard/tests/network/gethostbyaddr_basic1.phpt18
-rw-r--r--ext/standard/tests/network/gethostbyaddr_error.phpt60
-rw-r--r--ext/standard/tests/network/gethostbyname_basic001.phpt15
-rw-r--r--ext/standard/tests/network/gethostbyname_basic003.phpt18
-rw-r--r--ext/standard/tests/network/gethostbyname_error001.phpt10
-rw-r--r--ext/standard/tests/network/gethostbyname_error002.phpt10
-rw-r--r--ext/standard/tests/network/gethostbyname_error003.phpt10
-rw-r--r--ext/standard/tests/network/gethostbyname_error004.phpt16
-rw-r--r--ext/standard/tests/network/gethostbyname_error005.phpt12
-rw-r--r--ext/standard/tests/network/gethostbyname_error006.phpt10
-rw-r--r--ext/standard/tests/network/gethostbynamel_basic1.phpt19
-rw-r--r--ext/standard/tests/network/gethostbynamel_error.phpt36
-rw-r--r--ext/standard/tests/network/getmxrr.phpt24
-rw-r--r--ext/standard/tests/network/http-stream.phpt18
-rw-r--r--ext/standard/tests/network/inet.phpt75
-rw-r--r--ext/standard/tests/network/inet_ipv6.phpt50
-rw-r--r--ext/standard/tests/network/ip.phpt67
-rw-r--r--ext/standard/tests/network/ip2long_error.phpt37
-rw-r--r--ext/standard/tests/network/ip2long_variation1.phpt204
-rw-r--r--ext/standard/tests/network/ip_x86_64.phpt67
-rw-r--r--ext/standard/tests/network/long2ip_error.phpt37
-rw-r--r--ext/standard/tests/network/long2ip_variation1.phpt196
-rw-r--r--ext/standard/tests/network/shutdown.phpt65
-rw-r--r--ext/standard/tests/network/socket_get_status_basic.phpt27
-rw-r--r--ext/standard/tests/network/syslog_basic-win32.phpt31
-rw-r--r--ext/standard/tests/network/syslog_error.phpt40
-rw-r--r--ext/standard/tests/network/tcp4loop.phpt34
-rw-r--r--ext/standard/tests/network/tcp6loop.phpt42
-rw-r--r--ext/standard/tests/network/udgloop.phpt37
-rw-r--r--ext/standard/tests/network/udp4loop.phpt27
-rw-r--r--ext/standard/tests/network/udp6loop.phpt41
-rw-r--r--ext/standard/tests/network/unixloop.phpt44
-rw-r--r--ext/standard/tests/php_ini_loaded_file.phpt14
-rw-r--r--ext/standard/tests/php_logo_guid.phpt13
-rw-r--r--ext/standard/tests/php_real_logo_guid.phpt12
-rw-r--r--ext/standard/tests/serialize/001.phpt122
-rw-r--r--ext/standard/tests/serialize/002.phpt44
-rw-r--r--ext/standard/tests/serialize/003.phpt25
-rw-r--r--ext/standard/tests/serialize/004.phpt33
-rw-r--r--ext/standard/tests/serialize/005.phpt186
-rw-r--r--ext/standard/tests/serialize/006.phpt29
-rwxr-xr-xext/standard/tests/serialize/autoload_implements.p5c10
-rwxr-xr-xext/standard/tests/serialize/autoload_interface.p5c7
-rw-r--r--ext/standard/tests/serialize/bug14293.phpt36
-rw-r--r--ext/standard/tests/serialize/bug21957.phpt49
-rw-r--r--ext/standard/tests/serialize/bug23298.phpt13
-rw-r--r--ext/standard/tests/serialize/bug24063.phpt23
-rw-r--r--ext/standard/tests/serialize/bug25378.phpt59
-rw-r--r--ext/standard/tests/serialize/bug26762.phpt27
-rw-r--r--ext/standard/tests/serialize/bug27469.phpt27
-rw-r--r--ext/standard/tests/serialize/bug28325.phpt30
-rw-r--r--ext/standard/tests/serialize/bug30234.phpt40
-rw-r--r--ext/standard/tests/serialize/bug31402.phpt87
-rw-r--r--ext/standard/tests/serialize/bug31442.phpt10
-rw-r--r--ext/standard/tests/serialize/bug35895.phpt24
-rw-r--r--ext/standard/tests/serialize/bug36424.phpt72
-rw-r--r--ext/standard/tests/serialize/bug37947.phpt21
-rw-r--r--ext/standard/tests/serialize/bug42919.phpt14
-rw-r--r--ext/standard/tests/serialize/bug43614.phpt21
-rw-r--r--ext/standard/tests/serialize/bug45706.phpt28
-rw-r--r--ext/standard/tests/serialize/bug46882.phpt8
-rw-r--r--ext/standard/tests/serialize/bug55798.phpt18
-rw-r--r--ext/standard/tests/serialize/bug62373.phpt25
-rw-r--r--ext/standard/tests/serialize/bug62836_1.phpt34
-rw-r--r--ext/standard/tests/serialize/bug62836_2.phpt37
-rw-r--r--ext/standard/tests/serialize/incomplete_class.phpt27
-rw-r--r--ext/standard/tests/serialize/precision.phpt49
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_001.phpt91
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_002.phpt544
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_003.phpt294
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_004.phpt269
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_005.phpt521
-rw-r--r--ext/standard/tests/serialize/serialization_error_001.phpt42
-rw-r--r--ext/standard/tests/serialize/serialization_miscTypes_001.phptbin0 -> 7617 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_001.phptbin0 -> 2435 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_002.phptbin0 -> 7244 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_003.phpt69
-rw-r--r--ext/standard/tests/serialize/serialization_objects_004.phpt49
-rw-r--r--ext/standard/tests/serialize/serialization_objects_005.phpt120
-rw-r--r--ext/standard/tests/serialize/serialization_objects_006.phpt28
-rw-r--r--ext/standard/tests/serialize/serialization_objects_007.phpt42
-rw-r--r--ext/standard/tests/serialize/serialization_objects_008.phpt28
-rw-r--r--ext/standard/tests/serialize/serialization_objects_009.phpt35
-rw-r--r--ext/standard/tests/serialize/serialization_objects_010.phpt37
-rw-r--r--ext/standard/tests/serialize/serialization_objects_011.phpt196
-rw-r--r--ext/standard/tests/serialize/serialization_objects_012.phpt244
-rw-r--r--ext/standard/tests/serialize/serialization_objects_013.phpt494
-rw-r--r--ext/standard/tests/serialize/serialization_objects_014.phpt295
-rw-r--r--ext/standard/tests/serialize/serialization_objects_015.phpt336
-rw-r--r--ext/standard/tests/serialize/serialization_precision_001.phpt21
-rw-r--r--ext/standard/tests/serialize/serialization_precision_002.phpt21
-rw-r--r--ext/standard/tests/serialize/serialization_resources_001.phpt30
-rw-r--r--ext/standard/tests/serialize/unserializeS.phpt14
-rw-r--r--ext/standard/tests/streams/bug40459.phpt103
-rw-r--r--ext/standard/tests/streams/bug44712.phpt10
-rw-r--r--ext/standard/tests/streams/bug44818.phpt37
-rw-r--r--ext/standard/tests/streams/bug46024.phpt46
-rw-r--r--ext/standard/tests/streams/bug46426.phpt34
-rw-r--r--ext/standard/tests/streams/bug47997.phpt15
-rw-r--r--ext/standard/tests/streams/bug48309.phpt33
-rw-r--r--ext/standard/tests/streams/bug49936.phpt21
-rw-r--r--ext/standard/tests/streams/bug49936_win32.phpt30
-rw-r--r--ext/standard/tests/streams/bug53427.phpt27
-rw-r--r--ext/standard/tests/streams/bug53903.phpt32
-rw-r--r--ext/standard/tests/streams/bug54623.phpt17
-rw-r--r--ext/standard/tests/streams/bug54946.phpt39
-rw-r--r--ext/standard/tests/streams/bug60106.phpt23
-rw-r--r--ext/standard/tests/streams/bug60455_01.phpt21
-rw-r--r--ext/standard/tests/streams/bug60455_02.phpt31
-rw-r--r--ext/standard/tests/streams/bug60455_03.phpt55
-rw-r--r--ext/standard/tests/streams/bug60455_04.phpt32
-rw-r--r--ext/standard/tests/streams/bug60817.phpt36
-rw-r--r--ext/standard/tests/streams/bug61115-1.phpt17
-rw-r--r--ext/standard/tests/streams/bug61115-2.phpt10
-rw-r--r--ext/standard/tests/streams/bug61115.phpt13
-rw-r--r--ext/standard/tests/streams/bug61371-win.phpt45
-rw-r--r--ext/standard/tests/streams/bug61371.phpt45
-rw-r--r--ext/standard/tests/streams/bug63240.phpt17
-rw-r--r--ext/standard/tests/streams/stream_context_get_params_001.phpt121
-rw-r--r--ext/standard/tests/streams/stream_context_set_option_basic.phpt37
-rw-r--r--ext/standard/tests/streams/stream_context_set_option_error_001.phpt21
-rw-r--r--ext/standard/tests/streams/stream_context_set_option_error_002.phpt18
-rw-r--r--ext/standard/tests/streams/stream_copy_to_stream_socket.phpt30
-rw-r--r--ext/standard/tests/streams/stream_get_contents_001.phpt22
-rw-r--r--ext/standard/tests/streams/stream_get_contents_002.phpt18
-rw-r--r--ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt27
-rw-r--r--ext/standard/tests/streams/stream_get_line_nb.phpt66
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt50
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt33
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_error.phpt57
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt510
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt135
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt71
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt77
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt36
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt27
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt113
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt111
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt89
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt92
-rw-r--r--ext/standard/tests/streams/stream_is_local.phpt17
-rw-r--r--ext/standard/tests/streams/stream_resolve_include_path.phpt37
-rw-r--r--ext/standard/tests/streams/stream_set_chunk_size.phpt93
-rw-r--r--ext/standard/tests/streams/stream_set_timeout_error.phpt74
-rw-r--r--ext/standard/tests/streams/stream_socket_pair.phpt19
-rw-r--r--ext/standard/tests/strings/004.phpt84
-rw-r--r--ext/standard/tests/strings/005.phpt24
-rw-r--r--ext/standard/tests/strings/006.phpt21
-rw-r--r--ext/standard/tests/strings/007-win32.phpt20
-rw-r--r--ext/standard/tests/strings/007.phpt20
-rw-r--r--ext/standard/tests/strings/add-and-stripcslashes.phpt26
-rw-r--r--ext/standard/tests/strings/add-and-stripslashes.phpt20
-rw-r--r--ext/standard/tests/strings/addcslashes_001.phptbin0 -> 1587 bytes
-rw-r--r--ext/standard/tests/strings/addcslashes_002.phpt33
-rw-r--r--ext/standard/tests/strings/addcslashes_003.phptbin0 -> 1314 bytes
-rw-r--r--ext/standard/tests/strings/addcslashes_004.phpt30
-rw-r--r--ext/standard/tests/strings/addslashes_basic.phpt38
-rw-r--r--ext/standard/tests/strings/addslashes_error.phpt43
-rw-r--r--ext/standard/tests/strings/addslashes_variation1.phpt171
-rw-r--r--ext/standard/tests/strings/addslashes_variation2.phpt194
-rw-r--r--ext/standard/tests/strings/basename.phptbin0 -> 1148 bytes
-rw-r--r--ext/standard/tests/strings/basename_basic.phptbin0 -> 3225 bytes
-rw-r--r--ext/standard/tests/strings/basename_error.phpt58
-rw-r--r--ext/standard/tests/strings/basename_variation.phpt235
-rw-r--r--ext/standard/tests/strings/bin2hex.phpt14
-rw-r--r--ext/standard/tests/strings/bin2hex_basic.phpt50
-rw-r--r--ext/standard/tests/strings/bin2hex_error.phpt35
-rw-r--r--ext/standard/tests/strings/bin2hex_variation1.phpt128
-rw-r--r--ext/standard/tests/strings/bug20108.phpt11
-rw-r--r--ext/standard/tests/strings/bug20169.phpt14
-rw-r--r--ext/standard/tests/strings/bug20261.phpt26
-rw-r--r--ext/standard/tests/strings/bug20927.phpt17
-rw-r--r--ext/standard/tests/strings/bug20934.phpt17
-rw-r--r--ext/standard/tests/strings/bug21338.phpt10
-rw-r--r--ext/standard/tests/strings/bug21453.phpt18
-rw-r--r--ext/standard/tests/strings/bug21730.phpt35
-rw-r--r--ext/standard/tests/strings/bug21744.phpt15
-rw-r--r--ext/standard/tests/strings/bug22008.phpt24
-rw-r--r--ext/standard/tests/strings/bug22187.phpt10
-rw-r--r--ext/standard/tests/strings/bug22207.phpt11
-rw-r--r--ext/standard/tests/strings/bug22224.phpt31
-rw-r--r--ext/standard/tests/strings/bug22227.phpt9
-rw-r--r--ext/standard/tests/strings/bug23650.phpt31
-rw-r--r--ext/standard/tests/strings/bug23894.phpt15
-rw-r--r--ext/standard/tests/strings/bug24098.phpt19
-rw-r--r--ext/standard/tests/strings/bug24208.phpt12
-rw-r--r--ext/standard/tests/strings/bug24281.phpt18
-rw-r--r--ext/standard/tests/strings/bug24312.phpt27
-rw-r--r--ext/standard/tests/strings/bug25671.phpt23
-rw-r--r--ext/standard/tests/strings/bug25707.phpt12
-rw-r--r--ext/standard/tests/strings/bug26817.phpt26
-rw-r--r--ext/standard/tests/strings/bug26819.phpt9
-rw-r--r--ext/standard/tests/strings/bug26878.phpt9
-rw-r--r--ext/standard/tests/strings/bug26973.phpt34
-rw-r--r--ext/standard/tests/strings/bug27276.phpt15
-rw-r--r--ext/standard/tests/strings/bug27278.phpt21
-rw-r--r--ext/standard/tests/strings/bug27295.phpt14
-rw-r--r--ext/standard/tests/strings/bug27457.phpt21
-rw-r--r--ext/standard/tests/strings/bug27675.phpt8
-rw-r--r--ext/standard/tests/strings/bug28386.phpt13
-rw-r--r--ext/standard/tests/strings/bug28633.phpt10
-rw-r--r--ext/standard/tests/strings/bug29075.phpt14
-rw-r--r--ext/standard/tests/strings/bug29119.phpt8
-rw-r--r--ext/standard/tests/strings/bug29538.phpt10
-rw-r--r--ext/standard/tests/strings/bug33076.phpt14
-rw-r--r--ext/standard/tests/strings/bug33605.phpt11
-rw-r--r--ext/standard/tests/strings/bug34214.phpt10
-rw-r--r--ext/standard/tests/strings/bug35817.phpt29
-rw-r--r--ext/standard/tests/strings/bug36148.phpt29
-rw-r--r--ext/standard/tests/strings/bug36306.phpt15
-rw-r--r--ext/standard/tests/strings/bug36392.phpt16
-rw-r--r--ext/standard/tests/strings/bug36944.phpt26
-rw-r--r--ext/standard/tests/strings/bug37244.phpt18
-rw-r--r--ext/standard/tests/strings/bug37262.phpt9
-rw-r--r--ext/standard/tests/strings/bug38322.phpt13
-rw-r--r--ext/standard/tests/strings/bug38770.phpt25
-rw-r--r--ext/standard/tests/strings/bug39032.phpt18
-rw-r--r--ext/standard/tests/strings/bug39350.phpt13
-rw-r--r--ext/standard/tests/strings/bug39621.phptbin0 -> 866 bytes
-rw-r--r--ext/standard/tests/strings/bug39873.phpt17
-rw-r--r--ext/standard/tests/strings/bug40432.phpt8
-rw-r--r--ext/standard/tests/strings/bug40637.phpt13
-rw-r--r--ext/standard/tests/strings/bug40704.phpt13
-rw-r--r--ext/standard/tests/strings/bug40754.phpt63
-rw-r--r--ext/standard/tests/strings/bug40915.phptbin0 -> 377 bytes
-rw-r--r--ext/standard/tests/strings/bug42107.phpt47
-rw-r--r--ext/standard/tests/strings/bug42208.phpt15
-rw-r--r--ext/standard/tests/strings/bug43927.phpt12
-rw-r--r--ext/standard/tests/strings/bug44242.phpt14
-rw-r--r--ext/standard/tests/strings/bug44703.phpt46
-rw-r--r--ext/standard/tests/strings/bug45166.phpt10
-rw-r--r--ext/standard/tests/strings/bug45485.phpt23
-rw-r--r--ext/standard/tests/strings/bug46578.phpt25
-rw-r--r--ext/standard/tests/strings/bug47168.phpt12
-rw-r--r--ext/standard/tests/strings/bug47322.phpt19
-rw-r--r--ext/standard/tests/strings/bug47443.phpt14
-rw-r--r--ext/standard/tests/strings/bug47481.phpt57
-rw-r--r--ext/standard/tests/strings/bug47842.phpt34
-rw-r--r--ext/standard/tests/strings/bug48709.phpt31
-rw-r--r--ext/standard/tests/strings/bug49785.phpt4135
-rw-r--r--ext/standard/tests/strings/bug50052.phpt12
-rw-r--r--ext/standard/tests/strings/bug50847.phpt10
-rw-r--r--ext/standard/tests/strings/bug51059.phpt11
-rw-r--r--ext/standard/tests/strings/bug51899.phpt37
-rw-r--r--ext/standard/tests/strings/bug53021.phpt34
-rw-r--r--ext/standard/tests/strings/bug53319.phpt17
-rw-r--r--ext/standard/tests/strings/bug54055.phpt589
-rw-r--r--ext/standard/tests/strings/bug54238.phpt25
-rw-r--r--ext/standard/tests/strings/bug54322.phpt9
-rw-r--r--ext/standard/tests/strings/bug54332.phpt8
-rw-r--r--ext/standard/tests/strings/bug54454.phpt8
-rw-r--r--ext/standard/tests/strings/bug54721.phpt20
-rw-r--r--ext/standard/tests/strings/bug55674.phpt50
-rw-r--r--ext/standard/tests/strings/bug55871.phpt47
-rw-r--r--ext/standard/tests/strings/bug60801.phptbin0 -> 489 bytes
-rw-r--r--ext/standard/tests/strings/bug60965.phpt10
-rw-r--r--ext/standard/tests/strings/bug61374.phpt7
-rw-r--r--ext/standard/tests/strings/bug61660.phpt11
-rw-r--r--ext/standard/tests/strings/bug61764.phpt15
-rw-r--r--ext/standard/tests/strings/bug62443.phpt9
-rw-r--r--ext/standard/tests/strings/bug62462.phpt17
-rw-r--r--ext/standard/tests/strings/bug63943.phpt8
-rw-r--r--ext/standard/tests/strings/chop_basic.phptbin0 -> 861 bytes
-rw-r--r--ext/standard/tests/strings/chop_error.phpt44
-rw-r--r--ext/standard/tests/strings/chop_variation1.phpt214
-rw-r--r--ext/standard/tests/strings/chop_variation2.phpt175
-rw-r--r--ext/standard/tests/strings/chop_variation3.phptbin0 -> 1974 bytes
-rw-r--r--ext/standard/tests/strings/chop_variation4.phptbin0 -> 1836 bytes
-rw-r--r--ext/standard/tests/strings/chop_variation5.phpt39
-rw-r--r--ext/standard/tests/strings/chr_basic.phpt23
-rw-r--r--ext/standard/tests/strings/chr_error.phpt34
-rw-r--r--ext/standard/tests/strings/chr_ord.phptbin0 -> 3203 bytes
-rw-r--r--ext/standard/tests/strings/chr_variation1.phpt123
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt34
-rw-r--r--ext/standard/tests/strings/chunk_split_basic.phpt53
-rw-r--r--ext/standard/tests/strings/chunk_split_error.phpt40
-rw-r--r--ext/standard/tests/strings/chunk_split_variation1.phpt169
-rw-r--r--ext/standard/tests/strings/chunk_split_variation10.phpt86
-rw-r--r--ext/standard/tests/strings/chunk_split_variation11.phpt95
-rw-r--r--ext/standard/tests/strings/chunk_split_variation12.phpt145
-rw-r--r--ext/standard/tests/strings/chunk_split_variation13.phpt42
-rw-r--r--ext/standard/tests/strings/chunk_split_variation2.phpt183
-rw-r--r--ext/standard/tests/strings/chunk_split_variation3.phpt160
-rw-r--r--ext/standard/tests/strings/chunk_split_variation4.phpt176
-rw-r--r--ext/standard/tests/strings/chunk_split_variation5.phptbin0 -> 2289 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split_variation6.phpt76
-rw-r--r--ext/standard/tests/strings/chunk_split_variation7.phptbin0 -> 2462 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split_variation8.phpt92
-rw-r--r--ext/standard/tests/strings/chunk_split_variation9.phptbin0 -> 3344 bytes
-rw-r--r--ext/standard/tests/strings/convert_cyr_string.phpt50
-rw-r--r--ext/standard/tests/strings/convert_cyr_string_basic.phpt165
-rw-r--r--ext/standard/tests/strings/convert_cyr_string_error.phpt73
-rw-r--r--ext/standard/tests/strings/convert_cyr_string_variation1.phpt139
-rw-r--r--ext/standard/tests/strings/convert_uudecode_basic.phpt54
-rw-r--r--ext/standard/tests/strings/convert_uudecode_error.phpt35
-rw-r--r--ext/standard/tests/strings/convert_uudecode_variation1.phpt161
-rw-r--r--ext/standard/tests/strings/convert_uuencode_basic.phpt88
-rw-r--r--ext/standard/tests/strings/convert_uuencode_error.phpt35
-rw-r--r--ext/standard/tests/strings/convert_uuencode_variation1.phpt137
-rw-r--r--ext/standard/tests/strings/count_chars.phpt18
-rw-r--r--ext/standard/tests/strings/count_chars_basic.phpt1574
-rw-r--r--ext/standard/tests/strings/count_chars_error.phpt36
-rw-r--r--ext/standard/tests/strings/count_chars_variation1.phpt262
-rw-r--r--ext/standard/tests/strings/count_chars_variation2.phpt162
-rw-r--r--ext/standard/tests/strings/crc32.phpt14
-rw-r--r--ext/standard/tests/strings/crc32_basic.phpt41
-rw-r--r--ext/standard/tests/strings/crc32_error.phpt47
-rw-r--r--ext/standard/tests/strings/crc32_variation1.phpt197
-rw-r--r--ext/standard/tests/strings/crc32_variation2.phpt149
-rw-r--r--ext/standard/tests/strings/crc32_variation3.phpt161
-rw-r--r--ext/standard/tests/strings/crc32_variation4.phpt117
-rw-r--r--ext/standard/tests/strings/crypt.phpt43
-rw-r--r--ext/standard/tests/strings/crypt_blowfish.phpt78
-rw-r--r--ext/standard/tests/strings/crypt_blowfish_variation1.phpt37
-rw-r--r--ext/standard/tests/strings/crypt_blowfish_variation2.phpt14
-rw-r--r--ext/standard/tests/strings/crypt_chars.phpt19
-rw-r--r--ext/standard/tests/strings/crypt_sha256.phpt64
-rw-r--r--ext/standard/tests/strings/crypt_sha512.phpt65
-rw-r--r--ext/standard/tests/strings/crypt_variation1.phpt23
-rw-r--r--ext/standard/tests/strings/dirname_basic.phpt153
-rw-r--r--ext/standard/tests/strings/dirname_error.phpt25
-rw-r--r--ext/standard/tests/strings/dirname_variation.phpt143
-rw-r--r--ext/standard/tests/strings/explode.phpt164
-rw-r--r--ext/standard/tests/strings/explode1.phpt509
-rw-r--r--ext/standard/tests/strings/explode_bug.phpt15
-rw-r--r--ext/standard/tests/strings/explode_error.phpt37
-rw-r--r--ext/standard/tests/strings/explode_variation1.phpt193
-rw-r--r--ext/standard/tests/strings/explode_variation2.phpt195
-rw-r--r--ext/standard/tests/strings/explode_variation3.phpt238
-rw-r--r--ext/standard/tests/strings/explode_variation4.phpt36
-rw-r--r--ext/standard/tests/strings/explode_variation5.phpt48
-rw-r--r--ext/standard/tests/strings/explode_variation6.phpt70
-rw-r--r--ext/standard/tests/strings/fprintf_error.phpt31
-rw-r--r--ext/standard/tests/strings/fprintf_variation_001.phpt124
-rw-r--r--ext/standard/tests/strings/fprintf_variation_002.phpt124
-rw-r--r--ext/standard/tests/strings/fprintf_variation_003.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_003_64bit.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_004.phptbin0 -> 734 bytes
-rw-r--r--ext/standard/tests/strings/fprintf_variation_005.phpt46
-rw-r--r--ext/standard/tests/strings/fprintf_variation_006.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_006_64bit.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_007.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_007_64bit.phpt47
-rw-r--r--ext/standard/tests/strings/fprintf_variation_008.phpt48
-rw-r--r--ext/standard/tests/strings/fprintf_variation_008_64bit.phpt48
-rw-r--r--ext/standard/tests/strings/fprintf_variation_009.phpt64
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic1.phpt549
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic10.phpt121
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic2.phpt1565
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic3.phpt71
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic4.phpt293
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic5.phpt1598
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic6.phpt249
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic7.phpt342
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic8.phpt93
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic9.phpt95
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_error.phpt29
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_variation1.phpt316
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_variation2.phpt209
-rw-r--r--ext/standard/tests/strings/get_meta_tags.phpt95
-rw-r--r--ext/standard/tests/strings/hebrev_basic.phpt35
-rw-r--r--ext/standard/tests/strings/hebrev_error.phpt35
-rw-r--r--ext/standard/tests/strings/hebrev_variation1.phpt138
-rw-r--r--ext/standard/tests/strings/hebrev_variation2.phpt291
-rw-r--r--ext/standard/tests/strings/hebrevc_basic.phpt47
-rw-r--r--ext/standard/tests/strings/hebrevc_error.phpt35
-rw-r--r--ext/standard/tests/strings/hebrevc_variation1.phpt138
-rw-r--r--ext/standard/tests/strings/hebrevc_variation2.phpt430
-rw-r--r--ext/standard/tests/strings/highlight_file.phpt59
-rw-r--r--ext/standard/tests/strings/html_entity_decode1.phpt67
-rw-r--r--ext/standard/tests/strings/html_entity_decode2.phpt33
-rw-r--r--ext/standard/tests/strings/html_entity_decode3.phpt193
-rw-r--r--ext/standard/tests/strings/html_entity_decode_cp866.phpt533
-rw-r--r--ext/standard/tests/strings/html_entity_decode_html4.phpt516
-rw-r--r--ext/standard/tests/strings/html_entity_decode_html5.phpt4264
-rw-r--r--ext/standard/tests/strings/html_entity_decode_iso8859-15.phpt405
-rw-r--r--ext/standard/tests/strings/html_entity_decode_iso8859-5.phpt405
-rw-r--r--ext/standard/tests/strings/html_entity_decode_koi8-r.phpt533
-rw-r--r--ext/standard/tests/strings/html_entity_decode_macroman.phpt540
-rw-r--r--ext/standard/tests/strings/html_entity_decode_win1251.phpt537
-rw-r--r--ext/standard/tests/strings/html_entity_decode_win1252.phpt169
-rw-r--r--ext/standard/tests/strings/htmlentities-utf-2.phpt70
-rw-r--r--ext/standard/tests/strings/htmlentities-utf-3.phpt83
-rw-r--r--ext/standard/tests/strings/htmlentities-utf.phpt70
-rw-r--r--ext/standard/tests/strings/htmlentities.phpt19
-rw-r--r--ext/standard/tests/strings/htmlentities01.phpt13
-rw-r--r--ext/standard/tests/strings/htmlentities02.phpt20
-rw-r--r--ext/standard/tests/strings/htmlentities03.phpt20
-rw-r--r--ext/standard/tests/strings/htmlentities04.phpt21
-rw-r--r--ext/standard/tests/strings/htmlentities05.phpt18
-rw-r--r--ext/standard/tests/strings/htmlentities06.phpt17
-rw-r--r--ext/standard/tests/strings/htmlentities07.phpt17
-rw-r--r--ext/standard/tests/strings/htmlentities08.phpt18
-rw-r--r--ext/standard/tests/strings/htmlentities09.phpt20
-rw-r--r--ext/standard/tests/strings/htmlentities10.phpt16
-rw-r--r--ext/standard/tests/strings/htmlentities11.phpt14
-rw-r--r--ext/standard/tests/strings/htmlentities12.phpt14
-rw-r--r--ext/standard/tests/strings/htmlentities13.phpt17
-rw-r--r--ext/standard/tests/strings/htmlentities14.phpt17
-rw-r--r--ext/standard/tests/strings/htmlentities15.phpt25
-rw-r--r--ext/standard/tests/strings/htmlentities16.phpt21
-rw-r--r--ext/standard/tests/strings/htmlentities17.phpt47
-rw-r--r--ext/standard/tests/strings/htmlentities18.phpt43
-rw-r--r--ext/standard/tests/strings/htmlentities19.phpt30
-rw-r--r--ext/standard/tests/strings/htmlentities20.phpt199
-rw-r--r--ext/standard/tests/strings/htmlentities21.phpt198
-rw-r--r--ext/standard/tests/strings/htmlentities22.phpt283
-rw-r--r--ext/standard/tests/strings/htmlentities23.phpt95
-rw-r--r--ext/standard/tests/strings/htmlentities24.phpt331
-rw-r--r--ext/standard/tests/strings/htmlentities_html4.phpt313
-rw-r--r--ext/standard/tests/strings/htmlentities_html5.phpt1623
-rw-r--r--ext/standard/tests/strings/htmlspecialchars.phpt331
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_basic.phpt97
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt42
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_error.phpt37
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt161
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt191
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt99
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt65
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt76
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation6.phptbin0 -> 1523 bytes
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation7.phpt192
-rw-r--r--ext/standard/tests/strings/http_build_query.phpt15
-rw-r--r--ext/standard/tests/strings/http_build_query_error.phpt13
-rw-r--r--ext/standard/tests/strings/http_build_query_variation1.phpt30
-rw-r--r--ext/standard/tests/strings/http_build_query_variation2.phpt39
-rw-r--r--ext/standard/tests/strings/http_build_query_variation3.phpt27
-rw-r--r--ext/standard/tests/strings/implode.phpt23
-rw-r--r--ext/standard/tests/strings/implode1.phptbin0 -> 5876 bytes
-rw-r--r--ext/standard/tests/strings/join_basic.phpt43
-rw-r--r--ext/standard/tests/strings/join_error.phpt50
-rw-r--r--ext/standard/tests/strings/join_variation1.phpt167
-rw-r--r--ext/standard/tests/strings/join_variation2.phpt198
-rw-r--r--ext/standard/tests/strings/join_variation3.phpt99
-rw-r--r--ext/standard/tests/strings/join_variation4.phptbin0 -> 2213 bytes
-rw-r--r--ext/standard/tests/strings/join_variation5.phpt50
-rw-r--r--ext/standard/tests/strings/join_variation6.phptbin0 -> 729 bytes
-rw-r--r--ext/standard/tests/strings/lcfirst.phptbin0 -> 6877 bytes
-rw-r--r--ext/standard/tests/strings/levenshtein.phpt86
-rw-r--r--ext/standard/tests/strings/ltrim.phpt83
-rw-r--r--ext/standard/tests/strings/ltrim_basic.phpt53
-rw-r--r--ext/standard/tests/strings/ltrim_error.phpt61
-rw-r--r--ext/standard/tests/strings/ltrim_variation1.phpt138
-rw-r--r--ext/standard/tests/strings/ltrim_variation2.phpt138
-rw-r--r--ext/standard/tests/strings/md5.phpt20
-rw-r--r--ext/standard/tests/strings/md5_basic1.phpt17
-rw-r--r--ext/standard/tests/strings/md5_basic2.phpt30
-rw-r--r--ext/standard/tests/strings/md5_error.phpt35
-rw-r--r--ext/standard/tests/strings/md5_file.phptbin0 -> 2849 bytes
-rw-r--r--ext/standard/tests/strings/md5raw.phpt20
-rw-r--r--ext/standard/tests/strings/metaphone.phpt41
-rw-r--r--ext/standard/tests/strings/money_format_basic1.phpt80
-rw-r--r--ext/standard/tests/strings/money_format_error.phpt55
-rw-r--r--ext/standard/tests/strings/money_format_variation1.phpt172
-rw-r--r--ext/standard/tests/strings/money_format_variation2.phpt180
-rw-r--r--ext/standard/tests/strings/moneyformat.phpt23
-rw-r--r--ext/standard/tests/strings/nl2br.phpt45
-rw-r--r--ext/standard/tests/strings/nl2br_error.phpt34
-rw-r--r--ext/standard/tests/strings/nl2br_variation1.phpt80
-rw-r--r--ext/standard/tests/strings/nl2br_variation2.phpt70
-rw-r--r--ext/standard/tests/strings/nl2br_variation3.phpt64
-rw-r--r--ext/standard/tests/strings/nl2br_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/nl2br_variation5.phpt152
-rw-r--r--ext/standard/tests/strings/nl_langinfo_basic.phpt37
-rw-r--r--ext/standard/tests/strings/nl_langinfo_error1.phpt40
-rw-r--r--ext/standard/tests/strings/nl_langinfo_variation1.phpt104
-rw-r--r--ext/standard/tests/strings/number_format_basic.phpt109
-rw-r--r--ext/standard/tests/strings/number_format_error.phpt38
-rw-r--r--ext/standard/tests/strings/ord_basic.phpt47
-rw-r--r--ext/standard/tests/strings/ord_error.phpt34
-rw-r--r--ext/standard/tests/strings/ord_variation1.phpt136
-rw-r--r--ext/standard/tests/strings/pack.phpt385
-rw-r--r--ext/standard/tests/strings/parse_str_basic1.phpt76
-rw-r--r--ext/standard/tests/strings/parse_str_basic2.phpt26
-rw-r--r--ext/standard/tests/strings/parse_str_basic3.phptbin0 -> 5141 bytes
-rw-r--r--ext/standard/tests/strings/parse_str_basic4.phpt87
-rw-r--r--ext/standard/tests/strings/parse_str_error1.phpt32
-rw-r--r--ext/standard/tests/strings/pathinfo.phpt108
-rw-r--r--ext/standard/tests/strings/php_strip_whitespace.phpt52
-rw-r--r--ext/standard/tests/strings/print_basic.phpt92
-rw-r--r--ext/standard/tests/strings/print_variation1.phpt156
-rw-r--r--ext/standard/tests/strings/printf.phpt699
-rw-r--r--ext/standard/tests/strings/printf_64bit.phpt699
-rw-r--r--ext/standard/tests/strings/printf_basic1.phpt62
-rw-r--r--ext/standard/tests/strings/printf_basic2.phpt62
-rw-r--r--ext/standard/tests/strings/printf_basic3.phpt82
-rw-r--r--ext/standard/tests/strings/printf_basic4.phpt61
-rw-r--r--ext/standard/tests/strings/printf_basic5.phpt61
-rw-r--r--ext/standard/tests/strings/printf_basic6.phpt60
-rw-r--r--ext/standard/tests/strings/printf_basic7.phpt68
-rw-r--r--ext/standard/tests/strings/printf_basic8.phpt67
-rw-r--r--ext/standard/tests/strings/printf_basic9.phpt83
-rw-r--r--ext/standard/tests/strings/printf_error.phpt70
-rw-r--r--ext/standard/tests/strings/printf_variation1.phpt354
-rw-r--r--ext/standard/tests/strings/printf_variation2.phpt281
-rw-r--r--ext/standard/tests/strings/quoted_printable_decode_basic.phpt25
-rw-r--r--ext/standard/tests/strings/quoted_printable_decode_error.phpt38
-rw-r--r--ext/standard/tests/strings/quoted_printable_decode_variation1.phpt191
-rw-r--r--ext/standard/tests/strings/quoted_printable_encode_001.phpt33
-rw-r--r--ext/standard/tests/strings/quoted_printable_encode_002.phptbin0 -> 7292 bytes
-rw-r--r--ext/standard/tests/strings/quotemeta_basic.phpt23
-rw-r--r--ext/standard/tests/strings/quotemeta_error.phpt34
-rw-r--r--ext/standard/tests/strings/rtrim.phptbin0 -> 2446 bytes
-rw-r--r--ext/standard/tests/strings/rtrim_basic.phpt54
-rw-r--r--ext/standard/tests/strings/rtrim_error.phpt61
-rw-r--r--ext/standard/tests/strings/rtrim_variation1.phpt138
-rw-r--r--ext/standard/tests/strings/rtrim_variation2.phpt138
-rw-r--r--ext/standard/tests/strings/setlocale_basic1.phpt124
-rw-r--r--ext/standard/tests/strings/setlocale_basic2.phpt129
-rw-r--r--ext/standard/tests/strings/setlocale_basic3.phpt103
-rw-r--r--ext/standard/tests/strings/setlocale_error.phpt69
-rw-r--r--ext/standard/tests/strings/setlocale_variation1.phpt102
-rw-r--r--ext/standard/tests/strings/setlocale_variation2.phpt94
-rw-r--r--ext/standard/tests/strings/setlocale_variation3.phpt159
-rw-r--r--ext/standard/tests/strings/setlocale_variation4.phpt157
-rw-r--r--ext/standard/tests/strings/setlocale_variation5.phpt161
-rw-r--r--ext/standard/tests/strings/sha1.phpt51
-rw-r--r--ext/standard/tests/strings/sha1_basic.phpt70
-rw-r--r--ext/standard/tests/strings/sha1_error.phpt35
-rw-r--r--ext/standard/tests/strings/sha1_file.phpt119
-rw-r--r--ext/standard/tests/strings/sha1_variation1.phpt157
-rw-r--r--ext/standard/tests/strings/sha1_variation2.phpt160
-rw-r--r--ext/standard/tests/strings/sha1raw.phpt14
-rw-r--r--ext/standard/tests/strings/show_source_basic.phpt27
-rw-r--r--ext/standard/tests/strings/show_source_variation1.phpt28
-rw-r--r--ext/standard/tests/strings/show_source_variation2.phpt27
-rw-r--r--ext/standard/tests/strings/similar_text_basic.phpt39
-rw-r--r--ext/standard/tests/strings/similar_text_error.phpt29
-rw-r--r--ext/standard/tests/strings/soundex.phpt55
-rw-r--r--ext/standard/tests/strings/soundex_basic.phpt46
-rw-r--r--ext/standard/tests/strings/soundex_error.phpt34
-rw-r--r--ext/standard/tests/strings/sprintf_basic1.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic2.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic3.phpt53
-rw-r--r--ext/standard/tests/strings/sprintf_basic4.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic5.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic6.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic7.phpt48
-rw-r--r--ext/standard/tests/strings/sprintf_basic7_64bit.phpt44
-rw-r--r--ext/standard/tests/strings/sprintf_basic8.phpt47
-rw-r--r--ext/standard/tests/strings/sprintf_basic8_64bit.phpt43
-rw-r--r--ext/standard/tests/strings/sprintf_basic9.phpt54
-rw-r--r--ext/standard/tests/strings/sprintf_error.phpt64
-rw-r--r--ext/standard/tests/strings/sprintf_f.phpt40
-rw-r--r--ext/standard/tests/strings/sprintf_f_2.phpt116
-rw-r--r--ext/standard/tests/strings/sprintf_f_3.phpt23
-rw-r--r--ext/standard/tests/strings/sprintf_variation1.phpt270
-rw-r--r--ext/standard/tests/strings/sprintf_variation10.phpt327
-rw-r--r--ext/standard/tests/strings/sprintf_variation11.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation12.phpt263
-rw-r--r--ext/standard/tests/strings/sprintf_variation13.phpt358
-rw-r--r--ext/standard/tests/strings/sprintf_variation14.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation15.phptbin0 -> 7416 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation16.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation17.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation18.phpt232
-rw-r--r--ext/standard/tests/strings/sprintf_variation19.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation2.phpt221
-rw-r--r--ext/standard/tests/strings/sprintf_variation20.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation21.phptbin0 -> 5046 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation22.phptbin0 -> 2517 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation23.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation24.phptbin0 -> 3464 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation25.phptbin0 -> 4657 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation26.phptbin0 -> 1699 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation27.phptbin0 -> 2693 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation28.phpt332
-rw-r--r--ext/standard/tests/strings/sprintf_variation28_64bit.phpt328
-rw-r--r--ext/standard/tests/strings/sprintf_variation29.phpt172
-rw-r--r--ext/standard/tests/strings/sprintf_variation29_64bit.phpt168
-rw-r--r--ext/standard/tests/strings/sprintf_variation3.phpt325
-rw-r--r--ext/standard/tests/strings/sprintf_variation30.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation31.phpt246
-rw-r--r--ext/standard/tests/strings/sprintf_variation32.phpt342
-rw-r--r--ext/standard/tests/strings/sprintf_variation33.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation34.phpt332
-rw-r--r--ext/standard/tests/strings/sprintf_variation34_64bit.phpt328
-rw-r--r--ext/standard/tests/strings/sprintf_variation35.phpt237
-rw-r--r--ext/standard/tests/strings/sprintf_variation35_64bit.phpt233
-rw-r--r--ext/standard/tests/strings/sprintf_variation36.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation37.phpt230
-rw-r--r--ext/standard/tests/strings/sprintf_variation38.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation39.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation4.phpt237
-rw-r--r--ext/standard/tests/strings/sprintf_variation40.phpt333
-rw-r--r--ext/standard/tests/strings/sprintf_variation40_64bit.phpt329
-rw-r--r--ext/standard/tests/strings/sprintf_variation41.phpt316
-rw-r--r--ext/standard/tests/strings/sprintf_variation41_64bit.phpt312
-rw-r--r--ext/standard/tests/strings/sprintf_variation42.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation43.phpt262
-rw-r--r--ext/standard/tests/strings/sprintf_variation44.phpt365
-rw-r--r--ext/standard/tests/strings/sprintf_variation44_64bit.phpt361
-rw-r--r--ext/standard/tests/strings/sprintf_variation45.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation46.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation47.phpt343
-rw-r--r--ext/standard/tests/strings/sprintf_variation48.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation49.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation4_64bit.phpt233
-rw-r--r--ext/standard/tests/strings/sprintf_variation5.phpt73
-rw-r--r--ext/standard/tests/strings/sprintf_variation50.phpt343
-rw-r--r--ext/standard/tests/strings/sprintf_variation51.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation52.phpt65
-rw-r--r--ext/standard/tests/strings/sprintf_variation53.phpt70
-rw-r--r--ext/standard/tests/strings/sprintf_variation6.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation7.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation8.phpt374
-rw-r--r--ext/standard/tests/strings/sprintf_variation9.phpt519
-rw-r--r--ext/standard/tests/strings/sscanf_basic1.phpt44
-rw-r--r--ext/standard/tests/strings/sscanf_basic2.phpt44
-rw-r--r--ext/standard/tests/strings/sscanf_basic3.phpt43
-rw-r--r--ext/standard/tests/strings/sscanf_basic4.phpt43
-rw-r--r--ext/standard/tests/strings/sscanf_basic5.phpt58
-rw-r--r--ext/standard/tests/strings/sscanf_basic6.phpt53
-rw-r--r--ext/standard/tests/strings/sscanf_basic7.phpt47
-rw-r--r--ext/standard/tests/strings/sscanf_basic8.phpt65
-rw-r--r--ext/standard/tests/strings/sscanf_error.phpt44
-rw-r--r--ext/standard/tests/strings/sscanf_variation1.phpt169
-rw-r--r--ext/standard/tests/strings/sscanf_variation2.phpt153
-rw-r--r--ext/standard/tests/strings/str_getcsv_001.phpt115
-rw-r--r--ext/standard/tests/strings/str_ireplace.phpt101
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin0 -> 9818 bytes
-rw-r--r--ext/standard/tests/strings/str_pad_variation1.phpt140
-rw-r--r--ext/standard/tests/strings/str_pad_variation2.phpt139
-rw-r--r--ext/standard/tests/strings/str_pad_variation3.phpt153
-rw-r--r--ext/standard/tests/strings/str_pad_variation4.phpt168
-rw-r--r--ext/standard/tests/strings/str_pad_variation5.phpt34
-rw-r--r--ext/standard/tests/strings/str_repeat.phptbin0 -> 16786 bytes
-rw-r--r--ext/standard/tests/strings/str_replace.phpt957
-rw-r--r--ext/standard/tests/strings/str_replace_basic.phpt49
-rw-r--r--ext/standard/tests/strings/str_replace_error.phpt41
-rw-r--r--ext/standard/tests/strings/str_replace_variation1.phpt392
-rw-r--r--ext/standard/tests/strings/str_replace_variation2.phptbin0 -> 12679 bytes
-rw-r--r--ext/standard/tests/strings/str_replace_variation3.phpt227
-rw-r--r--ext/standard/tests/strings/str_rot13_basic.phpt55
-rw-r--r--ext/standard/tests/strings/str_rot13_error.phpt32
-rw-r--r--ext/standard/tests/strings/str_shuffle.phpt12
-rw-r--r--ext/standard/tests/strings/str_shuffle_basic.phpt59
-rw-r--r--ext/standard/tests/strings/str_shuffle_error.phpt33
-rw-r--r--ext/standard/tests/strings/str_shuffle_variation1.phpt135
-rw-r--r--ext/standard/tests/strings/str_split_basic.phpt91
-rw-r--r--ext/standard/tests/strings/str_split_error.phpt38
-rw-r--r--ext/standard/tests/strings/str_split_variation1.phpt241
-rw-r--r--ext/standard/tests/strings/str_split_variation2.phpt290
-rw-r--r--ext/standard/tests/strings/str_split_variation2_64bit.phpt291
-rw-r--r--ext/standard/tests/strings/str_split_variation3.phptbin0 -> 3006 bytes
-rw-r--r--ext/standard/tests/strings/str_split_variation4.phpt196
-rw-r--r--ext/standard/tests/strings/str_split_variation5.phpt176
-rw-r--r--ext/standard/tests/strings/str_split_variation6.phpt166
-rw-r--r--ext/standard/tests/strings/str_split_variation6_64bit.phpt167
-rw-r--r--ext/standard/tests/strings/str_split_variation7.phpt144
-rw-r--r--ext/standard/tests/strings/str_split_variation7_64bit.phpt145
-rw-r--r--ext/standard/tests/strings/str_word_count.phpt249
-rw-r--r--ext/standard/tests/strings/str_word_count1.phpt26
-rw-r--r--ext/standard/tests/strings/strcasecmp.phptbin0 -> 22268 bytes
-rw-r--r--ext/standard/tests/strings/strcmp.phptbin0 -> 20034 bytes
-rw-r--r--ext/standard/tests/strings/strcoll.phpt21
-rw-r--r--ext/standard/tests/strings/strcoll_error.phpt44
-rw-r--r--ext/standard/tests/strings/strcspn.phpt20
-rw-r--r--ext/standard/tests/strings/strcspn_basic.phpt41
-rw-r--r--ext/standard/tests/strings/strcspn_error.phpt57
-rw-r--r--ext/standard/tests/strings/strcspn_variation1.phpt273
-rw-r--r--ext/standard/tests/strings/strcspn_variation10.phpt272
-rw-r--r--ext/standard/tests/strings/strcspn_variation11.phpt1306
-rw-r--r--ext/standard/tests/strings/strcspn_variation12.phpt2482
-rw-r--r--ext/standard/tests/strings/strcspn_variation2.phpt272
-rw-r--r--ext/standard/tests/strings/strcspn_variation3.phpt243
-rw-r--r--ext/standard/tests/strings/strcspn_variation4.phpt196
-rw-r--r--ext/standard/tests/strings/strcspn_variation5.phptbin0 -> 2421 bytes
-rw-r--r--ext/standard/tests/strings/strcspn_variation6.phpt177
-rw-r--r--ext/standard/tests/strings/strcspn_variation7.phpt612
-rw-r--r--ext/standard/tests/strings/strcspn_variation8.phpt1892
-rw-r--r--ext/standard/tests/strings/strcspn_variation9.phptbin0 -> 2539 bytes
-rw-r--r--ext/standard/tests/strings/strings001.phpt12
-rw-r--r--ext/standard/tests/strings/strip_tags.phpt27
-rw-r--r--ext/standard/tests/strings/strip_tags_basic1.phpt75
-rw-r--r--ext/standard/tests/strings/strip_tags_basic2.phpt61
-rw-r--r--ext/standard/tests/strings/strip_tags_error.phpt40
-rw-r--r--ext/standard/tests/strings/strip_tags_variation1.phpt159
-rw-r--r--ext/standard/tests/strings/strip_tags_variation10.phpt55
-rw-r--r--ext/standard/tests/strings/strip_tags_variation11.phpt41
-rw-r--r--ext/standard/tests/strings/strip_tags_variation2.phpt159
-rw-r--r--ext/standard/tests/strings/strip_tags_variation3.phpt159
-rw-r--r--ext/standard/tests/strings/strip_tags_variation4.phpt74
-rw-r--r--ext/standard/tests/strings/strip_tags_variation5.phpt104
-rw-r--r--ext/standard/tests/strings/strip_tags_variation6.phpt47
-rw-r--r--ext/standard/tests/strings/strip_tags_variation7.phpt72
-rw-r--r--ext/standard/tests/strings/strip_tags_variation8.phpt59
-rw-r--r--ext/standard/tests/strings/strip_tags_variation9.phpt54
-rw-r--r--ext/standard/tests/strings/stripcslashes_basic.phpt28
-rw-r--r--ext/standard/tests/strings/stripcslashes_error.phpt34
-rw-r--r--ext/standard/tests/strings/stripcslashes_variation1.phpt173
-rw-r--r--ext/standard/tests/strings/stripos.phpt55
-rw-r--r--ext/standard/tests/strings/stripos_basic1.phpt48
-rw-r--r--ext/standard/tests/strings/stripos_basic2.phpt52
-rw-r--r--ext/standard/tests/strings/stripos_error.phpt35
-rw-r--r--ext/standard/tests/strings/stripos_variation1.phpt218
-rw-r--r--ext/standard/tests/strings/stripos_variation10.phpt188
-rw-r--r--ext/standard/tests/strings/stripos_variation11.phpt215
-rw-r--r--ext/standard/tests/strings/stripos_variation12.phpt47
-rw-r--r--ext/standard/tests/strings/stripos_variation13.phpt49
-rw-r--r--ext/standard/tests/strings/stripos_variation14.phpt155
-rw-r--r--ext/standard/tests/strings/stripos_variation15.phpt171
-rw-r--r--ext/standard/tests/strings/stripos_variation2.phpt226
-rw-r--r--ext/standard/tests/strings/stripos_variation3.phpt37
-rw-r--r--ext/standard/tests/strings/stripos_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/stripos_variation5.phpt34
-rw-r--r--ext/standard/tests/strings/stripos_variation6.phpt35
-rw-r--r--ext/standard/tests/strings/stripos_variation7.phpt34
-rw-r--r--ext/standard/tests/strings/stripos_variation8.phpt216
-rw-r--r--ext/standard/tests/strings/stripos_variation9.phpt184
-rw-r--r--ext/standard/tests/strings/stripslashes_basic.phptbin0 -> 2036 bytes
-rw-r--r--ext/standard/tests/strings/stripslashes_error.phpt43
-rw-r--r--ext/standard/tests/strings/stripslashes_variation1.phpt172
-rw-r--r--ext/standard/tests/strings/stripslashes_variation2.phptbin0 -> 9548 bytes
-rw-r--r--ext/standard/tests/strings/stripslashes_variation3.phpt124
-rw-r--r--ext/standard/tests/strings/stripslashes_variation4.phpt133
-rw-r--r--ext/standard/tests/strings/stristr.phpt43
-rw-r--r--ext/standard/tests/strings/stristr2.phpt25
-rw-r--r--ext/standard/tests/strings/stristr_basic.phpt36
-rw-r--r--ext/standard/tests/strings/stristr_error.phpt60
-rw-r--r--ext/standard/tests/strings/stristr_variation1.phpt133
-rw-r--r--ext/standard/tests/strings/stristr_variation2.phpt135
-rw-r--r--ext/standard/tests/strings/strlen.phptbin0 -> 7090 bytes
-rw-r--r--ext/standard/tests/strings/strlen_basic.phpt24
-rw-r--r--ext/standard/tests/strings/strlen_error.phpt33
-rw-r--r--ext/standard/tests/strings/strlen_variation1.phpt137
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_basic.phpt51
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_error.phpt33
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_variation1.phpt56
-rw-r--r--ext/standard/tests/strings/strnatcmp_basic.phpt80
-rw-r--r--ext/standard/tests/strings/strnatcmp_error.phpt34
-rw-r--r--ext/standard/tests/strings/strncasecmp_basic.phpt46
-rw-r--r--ext/standard/tests/strings/strncasecmp_error.phpt52
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation1.phpt135
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation10.phpt188
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation11.phpt189
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation2.phpt63
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation3.phpt39
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation4.phpt189
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation5.phpt163
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation6.phpt810
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation7.phpt27
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation8.phpt52
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation9.phpt92
-rw-r--r--ext/standard/tests/strings/strncmp_basic.phpt46
-rw-r--r--ext/standard/tests/strings/strncmp_error.phpt45
-rw-r--r--ext/standard/tests/strings/strncmp_variation1.phpt135
-rw-r--r--ext/standard/tests/strings/strncmp_variation2.phpt63
-rw-r--r--ext/standard/tests/strings/strncmp_variation3.phpt39
-rw-r--r--ext/standard/tests/strings/strncmp_variation4.phpt192
-rw-r--r--ext/standard/tests/strings/strncmp_variation5.phpt177
-rw-r--r--ext/standard/tests/strings/strncmp_variation6.phpt811
-rw-r--r--ext/standard/tests/strings/strncmp_variation7.phpt24
-rw-r--r--ext/standard/tests/strings/strncmp_variation8.phpt52
-rw-r--r--ext/standard/tests/strings/strncmp_variation9.phpt61
-rw-r--r--ext/standard/tests/strings/strpbrk_basic.phpt41
-rw-r--r--ext/standard/tests/strings/strpbrk_error.phpt57
-rw-r--r--ext/standard/tests/strings/strpos.phptbin0 -> 9981 bytes
-rw-r--r--ext/standard/tests/strings/strpos_number.phpt15
-rw-r--r--ext/standard/tests/strings/strrchr.phpt22
-rw-r--r--ext/standard/tests/strings/strrchr_basic.phpt57
-rw-r--r--ext/standard/tests/strings/strrchr_error.phpt40
-rw-r--r--ext/standard/tests/strings/strrchr_variation1.phptbin0 -> 4406 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation10.phpt200
-rw-r--r--ext/standard/tests/strings/strrchr_variation11.phpt159
-rw-r--r--ext/standard/tests/strings/strrchr_variation12.phptbin0 -> 1128 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation2.phpt220
-rw-r--r--ext/standard/tests/strings/strrchr_variation3.phpt43
-rw-r--r--ext/standard/tests/strings/strrchr_variation4.phpt58
-rw-r--r--ext/standard/tests/strings/strrchr_variation5.phpt50
-rw-r--r--ext/standard/tests/strings/strrchr_variation6.phpt45
-rw-r--r--ext/standard/tests/strings/strrchr_variation7.phpt44
-rw-r--r--ext/standard/tests/strings/strrchr_variation8.phpt41
-rw-r--r--ext/standard/tests/strings/strrchr_variation9.phpt198
-rw-r--r--ext/standard/tests/strings/strrev.phpt19
-rw-r--r--ext/standard/tests/strings/strrev_basic.phpt47
-rw-r--r--ext/standard/tests/strings/strrev_error.phpt27
-rw-r--r--ext/standard/tests/strings/strrev_variation1.phptbin0 -> 2941 bytes
-rw-r--r--ext/standard/tests/strings/strrev_variation2.phptbin0 -> 2955 bytes
-rw-r--r--ext/standard/tests/strings/strrev_variation3.phptbin0 -> 1628 bytes
-rw-r--r--ext/standard/tests/strings/strrev_variation4.phpt182
-rw-r--r--ext/standard/tests/strings/strripos.phpt33
-rw-r--r--ext/standard/tests/strings/strripos_basic1.phpt51
-rw-r--r--ext/standard/tests/strings/strripos_basic2.phpt64
-rw-r--r--ext/standard/tests/strings/strripos_error.phpt34
-rw-r--r--ext/standard/tests/strings/strripos_offset.phpt45
-rw-r--r--ext/standard/tests/strings/strripos_variation1.phpt254
-rw-r--r--ext/standard/tests/strings/strripos_variation2.phpt260
-rw-r--r--ext/standard/tests/strings/strripos_variation3.phpt59
-rw-r--r--ext/standard/tests/strings/strripos_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/strripos_variation5.phpt34
-rw-r--r--ext/standard/tests/strings/strrpos.phpt32
-rw-r--r--ext/standard/tests/strings/strrpos_basic1.phpt45
-rw-r--r--ext/standard/tests/strings/strrpos_basic2.phpt50
-rw-r--r--ext/standard/tests/strings/strrpos_error.phpt34
-rw-r--r--ext/standard/tests/strings/strrpos_offset.phpt41
-rw-r--r--ext/standard/tests/strings/strrpos_variation1.phpt182
-rw-r--r--ext/standard/tests/strings/strrpos_variation10.phpt162
-rw-r--r--ext/standard/tests/strings/strrpos_variation11.phpt199
-rw-r--r--ext/standard/tests/strings/strrpos_variation12.phpt47
-rw-r--r--ext/standard/tests/strings/strrpos_variation13.phpt49
-rw-r--r--ext/standard/tests/strings/strrpos_variation14.phpt153
-rw-r--r--ext/standard/tests/strings/strrpos_variation15.phpt171
-rw-r--r--ext/standard/tests/strings/strrpos_variation2.phpt186
-rw-r--r--ext/standard/tests/strings/strrpos_variation3.phpt37
-rw-r--r--ext/standard/tests/strings/strrpos_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/strrpos_variation5.phpt34
-rw-r--r--ext/standard/tests/strings/strrpos_variation6.phpt35
-rw-r--r--ext/standard/tests/strings/strrpos_variation7.phpt32
-rw-r--r--ext/standard/tests/strings/strrpos_variation8.phpt59
-rw-r--r--ext/standard/tests/strings/strrpos_variation9.phpt184
-rw-r--r--ext/standard/tests/strings/strspn.phpt18
-rw-r--r--ext/standard/tests/strings/strspn_basic.phpt41
-rw-r--r--ext/standard/tests/strings/strspn_error.phpt57
-rw-r--r--ext/standard/tests/strings/strspn_variation1.phpt273
-rw-r--r--ext/standard/tests/strings/strspn_variation10.phpt274
-rw-r--r--ext/standard/tests/strings/strspn_variation11.phpt1306
-rw-r--r--ext/standard/tests/strings/strspn_variation12.phpt2878
-rw-r--r--ext/standard/tests/strings/strspn_variation2.phpt272
-rw-r--r--ext/standard/tests/strings/strspn_variation3.phpt243
-rw-r--r--ext/standard/tests/strings/strspn_variation4.phpt196
-rw-r--r--ext/standard/tests/strings/strspn_variation5.phptbin0 -> 2415 bytes
-rw-r--r--ext/standard/tests/strings/strspn_variation6.phpt179
-rw-r--r--ext/standard/tests/strings/strspn_variation7.phpt612
-rw-r--r--ext/standard/tests/strings/strspn_variation8.phpt1894
-rw-r--r--ext/standard/tests/strings/strspn_variation9.phptbin0 -> 2538 bytes
-rw-r--r--ext/standard/tests/strings/strstr.phptbin0 -> 10539 bytes
-rw-r--r--ext/standard/tests/strings/strstr2.phpt40
-rw-r--r--ext/standard/tests/strings/strtok_basic.phpt63
-rw-r--r--ext/standard/tests/strings/strtok_error.phpt55
-rw-r--r--ext/standard/tests/strings/strtok_variation1.phpt174
-rw-r--r--ext/standard/tests/strings/strtok_variation2.phpt174
-rw-r--r--ext/standard/tests/strings/strtok_variation3.phpt150
-rw-r--r--ext/standard/tests/strings/strtok_variation4.phpt110
-rw-r--r--ext/standard/tests/strings/strtok_variation5.phpt150
-rw-r--r--ext/standard/tests/strings/strtok_variation6.phpt160
-rw-r--r--ext/standard/tests/strings/strtok_variation7.phpt108
-rw-r--r--ext/standard/tests/strings/strtolower-win32.phptbin0 -> 4878 bytes
-rw-r--r--ext/standard/tests/strings/strtolower.phptbin0 -> 3889 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper.phpt20
-rw-r--r--ext/standard/tests/strings/strtoupper1-win32.phptbin0 -> 4889 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1.phptbin0 -> 3900 bytes
-rw-r--r--ext/standard/tests/strings/strtr.phpt10
-rw-r--r--ext/standard/tests/strings/strtr_basic.phpt54
-rw-r--r--ext/standard/tests/strings/strtr_error.phpt41
-rw-r--r--ext/standard/tests/strings/strtr_variation1.phpt86
-rw-r--r--ext/standard/tests/strings/strtr_variation2.phpt90
-rw-r--r--ext/standard/tests/strings/strtr_variation3.phpt103
-rw-r--r--ext/standard/tests/strings/strtr_variation4.phpt79
-rw-r--r--ext/standard/tests/strings/strtr_variation5.phpt139
-rw-r--r--ext/standard/tests/strings/strtr_variation6.phpt136
-rw-r--r--ext/standard/tests/strings/strtr_variation7.phpt158
-rw-r--r--ext/standard/tests/strings/strtr_variation8.phpt179
-rw-r--r--ext/standard/tests/strings/strtr_variation9.phpt225
-rw-r--r--ext/standard/tests/strings/strval.phpt26
-rw-r--r--ext/standard/tests/strings/strval_basic.phpt77
-rw-r--r--ext/standard/tests/strings/strval_error.phpt51
-rw-r--r--ext/standard/tests/strings/strval_variation1.phpt190
-rw-r--r--ext/standard/tests/strings/strval_variation2.phpt82
-rw-r--r--ext/standard/tests/strings/substr.phptbin0 -> 4770 bytes
-rw-r--r--ext/standard/tests/strings/substr_compare.phpt41
-rw-r--r--ext/standard/tests/strings/substr_count_basic.phpt33
-rw-r--r--ext/standard/tests/strings/substr_count_error.phpt65
-rw-r--r--ext/standard/tests/strings/substr_count_variation_001.phpt99
-rw-r--r--ext/standard/tests/strings/substr_count_variation_002.phpt53
-rw-r--r--ext/standard/tests/strings/substr_replace.phpt810
-rw-r--r--ext/standard/tests/strings/substr_replace_array.phpt19
-rw-r--r--ext/standard/tests/strings/substr_replace_error.phpt70
-rw-r--r--ext/standard/tests/strings/trim.phpt27
-rw-r--r--ext/standard/tests/strings/trim1.phptbin0 -> 2046 bytes
-rw-r--r--ext/standard/tests/strings/trim_basic.phpt45
-rw-r--r--ext/standard/tests/strings/trim_error.phpt61
-rw-r--r--ext/standard/tests/strings/trim_variation1.phpt138
-rw-r--r--ext/standard/tests/strings/trim_variation2.phpt138
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin0 -> 6105 bytes
-rw-r--r--ext/standard/tests/strings/ucwords_basic.phpt83
-rw-r--r--ext/standard/tests/strings/ucwords_error.phpt41
-rw-r--r--ext/standard/tests/strings/ucwords_variation1.phpt201
-rw-r--r--ext/standard/tests/strings/ucwords_variation2.phpt96
-rw-r--r--ext/standard/tests/strings/ucwords_variation3.phpt97
-rw-r--r--ext/standard/tests/strings/ucwords_variation4.phpt124
-rw-r--r--ext/standard/tests/strings/unpack.phpt11
-rw-r--r--ext/standard/tests/strings/unpack_error.phpt42
-rw-r--r--ext/standard/tests/strings/url_t.phpt712
-rw-r--r--ext/standard/tests/strings/uuencode.phpt40
-rw-r--r--ext/standard/tests/strings/vfprintf_basic.phpt71
-rw-r--r--ext/standard/tests/strings/vfprintf_basic1.phpt49
-rw-r--r--ext/standard/tests/strings/vfprintf_basic2.phpt53
-rw-r--r--ext/standard/tests/strings/vfprintf_basic3.phpt64
-rw-r--r--ext/standard/tests/strings/vfprintf_basic4.phpt47
-rw-r--r--ext/standard/tests/strings/vfprintf_basic5.phpt48
-rw-r--r--ext/standard/tests/strings/vfprintf_basic6.phpt49
-rw-r--r--ext/standard/tests/strings/vfprintf_basic7.phpt53
-rw-r--r--ext/standard/tests/strings/vfprintf_basic7_64bit.phpt51
-rw-r--r--ext/standard/tests/strings/vfprintf_basic8.phpt46
-rw-r--r--ext/standard/tests/strings/vfprintf_basic9.phpt60
-rw-r--r--ext/standard/tests/strings/vfprintf_error1.phpt46
-rw-r--r--ext/standard/tests/strings/vfprintf_error2.phpt48
-rw-r--r--ext/standard/tests/strings/vfprintf_error3.phpt54
-rw-r--r--ext/standard/tests/strings/vfprintf_error4.phpt43
-rw-r--r--ext/standard/tests/strings/vfprintf_variation1.phpt86
-rw-r--r--ext/standard/tests/strings/vfprintf_variation10.phptbin0 -> 2963 bytes
-rw-r--r--ext/standard/tests/strings/vfprintf_variation11.phpt88
-rw-r--r--ext/standard/tests/strings/vfprintf_variation11_64bit.phpt88
-rw-r--r--ext/standard/tests/strings/vfprintf_variation12.phpt125
-rw-r--r--ext/standard/tests/strings/vfprintf_variation12_64bit.phpt125
-rw-r--r--ext/standard/tests/strings/vfprintf_variation13.phpt88
-rw-r--r--ext/standard/tests/strings/vfprintf_variation13_64bit.phpt88
-rw-r--r--ext/standard/tests/strings/vfprintf_variation14.phpt125
-rw-r--r--ext/standard/tests/strings/vfprintf_variation14_64bit.phpt125
-rw-r--r--ext/standard/tests/strings/vfprintf_variation15.phpt75
-rw-r--r--ext/standard/tests/strings/vfprintf_variation15_64bit.phpt75
-rw-r--r--ext/standard/tests/strings/vfprintf_variation16.phpt112
-rw-r--r--ext/standard/tests/strings/vfprintf_variation16_64bit.phpt112
-rw-r--r--ext/standard/tests/strings/vfprintf_variation17.phpt70
-rw-r--r--ext/standard/tests/strings/vfprintf_variation18.phpt107
-rw-r--r--ext/standard/tests/strings/vfprintf_variation19.phpt94
-rw-r--r--ext/standard/tests/strings/vfprintf_variation19_64bit.phpt94
-rw-r--r--ext/standard/tests/strings/vfprintf_variation20.phpt175
-rw-r--r--ext/standard/tests/strings/vfprintf_variation21.phpt168
-rw-r--r--ext/standard/tests/strings/vfprintf_variation3.phpt87
-rw-r--r--ext/standard/tests/strings/vfprintf_variation4.phpt113
-rw-r--r--ext/standard/tests/strings/vfprintf_variation4_64bit.phpt113
-rw-r--r--ext/standard/tests/strings/vfprintf_variation5.phpt86
-rw-r--r--ext/standard/tests/strings/vfprintf_variation6.phpt108
-rw-r--r--ext/standard/tests/strings/vfprintf_variation7.phptbin0 -> 2391 bytes
-rw-r--r--ext/standard/tests/strings/vfprintf_variation8.phpt111
-rw-r--r--ext/standard/tests/strings/vfprintf_variation9.phptbin0 -> 1857 bytes
-rw-r--r--ext/standard/tests/strings/vprintf_basic1.phpt43
-rw-r--r--ext/standard/tests/strings/vprintf_basic2.phpt47
-rw-r--r--ext/standard/tests/strings/vprintf_basic3.phpt66
-rw-r--r--ext/standard/tests/strings/vprintf_basic4.phpt43
-rw-r--r--ext/standard/tests/strings/vprintf_basic5.phpt43
-rw-r--r--ext/standard/tests/strings/vprintf_basic6.phpt43
-rw-r--r--ext/standard/tests/strings/vprintf_basic7.phpt47
-rw-r--r--ext/standard/tests/strings/vprintf_basic7_64bit.phpt46
-rw-r--r--ext/standard/tests/strings/vprintf_basic8.phpt43
-rw-r--r--ext/standard/tests/strings/vprintf_basic9.phpt62
-rw-r--r--ext/standard/tests/strings/vprintf_error.phpt46
-rw-r--r--ext/standard/tests/strings/vprintf_variation1.phpt219
-rw-r--r--ext/standard/tests/strings/vprintf_variation10.phptbin0 -> 2783 bytes
-rw-r--r--ext/standard/tests/strings/vprintf_variation11.phpt94
-rw-r--r--ext/standard/tests/strings/vprintf_variation11_64bit.phpt94
-rw-r--r--ext/standard/tests/strings/vprintf_variation12.phpt125
-rw-r--r--ext/standard/tests/strings/vprintf_variation12_64bit.phpt125
-rw-r--r--ext/standard/tests/strings/vprintf_variation13.phpt94
-rw-r--r--ext/standard/tests/strings/vprintf_variation13_64bit.phpt94
-rw-r--r--ext/standard/tests/strings/vprintf_variation14.phpt126
-rw-r--r--ext/standard/tests/strings/vprintf_variation14_64bit.phpt126
-rw-r--r--ext/standard/tests/strings/vprintf_variation15.phpt75
-rw-r--r--ext/standard/tests/strings/vprintf_variation15_64bit.phpt75
-rw-r--r--ext/standard/tests/strings/vprintf_variation16.phpt109
-rw-r--r--ext/standard/tests/strings/vprintf_variation16_64bit.phpt110
-rw-r--r--ext/standard/tests/strings/vprintf_variation17.phpt71
-rw-r--r--ext/standard/tests/strings/vprintf_variation18.phpt106
-rw-r--r--ext/standard/tests/strings/vprintf_variation19.phpt104
-rw-r--r--ext/standard/tests/strings/vprintf_variation19_64bit.phpt104
-rw-r--r--ext/standard/tests/strings/vprintf_variation2.phpt202
-rw-r--r--ext/standard/tests/strings/vprintf_variation3.phpt91
-rw-r--r--ext/standard/tests/strings/vprintf_variation4.phpt110
-rw-r--r--ext/standard/tests/strings/vprintf_variation4_64bit.phpt110
-rw-r--r--ext/standard/tests/strings/vprintf_variation5.phpt91
-rw-r--r--ext/standard/tests/strings/vprintf_variation6.phpt106
-rw-r--r--ext/standard/tests/strings/vprintf_variation7.phptbin0 -> 2230 bytes
-rw-r--r--ext/standard/tests/strings/vprintf_variation8.phpt109
-rw-r--r--ext/standard/tests/strings/vprintf_variation9.phptbin0 -> 1698 bytes
-rw-r--r--ext/standard/tests/strings/vsprintf_basic1.phpt33
-rw-r--r--ext/standard/tests/strings/vsprintf_basic2.phpt36
-rw-r--r--ext/standard/tests/strings/vsprintf_basic3.phpt45
-rw-r--r--ext/standard/tests/strings/vsprintf_basic4.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic5.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic6.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic7.phpt36
-rw-r--r--ext/standard/tests/strings/vsprintf_basic7_64bit.phpt36
-rw-r--r--ext/standard/tests/strings/vsprintf_basic8.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic9.phpt45
-rw-r--r--ext/standard/tests/strings/vsprintf_error.phpt46
-rw-r--r--ext/standard/tests/strings/vsprintf_variation1.phpt191
-rw-r--r--ext/standard/tests/strings/vsprintf_variation10.phptbin0 -> 2779 bytes
-rw-r--r--ext/standard/tests/strings/vsprintf_variation11.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation11_64bit.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation12.phpt118
-rw-r--r--ext/standard/tests/strings/vsprintf_variation12_64bit.phpt118
-rw-r--r--ext/standard/tests/strings/vsprintf_variation13.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation13_64bit.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation14.phpt119
-rw-r--r--ext/standard/tests/strings/vsprintf_variation14_64bit.phpt119
-rw-r--r--ext/standard/tests/strings/vsprintf_variation15.phpt68
-rw-r--r--ext/standard/tests/strings/vsprintf_variation15_64bit.phpt68
-rw-r--r--ext/standard/tests/strings/vsprintf_variation16.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation16_64bit.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation17.phpt64
-rw-r--r--ext/standard/tests/strings/vsprintf_variation18.phpt100
-rw-r--r--ext/standard/tests/strings/vsprintf_variation19.phpt91
-rw-r--r--ext/standard/tests/strings/vsprintf_variation19_64bit.phpt91
-rw-r--r--ext/standard/tests/strings/vsprintf_variation2.phpt177
-rw-r--r--ext/standard/tests/strings/vsprintf_variation3.phpt82
-rw-r--r--ext/standard/tests/strings/vsprintf_variation4.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation4_64bit.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation5.phpt82
-rw-r--r--ext/standard/tests/strings/vsprintf_variation6.phpt100
-rw-r--r--ext/standard/tests/strings/vsprintf_variation7.phptbin0 -> 2238 bytes
-rw-r--r--ext/standard/tests/strings/vsprintf_variation8.phpt103
-rw-r--r--ext/standard/tests/strings/vsprintf_variation9.phptbin0 -> 1709 bytes
-rw-r--r--ext/standard/tests/strings/wordwrap.phpt37
-rw-r--r--ext/standard/tests/strings/wordwrap_basic.phpt47
-rw-r--r--ext/standard/tests/strings/wordwrap_error.phpt78
-rw-r--r--ext/standard/tests/strings/wordwrap_variation1.phpt335
-rw-r--r--ext/standard/tests/strings/wordwrap_variation2.phpt340
-rw-r--r--ext/standard/tests/strings/wordwrap_variation3.phpt301
-rw-r--r--ext/standard/tests/strings/wordwrap_variation4.phpt144
-rw-r--r--ext/standard/tests/strings/wordwrap_variation5.phpt60
-rw-r--r--ext/standard/tests/time/001.phpt34
-rw-r--r--ext/standard/tests/time/bug38524.phpt31
-rw-r--r--ext/standard/tests/time/bug60222.phpt15
-rw-r--r--ext/standard/tests/time/idate.phpt31
-rw-r--r--ext/standard/tests/time/strptime_basic.phpt100
-rw-r--r--ext/standard/tests/time/strptime_error.phpt55
-rw-r--r--ext/standard/tests/time/strptime_parts.phpt76
-rw-r--r--ext/standard/tests/url/base64_decode_basic_001.phpt24
-rw-r--r--ext/standard/tests/url/base64_decode_basic_002.phpt47
-rw-r--r--ext/standard/tests/url/base64_decode_error_001.phpt38
-rw-r--r--ext/standard/tests/url/base64_decode_variation_001.phpt181
-rw-r--r--ext/standard/tests/url/base64_decode_variation_002.phpt175
-rw-r--r--ext/standard/tests/url/base64_encode_basic_001.phpt283
-rw-r--r--ext/standard/tests/url/base64_encode_basic_002.phpt59
-rw-r--r--ext/standard/tests/url/base64_encode_error_001.phpt37
-rw-r--r--ext/standard/tests/url/base64_encode_variation_001.phpt172
-rw-r--r--ext/standard/tests/url/bug47174.phpt18
-rw-r--r--ext/standard/tests/url/bug52327.phpt12
-rw-r--r--ext/standard/tests/url/bug53248.phpt12
-rw-r--r--ext/standard/tests/url/bug54180.phpt32
-rw-r--r--ext/standard/tests/url/bug55273.phpt25
-rw-r--r--ext/standard/tests/url/bug55399.phpt10
-rw-r--r--ext/standard/tests/url/bug63162.phpt38
-rw-r--r--ext/standard/tests/url/get_headers_error_001.phpt44
-rw-r--r--ext/standard/tests/url/get_headers_error_002.phpt55
-rw-r--r--ext/standard/tests/url/parse_url_basic_001.phpt866
-rw-r--r--ext/standard/tests/url/parse_url_basic_002.phpt125
-rw-r--r--ext/standard/tests/url/parse_url_basic_003.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_004.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_005.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_006.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_007.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_008.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_009.phpt124
-rw-r--r--ext/standard/tests/url/parse_url_basic_010.phpt31
-rw-r--r--ext/standard/tests/url/parse_url_error_001.phpt38
-rw-r--r--ext/standard/tests/url/parse_url_error_002.phpt47
-rw-r--r--ext/standard/tests/url/parse_url_relative_scheme.phpt11
-rw-r--r--ext/standard/tests/url/parse_url_variation_001.phpt226
-rw-r--r--ext/standard/tests/url/parse_url_variation_002_32bit.phpt205
-rw-r--r--ext/standard/tests/url/parse_url_variation_002_64bit.phpt189
-rw-r--r--ext/standard/tests/url/rawurldecode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/rawurldecode_variation_001.phpt173
-rw-r--r--ext/standard/tests/url/rawurlencode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/rawurlencode_variation_001.phpt173
-rw-r--r--ext/standard/tests/url/urldecode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/urldecode_variation_001.phpt173
-rw-r--r--ext/standard/tests/url/urlencode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/urlencode_variation_001.phpt173
-rw-r--r--ext/standard/tests/url/urls.inc109
-rw-r--r--ext/standard/tests/versioning/php_sapi_name.phpt9
-rw-r--r--ext/standard/tests/versioning/php_sapi_name_variation001.phpt14
-rw-r--r--ext/standard/tests/versioning/version_compare.phpt795
-rw-r--r--ext/standard/tests/zend_logo_guid.phpt12
-rw-r--r--ext/standard/type.c396
-rw-r--r--ext/standard/uniqid.c96
-rw-r--r--ext/standard/uniqid.h28
-rw-r--r--ext/standard/url.c785
-rw-r--r--ext/standard/url.h68
-rw-r--r--ext/standard/url_scanner_ex.c1054
-rw-r--r--ext/standard/url_scanner_ex.h58
-rw-r--r--ext/standard/url_scanner_ex.re548
-rw-r--r--ext/standard/user_filters.c623
-rw-r--r--ext/standard/uuencode.c233
-rw-r--r--ext/standard/var.c994
-rw-r--r--ext/standard/var_unserializer.c1182
-rw-r--r--ext/standard/var_unserializer.re764
-rw-r--r--ext/standard/versioning.c255
-rw-r--r--ext/standard/winver.h97
3648 files changed, 591579 insertions, 0 deletions
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 <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Rasmus Lerdorf <rasmus@php.net> |
+ | Andrei Zmievski <andrei@php.net> |
+ | Stig Venaas <venaas@php.net> |
+ | Jason Greene <jason@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include "php_ini.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#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<ZEND_NUM_ARGS(); i++) {
+ php_compact_var(EG(active_symbol_table), return_value, *args[i] TSRMLS_CC);
+ }
+
+ if (args) {
+ efree(args);
+ }
+}
+/* }}} */
+
+/* {{{ proto array array_fill(int start_key, int num, mixed val)
+ Create an array containing num elements starting with index start_key each initialized to val */
+PHP_FUNCTION(array_fill)
+{
+ zval *val;
+ long start_key, num;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz", &start_key, &num, &val) == FAILURE) {
+ return;
+ }
+
+ if (num < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of elements must be positive");
+ RETURN_FALSE;
+ }
+
+ /* allocate an array for return */
+ array_init_size(return_value, num);
+
+ num--;
+ zend_hash_index_update(Z_ARRVAL_P(return_value), start_key, &val, sizeof(zval *), NULL);
+ zval_add_ref(&val);
+
+ while (num--) {
+ if (zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &val, sizeof(zval *), NULL) == SUCCESS) {
+ zval_add_ref(&val);
+ } else {
+ zval_dtor(return_value);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element to the array as the next element is already occupied");
+ RETURN_FALSE;
+ }
+ }
+}
+/* }}} */
+
+/* {{{ proto array array_fill_keys(array keys, mixed val)
+ Create an array using the elements of the first parameter as keys each initialized to val */
+PHP_FUNCTION(array_fill_keys)
+{
+ zval *keys, *val, **entry;
+ HashPosition pos;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "az", &keys, &val) == FAILURE) {
+ return;
+ }
+
+ /* Initialize return array */
+ array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(keys)));
+
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(keys), &pos);
+ while (zend_hash_get_current_data_ex(Z_ARRVAL_P(keys), (void **)&entry, &pos) == SUCCESS) {
+
+ if (Z_TYPE_PP(entry) == IS_LONG) {
+ zval_add_ref(&val);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &val, sizeof(zval *), NULL);
+ } else {
+ zval key, *key_ptr = *entry;
+
+ if (Z_TYPE_PP(entry) != IS_STRING) {
+ key = **entry;
+ zval_copy_ctor(&key);
+ convert_to_string(&key);
+ key_ptr = &key;
+ }
+
+ zval_add_ref(&val);
+ zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(key_ptr), Z_STRLEN_P(key_ptr) + 1, &val, sizeof(zval *), NULL);
+
+ if (key_ptr != *entry) {
+ zval_dtor(&key);
+ }
+ }
+
+ zend_hash_move_forward_ex(Z_ARRVAL_P(keys), &pos);
+ }
+}
+/* }}} */
+
+/* {{{ proto array range(mixed low, mixed high[, int step])
+ Create an array containing the range of integers or characters from low to high (inclusive) */
+PHP_FUNCTION(range)
+{
+ zval *zlow, *zhigh, *zstep = NULL;
+ int err = 0, is_step_double = 0;
+ double step = 1.0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z/|z/", &zlow, &zhigh, &zstep) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ if (zstep) {
+ if (Z_TYPE_P(zstep) == IS_DOUBLE ||
+ (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE)
+ ) {
+ is_step_double = 1;
+ }
+
+ convert_to_double_ex(&zstep);
+ step = Z_DVAL_P(zstep);
+
+ /* We only want positive step values. */
+ if (step < 0.0) {
+ step *= -1;
+ }
+ }
+
+ /* Initialize the return_value as an array. */
+ array_init(return_value);
+
+ /* If the range is given as strings, generate an array of characters. */
+ if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 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 **)&params[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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include <string.h>
+
+#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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <zend_language_parser.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include <stdio.h>
+
+#ifndef PHP_WIN32
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+#ifdef NETWARE
+#include <netinet/in.h>
+#endif
+
+#ifndef PHP_WIN32
+# include <netdb.h>
+#else
+#include "win32/inet.h"
+#endif
+
+#if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#if HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#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 <len> 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, &params) == 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, &params, &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, &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");
+ 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, &params) == 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 <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef BASIC_FUNCTIONS_H
+#define BASIC_FUNCTIONS_H
+
+#include <sys/stat.h>
+
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#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 <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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; i<Z_STRLEN_P(pattern); i++, j++) {
+ switch (Z_STRVAL_P(pattern)[i]) {
+ case '?':
+ t[j] = '.';
+ break;
+ case '*':
+ t[j++] = '.';
+ t[j] = '*';
+ break;
+ case '.':
+ t[j++] = '\\';
+ t[j] = '.';
+ break;
+ case '\\':
+ t[j++] = '\\';
+ t[j] = '\\';
+ break;
+ case '(':
+ t[j++] = '\\';
+ t[j] = '(';
+ break;
+ case ')':
+ t[j++] = '\\';
+ t[j] = ')';
+ break;
+ case '\xA7':
+ t[j++] = '\\';
+ t[j] = '\xA7';
+ break;
+ default:
+ t[j] = Z_STRVAL_P(pattern)[i];
+ break;
+ }
+ }
+
+ t[j++] = '$';
+ t[j++] = '\xA7';
+
+ t[j]=0;
+ Z_STRVAL_P(pattern) = t;
+ Z_STRLEN_P(pattern) = j;
+}
+/* }}} */
+
+static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */
+{
+ browser_data *bdata = arg;
+ int persistent = bdata->htab->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**) &current_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 <stdio.h>
+#include <stdlib.h>
+
+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 <unistd.h>
+#endif
+
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#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 <unistd.h>
+#endif
+
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#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 <unistd.h>
+#endif
+
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#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 <unistd.h>
+#endif
+
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#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 <unistd.h>
+#endif
+
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#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 <unistd.h>
+#endif
+
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#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 <math.h>
+#include <stdlib.h>
+
+#ifdef HAVE_ISNAN
+#define zend_isnan(a) isnan(a)
+#elif defined(HAVE_FPCLASS)
+#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
+#else
+#define zend_isnan(a) 0
+#endif
+
+int main(int argc, char** argv)
+{
+ return zend_isnan(atof("NAN")) ? 0 : 1;
+}
+],[
+ ac_cv_atof_accept_nan=yes
+],[
+ ac_cv_atof_accept_nan=no
+],[
+ ac_cv_atof_accept_nan=no
+])])
+if test "$ac_cv_atof_accept_nan" = "yes"; then
+ AC_DEFINE([HAVE_ATOF_ACCEPTS_NAN], 1, [whether atof() accepts NAN])
+fi
+
+dnl
+dnl Check if atof() accepts INF
+dnl
+AC_CACHE_CHECK(whether atof() accepts INF, ac_cv_atof_accept_inf,[
+AC_TRY_RUN([
+#include <math.h>
+#include <stdlib.h>
+
+#ifdef HAVE_ISINF
+#define zend_isinf(a) isinf(a)
+#elif defined(INFINITY)
+/* Might not work, but is required by ISO C99 */
+#define zend_isinf(a) (((a)==INFINITY)?1:0)
+#elif defined(HAVE_FPCLASS)
+#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
+#else
+#define zend_isinf(a) 0
+#endif
+
+int main(int argc, char** argv)
+{
+ return zend_isinf(atof("INF")) && zend_isinf(atof("-INF")) ? 0 : 1;
+}
+],[
+ ac_cv_atof_accept_inf=yes
+],[
+ ac_cv_atof_accept_inf=no
+],[
+ ac_cv_atof_accept_inf=no
+])])
+if test "$ac_cv_atof_accept_inf" = "yes"; then
+ AC_DEFINE([HAVE_ATOF_ACCEPTS_INF], 1, [whether atof() accepts INF])
+fi
+
+dnl
+dnl Check if HUGE_VAL == INF
+dnl
+AC_CACHE_CHECK(whether HUGE_VAL == INF, ac_cv_huge_val_inf,[
+AC_TRY_RUN([
+#include <math.h>
+#include <stdlib.h>
+
+#ifdef HAVE_ISINF
+#define zend_isinf(a) isinf(a)
+#elif defined(INFINITY)
+/* Might not work, but is required by ISO C99 */
+#define zend_isinf(a) (((a)==INFINITY)?1:0)
+#elif defined(HAVE_FPCLASS)
+#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
+#else
+#define zend_isinf(a) 0
+#endif
+
+int main(int argc, char** argv)
+{
+ return zend_isinf(HUGE_VAL) ? 0 : 1;
+}
+],[
+ ac_cv_huge_val_inf=yes
+],[
+ ac_cv_huge_val_inf=no
+],[
+ ac_cv_huge_val_inf=yes
+])])
+dnl This is the most probable fallback so we assume yes in case of cross compile.
+if test "$ac_cv_huge_val_inf" = "yes"; then
+ AC_DEFINE([HAVE_HUGE_VAL_INF], 1, [whether HUGE_VAL == INF])
+fi
+
+dnl
+dnl Check if HUGE_VAL + -HUGEVAL == NAN
+dnl
+AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
+AC_TRY_RUN([
+#include <math.h>
+#include <stdlib.h>
+
+#ifdef HAVE_ISNAN
+#define zend_isnan(a) isnan(a)
+#elif defined(HAVE_FPCLASS)
+#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
+#else
+#define zend_isnan(a) 0
+#endif
+
+int main(int argc, char** argv)
+{
+#if defined(__sparc__) && !(__GNUC__ >= 3)
+ /* prevent bug #27830 */
+ return 1;
+#else
+ return zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
+#endif
+}
+],[
+ ac_cv_huge_val_nan=yes
+],[
+ ac_cv_huge_val_nan=no
+],[
+ ac_cv_huge_val_nan=yes
+])])
+dnl This is the most probable fallback so we assume yes in case of cross compile.
+if test "$ac_cv_huge_val_nan" = "yes"; then
+ AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
+fi
+
+dnl
+dnl Check for strptime()
+dnl
+AC_CACHE_CHECK(whether strptime() declaration fails, ac_cv_strptime_decl_fails,[
+AC_TRY_COMPILE([
+#include <time.h>
+],[
+#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 <wchar.h>
+#endif
+])
+AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],[
+AC_TRY_COMPILE([
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#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 <rasmus@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <srg@quick.com>
+ */
+
+#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 <rasmus@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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("<h1>PHP Credits</h1>\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 &amp; 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("</div></body></html>\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 <rasmus@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ssb@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Rasmus Lerdorf <rasmus@php.net> |
+ | Pierre Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include <stdlib.h>
+
+#include "php.h"
+#if HAVE_CRYPT
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#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 <crypt.h>
+# endif
+#endif
+#if TM_IN_SYS_TIME
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#ifdef PHP_WIN32
+#include <process.h>
+#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 <solar at openwall.com> 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 <provos at citi.umich.edu>, and uses some of his
+ * ideas. The password hashing algorithm was designed by David Mazieres
+ * <dm at lcs.mit.edu>. 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 <string.h>
+
+#include <errno.h>
+#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 <solar at openwall.com> 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 <solar at openwall.com>
+ */
+
+/*
+ * 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 <davidb at werj.com.au>.
+ *
+ * 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 <sys/types.h>
+#include <string.h>
+
+#ifdef TEST
+#include <stdio.h>
+#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 <inttypes.h>
+# elif HAVE_STDINT_H
+# include <stdint.h>
+# 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 <drepper@redhat.com>. */
+/* Windows VC++ port by Pierre Joye <pierre@php.net> */
+
+#include "php.h"
+#include "php_main.h"
+
+#include <errno.h>
+#include <limits.h>
+
+#ifdef PHP_WIN32
+# include "win32/php_stdint.h"
+# define __alignof__ __alignof
+# define alloca _alloca
+#else
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# elif HAVE_STDINT_H
+# include <stdint.h>
+# endif
+# ifndef HAVE_ALIGNOF
+# include <stddef.h>
+# 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 <stdio.h>
+#include <stdlib.h>
+
+#ifdef PHP_WIN32
+# include <string.h>
+#else
+# include <sys/param.h>
+# include <sys/types.h>
+# if HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# 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 <drepper@redhat.com>. */
+/* Windows VC++ port by Pierre Joye <pierre@php.net> */
+
+#include "php.h"
+#include "php_main.h"
+
+#include <errno.h>
+#include <limits.h>
+#ifdef PHP_WIN32
+# include "win32/php_stdint.h"
+# define __alignof__ __alignof
+# define alloca _alloca
+#else
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# elif HAVE_STDINT_H
+# include <stdint.h>
+# endif
+# ifndef HAVE_ALIGNOF
+# include <stddef.h>
+# 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 <stdio.h>
+#include <stdlib.h>
+
+#ifdef PHP_WIN32
+# include <string.h>
+#else
+# include <sys/param.h>
+# include <sys/types.h>
+# if HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# 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 <colin@easydns.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <colin@easydns.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <kir@rus.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include <stdlib.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <errno.h>
+
+#include "php.h"
+#include "cyr_convert.h"
+
+#include <stdio.h>
+
+/*****************************************************************************
+* 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<length; i++)
+ {
+ tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
+ str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
+ }
+ return (char *)str;
+}
+/* }}} */
+
+/* {{{ proto string convert_cyr_string(string str, string from, string to)
+ Convert from one Cyrillic character set to another */
+PHP_FUNCTION(convert_cyr_string)
+{
+ char *input, *fr_cs, *to_cs;
+ int input_len, fr_cs_len, to_cs_len;
+ unsigned char *str;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &input, &input_len, &fr_cs, &fr_cs_len, &to_cs, &to_cs_len) == FAILURE) {
+ return;
+ }
+
+ str = (unsigned char*) estrndup(input, input_len);
+
+ php_convert_cyr_string(str, input_len, fr_cs[0], to_cs[0] TSRMLS_CC);
+ RETVAL_STRING((char *)str, 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/cyr_convert.h b/ext/standard/cyr_convert.h
new file mode 100644
index 0000000..afcb872
--- /dev/null
+++ b/ext/standard/cyr_convert.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: Kirill Maximov <kir@rus.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Rasmus Lerdorf <rasmus@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include "php.h"
+#include "zend_operators.h"
+#include "datetime.h"
+#include "php_globals.h"
+
+#include <time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <stdio.h>
+
+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 <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <dirent.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+
+#ifdef PHP_WIN32
+#include "win32/readdir.h"
+#endif
+
+
+#ifdef HAVE_GLOB
+#ifndef PHP_WIN32
+#include <glob.h>
+#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 <brian@tool.net> |
+ | Shane Caraveo <shane@caraveo.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <stdlib.h>
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef PHP_WIN32
+#include "win32/param.h"
+#include "win32/winutil.h"
+#define GET_DL_ERROR() php_win_err()
+#elif defined(NETWARE)
+#include <sys/param.h>
+#define GET_DL_ERROR() dlerror()
+#else
+#include <sys/param.h>
+#define GET_DL_ERROR() DL_ERROR()
+#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<br />.\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 <brian@tool.net> |
+ | Shane Caraveo <shane@caraveo.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <pollita@php.net> |
+ | Marcus Boerger <helly@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+/* {{{ includes */
+#include "php.h"
+#include "php_network.h"
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef PHP_WIN32
+# include "win32/inet.h"
+# include <winsock2.h>
+# include <windows.h>
+# include <Ws2tcpip.h>
+#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */
+#include <netinet/in.h>
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#include <netdb.h>
+#ifdef _OSD_POSIX
+#undef STATUS
+#undef T_UNSPEC
+#endif
+#if HAVE_ARPA_NAMESER_H
+#ifdef DARWIN
+# define BIND_8_COMPAT 1
+#endif
+#include <arpa/nameser.h>
+#endif
+#if HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+#ifdef HAVE_DNS_H
+#include <dns.h>
+#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 <arpa/nameser.h> */
+#endif /* HFIXEDSZ */
+
+#ifndef QFIXEDSZ
+#define QFIXEDSZ 4 /* fixed data in query <arpa/nameser.h> */
+#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 <pierre@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "php.h"
+
+#include <windows.h>
+#include <Winbase.h >
+#include <Windns.h>
+
+#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 <rasmus@php.net> |
+ | Ilia Alshanetsky <iliaa@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include <stdio.h>
+#include "php.h"
+#include <ctype.h>
+#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 <sys/wait.h>
+#endif
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#if HAVE_NICE && HAVE_UNISTD_H
+#include <unistd.h>
+#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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ | Stig Bakken <ssb@php.net> |
+ | Andi Gutmans <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ | 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 <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#ifdef PHP_WIN32
+# include <io.h>
+# define O_RDONLY _O_RDONLY
+# include "win32/param.h"
+# include "win32/winutil.h"
+# include "win32/fnmatch.h"
+#else
+# if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# if defined(NETWARE) && defined(USE_WINSOCK)
+# include <novsock2.h>
+# else
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <netdb.h>
+# endif
+# if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+# 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 <pwd.h>
+# endif
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+
+#include "fsock.h"
+#include "fopen_wrappers.h"
+#include "streamsfuncs.h"
+#include "php_globals.h"
+
+#ifdef HAVE_SYS_FILE_H
+# include <sys/file.h>
+#endif
+
+#if MISSING_FCLOSE_DECL
+extern int fclose(FILE *);
+#endif
+
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#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 <fnmatch.h>
+#endif
+
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include "php.h"
+#include "fopen_wrappers.h"
+#include "php_globals.h"
+
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <time.h>
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if HAVE_SYS_VFS_H
+# include <sys/vfs.h>
+#endif
+
+#ifdef OS2
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
+# include <sys/statvfs.h>
+#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+# include <sys/statfs.h>
+#elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_STATFS)
+# include <sys/mount.h>
+#endif
+
+#if HAVE_PWD_H
+# ifdef PHP_WIN32
+# include "win32/pwd.h"
+# else
+# include <pwd.h>
+# endif
+#endif
+
+#if HAVE_GRP_H
+# ifdef PHP_WIN32
+# include "win32/grp.h"
+# else
+# include <grp.h>
+# endif
+#endif
+
+#if HAVE_UTIME
+# ifdef PHP_WIN32
+# include <sys/utime.h>
+# else
+# include <utime.h>
+# 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 <thies@thieso.net> */
+ 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 <thies@thieso.net> */
+ 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;i<n;i++){
+ if(ssb.sb.st_gid==gids[i]) {
+ rmask=S_IRGRP;
+ wmask=S_IWGRP;
+ xmask=S_IXGRP;
+ break;
+ }
+ }
+ efree(gids);
+ }
+ }
+ }
+#endif
+
+#ifndef NETWARE
+ if (IS_ABLE_CHECK(type) && getuid() == 0) {
+ /* root has special perms on plain_wrapper
+ But we don't know about root under Netware */
+ if (wrapper == &php_plain_files_wrapper) {
+ if (type == FS_IS_X) {
+ xmask = S_IXROOT;
+ } else {
+ RETURN_TRUE;
+ }
+ }
+ }
+#endif
+
+ switch (type) {
+ case FS_PERMS:
+ RETURN_LONG((long)ssb.sb.st_mode);
+ case FS_INODE:
+ RETURN_LONG((long)ssb.sb.st_ino);
+ case FS_SIZE:
+ RETURN_LONG((long)ssb.sb.st_size);
+ case FS_OWNER:
+ RETURN_LONG((long)ssb.sb.st_uid);
+ case FS_GROUP:
+ RETURN_LONG((long)ssb.sb.st_gid);
+ case FS_ATIME:
+ RETURN_LONG((long)ssb.sb.st_atime);
+ case FS_MTIME:
+ RETURN_LONG((long)ssb.sb.st_mtime);
+ case FS_CTIME:
+ RETURN_LONG((long)ssb.sb.st_ctime);
+ case FS_TYPE:
+ if (S_ISLNK(ssb.sb.st_mode)) {
+ RETURN_STRING("link", 1);
+ }
+ switch(ssb.sb.st_mode & S_IFMT) {
+ case S_IFIFO: RETURN_STRING("fifo", 1);
+ case S_IFCHR: RETURN_STRING("char", 1);
+ case S_IFDIR: RETURN_STRING("dir", 1);
+ case S_IFBLK: RETURN_STRING("block", 1);
+ case S_IFREG: RETURN_STRING("file", 1);
+#if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__)
+ case S_IFSOCK: RETURN_STRING("socket", 1);
+#endif
+ }
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%d)", ssb.sb.st_mode&S_IFMT);
+ RETURN_STRING("unknown", 1);
+ case FS_IS_W:
+ RETURN_BOOL((ssb.sb.st_mode & wmask) != 0);
+ case FS_IS_R:
+ RETURN_BOOL((ssb.sb.st_mode&rmask)!=0);
+ case FS_IS_X:
+ RETURN_BOOL((ssb.sb.st_mode&xmask)!=0 && !S_ISDIR(ssb.sb.st_mode));
+ case FS_IS_FILE:
+ RETURN_BOOL(S_ISREG(ssb.sb.st_mode));
+ case FS_IS_DIR:
+ RETURN_BOOL(S_ISDIR(ssb.sb.st_mode));
+ case FS_IS_LINK:
+ RETURN_BOOL(S_ISLNK(ssb.sb.st_mode));
+ case FS_EXISTS:
+ RETURN_TRUE; /* the false case was done earlier */
+ case FS_LSTAT:
+ /* FALLTHROUGH */
+ case FS_STAT:
+ array_init(return_value);
+
+ MAKE_LONG_ZVAL_INCREF(stat_dev, stat_sb->st_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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include <errno.h>
+#include "ext/standard/flock_compat.h"
+
+#if HAVE_STRUCT_FLOCK
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/file.h>
+#endif
+
+#ifdef PHP_WIN32
+#include <io.h>
+#include "config.w32.h"
+#endif
+
+#ifdef NETWARE
+#include <netinet/in.h>
+#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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include <math.h> /* modf() */
+#include "php.h"
+#include "ext/standard/head.h"
+#include "php_string.h"
+#include "zend_execute.h"
+#include <stdio.h>
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#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<Z_STRLEN_PP(args[format_offset])) {
+ int expprec = 0, multiuse = 0;
+ zval *tmp;
+
+ PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos]));
+ PRINTF_DEBUG(("sprintf: outpos=%d\n", outpos));
+ if (format[inpos] != '%') {
+ php_sprintf_appendchar(&result, &outpos, &size, format[inpos++] TSRMLS_CC);
+ } else if (format[inpos + 1] == '%') {
+ php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC);
+ inpos += 2;
+ } else {
+ /* starting a new format specifier, reset variables */
+ alignment = ALIGN_RIGHT;
+ adjusting = 0;
+ padding = ' ';
+ always_sign = 0;
+ inpos++; /* skip the '%' */
+
+ PRINTF_DEBUG(("sprintf: first looking at '%c', inpos=%d\n",
+ format[inpos], inpos));
+ if (isascii((int)format[inpos]) && !isalpha((int)format[inpos])) {
+ /* first look for argnum */
+ temppos = inpos;
+ while (isdigit((int)format[temppos])) temppos++;
+ if (format[temppos] == '$') {
+ argnum = php_sprintf_getnumber(format, &inpos);
+
+ if (argnum <= 0) {
+ efree(result);
+ efree(args);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument number must be greater than zero");
+ return NULL;
+ }
+
+ multiuse = 1;
+ inpos++; /* skip the '$' */
+ } else {
+ argnum = currarg++;
+ }
+
+ argnum += format_offset;
+
+ /* after argnum comes modifiers */
+ PRINTF_DEBUG(("sprintf: looking for modifiers\n"
+ "sprintf: now looking at '%c', inpos=%d\n",
+ format[inpos], inpos));
+ for (;; inpos++) {
+ if (format[inpos] == ' ' || format[inpos] == '0') {
+ padding = format[inpos];
+ } else if (format[inpos] == '-') {
+ alignment = ALIGN_LEFT;
+ /* space padding, the default */
+ } else if (format[inpos] == '+') {
+ always_sign = 1;
+ } else if (format[inpos] == '\'') {
+ padding = format[++inpos];
+ } else {
+ PRINTF_DEBUG(("sprintf: end of modifiers\n"));
+ break;
+ }
+ }
+ PRINTF_DEBUG(("sprintf: padding='%c'\n", padding));
+ PRINTF_DEBUG(("sprintf: alignment=%s\n",
+ (alignment == ALIGN_LEFT) ? "left" : "right"));
+
+
+ /* after modifiers comes width */
+ if (isdigit((int)format[inpos])) {
+ PRINTF_DEBUG(("sprintf: getting width\n"));
+ if ((width = php_sprintf_getnumber(format, &inpos)) < 0) {
+ efree(result);
+ efree(args);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Width must be greater than zero and less than %d", INT_MAX);
+ return NULL;
+ }
+ adjusting |= ADJ_WIDTH;
+ } else {
+ width = 0;
+ }
+ PRINTF_DEBUG(("sprintf: width=%d\n", width));
+
+ /* after width and argnum comes precision */
+ if (format[inpos] == '.') {
+ inpos++;
+ PRINTF_DEBUG(("sprintf: getting precision\n"));
+ if (isdigit((int)format[inpos])) {
+ if ((precision = php_sprintf_getnumber(format, &inpos)) < 0) {
+ efree(result);
+ efree(args);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Precision must be greater than zero and less than %d", INT_MAX);
+ return NULL;
+ }
+ adjusting |= ADJ_PRECISION;
+ expprec = 1;
+ } else {
+ precision = 0;
+ }
+ } else {
+ precision = 0;
+ }
+ PRINTF_DEBUG(("sprintf: precision=%d\n", precision));
+ } else {
+ width = precision = 0;
+ argnum = currarg++ + format_offset;
+ }
+
+ if (argnum >= 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 <jimw@php.net> |
+ | Sascha Schumann <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include "php_globals.h"
+#include <stdlib.h>
+#include <stddef.h>
+#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 <jimw@php.net> |
+ | 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 <sitnikov@infonet.ee> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+
+#include <sys/types.h>
+
+#ifdef HAVE_SYS_IPC_H
+#include <sys/ipc.h>
+#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 <rasmus@php.net> |
+ | Jim Winstead <jimw@php.net> |
+ | Hartmut Holzgraefe <hholzgra@php.net> |
+ | Sara Golemon <pollita@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include "php.h"
+#include "php_globals.h"
+#include "php_network.h"
+#include "php_ini.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#ifdef PHP_WIN32
+#include <winsock2.h>
+#define O_RDONLY _O_RDONLY
+#include "win32/param.h"
+#else
+#include <sys/param.h>
+#endif
+
+#include "php_standard.h"
+
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef PHP_WIN32
+#include <winsock2.h>
+#elif defined(NETWARE) && defined(USE_WINSOCK)
+#include <novsock2.h>
+#else
+#include <netinet/in.h>
+#include <netdb.h>
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#endif
+
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
+#undef AF_UNIX
+#endif
+
+#if defined(AF_UNIX)
+#include <sys/un.h>
+#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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include <stdio.h>
+#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 <sys/time.h>
+#else
+#include <time.h>
+#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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ | Jaakko HyvÀtti <jaakko.hyvatti@iki.fi> |
+ | Wez Furlong <wez@thebrainroom.com> |
+ | Gustavo Lopes <cataphract@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <php_config.h>
+#endif
+#include "php_standard.h"
+#include "php_string.h"
+#include "SAPI.h"
+#if HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#if HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+
+#include <zend_hash.h>
+#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 <http://www.unicode.org/Public/6.0.0/ucd/Unihan.zip> */
+ case cs_sjis:
+ case cs_eucjp:
+ /* we interpret 0x5C as the Yen symbol. This is not universal.
+ * See <http://www.w3.org/Submission/japanese-xml/#ambiguity_of_yen> */
+ 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: <http://www.w3.org/TR/REC-xml/#charsets>
+ * HTML 4.01: <http://www.w3.org/TR/1999/PR-html40-19990824/sgml/sgmldecl.html>
+ * HTML 5: <http://dev.w3.org/html5/spec/Overview.html#preprocessing-the-input-stream>
+ *
+ * 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 <http://cmsmcq.com/2007/C1.xml>.
+ */
+
+ 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 <http://www.w3.org/TR/REC-xml/#NT-CharRef> */
+ 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 &nGt; and &nLt; */
+/* +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 &apos;...*/
+ 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*)"&#xFFFD;";
+ replacement_len = sizeof("&#xFFFD;") - 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], "&amp;", sizeof("&amp;") - 1);
+ len += sizeof("&amp;") - 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, &quote_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,
+ &quote_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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 &apos; 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 @@
+<?php
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2010 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This 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: Gustavo Lopes <cataphract@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* This file prints to stdout the contents of ext/standard/html_tables.h */
+/* put together with glue; have patience */
+
+$t = <<<CODE
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-%s The PHP Group |
+ +----------------------------------------------------------------------+
+ | This 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 },
+ { "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 = <<<CODE
+
+/* 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;
+
+
+CODE;
+
+echo $t;
+
+$encodings = array(
+ array(
+ "ident" => "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 &gt; 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 = <<<CODE
+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} } },
+};
+
+CODE;
+
+if (!$pass2)
+ echo $t;
+
+$mstable = array();
+foreach ($dp as $el) {
+ $s1 = (hexdec($el[1]) & 0xFFF000) >> 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 &quote;, not &QUOT; */
+ 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 = <<<CODE
+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,
+};
+
+CODE;
+
+if (!$pass2)
+ echo $t;
+
+for ($i = 0; $i < 0x1E; $i++) {
+ $any = false;
+ for ($k = 0; $k < 64; $k++) {
+ if (isset($mstable[$i][$k]))
+ $any = true;
+ }
+ if ($any) {
+ echo "static const entity_stage2_row stage2_table_{$ident}_",
+ sprintf("%02X000", $i), "[] = {\n";
+ for ($k = 0; $k < 64; $k++) {
+ if ($k == 0) echo "\t";
+ elseif ($k % 4 == 0) echo "\n\t";
+ else echo " ";
+ if (isset($mstable[$i][$k])) {
+ echo sprintf("stage3_table_{$ident}_%05X", ($i << 12) | ($k << 6)), ",";
+ } else {
+ echo "empty_stage3_table", ",";
+ }
+ }
+ echo "\n};\n\n";
+ }
+}
+
+echo
+"/* end of stage 2 tables for $name }}} */", "\n\n";
+
+echo "static const entity_stage1_row entity_ms_table_{$ident}[] = {\n";
+for ($i = 0; $i < 0x1E; $i++) {
+ if (isset($mstable[$i]))
+ echo "\t", sprintf("stage2_table_{$ident}_%02X000", $i), ",\n";
+ else
+ echo "\tempty_stage2_table,\n";
+}
+echo "};\n\n";
+
+echo
+"/* end of $name multi-stage table for codepoint -> 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 = <<<CODE
+//typedef struct {
+// const char *entity;
+// unsigned short entity_len;
+// unsigned int codepoint1;
+// unsigned int codepoint2;
+//} entity_cp_map;
+//
+//#define ENTITY_CP_MAP_CMP(l, lsize, r, rsize) \
+// ( ((lsize)==(rsize)) ? (memcmp((l), (r), (lsize))) : ((lsize)-(rsize)) )
+//
+//static const entity_cp_map html5_ent_cp_map[] = {
+//
+//CODE;
+//echo $t;
+//
+//$dp = $origdp;
+//usort($dp, function($a, $b) { $d = strlen($a[0])-strlen($b[0]);
+// return $d==0?strcmp($a[0], $b[0]):$d; });
+//
+//$k = 0;
+//foreach ($dp as $o) {
+// if ($k == 0) echo "\t";
+// elseif ($k % 3 == 0) echo "\n\t";
+// else echo " ";
+// if (isset($o[2]))
+// echo sprintf('{"%s", %d, 0x%X, 0x%X},', $o[0], strlen($o[0]),
+// hexdec($o[1]), hexdec($o[2]));
+// else
+// echo sprintf('{"%s", %d, 0x%X, 0},', $o[0], strlen($o[0]),
+// hexdec($o[1]));
+//
+// if (isset($o[2])) {
+// $entlen = strlen($o[0]) + 2;
+// $utf8len = strlen(
+// mb_convert_encoding("&#x{$o[1]};&#x{$o[2]};", "UTF-8", "HTML-ENTITIES"));
+// if ($utf8len > $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 = <<<CODE
+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} };
+
+CODE;
+
+if (!$pass2)
+ echo $t;
+
+function hashfun($str)
+{
+
+ $hash = 5381;
+ $nKeyLength = strlen($str);
+ $pos = 0;
+
+ for (; $nKeyLength > 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 <kenw@sybase.com>
+#
+# 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:
+# <ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+# Any comments or problems, contact <errata@unicode.org>
+# Please note that <errata@unicode.org> 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 # <control>
+0x81 0x0081 # <control>
+0x82 0x0082 # <control>
+0x83 0x0083 # <control>
+0x84 0x0084 # <control>
+0x85 0x0085 # <control>
+0x86 0x0086 # <control>
+0x87 0x0087 # <control>
+0x88 0x0088 # <control>
+0x89 0x0089 # <control>
+0x8A 0x008A # <control>
+0x8B 0x008B # <control>
+0x8C 0x008C # <control>
+0x8D 0x008D # <control>
+0x8E 0x008E # <control>
+0x8F 0x008F # <control>
+0x90 0x0090 # <control>
+0x91 0x0091 # <control>
+0x92 0x0092 # <control>
+0x93 0x0093 # <control>
+0x94 0x0094 # <control>
+0x95 0x0095 # <control>
+0x96 0x0096 # <control>
+0x97 0x0097 # <control>
+0x98 0x0098 # <control>
+0x99 0x0099 # <control>
+0x9A 0x009A # <control>
+0x9B 0x009B # <control>
+0x9C 0x009C # <control>
+0x9D 0x009D # <control>
+0x9E 0x009E # <control>
+0x9F 0x009F # <control>
+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 <http://www.cl.cam.ac.uk/~mgk25/>
+# Ken Whistler <kenw@sybase.com>
+#
+# 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:
+# <ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+# Any comments or problems, contact <errata@unicode.org>
+# Please note that <errata@unicode.org> 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 # <control>
+0x81 0x0081 # <control>
+0x82 0x0082 # <control>
+0x83 0x0083 # <control>
+0x84 0x0084 # <control>
+0x85 0x0085 # <control>
+0x86 0x0086 # <control>
+0x87 0x0087 # <control>
+0x88 0x0088 # <control>
+0x89 0x0089 # <control>
+0x8A 0x008A # <control>
+0x8B 0x008B # <control>
+0x8C 0x008C # <control>
+0x8D 0x008D # <control>
+0x8E 0x008E # <control>
+0x8F 0x008F # <control>
+0x90 0x0090 # <control>
+0x91 0x0091 # <control>
+0x92 0x0092 # <control>
+0x93 0x0093 # <control>
+0x94 0x0094 # <control>
+0x95 0x0095 # <control>
+0x96 0x0096 # <control>
+0x97 0x0097 # <control>
+0x98 0x0098 # <control>
+0x99 0x0099 # <control>
+0x9A 0x009A # <control>
+0x9B 0x009B # <control>
+0x9C 0x009C # <control>
+0x9D 0x009D # <control>
+0x9E 0x009E # <control>
+0x9F 0x009F # <control>
+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 <kenw@sybase.com>
+#
+# 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:
+# <ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+# Any comments or problems, contact <errata@unicode.org>
+# Please note that <errata@unicode.org> 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 # <control>
+0x81 0x0081 # <control>
+0x82 0x0082 # <control>
+0x83 0x0083 # <control>
+0x84 0x0084 # <control>
+0x85 0x0085 # <control>
+0x86 0x0086 # <control>
+0x87 0x0087 # <control>
+0x88 0x0088 # <control>
+0x89 0x0089 # <control>
+0x8A 0x008A # <control>
+0x8B 0x008B # <control>
+0x8C 0x008C # <control>
+0x8D 0x008D # <control>
+0x8E 0x008E # <control>
+0x8F 0x008F # <control>
+0x90 0x0090 # <control>
+0x91 0x0091 # <control>
+0x92 0x0092 # <control>
+0x93 0x0093 # <control>
+0x94 0x0094 # <control>
+0x95 0x0095 # <control>
+0x96 0x0096 # <control>
+0x97 0x0097 # <control>
+0x98 0x0098 # <control>
+0x99 0x0099 # <control>
+0x9A 0x009A # <control>
+0x9B 0x009B # <control>
+0x9C 0x009C # <control>
+0x9D 0x009D # <control>
+0x9E 0x009E # <control>
+0x9F 0x009F # <control>
+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 <richter@lrz.de>
+#
+# 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 <errata@unicode.org>
+# Please note that <errata@unicode.org> 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
+# <c1.1> and Text Encoding Converter 2.0.
+# b4,c1 2002-Dec-19 Update URLs, notes. Matches internal
+# utom<b5>.
+# b03 1999-Sep-22 Update contact e-mail address. Matches
+# internal utom<b4>, ufrm<b3>, 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<b3>,
+# ufrm<b3>.
+# 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<n3>, ufrm<n22>:
+# 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<n9>.
+#
+# 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:
+#
+# <http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/>
+#
+# 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 <pollita@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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(&copyzval);
+ 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(&copyzval);
+ }
+ 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 <rasmus@php.net> |
+ | Jim Winstead <jimw@php.net> |
+ | Hartmut Holzgraefe <hholzgra@php.net> |
+ | Wez Furlong <wez@thebrainroom.com> |
+ | Sara Golemon <pollita@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $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 <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#ifdef PHP_WIN32
+#define O_RDONLY _O_RDONLY
+#include "win32/param.h"
+#else
+#include <sys/param.h>
+#endif
+
+#include "php_standard.h"
+
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef PHP_WIN32
+#include <winsock2.h>
+#elif defined(NETWARE) && defined(USE_WINSOCK)
+#include <novsock2.h>
+#else
+#include <netinet/in.h>
+#include <netdb.h>
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#endif
+
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
+#undef AF_UNIX
+#endif
+
+#if defined(AF_UNIX)
+#include <sys/un.h>
+#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 <rasmus@php.net> |
+ | Marcus Boerger <helly@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include "php.h"
+#include <stdio.h>
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include "fopen_wrappers.h"
+#include "ext/standard/fsock.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#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_<xxx> 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<<factor++);
+ buf = (char *) erealloc(buf,szlength);
+ status = uncompress(buf, &szlength, bufz, slength);
+ } while ((status==Z_BUF_ERROR)&&(factor<maxfactor));
+
+ if (bufz) {
+ pefree(bufz, 0);
+ }
+
+ if (status == Z_OK) {
+ memcpy(b, buf, len);
+ }
+
+ if (buf) {
+ efree(buf);
+ }
+ }
+
+ if (!status) {
+ result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo));
+ bits = php_swf_get_bits (b, 0, 5);
+ result->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;i<num_entries;i++) {
+ dir_entry = ifd_data+2+i*12;
+ entry_tag = php_ifd_get16u(dir_entry+0, motorola_intel);
+ entry_type = php_ifd_get16u(dir_entry+2, motorola_intel);
+ switch(entry_type) {
+ case TAG_FMT_BYTE:
+ case TAG_FMT_SBYTE:
+ entry_value = (size_t)(dir_entry[8]);
+ break;
+ case TAG_FMT_USHORT:
+ entry_value = php_ifd_get16u(dir_entry+8, motorola_intel);
+ break;
+ case TAG_FMT_SSHORT:
+ entry_value = php_ifd_get16s(dir_entry+8, motorola_intel);
+ break;
+ case TAG_FMT_ULONG:
+ entry_value = php_ifd_get32u(dir_entry+8, motorola_intel);
+ break;
+ case TAG_FMT_SLONG:
+ entry_value = php_ifd_get32s(dir_entry+8, motorola_intel);
+ break;
+ default:
+ continue;
+ }
+ switch(entry_tag) {
+ case TAG_IMAGEWIDTH:
+ case TAG_COMP_IMAGEWIDTH:
+ width = entry_value;
+ break;
+ case TAG_IMAGEHEIGHT:
+ case TAG_COMP_IMAGEHEIGHT:
+ height = entry_value;
+ break;
+ }
+ }
+ efree(ifd_data);
+ if ( width && height) {
+ /* not the same when in for-loop */
+ result = (struct gfxinfo *) ecalloc(1, sizeof(struct gfxinfo));
+ result->height = 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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Colin Viebrock <colin@easydns.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <time.h>
+#include "php_main.h"
+#include "zend_globals.h" /* needs ELS */
+#include "zend_extensions.h"
+#include "zend_highlight.h"
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#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("<h2>" name "</h2>\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("<tr><td class=\"e\">Registered %s</td><td class=\"v\">", 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("</td></tr>\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("<h2><a name=\"module_%s\">%s</a></h2>\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("<tr><td>%s</td></tr>\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("<tr>");
+ php_info_print("<td class=\"e\">");
+ }
+
+ 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("</td><td class=\"v\">");
+ } else {
+ php_info_print(" => ");
+ }
+ if (Z_TYPE_PP(tmp) == IS_ARRAY) {
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("<pre>");
+ zend_print_zval_r_ex((zend_write_func_t) php_info_print_html_esc, *tmp, 0 TSRMLS_CC);
+ php_info_print("</pre>");
+ } 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("<i>no value</i>");
+ } 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("</td></tr>\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("<style type=\"text/css\">\n");
+ php_info_print_css(TSRMLS_C);
+ php_info_printf("</style>\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("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
+ php_info_print("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+ php_info_print("<head>\n");
+ php_info_print_style(TSRMLS_C);
+ php_info_print("<title>phpinfo()</title>");
+ php_info_print("<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW,NOARCHIVE\" />");
+ php_info_print("</head>\n");
+ php_info_print("<body><div class=\"center\">\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("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
+ php_info_print_request_uri(TSRMLS_C);
+ php_info_print("?=");
+ logo_guid = php_logo_guid();
+ php_info_print(logo_guid);
+ efree(logo_guid);
+ php_info_print("\" alt=\"PHP Logo\" /></a>");
+ }
+
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_printf("<h1 class=\"p\">PHP Version %s</h1>\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("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
+ php_info_print_request_uri(TSRMLS_C);
+ php_info_print("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
+ }
+ php_info_print("This program makes use of the Zend Scripting Language Engine:");
+ php_info_print(!sapi_module.phpinfo_as_text?"<br />":"\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("<h1><a href=\"");
+ php_info_print_request_uri(TSRMLS_C);
+ php_info_print("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
+ php_info_print("PHP Credits");
+ php_info_print("</a></h1>\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("<h1>Configuration</h1>\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("<p>\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("</p>\n");
+ php_info_print("<p>");
+ 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("</p>\n");
+ php_info_print("<p>");
+ 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("</p>\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("</div></body></html>");
+ }
+}
+/* }}} */
+
+PHPAPI void php_info_print_table_start(void) /* {{{ */
+{
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n");
+ } else {
+ php_info_print("\n");
+ }
+}
+/* }}} */
+
+PHPAPI void php_info_print_table_end(void) /* {{{ */
+{
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("</table><br />\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("<tr class=\"h\"><td>\n");
+ }
+ } else {
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("<tr class=\"v\"><td>\n");
+ } else {
+ php_info_print("\n");
+ }
+ }
+}
+/* }}} */
+
+PHPAPI void php_info_print_box_end(void) /* {{{ */
+{
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("</td></tr>\n");
+ }
+ php_info_print_table_end();
+}
+/* }}} */
+
+PHPAPI void php_info_print_hr(void) /* {{{ */
+{
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("<hr />\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("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\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("<tr class=\"h\">");
+ }
+ for (i=0; i<num_cols; i++) {
+ row_element = va_arg(row_elements, char *);
+ if (!row_element || !*row_element) {
+ row_element = " ";
+ }
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("<th>");
+ php_info_print(row_element);
+ php_info_print("</th>");
+ } 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("</tr>\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("<tr>");
+ }
+ for (i=0; i<num_cols; i++) {
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_printf("<td class=\"%s\">",
+ (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( "<i>no value</i>" );
+ } 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(" </td>");
+ } else if (i == (num_cols - 1)) {
+ php_info_print("\n");
+ }
+ }
+ if (!sapi_module.phpinfo_as_text) {
+ php_info_print("</tr>\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 <rasmus@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <sys/stat.h>
+
+
+/* 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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include "php_lcg.h"
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef PHP_WIN32
+#include "win32/time.h"
+#else
+#include <sys/time.h>
+#endif
+
+#ifdef ZTS
+int lcg_globals_id;
+#else
+static php_lcg_globals lcg_globals;
+#endif
+
+#ifdef PHP_WIN32
+#include <process.h>
+#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 <hholzgra@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include "php.h"
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+#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 <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/stat.h>
+#include <string.h>
+#if HAVE_PWD_H
+#ifdef PHP_WIN32
+#include "win32/pwd.h"
+#else
+#include <pwd.h>
+#endif
+#endif
+#if HAVE_GRP_H
+#ifdef PHP_WIN32
+#include "win32/grp.h"
+#else
+#include <grp.h>
+#endif
+#endif
+#include <errno.h>
+#include <ctype.h>
+
+#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 <pierre@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+#ifdef PHP_WIN32
+
+#include "php.h"
+#include "php_filestat.h"
+#include "php_globals.h"
+
+#include <WinBase.h>
+
+#include <stdlib.h>
+
+#include <string.h>
+#if HAVE_PWD_H
+#include "win32/pwd.h"
+#endif
+
+#if HAVE_GRP_H
+#include "win32/grp.h"
+#endif
+
+#include <errno.h>
+#include <ctype.h>
+
+#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 <rasmus@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdio.h>
+#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 <sysexits.h>
+#endif
+#if HAVE_SYS_SYSEXITS_H
+#include <sys/sysexits.h>
+#endif
+
+#if PHP_SIGCHILD
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#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 <jimw@php.net> |
+ | Stig SÊther Bakken <ssb@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ | PHP 4.0 patches by Thies C. Arntzen <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include "php_math.h"
+#include "zend_multiply.h"
+
+#include <math.h>
+#include <float.h>
+#include <stdlib.h>
+
+#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", &deg) == 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) <solar at openwall.com> |
+ | Lachlan Roche |
+ | Alessandro Astarita <aleast@capri.it> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <solar at openwall.com> 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 <string.h>
+
+/*
+ * 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) <solar at openwall.com> |
+ | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <solar at openwall.com> 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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+/*
+ Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com>
+*/
+
+#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 <sys/types.h>
+#endif
+#ifdef PHP_WIN32
+#include "win32/time.h"
+#elif defined(NETWARE)
+#include <sys/timeval.h>
+#include <sys/time.h>
+#else
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+#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 <cschneid@relog.ch> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include "php.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#ifdef PHP_WIN32
+#define O_RDONLY _O_RDONLY
+#include "win32/param.h"
+#elif defined(NETWARE)
+#ifdef USE_WINSOCK
+#include <novsock2.h>
+#else
+#include <sys/socket.h>
+#endif
+#include <sys/param.h>
+#else
+#include <sys/param.h>
+#endif
+#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 <pwd.h>
+#endif
+#endif
+#include "fsock.h"
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#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 <formatlen> 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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+#include "pageinfo.h"
+#include "SAPI.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_PWD_H
+#ifdef PHP_WIN32
+#include "win32/pwd.h"
+#else
+#include <pwd.h>
+#endif
+#endif
+#if HAVE_GRP_H
+# ifdef PHP_WIN32
+# include "win32/grp.h"
+# else
+# include <grp.h>
+# endif
+#endif
+#ifdef PHP_WIN32
+#undef getgid
+#define getgroups(a, b) 0
+#define getgid() 1
+#define getuid() 1
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/stat.h>
+#include <sys/types.h>
+#ifdef PHP_WIN32
+#include <process.h>
+#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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <andi@zend.com> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Rasmus Lerdorf <rasmus@php.net> |
+ | Andrei Zmievski <andrei@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ssb@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Rasmus Lerdorf <rasmus@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <pajoye@php.net |
+ +----------------------------------------------------------------------+
+ */
+
+/*
+ * License for the Unix md5crypt implementation (md5_crypt):
+ *
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@login.dknet.dk> 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 <string.h>
+
+#if PHP_WIN32
+# include <windows.h>
+# include <Wincrypt.h>
+#endif
+
+#ifdef HAVE_ATOMIC_H /* Solaris 10 defines atomic API within */
+# include <atomic.h>
+#else
+# include <signal.h>
+#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 <pajoye@php.net |
+ +----------------------------------------------------------------------+
+ */
+
+#ifndef _CRYPT_WIHN32_H_
+#define _CRYPT_WIHN32_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include "crypt_freesec.h"
+
+#ifndef __const
+#ifdef __GNUC__
+#define __CONST __const
+#else
+#define __CONST
+#endif
+#else
+#define __CONST __const
+#endif
+
+void php_init_crypt_r();
+void php_shutdown_crypt_r();
+
+extern void _crypt_extended_init_r(void);
+
+/*PHPAPI char* crypt(const char *key, const char *salt);*/
+PHPAPI char *php_crypt_r (const char *__key, const char *__salt, struct php_crypt_extended_data * __data);
+
+#define MD5_HASH_MAX_LEN 120
+
+#include "crypt_blowfish.h"
+
+extern char * php_md5_crypt_r(const char *pw, const char *salt, char *out);
+extern char * php_sha512_crypt_r (const char *key, const char *salt, char *buffer, int buflen);
+extern char * php_sha256_crypt_r (const char *key, const char *salt, char *buffer, int buflen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CRYPT_WIHN32_H_ */
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
new file mode 100644
index 0000000..432ee33
--- /dev/null
+++ b/ext/standard/php_dir.h
@@ -0,0 +1,44 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <helly@php.net> |
+ | Pollita <pollita@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ | Jim Winstead <jimw@php.net> |
+ | Hartmut Holzgraefe <hholzgra@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#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/<orig 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 <rasmus@php.net> |
+ | Jim Winstead <jimw@php.net> |
+ | Hartmut Holzgraefe <hholzgra@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sitnikov@infonet.ee> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <pollita@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ | Marcus Boerger <helly@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <jimw@php.net> |
+ | Stig Sæther Bakken <ssb@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <math.h>
+
+#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 <thies@thieso.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <rasmus@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Pedro Melo <melo@ip.pt> |
+ | Sterling Hughes <sterling@php.net> |
+ | |
+ | Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#ifndef PHP_RAND_H
+#define PHP_RAND_H
+
+#include <stdlib.h>
+#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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#ifndef PHP_SMART_STR_H
+#define PHP_SMART_STR_H
+
+#include "php_smart_str_public.h"
+
+#include <stdlib.h>
+#ifndef SMART_STR_USE_REALLOC
+#include <zend.h>
+#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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#ifndef PHP_SMART_STR_PUBLIC_H
+#define PHP_SMART_STR_PUBLIC_H
+
+#include <sys/types.h>
+
+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 <rasmus@php.net> |
+ | Stig Sæther Bakken <ssb@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@lerdorf.on.ca> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ilia@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <jkl@njet.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+ */
+/* $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 <stdio.h>
+#include <ctype.h>
+#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 <proc.h>
+#include <library.h>
+#endif
+
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#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 <sys/ioctl.h>
+# include <termios.h>
+# 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, &copy, 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 <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+ */
+/* $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 <kir@actimind.com> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include <stdlib.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
+#include <errno.h>
+
+#include "php.h"
+#include "quot_print.h"
+
+#include <stdio.h>
+
+/*
+* 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 <rasmus@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ | Pedro Melo <melo@ip.pt> |
+ | Sterling Hughes <sterling@php.net> |
+ | |
+ | Based on code from: Richard J. Wagner <rjwagner@writeme.com> |
+ | Makoto Matsumoto <matumoto@math.keio.ac.jp> |
+ | Takuji Nishimura |
+ | Shawn Cokus <Cokus@math.washington.edu> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include <stdlib.h>
+
+#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 <clcollie@mindspring.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <stdio.h>
+#include <limits.h>
+#include <ctype.h>
+#include "php.h"
+#include "php_variables.h"
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#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("<br>in sscanf_internal : <br> string is \"%s\", format = \"%s\"<br> NumVars = %d. VarStart = %d<br>-------------------------<br>",
+ 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 <clcollie@mindspring.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sesser@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sesser@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <borud@guardian.no> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include "php.h"
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+#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 <wez@thebrainroom.com> |
+ | Sara Golemon <pollita@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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, &params) == 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", &params) == 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, &params) == 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, &microseconds) == 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 <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <rasmus@php.net> |
+ | Stig Sæther Bakken <ssb@php.net> |
+ | Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
+
+#include <stdio.h>
+#ifdef PHP_WIN32
+# include "win32/php_stdint.h"
+#else
+# include <stdint.h>
+#endif
+#include "php.h"
+#include "php_rand.h"
+#include "php_string.h"
+#include "php_variables.h"
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#ifdef HAVE_LANGINFO_H
+# include <langinfo.h>
+#endif
+#ifdef HAVE_MONETARY_H
+# include <monetary.h>
+#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 <libintl.h> /* 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 <Zend/zend_exceptions.h>
+#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, &copy);
+ 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 <zeev@php.net>
+ */
+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<str_len-1) {
+ tmp++;
+ block_end++;
+ block_length++;
+ }
+ for (i = block_start; i<= block_end; i++) {
+ *target = str[i];
+ switch (*target) {
+ case '(':
+ *target = ')';
+ break;
+ case ')':
+ *target = '(';
+ break;
+ case '[':
+ *target = ']';
+ break;
+ case ']':
+ *target = '[';
+ break;
+ case '{':
+ *target = '}';
+ break;
+ case '}':
+ *target = '{';
+ break;
+ case '<':
+ *target = '>';
+ break;
+ case '>':
+ *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', "<br />\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 <br /> or <br> 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("<br />") - 1) : (sizeof("<br>") - 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 <a whatever...> into just <a> and any </tag>
+ into <tag>
+ */
+ 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 <?xml tags without assuming it PHP
+ code.
+*/
+PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, int allow_len, zend_bool allow_tag_spaces)
+{
+ char *tbuf, *buf, *p, *tp, *rp, c, lc;
+ int br, i=0, depth=0, in_q = 0;
+ int state = 0, pos;
+ char *allow_free;
+
+ if (stateptr)
+ state = *stateptr;
+
+ buf = estrndup(rbuf, len);
+ c = *buf;
+ lc = '\0';
+ p = buf;
+ rp = rbuf;
+ br = 0;
+ if (allow) {
+ if (IS_INTERNED(allow)) {
+ allow_free = allow = zend_str_tolower_dup(allow, allow_len);
+ } else {
+ allow_free = NULL;
+ php_strtolower(allow, allow_len);
+ }
+ tbuf = emalloc(PHP_TAG_BUF_SIZE + 1);
+ tp = tbuf;
+ } else {
+ tbuf = tp = NULL;
+ }
+
+ while (i < len) {
+ switch (c) {
+ case '\0':
+ break;
+ case '<':
+ if (in_q) {
+ break;
+ }
+ if (isspace(*(p + 1)) && !allow_tag_spaces) {
+ goto reg_char;
+ }
+ if (state == 0) {
+ lc = '<';
+ state = 1;
+ 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++) = '<';
+ }
+ } 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 <!-- comment --> */
+ 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 '<?xml' then we shouldn't be in
+ * state == 2 (PHP). Switch back to HTML.
+ */
+
+ if (state == 2 && p > 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<ee) {
+ l = (e-s) < (ee-e) ? (e-s) : (ee-e);
+ memmove(e, s, l);
+ e += l;
+ }
+ }
+
+ result[result_len] = '\0';
+
+ RETURN_STRINGL(result, result_len, 0);
+}
+/* }}} */
+
+/* {{{ proto mixed count_chars(string input [, int mode])
+ Returns info about what characters are used in input */
+PHP_FUNCTION(count_chars)
+{
+ char *input;
+ int chars[256];
+ long mymode=0;
+ unsigned char *buf;
+ int len, inx;
+ char retstr[256];
+ int retlen=0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &input, &len, &mymode) == FAILURE) {
+ return;
+ }
+
+ if (mymode < 0 || mymode > 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 <andrei@ispi.net>
+
+ strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
+ Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
+
+ 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 <ctype.h>
+#include <string.h>
+#include <assert.h>
+#include <stdio.h>
+
+#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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include "php.h"
+
+#ifdef HAVE_SYSLOG_H
+#include "php_ini.h"
+#include "zend_globals.h"
+
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include <stdio.h>
+#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--
+<?php
+require(dirname(__FILE__) . '/data.inc');
+/*
+** Create sample arrays
+** Test alpha, numeric (decimal, hex, octal) and special data
+**
+**
+*/
+
+/* Helper function to build testing arrays */
+function make_nested_array ($depth, $breadth, $function = NULL, $args = array ()) {
+ for ($x = 0; $x < $breadth; ++$x) {
+ if (NULL === $function) {
+ $array = array (0);
+ } else {
+ $array = array (call_user_func_array ($function, $args));
+ }
+ for ($y = 1; $y < $depth; ++$y) {
+ $array[0] = array ($array[0]);
+ }
+ $temp[$x] = $array;
+ }
+ return $temp;
+}
+
+/* Nested array */
+$data2 = make_nested_array (3, 3);
+$data = array_merge($data, $data2);
+
+var_dump ($data);
+
+function echo_kv ($value, $key) {
+ var_dump ($key);
+ var_dump ($value);
+}
+
+echo " -- Testing array_walk() -- \n";
+array_walk ($data, 'echo_kv');
+
+?>
+--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--
+<?php
+require(dirname(__FILE__) . '/data.inc');
+
+function test_sort ($sort_function, $data) {
+ echo "\n -- Testing $sort_function() -- \n";
+ echo "No second argument:\n";
+ $sort_function ($data);
+ var_dump ($data);
+ echo "Using SORT_REGULAR:\n";
+ $sort_function ($data, SORT_REGULAR);
+ var_dump ($data);
+ echo "Using SORT_NUMERIC:\n";
+ $sort_function ($data, SORT_NUMERIC);
+ var_dump ($data);
+ echo "Using SORT_STRING\n";
+ $sort_function ($data, SORT_STRING);
+ var_dump ($data);
+}
+
+echo "Unsorted data:\n";
+var_dump ($data);
+foreach (array ('arsort', 'asort', 'krsort', 'ksort', 'rsort', 'sort') as $test_function) {
+ test_sort ($test_function, $data);
+}
+
+?>
+--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--
+<?php
+require(dirname(__FILE__) . '/data.inc');
+
+function cmp ($a, $b) {
+ is_array ($a)
+ and $a = array_sum ($a);
+ is_array ($b)
+ and $b = array_sum ($b);
+ return strcmp ($a, $b);
+}
+
+echo " -- Testing uasort() -- \n";
+uasort ($data, 'cmp');
+var_dump ($data);
+
+
+echo "\n -- Testing uksort() -- \n";
+uksort ($data, 'cmp');
+var_dump ($data);
+
+echo "\n -- Testing usort() -- \n";
+usort ($data, 'cmp');
+var_dump ($data);
+?>
+--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--
+<?php
+$data = array(
+ 'Test1',
+ 'teST2'=>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--
+<?php
+/* Prototype: mixed array_shift( array &array );
+ * Description: Shifts the first value of the array off and returns it.
+ */
+
+array_shift($GLOBALS);
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+
+/* Zero argument */
+var_dump( array_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--
+<?php
+
+array_pop($GLOBALS);
+
+$a = array("foo", "bar", "fubar");
+$b = array("3" => "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--
+<?php
+$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));
+$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--
+<?php
+//-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=- TEST 1 -=-=-=-=-
+$a = array(1,"big"=>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--
+<?php
+/* Prototype & Usage:
+ mixed key ( array &$array ) -> returns the index element of the current array position
+ mixed current ( array &$array ) -> returns the current element in the array
+ mixed next ( array &$array ) -> similar to current() but advances the internal pointer to next element
+ mixed reset ( array &$array ) -> Reset the internal pointer to first element
+*/
+
+$basic_arrays = array (
+ array(0), // array with element as 0
+ array(1), // array with single element
+ array(1,2, 3, -1, -2, -3), // array of integers
+ array(1.1, 2.2, 3.3, -1.1, -2.2, -3.3), // array of floats
+ array('a', 'b', 'c', "ab", "ac", "ad"), // string array
+ array("a" => "apple", "b" => "book", "c" => "cook"), // associative array
+ array('d' => 'drink', 'p' => 'port', 's' => 'set'), // another associative array
+ array(1 => 'One', 2 => 'two', 3 => "three") // associative array with key as integers
+);
+
+$varient_arrays = array (
+ array(), // empty array
+ array(""), // array with null string
+ array(NULL),// array with NULL
+ array(null),// array with null
+ array(NULL, true, null, "", 1), // mixed array
+ array(-1.5 => "test", -2 => "rest", 2.5 => "two",
+ "" => "string", 0 => "zero", "" => "" ) // mixed array
+);
+
+echo "*** Testing basic operations ***\n";
+$loop_count = 1;
+foreach ($basic_arrays as $sub_array ) {
+ echo "-- Iteration $loop_count --\n";
+ $loop_count++;
+ $c = count ($sub_array);
+ $c++; // increment by one to create the situation of accessing beyond array size
+ while ( $c ) {
+ var_dump( current($sub_array)); // current element
+ var_dump( key($sub_array) ); // key of the current element
+ var_dump( next($sub_array) ); // move to next element
+ $c --;
+ }
+ var_dump( reset($sub_array) ); // reset the internal pointer to first element
+ var_dump( key($sub_array) ); // access the array after reset
+ var_dump( $sub_array ); // dump the array to see that its intact
+
+ echo "\n";
+}
+
+echo "\n*** Testing possible variations ***\n";
+$loop_count = 1;
+foreach ($varient_arrays as $sub_array ) {
+ echo "-- Iteration $loop_count --\n";
+ $loop_count++;
+ $c = count ($sub_array);
+ $c++; // increment by one to create the situation of accessing beyond array size
+ while ( $c ) {
+ var_dump( current($sub_array)); // current element
+ var_dump( key($sub_array) ); // key of the current element
+ var_dump( next($sub_array) ); // move to next element
+ $c --;
+ }
+ var_dump( reset($sub_array) ); // reset the internal pointer to first element
+ var_dump( key($sub_array) ); // access the array after reset
+ var_dump( $sub_array ); // dump the array to see that its intact
+ echo "\n";
+}
+
+/*test these functions on array which is already unset */
+echo "\n-- Testing variation: when array is unset --\n";
+$unset_array = array (1);
+unset($unset_array);
+
+var_dump( current($unset_array) );
+var_dump( key($unset_array) );
+var_dump( next($unset_array) );
+var_dump( reset($unset_array) );
+
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument, expected 1 argument
+var_dump( key() );
+var_dump( current() );
+var_dump( reset() );
+var_dump( next() );
+
+// args more than expected, expected 1 argument
+$temp_array = array(1);
+var_dump( key($temp_array, $temp_array) );
+var_dump( current($temp_array, $temp_array) );
+var_dump( reset($temp_array, $temp_array) );
+var_dump( next($temp_array, $temp_array) );
+
+// invalid args type, valid arguement: array
+$int_var = 1;
+$float_var = 1.5;
+$string = "string";
+var_dump( key($int_var) );
+var_dump( key($float_var) );
+var_dump( key($string) );
+
+var_dump( current($int_var) );
+var_dump( current($float_var) );
+var_dump( current($string) );
+
+var_dump( next($int_var) );
+var_dump( next($float_var) );
+var_dump( next($string) );
+
+var_dump( reset($int_var) );
+var_dump( reset($float_var) );
+var_dump( reset($string) );
+
+echo "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--
+<?php
+/* Prototype: array array_change_key_case ( array $input [, int $case] )
+ Description: Changes the keys in the input array to be all lowercase
+ or uppercase. The change depends on the last optional case parameter.
+ You can pass two constants there, CASE_UPPER and CASE_LOWER(default).
+ The function will leave number indices as is.
+*/
+$arrays = array (
+ array (),
+ array (0),
+ array (1),
+ array (-1),
+ array (0, 2, 3, 4, 5),
+ array (1, 2, 3, 4, 5),
+ array ("" => 1),
+ array ("a" => 1),
+ array ("Z" => 1),
+ array ("one" => 1),
+ array ("ONE" => 1),
+ array ("OnE" => 1),
+ array ("oNe" => 1),
+ array ("one" => 1, "two" => 2),
+ array ("ONE" => 1, "two" => 2),
+ array ("OnE" => 1, "two" => 2),
+ array ("oNe" => 1, "two" => 2),
+ array ("one" => 1, "TWO" => 2),
+ array ("ONE" => 1, "TWO" => 2),
+ array ("OnE" => 1, "TWO" => 2),
+ array ("oNe" => 1, "TWO" => 2),
+ array ("one" => 1, "TwO" => 2),
+ array ("ONE" => 1, "TwO" => 2),
+ array ("OnE" => 1, "TwO" => 2),
+ array ("oNe" => 1, "TwO" => 2),
+ array ("one" => 1, "tWo" => 2),
+ array ("ONE" => 1, "tWo" => 2),
+ array ("OnE" => 1, "tWo" => 2),
+ array ("oNe" => 1, "tWo" => 2),
+ array ("one" => 1, 2),
+ array ("ONE" => 1, 2),
+ array ("OnE" => 1, 2),
+ array ("oNe" => 1, 2),
+ array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"),
+ array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"),
+ array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"),
+ array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four")
+);
+
+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--
+<?php
+/* generate different failure conditions */
+$int_var = -19;
+$item = array ("one" => 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--
+<?php
+
+$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
+
+/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
+var_dump(array_change_key_case($item, "CASE_UPPER"));
+var_dump(array_change_key_case($item, 5));
+
+/* when keys are different in terms of only case */
+/* should return one value key pair with key being in lowercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
+
+/* should return one value key pair with key being in uppercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) );
+
+echo "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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $input argument to test behaviour of array_change_key_case()
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_change_key_case()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_change_key_case($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_change_key_case() 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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $case argument to array_change_key_case() to test behaviour
+ * Where possible, CASE_UPPER has been entered as a string value
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$array = array ('one' => 1, 'TWO' => 2, 'Three' => 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+CASE_UPPER
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $case argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "CASE_UPPER",
+ 'CASE_UPPER',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_change_key_case()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_change_key_case($array, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Iteration 1 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 2 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 3 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 4 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 5 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 6 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 7 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 11 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 12 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 13 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 14 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 15 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 16 --
+
+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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays with different data types as keys to array_change_key_case()
+ * to test conversion
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays of different data types to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*3*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*4*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*5*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*6*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*8*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*9*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_change_key_case()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ var_dump( array_change_key_case($input, CASE_UPPER) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Iteration 1 : int data --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [-2345]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 : float data --
+array(3) {
+ [10]=>
+ string(8) "positive"
+ [-10]=>
+ string(8) "negative"
+ [0]=>
+ string(4) "half"
+}
+
+-- Iteration 3 : extreme floats data --
+array(2) {
+ [12345678]=>
+ string(5) "large"
+ [0]=>
+ string(5) "small"
+}
+
+-- Iteration 4 : null uppercase data --
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5 : null lowercase data --
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6 : bool lowercase data --
+array(2) {
+ [1]=>
+ string(6) "lowert"
+ [0]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7 : bool uppercase data --
+array(2) {
+ [1]=>
+ string(6) "uppert"
+ [0]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8 : empty double quotes data --
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9 : empty single quotes data --
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10 : string data --
+array(3) {
+ ["STRINGD"]=>
+ string(7) "stringd"
+ ["STRINGS"]=>
+ string(7) "strings"
+ ["HELLO WORLD"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11 : undefined data --
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12 : unset data --
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation4.phpt b/ext/standard/tests/array/array_change_key_case_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different integer values as $case argument to array_change_key_case() to test behaviour
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array('One' => 'un', 'TWO' => 'deux', 'three' => 'trois');
+for ($i = -5; $i <=5; $i += 1){
+ echo "\n-- \$sort argument is $i --\n";
+ $temp = $input;
+ var_dump(array_change_key_case($temp, $i));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- $sort argument is -5 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -4 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -3 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -2 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -1 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 0 --
+array(3) {
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+ ["three"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 1 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 2 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 3 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 4 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 5 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation5.phpt b/ext/standard/tests/array/array_change_key_case_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check the position of the internal array pointer after calling the function
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
+
+echo "\n-- Call array_change_key_case() --\n";
+var_dump($result = array_change_key_case($input, CASE_UPPER));
+
+echo "-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Call array_change_key_case() --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+-- Position of Internal Pointer in Result: --
+ONE => un
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation6.phpt b/ext/standard/tests/array/array_change_key_case_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_change_key_case() converts keys in multi-dimensional arrays
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array('English' => array('one' => 1, 'two' => 2, 'three' => 3),
+ 'French' => array('un' => 1, 'deux' => 2, 'trois' => 3),
+ 'German' => array('eins' => 1, 'zwei' => 2, 'drei' => 3));
+
+echo "\n-- Pass a two-dimensional array as \$input argument --\n";
+var_dump(array_change_key_case($input, CASE_UPPER));
+
+echo "\n-- Pass a sub-arry as \$input argument --\n";
+var_dump(array_change_key_case($input['English'], CASE_UPPER));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Pass a two-dimensional array as $input argument --
+array(3) {
+ ["ENGLISH"]=>
+ array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ }
+ ["FRENCH"]=>
+ array(3) {
+ ["un"]=>
+ int(1)
+ ["deux"]=>
+ int(2)
+ ["trois"]=>
+ int(3)
+ }
+ ["GERMAN"]=>
+ array(3) {
+ ["eins"]=>
+ int(1)
+ ["zwei"]=>
+ int(2)
+ ["drei"]=>
+ int(3)
+ }
+}
+
+-- Pass a sub-arry as $input argument --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation7.phpt b/ext/standard/tests/array/array_change_key_case_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_change_key_case() when:
+ * 1. Passed a referenced variable
+ * 2. Passed an argument by reference
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array('one' => 1, 'two' => 2, 'ABC' => 'xyz');
+
+echo "\n-- \$input argument is a reference to array --\n";
+$new_input = &$input;
+echo "Result:\n";
+var_dump(array_change_key_case($new_input, CASE_UPPER));
+echo "Original:\n";
+var_dump($input);
+echo "Referenced:\n";
+var_dump($new_input);
+
+echo "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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_change_key_case() behaves with different strings
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$inputs = array (
+ // group of escape sequences
+ array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
+
+ // array contains combination of capital/small letters
+ array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12)
+);
+
+foreach($inputs as $input) {
+ echo "\n-- \$case = default --\n";
+ var_dump(array_change_key_case($input));
+ echo "-- \$case = upper --\n";
+ var_dump(array_change_key_case($input, CASE_UPPER));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- $case = default --
+array(10) {
+ [""]=>
+ int(2)
+ ["\a"]=>
+ int(3)
+ ["\cx"]=>
+ int(4)
+ [""]=>
+ 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--
+<?php
+$array = array ();
+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(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--
+<?php
+$input_array = array('a', 'b', 'c', 'd', 'e');
+var_dump(array_chunk($input_array, 0));
+var_dump(array_chunk($input_array, 0, true));
+var_dump(array_chunk($input_array, 1));
+var_dump(array_chunk($input_array, 1, true));
+var_dump(array_chunk($input_array, 2));
+var_dump(array_chunk($input_array, 2, true));
+var_dump(array_chunk($input_array, 10));
+var_dump(array_chunk($input_array, 10, true));
+?>
+--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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Chunks an array into size large chunks.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_chunk() : basic functionality ***\n";
+$size = 2;
+
+$input_arrays = array (
+ // array with default keys - numeric values
+ array(1, 2, 3, 4, 5),
+
+ // array with default keys - string values
+ array('value1', "value2", "value3"),
+
+ // associative arrays - key as string
+ array('key1' => 1, "key2" => 2, "key3" => 3),
+
+ // associative arrays - key as numeric
+ array(1 => 'one', 2 => "two", 3 => "three"),
+
+ // array containing elements with/witout keys
+ array(1 => 'one','two', 3 => 'three', 4, "five" => 5)
+
+);
+
+$count = 1;
+// loop through each element of the array for input
+foreach ($input_arrays as $input_array){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input_array, $size) );
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_chunk() : basic functionality ***
+
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(6) "value3"
+ }
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(5) "three"
+ }
+}
+
+-- Iteration 5 --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_basic2.phpt b/ext/standard/tests/array/array_chunk_basic2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Chunks an array into size large chunks.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_chunk() : basic functionality ***\n";
+$size = 2;
+
+$input_arrays = array(
+ // array with default keys - numeric values
+ array(1, 2, 3, 4, 5),
+
+ // array with default keys - string values
+ array('value1', "value2", "value3"),
+
+ // associative arrays - key as string
+ array('key1' => 1, "key2" => 2, "key3" => 3),
+
+ // associative arrays - key as numeric
+ array(1 => 'one', 2 => "two", 3 => "three"),
+
+ // array containing elements with/without keys
+ array(1 => 'one','two', 3 => 'three', 4, "five" => 5)
+);
+
+$count = 1;
+// loop through each element of the array for input
+foreach ($input_arrays as $input_array){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input_array, $size, true) );
+ var_dump( array_chunk($input_array, $size, false) );
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_chunk() : basic functionality ***
+
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [4]=>
+ int(5)
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ }
+ [1]=>
+ array(1) {
+ [2]=>
+ string(6) "value3"
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(6) "value3"
+ }
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ ["key1"]=>
+ int(1)
+ ["key2"]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ ["key3"]=>
+ int(3)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(1) {
+ [3]=>
+ string(5) "three"
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(5) "three"
+ }
+}
+
+-- Iteration 5 --
+array(3) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(2) {
+ [3]=>
+ string(5) "three"
+ [4]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ ["five"]=>
+ int(5)
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_error.phpt b/ext/standard/tests/array/array_chunk_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_chunk(array input, int size [, bool preserve_keys])
+ * Description: Split array into chunks
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_chunk() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_chunk() function with zero arguments --\n";
+var_dump( array_chunk() );
+
+echo "\n-- Testing array_chunk() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$size = 10;
+$preserve_keys = true;
+$extra_arg = 10;
+var_dump( array_chunk($input,$size,$preserve_keys, $extra_arg) );
+
+echo "\n-- Testing array_chunk() function with less than expected no. of arguments --\n";
+$input = array(1, 2);
+var_dump( array_chunk($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : error conditions ***
+
+-- Testing array_chunk() function with zero arguments --
+
+Warning: array_chunk() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing array_chunk() function with more than expected no. of arguments --
+
+Warning: array_chunk() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing array_chunk() function with less than expected no. of arguments --
+
+Warning: array_chunk() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation1.phpt b/ext/standard/tests/array/array_chunk_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Chunks an array into size large chunks.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function with unexpected values for 'array' argument
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// Initialise function arguments
+$size = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new stdclass(),
+
+ // undefined data
+/*21*/ @undefined_var,
+
+ // unset data
+/*22*/ @unset_var
+
+);
+
+$count = 1;
+// loop through each element of the array for input
+foreach($values as $value){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($value, $size) );
+ var_dump( array_chunk($value, $size, true) );
+ var_dump( array_chunk($value, $size, false) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_chunk_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--
+<?php
+$array = array (1 => 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--
+<?php
+$array = array (0 => 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--
+<?php
+$array = array (1 => 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--
+<?php
+$array = array (1, 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(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--
+<?php
+$array = array (0, 1, 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(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--
+<?php
+$array = array (1, 2, 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) {
+ [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--
+<?php
+$array = array (0, 1, 2, 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(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--
+<?php
+$array = array (1, 2, 3, 4);
+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(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--
+<?php
+$array = array (0, 1, 2, 3, 4);
+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(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--
+<?php
+$array = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+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(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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function with unexpected values for 'size' argument
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array (
+
+ // float data
+/*1*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+/*6*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // string data
+/*19*/ "string",
+ 'string',
+
+ // object data
+/*21*/ new stdclass(),
+
+ // undefined data
+/*22*/ @undefined_var,
+
+ // unset data
+/*23*/ @unset_var
+
+);
+
+// loop through each element of the array for size
+$count = 1;
+foreach($values as $value){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input, $value) );
+ var_dump( array_chunk($input, $value, true) );
+ var_dump( array_chunk($input, $value, false) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 2 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 4 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+
+-- Iteration 14 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+
+-- Iteration 16 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_chunk_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--
+<?php
+$array = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+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(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--
+<?php
+$array = array ("a" => 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--
+<?php
+$array = array ("b" => 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--
+<?php
+$array = array ("p" => 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--
+<?php
+$array = array ("a" => "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--
+<?php
+$array = array ("p" => "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--
+<?php
+$array =array (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) {
+ [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--
+<?php
+$array = array (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) {
+ [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--
+<?php
+$array = array (-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) {
+ [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--
+<?php
+$array = array (0, 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)
+ [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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function with unexpected values for 'preserve_keys'
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input = array(1, 2);
+$size = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // empty data
+/*12*/ "",
+ '',
+
+ // string data
+/*14*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var
+
+);
+
+$count = 1;
+
+// loop through each element of the array for preserve_keys
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input, $size, $value) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 16 --
+
+Warning: array_chunk() expects parameter 3 to be boolean, object given in %s on line %d
+NULL
+
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_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--
+<?php
+$array = array (1, 2, 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) {
+ [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--
+<?php
+$array = array (1 => 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--
+<?php
+$array = array (2 => 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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function - input array containing different sub arrays
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+$size = 2;
+
+// input array
+$input_array = array (
+ "array1" => array(),
+ "array2" => array(1, 2, 3),
+ "array3" => array(1)
+);
+
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --\n";
+var_dump( array_chunk($input_array, $size) );
+
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true --\n";
+var_dump( array_chunk($input_array, $size, true) );
+
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = false --\n";
+var_dump( array_chunk($input_array, $size, false) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+}
+
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true --
+array(2) {
+ [0]=>
+ array(2) {
+ ["array1"]=>
+ array(0) {
+ }
+ ["array2"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ }
+ [1]=>
+ array(1) {
+ ["array3"]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+}
+
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = false --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_chunk() function with following conditions
+ * 1. -ve size value
+ * 2. size value is more than the no. of elements in the input array
+ * 3. size value is zero
+ * 4. Decimal size value
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input_array = array(1, 2, 3);
+
+// different magnitude's
+$sizes = array(-1, count($input_array) + 1, 0, 1.5);
+
+// loop through the array for size argument
+foreach ($sizes as $size){
+ echo "\n-- Testing array_chunk() when size = $size --\n";
+ var_dump( array_chunk($input_array, $size) );
+ var_dump( array_chunk($input_array, $size, true) );
+ var_dump( array_chunk($input_array, $size, false) );
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk() when size = -1 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Testing array_chunk() when size = 4 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Testing array_chunk() when size = 0 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Testing array_chunk() when size = 1.5 --
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [2]=>
+ int(3)
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation6.phpt b/ext/standard/tests/array/array_chunk_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_chunk() function with following conditions
+ * 1. array without elements
+ * 2. associative array with duplicate keys
+ * 3. array with one element
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input_arrays = array (
+
+ // array without elements
+ "array1" => array(),
+
+ // array with one element
+ "array2" => array(1),
+
+ // associative array with duplicate keys
+ "array3" => array("a" => 1, "b" => 2, "c" => 3, "a" => 4, "d" => 5)
+
+);
+
+$size = 2;
+$count = 1;
+
+echo "\n-- Testing array_chunk() by supplying various arrays --\n";
+
+// loop through the array for 'array' argument
+foreach ($input_arrays as $input_array){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input_array, $size) );
+ var_dump( array_chunk($input_array, $size, true) );
+ var_dump( array_chunk($input_array, $size, false) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk() by supplying various arrays --
+
+-- Iteration 1 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(5)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ ["a"]=>
+ int(4)
+ ["b"]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ ["c"]=>
+ int(3)
+ ["d"]=>
+ int(5)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(5)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation7.phpt b/ext/standard/tests/array/array_chunk_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_chunk() function with following conditions
+ * 1. input array containing references
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+$size = 2;
+
+echo "\n-- Testing array_chunk(), input array containing references \n";
+
+$numbers=array(1, 2, 3, 4);
+// reference array
+$input_array = array (
+ "one" => &$numbers[0],
+ "two" => &$numbers[1],
+ "three" => &$numbers[2],
+ "four" => &$numbers[3]
+);
+
+var_dump( array_chunk($input_array, $size) );
+var_dump( array_chunk($input_array, $size, true) );
+var_dump( array_chunk($input_array, $size, false) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk(), input array containing references
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ &int(3)
+ [1]=>
+ &int(4)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ ["one"]=>
+ &int(1)
+ ["two"]=>
+ &int(2)
+ }
+ [1]=>
+ array(2) {
+ ["three"]=>
+ &int(3)
+ ["four"]=>
+ &int(4)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ &int(3)
+ [1]=>
+ &int(4)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_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--
+<?php
+$array = array (3 => -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--
+<?php
+$array = array (1 => 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--
+<?php
+ $array1 = array('green', 'red', 'yellow');
+ $array2 = array('1', '2', '3');
+ $array3 = array(0, 1, 2);
+ $array4 = array(TRUE, FALSE, NULL);
+ $a = array_combine($array1, $array1);
+ $b = array_combine($array1, $array2);
+ $c = array_combine($array1, $array3);
+ $d = array_combine($array1, $array4);
+ $e = array_combine($array2, $array1);
+ $f = array_combine($array2, $array2);
+ $g = array_combine($array2, $array3);
+ $h = array_combine($array2, $array4);
+ $i = array_combine($array3, $array1);
+ $j = array_combine($array3, $array2);
+ $k = array_combine($array3, $array3);
+ $l = array_combine($array3, $array4);
+ $m = array_combine($array4, $array1);
+ $n = array_combine($array4, $array2);
+ $o = array_combine($array4, $array3);
+ $p = array_combine($array4, $array4);
+ for($letter = "a"; $letter <= "p"; $letter++)
+ {
+ print_r($$letter);
+ }
+?>
+--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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_combine() : basic functionality ***\n";
+
+/* Different arrays for $keys and $values arguments */
+
+// array with default keys for $keys and $values arguments
+$keys_array = array(1, 2);
+$values_array = array(3,4);
+var_dump( array_combine($keys_array, $values_array) );
+
+// associative arrays for $keys and $values arguments
+$keys_array = array(1 => "a", 2 => 'b');
+$values_array = array(3 => 'c', 4 => "d");
+var_dump( array_combine($keys_array, $values_array) );
+
+// mixed array for $keys and $values arguments
+$keys_array = array(1, 2 => "b");
+$values_array = array(3 => 'c', 4);
+var_dump( array_combine($keys_array, $values_array) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : basic functionality ***
+array(2) {
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+array(2) {
+ ["a"]=>
+ string(1) "c"
+ ["b"]=>
+ string(1) "d"
+}
+array(2) {
+ [1]=>
+ string(1) "c"
+ ["b"]=>
+ int(4)
+}
+Done
diff --git a/ext/standard/tests/array/array_combine_error1.phpt b/ext/standard/tests/array/array_combine_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_combine() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_combine() function with Zero arguments --\n";
+var_dump( array_combine() );
+
+//Test array_combine with one more than the expected number of arguments
+echo "\n-- Testing array_combine() function with more than expected no. of arguments --\n";
+$keys = array(1, 2);
+$values = array(1, 2);
+$extra_arg = 10;
+var_dump( array_combine($keys,$values, $extra_arg) );
+
+// Testing array_combine with one less than the expected number of arguments
+echo "\n-- Testing array_combine() function with less than expected no. of arguments --\n";
+$keys = array(1, 2);
+var_dump( array_combine($keys) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : error conditions ***
+
+-- Testing array_combine() function with Zero arguments --
+
+Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing array_combine() function with more than expected no. of arguments --
+
+Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing array_combine() function with less than expected no. of arguments --
+
+Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_combine() : error conditions specific to array_combine() ***\n";
+
+// Testing array_combine by passing empty arrays to $keys and $values arguments
+echo "\n-- Testing array_combine() function with empty arrays --\n";
+var_dump( array_combine(array(), array()) );
+
+// Testing array_combine by passing empty array to $keys
+echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
+var_dump( array_combine(array(), array(1, 2)) );
+
+// Testing array_combine by passing empty array to $values
+echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
+var_dump( array_combine(array(1, 2), array()) );
+
+// Testing array_combine with arrays having unequal number of elements
+echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
+var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : error conditions specific to array_combine() ***
+
+-- Testing array_combine() function with empty arrays --
+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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_combine() function by passing values to $keys argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $values argument passed is a fixed array.
+*/
+
+echo "*** Testing array_combine() : Passing non-array values to \$keys argument ***\n";
+
+// Initialise $values argument
+$values = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $keys argument
+$keys_passed = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element within $keys_passed to check the behavior of array_combine()
+$iterator = 1;
+foreach($keys_passed as $keys) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($keys,$values) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : Passing non-array values to $keys argument ***
+-- Iteration 1 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_combine() expects parameter 1 to be array, object given in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: array_combine() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_combine_variation2.phpt b/ext/standard/tests/array/array_combine_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_combine() function by passing values to $values argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $keys argument passed is a fixed array.
+*/
+
+echo "*** Testing array_combine() : Passing non-array values to \$values argument ***\n";
+
+// Initialize $keys array
+$keys = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $values argument
+$values_passed = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element within $values_passed to check the behavior of array_combine()
+$iterator = 1;
+foreach($values_passed as $values) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($keys,$values) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : Passing non-array values to $values argument ***
+-- Iteration 1 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_combine() expects parameter 2 to be array, object given in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: array_combine() expects parameter 2 to be array, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_combine_variation3.phpt b/ext/standard/tests/array/array_combine_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to both $keys and $values arguments and testing whether
+* array_combine() behaves in an expected way with the arguments passed to the function
+*/
+
+echo "*** Testing array_combine() : Passing different types of arrays to both \$keys and \$values argument ***\n";
+/* Different heredoc strings passed as argument to arrays */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// arrays passed to $keys argument
+$arrays = array (
+/*1*/ array(1, 2), // with default keys and numeric values
+ array(1.1, 2.2), // with default keys & float values
+ array(false,true), // with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // with NULL
+ array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings
+ array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through each sub-array within $arrays to check the behavior of array_combine()
+// same arrays are passed to both $keys and $values
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($array, $array) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : Passing different types of arrays to both $keys and $values argument ***
+-- Iteration 1 --
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+-- Iteration 2 --
+array(2) {
+ ["1.1"]=>
+ float(1.1)
+ ["2.2"]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(2) {
+ [""]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 4 --
+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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_combine() by passing different
+ * associative arrays having different possible keys to $keys argument and
+ * associative arrays having different possible keys to $values argument.
+*/
+
+echo "*** Testing array_combine() : assoc array with diff keys to both \$keys and \$values argument ***\n";
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed keys
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// array to be passsed to $arr2 argument
+$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
+ "\tHello" => 111, 2.2, 'color', "Hello world" => "string",
+ "pen\n" => 33, new classA() => 11, 133 => "int");
+
+// loop through each sub-array within $arrays to check the behavior of array_combine()
+// same arrays are passed to both $keys and $values
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($array, $array) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : assoc array with diff keys to both $keys and $values argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the functionality of array_combine() by passing various
+* associative arrays having different possible values to $keys argument and
+* associative arrays having different possible values to $values argument.
+*/
+
+echo "*** Testing array_combine() : assoc array with diff values to both \$keys and \$values argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+public function __toString(){
+return "Class A object";
+}
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+
+// loop through each sub-array within $arrays to check the behavior of array_combine()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($array, $array) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : assoc array with diff values to both $keys and $values argument ***
+-- Iteration 1 --
+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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_combine() by passing array with
+* binary values for $keys and $values argument.
+*/
+
+echo "*** Testing array_combine() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+$arr_normal = array("hello", "world");
+
+// array with binary value for $keys and $values argument
+var_dump( array_combine($arr_binary, $arr_binary) );
+
+// array with binary value for $values argument
+var_dump( array_combine($arr_normal, $arr_binary) );
+
+// array with binary value for $keys argument
+var_dump( array_combine($arr_binary, $arr_normal) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : binary safe checking ***
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["world"]=>
+ string(5) "world"
+}
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["world"]=>
+ string(5) "world"
+}
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["world"]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_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--
+<?php
+$arrays = array (
+ array (),
+ array (0),
+ array (1),
+ array (-1),
+ array (0, 0),
+ array (0, 1),
+ array (1, 1),
+ array (1, "hello", 1, "world", "hello"),
+ array ("hello", "world", "hello"),
+ array ("", "world", "", "hello", "world", "hello", "hello", "world", "hello"),
+ array (0, array (1, "hello", 1, "world", "hello")),
+ array (1, array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello")),
+);
+
+foreach ($arrays as $item) {
+ var_dump (@array_count_values ($item));
+ echo "\n";
+}
+?>
+--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--
+<?php
+$array1 = array(1,
+ "hello",
+ 1,
+ "world",
+ "hello",
+ "",
+ "rabbit",
+ "foo",
+ "Foo",
+ TRUE,
+ FALSE,
+ NULL,
+ 0);
+var_dump(array_count_values($array1));
+?>
+--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--
+<?php
+/* Prototype : proto array array_count_values(array input)
+ * Description: Return the value as key and the frequency of that value in input as value
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Test for handling of incorrect parameters.
+ */
+
+echo "*** Testing array_count_values() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_count_values() function with Zero arguments --\n";
+var_dump( array_count_values() );
+
+//Test array_count_values with one more than the expected number of arguments
+echo "\n-- Testing array_count_values() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_count_values($input, $extra_arg) );
+
+//Test array_count_values with integer arguments
+echo "\n-- Testing array_count_values() function integer arguments --\n";
+var_dump( array_count_values(1 ));
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array array_count_values(array input)
+ * Description: Return the value as key and the frequency of that value in input as value
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Test behaviour with paramter variations
+ */
+
+echo "*** Testing array_count_values() : parameter variations ***\n";
+
+class A {
+ static function hello() {
+ echo "Hello\n";
+ }
+}
+
+$ob = new A();
+
+$fp = fopen("array_count_file", "w+");
+
+$arrays = array ("bobk" => "bobv", "val", 6 => "val6", $fp, $ob);
+
+var_dump (@array_count_values ($arrays));
+echo "\n";
+
+
+echo "Done";
+?>
+
+--CLEAN--
+<?php
+unlink("array_count_file");
+?>
+--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--
+<?php
+//-=-=-=-=-
+$a = array();
+$b = 3;
+$c = array(5);
+array_diff($a, $b, $c);
+//-=-=-=-=-=-
+echo "OK!";
+?>
+--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--
+<?php
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_diff_assoc
+ */
+
+echo "*** Testing array_diff_assoc() : basic functionality ***\n";
+$array_default_key = array('one', 2, 'three', '4');
+$array_numeric_key = array(1 => 'one', 2=> 'two', 3 => 4);
+$array_string_key = array('one' => 1, 'two' => '2', '3' => 'three');
+
+
+
+echo "-- Compare Default keys to numeric keys --\n";
+var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
+var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
+
+
+echo "\n-- Compare Default keys to string keys --\n";
+var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
+var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
+
+
+echo "\n-- Compare numeric keys to string keys --\n";
+var_dump(array_diff_assoc($array_numeric_key, $array_string_key));
+var_dump(array_diff_assoc($array_string_key, $array_numeric_key));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : basic functionality ***
+-- Compare Default keys to numeric keys --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+
+-- Compare Default keys to string keys --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+
+-- Compare numeric keys to string keys --
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(4)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ string(1) "2"
+ [3]=>
+ string(5) "three"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are not present
+ * in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test errors for array_diff with too few\zero arguments
+ */
+
+echo "*** Testing array_diff_assoc() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_diff_assoc() function with zero arguments --\n";
+var_dump( array_diff_assoc() );
+
+// Testing array_diff_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_diff_assoc($arr1) );
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : error conditions ***
+
+-- Testing array_diff_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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not present
+ * in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_diff_assoc arguments that are not arrays in place of $arr1
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of unexpected values to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp,
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($input, $array));
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation10.phpt b/ext/standard/tests/array/array_diff_assoc_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are not
+ * present in any of the others arguments but do additional checks whether
+ * the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() compares binary data
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array1 = array( b"1",
+ b"hello",
+ "world",
+ "str1" => "hello",
+ "str2" => "world");
+
+$array2 = array( b"1" => 'hello',
+ b"world",
+ "hello",
+ 'test');
+
+var_dump(array_diff_assoc($array1, $array2));
+var_dump(array_diff_assoc($array2, $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+array(3) {
+ [0]=>
+ string(1) "1"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+}
+array(2) {
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ string(4) "test"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are not present
+ * in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * pass array_diff_assoc arguments which are not arrays in place of $arr2
+ */
+
+echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of unexpected values to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp,
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($array, $input));
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation3.phpt b/ext/standard/tests/array/array_diff_assoc_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are not present
+ * in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() compares indexed arrays containing different data types
+ */
+
+echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+//array of different data types to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/
+'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345),
+
+ // float data
+/*2*/
+'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5),
+
+ // null data
+/*3*/
+'null' => array(
+ NULL,
+ null),
+
+ // boolean data
+/*4*/
+'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE),
+
+ // empty data
+/*5*/
+'empty' => array(
+ "",
+ ''),
+
+ // string data
+/*6*/
+'string' => array(
+ "string",
+ 'string',
+ $heredoc),
+
+ // binary data
+/*7*/
+'binary' => array(
+ b"binary",
+ (binary)"binary"),
+
+ // object data
+/*8*/
+'object' => array(
+ new classA()),
+
+ // undefined data
+/*9*/
+'undefined' => array(
+ @$undefined_var),
+
+ // unset data
+/*10*/
+'unset' => array(
+ @$unset_var),
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($input, $array));
+ $iterator++;
+};
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+}
+
+-- Iteration 2 --
+array(5) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+-- Iteration 4 --
+array(3) {
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+
+-- Iteration 6 --
+array(3) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(11) "hello world"
+}
+
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(6) "binary"
+ [1]=>
+ string(6) "binary"
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation4.phpt b/ext/standard/tests/array/array_diff_assoc_variation4.phpt
new file mode 100644
index 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--
+
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are not present
+ * in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() compares arrays containing different data types
+ * as keys
+ */
+
+echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+//Different data types as keys to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/
+'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative'),
+
+ // float data
+/*2*/
+'float' => array(
+ 10.5 => 'float 1',
+ -10.5 => 'float 2',
+ .5 => 'float 3'),
+
+ // null data
+/*3*/
+'null' => array(
+ NULL => 'null 1',
+ null => 'null 2'),
+
+ // boolean data
+/*4*/
+'bool' => array(
+ true => 'boolt',
+ false => 'boolf',
+ TRUE => 'boolT',
+ FALSE => 'boolF'),
+
+ // empty data
+/*5*/
+'empty' => array(
+ "" => 'emptyd',
+ '' => 'emptys'),
+
+ // string data
+/*6*/
+'string' => array(
+ "string" => 'stringd',
+ 'string' => 'strings',
+ $heredoc => 'stringh'),
+
+ // binary data
+/*7*/
+'binary' => array(
+ b"binary1" => 'binary 1',
+ (binary)"binary2" => 'binary 2'),
+
+ // undefined data
+/*8*/
+'undefined' => array(
+ @$undefined_var => 'undefined'),
+
+ // unset data
+/*9*/
+'unset' => array(
+ @$unset_var => 'unset'),
+
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($input, $array));
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [-2345]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 --
+array(3) {
+ [10]=>
+ string(7) "float 1"
+ [-10]=>
+ string(7) "float 2"
+ [0]=>
+ string(7) "float 3"
+}
+
+-- Iteration 3 --
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 4 --
+array(2) {
+ [1]=>
+ string(5) "boolT"
+ [0]=>
+ string(5) "boolF"
+}
+
+-- Iteration 5 --
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 6 --
+array(2) {
+ ["string"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 7 --
+array(2) {
+ ["binary1"]=>
+ string(8) "binary 1"
+ ["binary2"]=>
+ string(8) "binary 2"
+}
+
+-- Iteration 8 --
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 9 --
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation5.phpt b/ext/standard/tests/array/array_diff_assoc_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are not present
+ * in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc compares integers, floats and string
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+$arr_default_int = array(1, 2, 3, 'a');
+$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 'b');
+$arr_string = array('1', '2', '3', 'c');
+$arr_string_float = array('0' => '1.00', '1.00' => '2.00', '2.00' => '3.00', 'd');
+
+echo "-- Result of comparing integers and floating point numbers: --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_float));
+var_dump(array_diff_assoc($arr_float, $arr_default_int));
+
+echo "-- Result of comparing integers and strings containing an integers : --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_string));
+var_dump(array_diff_assoc($arr_string, $arr_default_int));
+
+echo "-- Result of comparing integers and strings containing floating points : --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_string_float));
+var_dump(array_diff_assoc($arr_string_float, $arr_default_int));
+
+echo "-- Result of comparing floating points and strings containing integers : --\n";
+var_dump(array_diff_assoc($arr_float, $arr_string));
+var_dump(array_diff_assoc($arr_string, $arr_float));
+
+echo "-- Result of comparing floating points and strings containing floating point: --\n";
+var_dump(array_diff_assoc($arr_float, $arr_string_float));
+var_dump(array_diff_assoc($arr_string_float, $arr_float));
+
+echo "-- Result of comparing strings containing integers and strings containing floating points : --\n";
+var_dump(array_diff_assoc($arr_string, $arr_string_float));
+var_dump(array_diff_assoc($arr_string_float, $arr_string));
+
+echo "-- Result of comparing more than two arrays: --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_float, $arr_string, $arr_string_float));
+
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+-- Result of comparing integers and floating point numbers: --
+array(1) {
+ [3]=>
+ string(1) "a"
+}
+array(1) {
+ [3]=>
+ string(1) "b"
+}
+-- Result of comparing integers and strings containing an integers : --
+array(1) {
+ [3]=>
+ string(1) "a"
+}
+array(1) {
+ [3]=>
+ string(1) "c"
+}
+-- Result of comparing integers and strings containing floating points : --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(1) "a"
+}
+array(4) {
+ [0]=>
+ string(4) "1.00"
+ ["1.00"]=>
+ string(4) "2.00"
+ ["2.00"]=>
+ string(4) "3.00"
+ [1]=>
+ string(1) "d"
+}
+-- Result of comparing floating points and strings containing integers : --
+array(1) {
+ [3]=>
+ string(1) "b"
+}
+array(1) {
+ [3]=>
+ string(1) "c"
+}
+-- Result of comparing floating points and strings containing floating point: --
+array(4) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(2)
+ [2]=>
+ float(3)
+ [3]=>
+ string(1) "b"
+}
+array(4) {
+ [0]=>
+ string(4) "1.00"
+ ["1.00"]=>
+ string(4) "2.00"
+ ["2.00"]=>
+ string(4) "3.00"
+ [1]=>
+ string(1) "d"
+}
+-- Result of comparing strings containing integers and strings containing floating points : --
+array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "c"
+}
+array(4) {
+ [0]=>
+ string(4) "1.00"
+ ["1.00"]=>
+ string(4) "2.00"
+ ["2.00"]=>
+ string(4) "3.00"
+ [1]=>
+ string(1) "d"
+}
+-- Result of comparing more than two arrays: --
+array(1) {
+ [3]=>
+ string(1) "a"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation6.phpt b/ext/standard/tests/array/array_diff_assoc_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc behaves
+ * 1. When comparing an array that has similar elements
+ * but has been created in a different order
+ * 2. When doing a strict comparison of string representation
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array ('zero',
+ 1 => 1,
+ 'two' => 2.00000000000001);
+
+$inputs = array (
+
+//default keys => string values
+/*1*/ array('2.00000000000001', '1', 'zero', 'a'),
+
+//numeric keys => string values
+/*2*/ array(2 => '2.00000000000001',
+ 1 => '1',
+ 0 => 'zero',
+ 3 => 'a'),
+
+//string keys => string values
+/*3*/ array('2' => '2.00000000000001',
+ '1' => '1',
+ '0' => 'zero',
+ '3' => 'a') ,
+
+//default keys => numeric values
+/*4*/ array(2, 1, 0),
+
+//numeric keys => numeric values
+/*5*/ array(2 => 2,
+ 1 => 1,
+ 0 => 0),
+
+//string keys => numeric values
+/*6*/ array('two' => 2,
+ '1' => 1,
+ '0' => 0),
+
+//defualt keys => float values
+/*7*/ array(2.00000000000001, 1.00, 0.01E-9),
+
+//numeric keys => float values
+/*8*/ array(2 => 2.00000000000001,
+ 1 => 1.00,
+ 0 => 0.01E-9),
+
+//string keys => float values
+/*9*/ array ('two' => 2.00000000000001,
+ '1' => 1.00,
+ '0' =>0.01E-9)
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(array_diff_assoc($array, $input));
+ var_dump(array_diff_assoc($input, $array));
+ $iterator++;
+};
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(3) {
+ [0]=>
+ string(16) "2.00000000000001"
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "a"
+}
+
+-- Iteration 2 --
+array(1) {
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ string(16) "2.00000000000001"
+ [3]=>
+ string(1) "a"
+}
+
+-- Iteration 3 --
+array(1) {
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ string(16) "2.00000000000001"
+ [3]=>
+ string(1) "a"
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [0]=>
+ int(2)
+ [2]=>
+ int(0)
+}
+
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ int(2)
+ [0]=>
+ int(0)
+}
+
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(4) "zero"
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [0]=>
+ float(2)
+ [2]=>
+ float(1.0E-11)
+}
+
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ float(2)
+ [0]=>
+ float(1.0E-11)
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(4) "zero"
+}
+array(1) {
+ [0]=>
+ float(1.0E-11)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation7.phpt b/ext/standard/tests/array/array_diff_assoc_variation7.phpt
new file mode 100644
index 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--
+
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments but do additional checks whether the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Tests how array_diff_assoc compares
+ * 1. Referenced variables
+ * 2. Arrays that have been referenced to each other
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$a = 'a';
+
+$arr1 = array('a', 'b', 'c', $a);
+$arr2 = array('a' => 1, 'b' => 2, 'c' => 3, &$a);
+
+echo "-- Results when \$a = $a: --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+$a = 4;
+
+echo "-- Results when \$a has been changed to $a: --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+$arr2 = &$arr1;
+
+echo "-- Results when \$arr2 is referenced to \$arr1 --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+$arr1 = array('zero' => 'x', 'one' => 'y', 'two' => 'z');
+
+echo "-- Results when \$arr1 is changed --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+-- Results when $a = a: --
+array(3) {
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "a"
+}
+array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+}
+-- Results when $a has been changed to 4: --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "a"
+}
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ [0]=>
+ &int(4)
+}
+-- Results when $arr2 is referenced to $arr1 --
+array(0) {
+}
+array(0) {
+}
+-- Results when $arr1 is changed --
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation8.phpt b/ext/standard/tests/array/array_diff_assoc_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments but do additional checks whether
+ * the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() behaves when comparing:
+ * 1. the order of the array
+ * 2. duplicate values
+ * 3. duplicate key names
+ */
+
+echo "*** Testing array_diff_assoc() : variation ***\n";
+
+$array_index = array('a', 'b', 'c', 0 => 'd', 'b'); //duplicate key (0), duplicate value (b)
+$array_assoc = array ('2' => 'c', //same key=>value pair, different order
+ '1' => 'b',
+ '0' => 'a',
+ 'b' => '3', //key and value from array_index swapped
+ 'c' => 2); //same as above, using integer
+
+var_dump(array_diff_assoc($array_index, $array_assoc));
+var_dump(array_diff_assoc($array_assoc, $array_index));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : variation ***
+array(2) {
+ [0]=>
+ string(1) "d"
+ [3]=>
+ string(1) "b"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "3"
+ ["c"]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation9.phpt b/ext/standard/tests/array/array_diff_assoc_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments but do additional checks whether
+ * the keys are equal
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc behaves when comparing
+ * multi-dimensional arrays
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array1 = array('sub_array1' => array (1, 2, 3),
+ 'sub_array2' => array ('a', 'b', 'c'));
+$array2 = array('sub_arraya' => array (1, 3, 5),
+ 'sub_arrayb' => array ('a', 'z', 'y'));
+
+echo "-- Compare two 2-D arrays --\n";
+var_dump(array_diff_assoc($array1, $array2));
+var_dump(array_diff_assoc($array2, $array1));
+
+echo "\n-- Compare subarrays from two 2-D arrays --\n";
+var_dump(array_diff_assoc($array1['sub_array1'], $array2['sub_arraya']));
+var_dump(array_diff_assoc($array2['sub_arraya'], $array1['sub_array1']));
+var_dump(array_diff_assoc($array1['sub_array2'], $array2['sub_arrayb']));
+var_dump(array_diff_assoc($array2['sub_arrayb'], $array1['sub_array1']));
+
+echo "\n-- Compare a subarray from one 2-D array and one 2-D array --\n";
+var_dump(array_diff_assoc($array1['sub_array1'], $array2));
+var_dump(array_diff_assoc($array1, $array2['sub_arraya']));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+-- Compare two 2-D arrays --
+array(2) {
+ ["sub_array1"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["sub_array2"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+array(2) {
+ ["sub_arraya"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ ["sub_arrayb"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "z"
+ [2]=>
+ string(1) "y"
+ }
+}
+
+-- Compare subarrays from two 2-D arrays --
+array(2) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+}
+array(2) {
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "z"
+ [2]=>
+ string(1) "y"
+}
+
+-- Compare a subarray from one 2-D array and one 2-D array --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ ["sub_array1"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["sub_array2"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_basic.phpt b/ext/standard/tests/array/array_diff_basic.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not present
+ * in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_diff
+ */
+
+echo "*** Testing array_diff() : basic functionality ***\n";
+
+//Test indexed array with integers as elements
+$array_int1 = array (1, 2, 3, 4);
+$array_int2 = array (3, 4, 5, 6);
+
+echo "-- Test indexed array with integers as elements --\n";
+var_dump(array_diff($array_int1, $array_int2));
+var_dump(array_diff($array_int2, $array_int1));
+
+
+//Test indexed array with strings as elements
+$array_string1 = array ('one', 'two', 'three', 'four');
+$array_string2 = array ('three', 'four', 'five', 'six');
+
+echo "-- Test indexed array with strings as elements --\n";
+var_dump(array_diff($array_string1, $array_string2));
+var_dump(array_diff($array_string2, $array_string1));
+
+//Test associative array with strings as keys and integers as elements
+$array_assoc_int1 = array ('one' => 1, 'two' => 2, 'three' => 3, 'four' => 4);
+$array_assoc_int2 = array ('three' => 3, 'four' => 4, 'five' => 5, 'six' => 6);
+
+echo "-- Test associative array with strings as keys and integers as elements --\n";
+var_dump(array_diff($array_assoc_int1, $array_assoc_int2));
+var_dump(array_diff($array_assoc_int2, $array_assoc_int1));
+
+//Test associative array with strings as keys and elements
+$array_assoc_str1 = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois', 'four' => 'quatre');
+$array_assoc_str2 = array ('three' => 'trois', 'four' => 'quatre', 'five' => 'cinq', 'six' => 'six');
+
+echo "-- Test associative array with strings as keys and integers as elements --\n";
+var_dump(array_diff($array_assoc_str1, $array_assoc_str2));
+var_dump(array_diff($array_assoc_str2, $array_assoc_str1));
+
+echo "-- Test array_diff with more than 2 arguments --\n";
+var_dump(array_diff($array_int1, $array_int2, $array_string1, $array_string2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : basic functionality ***
+-- Test indexed array with integers as elements --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [2]=>
+ int(5)
+ [3]=>
+ int(6)
+}
+-- Test indexed array with strings as elements --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+array(2) {
+ [2]=>
+ string(4) "five"
+ [3]=>
+ string(3) "six"
+}
+-- Test associative array with strings as keys and integers as elements --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(2) {
+ ["five"]=>
+ int(5)
+ ["six"]=>
+ int(6)
+}
+-- Test associative array with strings as keys and integers as elements --
+array(2) {
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+}
+array(2) {
+ ["five"]=>
+ string(4) "cinq"
+ ["six"]=>
+ string(3) "six"
+}
+-- Test array_diff with more than 2 arguments --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff with less than the expected number of arguments
+ */
+
+echo "*** Testing array_diff() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing array_diff() function with zero arguments --\n";
+var_dump( array_diff() );
+
+
+// Testing array_diff with one less than the expected number of arguments
+echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_diff($arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : error conditions ***
+
+-- Testing array_diff() function with zero arguments --
+
+Warning: 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--
+<?php
+$a = array(1, 6, 2, -20, 15, 1200, -2500);
+$b = array(0, 7, 2, -20, 11, 1100, -2500);
+$c = array(0, 6, 2, -20, 19, 1000, -2500);
+$d = array(3, 8,-2, -20, 14, 900, -2600);
+$a_f = array_flip($a);
+$b_f = array_flip($b);
+$c_f = array_flip($c);
+$d_f = array_flip($d);
+$i = 1;
+/* give nicer values */
+foreach ($a_f as $k=> &$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--
+<?php
+$array1 = array("a" => "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--
+<?php
+/*
+* proto array array_diff_key(array arr1, array arr2 [, array ...])
+* Function is implemented in ext/standard/array.c
+*/
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_diff_key($array1, $array2));
+?>
+--EXPECT--
+array(2) {
+ ["red"]=>
+ int(2)
+ ["purple"]=>
+ int(4)
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : error conditions ***\n";
+
+// Initialise the variables
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array2 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('blue' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(-07 => '-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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(10 => '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--
+<?php
+/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array(
+
+ 'first' => 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--
+<?php
+/*
+* array array_diff_uassoc ( array $array1, array $array2 [, array $..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($a, $b) {
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b) ? 1 : -1;
+}
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
+$array2 = array("a" => "green", "yellow", "red");
+$result = array_diff_uassoc($array1, $array2, "key_compare_func");
+var_dump($result);
+?>
+--EXPECT--
+array(3) {
+ ["b"]=>
+ string(5) "brown"
+ ["c"]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : error conditions ***\n";
+
+//Initialize array
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$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 = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(10 => '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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$ref_var = 'a';
+$array1 = array('a', $ref_var);
+$array2 = array('a' => 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize array
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$array1 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize array
+$array1 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$array1 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$arr_default_int = array(1, 2, 3, 4);
+$arr_float = array(0 => 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$arr_float = array(0 => 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$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 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$arr_default_int = array(1, 2, 3);
+$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 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--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(10 => 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--
+<?php
+/*
+* proto array array_diff_ukey ( array $array1, array $array2 [, array $ ..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($key1, $key2) {
+ if ($key1 == $key2) return 0;
+ else if ($key1 > $key2) return 1;
+ else return -1;
+}
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_diff_ukey($array1, $array2, 'key_compare_func'));
+?>
+--EXPECT--
+array(2) {
+ ["red"]=>
+ int(2)
+ ["purple"]=>
+ int(4)
+}
diff --git a/ext/standard/tests/array/array_diff_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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : error conditions ***\n";
+
+// Initialize
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array2 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+//Initialize variables
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('green' => 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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialize function arguments not being substituted (if any)
+$array1 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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 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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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 ...
+
+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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array(
+
+ 'first' => 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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(-07 => '-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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_ukey() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(10 => '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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff by passing non array values in place of $arr1
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_diff
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_diff($input, $array));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+-- Iteration 1 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation10.phpt b/ext/standard/tests/array/array_diff_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test behaviour of array_diff() function with binary input
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+
+$array1 = array( b"1",
+ b"hello",
+ "world",
+ "str1" => "hello",
+ "str2" => "world");
+
+$array2 = array( b"1" => 'hello',
+ b"world",
+ "hello",
+ 'test');
+
+var_dump(array_diff($array1, $array2));
+var_dump(array_diff($array2, $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [4]=>
+ string(4) "test"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff by passing non array values in place of $arr2
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_diff
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_diff($array, $input));
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+-- Iteration 1 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation3.phpt b/ext/standard/tests/array/array_diff_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff() compares indexed arrays containing different
+ * data types as values in place of $arr1
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get heredoc
+$heredoc = <<<END
+This is a heredoc
+END;
+
+//array of values to iterate over
+$values = array(
+
+/*1*/"empty array" => array(),
+
+/*2*/
+"int" => array(
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345),
+
+/*3*/
+"float" => array(
+ // float data
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5),
+
+/*4*/
+"null" => array(
+ // null data
+ NULL,
+ null),
+
+/*5*/
+"boolean" => array(
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE),
+
+/*6*/
+"empty" => array(
+ // empty data
+ "",
+ ''),
+
+/*7*/
+"string" => array(
+ // string data
+ "string",
+ 'string',
+ $heredoc),
+
+/*8*/
+"binary" => array(
+ // binary data
+ b"binary",
+ (binary)"binary"),
+
+/*9*/
+"undefined" => array(
+ // undefined data
+ @$undefined_var),
+
+/*10*/
+"unset" => array(
+ // unset data
+ @$unset_var)
+);
+
+// loop through each element of the array for arr1
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n Iteration: $iterator \n";
+ var_dump( array_diff($value, $array) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+ Iteration: 1
+array(0) {
+}
+
+ Iteration: 2
+array(3) {
+ [0]=>
+ int(0)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+}
+
+ Iteration: 3
+array(5) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+}
+
+ Iteration: 4
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+ Iteration: 5
+array(2) {
+ [1]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+ Iteration: 6
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+
+ Iteration: 7
+array(3) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(17) "This is a heredoc"
+}
+
+ Iteration: 8
+array(2) {
+ [0]=>
+ string(6) "binary"
+ [1]=>
+ string(6) "binary"
+}
+
+ Iteration: 9
+array(1) {
+ [0]=>
+ NULL
+}
+
+ Iteration: 10
+array(1) {
+ [0]=>
+ NULL
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation4.phpt b/ext/standard/tests/array/array_diff_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff() compares indexed arrays containing different
+ * data types as values in place of $arr2
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get heredoc
+$heredoc = <<<END
+This is a heredoc
+END;
+
+//array of values to iterate over
+$values = array(
+
+/*1*/"empty array" => array(),
+
+/*2*/
+"int" => array(
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345),
+
+/*3*/
+"float" => array(
+ // float data
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5),
+
+/*4*/
+"null" => array(
+ // null data
+ NULL,
+ null),
+
+/*5*/
+"boolean" => array(
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE),
+
+/*6*/
+"empty" => array(
+ // empty data
+ "",
+ ''),
+
+/*7*/
+"string" => array(
+ // string data
+ "string",
+ 'string',
+ $heredoc),
+
+/*8*/
+"binary" => array(
+ // binary data
+ b"binary",
+ (binary)"binary"),
+
+/*9*/
+"undefined" => array(
+ // undefined data
+ @$undefined_var),
+
+/*10*/
+"unset" => array(
+ // unset data
+ @$unset_var)
+);
+
+// loop through each element of the array for $arr2
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n Iteration: $iterator \n";
+ var_dump( array_diff($array, $value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+ Iteration: 1
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 2
+array(1) {
+ [1]=>
+ int(2)
+}
+
+ Iteration: 3
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 4
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 5
+array(1) {
+ [1]=>
+ int(2)
+}
+
+ Iteration: 6
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 7
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 8
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 9
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 10
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation5.phpt b/ext/standard/tests/array/array_diff_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff compares integers, floats and strings
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$arr_int = array(1, 2, 3);
+$arr_float = array(1.00, 2.00, 3.00);
+$arr_int_str = array('1', '2', '3');
+$arr_float_str = array('1.00', '2.00', '3.00');
+
+print "-- Compare integers and floats: --\n";
+var_dump(array_diff($arr_int, $arr_float));
+var_dump(array_diff($arr_float, $arr_int));
+
+
+print "-- Compare integers and strings containing an integers: --\n";
+var_dump(array_diff($arr_int, $arr_int_str));
+var_dump(array_diff($arr_int_str, $arr_int));
+
+print "-- Compare integers and strings containing floats: --\n";
+var_dump(array_diff($arr_int, $arr_float_str));
+var_dump(array_diff($arr_float_str, $arr_int));
+
+print "-- Compare floats and strings containing integers: --\n";
+
+var_dump(array_diff($arr_float, $arr_int_str));
+var_dump(array_diff($arr_int_str, $arr_float));
+
+print "-- Compare floats and strings containing floats: --\n";
+var_dump(array_diff($arr_float, $arr_float_str));
+var_dump(array_diff($arr_float_str, $arr_float));
+
+print "-- Compare strings containing integers and strings containing floats: --\n";
+var_dump(array_diff($arr_int_str, $arr_float_str));
+var_dump(array_diff($arr_float_str, $arr_int_str));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+-- Compare integers and floats: --
+array(0) {
+}
+array(0) {
+}
+-- Compare integers and strings containing an integers: --
+array(0) {
+}
+array(0) {
+}
+-- Compare integers and strings containing floats: --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(3) {
+ [0]=>
+ string(4) "1.00"
+ [1]=>
+ string(4) "2.00"
+ [2]=>
+ string(4) "3.00"
+}
+-- Compare floats and strings containing integers: --
+array(0) {
+}
+array(0) {
+}
+-- Compare floats and strings containing floats: --
+array(3) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(2)
+ [2]=>
+ float(3)
+}
+array(3) {
+ [0]=>
+ string(4) "1.00"
+ [1]=>
+ string(4) "2.00"
+ [2]=>
+ string(4) "3.00"
+}
+-- Compare strings containing integers and strings containing floats: --
+array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+}
+array(3) {
+ [0]=>
+ string(4) "1.00"
+ [1]=>
+ string(4) "2.00"
+ [2]=>
+ string(4) "3.00"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation6.phpt b/ext/standard/tests/array/array_diff_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test that array_diff behaves as expected for comparing:
+ * 1. the order of the array
+ * 2. duplicate values
+ * 3. duplicate key names
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array_index = array('a', 'b', 'c', 0 => 'd', 'b'); //duplicate key (0), duplicate value (b)
+$array_assoc = array ('2' => 'c', //same key=>value pair, different order
+ '1' => 'b',
+ '0' => 'a',
+ 'b' => '3', //key and value from array_index swapped
+ 'c' => 2); //same as above, using integer
+
+var_dump(array_diff($array_index, $array_assoc));
+var_dump(array_diff($array_assoc, $array_index));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+array(1) {
+ [0]=>
+ string(1) "d"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "3"
+ ["c"]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation7.phpt b/ext/standard/tests/array/array_diff_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff compares arrays that
+ * 1. Contain referenced variables
+ * 2. Have been referenced to each other
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+$a = 'a';
+
+$arr1 = array ("&$a", 'b', 'c');
+$arr2 = array (1, 2, 3);
+echo "-- Basic Comparison --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+$a = 1;
+
+echo "-- \$a changed --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+
+$arr2 = &$arr1;
+echo "-- Arrays referenced to each other --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+
+$arr1 = array('x', 'y', 'z');
+echo "-- \$arr1 changed --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff() : usage variations ***
+-- Basic Comparison --
+array(3) {
+ [0]=>
+ string(2) "&a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+-- $a changed --
+array(3) {
+ [0]=>
+ string(2) "&a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+-- Arrays referenced to each other --
+array(0) {
+}
+array(0) {
+}
+-- $arr1 changed --
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation8.phpt b/ext/standard/tests/array/array_diff_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff() with associative arrays containing different data types as values
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array = array('a' => '1', 'b' => '2', 'c' => '3');
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// associative arrays with different values
+$inputs = array (
+ // arrays with integer values
+/*1*/ array('0' => 0, '1' => 0),
+ array("one" => 1, 'two' => 2, "three" => 1, 4 => 1),
+
+ // arrays with float values
+/*3*/ array("float1" => 2.3333, "float2" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2),
+
+ // arrays with string values
+/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'),
+ array(1 => "hello", "heredoc" => $heredoc, $heredoc),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp, new classA(), $fp),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_diff($array, $input) );
+ var_dump( array_diff($input, $array) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+-- Iteration 1 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+}
+-- Iteration 2 --
+array(1) {
+ ["c"]=>
+ string(1) "3"
+}
+array(0) {
+}
+-- Iteration 3 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(2) {
+ ["float1"]=>
+ float(2.3333)
+ ["float2"]=>
+ float(2.3333)
+}
+-- Iteration 4 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(4) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+ ["f4"]=>
+ float(1.2)
+}
+-- Iteration 5 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(4) {
+ [111]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+ [3]=>
+ string(6) " Hello"
+}
+-- Iteration 6 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(4) {
+ [111]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+ [3]=>
+ string(7) "\tHello"
+}
+-- Iteration 7 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(3) {
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+ [2]=>
+ string(11) "Hello world"
+}
+-- Iteration 8 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(5) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [12]=>
+ object(classA)#%d (0) {
+ }
+ [13]=>
+ resource(%d) of type (stream)
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_variation9.phpt b/ext/standard/tests/array/array_diff_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff() compares multidimensional arrays
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array1 = array('sub_array1' => array (1, 2, 3),
+ 'sub_array2' => array ('a', 'b', 'c'));
+$array2 = array('sub_arraya' => array (1, 3, 5),
+ 'sub_arrayb' => array ('a', 'z', 'y'));
+
+echo "-- Compare two 2-D arrays --\n";
+var_dump(array_diff($array1, $array2));
+var_dump(array_diff($array2, $array1));
+
+echo "\n-- Compare subarrays from two 2-D arrays --\n";
+var_dump(array_diff($array1['sub_array1'], $array2['sub_arraya']));
+var_dump(array_diff($array2['sub_arraya'], $array1['sub_array1']));
+
+var_dump(array_diff($array1['sub_array2'], $array2['sub_arrayb']));
+var_dump(array_diff($array2['sub_arrayb'], $array1['sub_array1']));
+
+echo "\n-- Compare a subarray from one 2-D array and one 2-D array --\n";
+var_dump(array_diff($array1['sub_array1'], $array2));
+var_dump(array_diff($array1, $array2['sub_arraya']));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+-- Compare two 2-D arrays --
+
+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--
+<?php
+$array1 = array(0.0, 1, 2.5);
+$array2 = array(TRUE, FALSE, NULL, "d", "e", "f");
+foreach($array1 as $start)
+{
+ foreach($array1 as $num)
+ {
+ foreach($array2 as $value)
+ {
+ echo '==========================='."\n";
+ echo 'start: '.$start.' num: '.$num.' value: '.$value."\n";
+ $output = array_fill($start, $num, $value);
+ var_dump($output);
+ }
+ }
+}
+echo '== Done ==';
+?>
+===============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--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_fill() : basic functionality ***\n";
+
+// calling the array_fill with all possible valid values for 'val' argument
+$start_key = 0 ;
+$num = 2;
+$heredoc = <<<HERE_DOC
+Hello
+HERE_DOC;
+
+// array of possible valid values for 'val' arugment
+$values = array (
+
+ /* 1 */ NULL,
+ 0,
+ 1,
+ /* 4 */ 1.5,
+ 'hi',
+ "hi",
+ /* 7 */ $heredoc
+
+);
+
+$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() : 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--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+*/
+
+
+echo "*** Testing array_fill() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing array_fill() function with Zero arguments --\n";
+var_dump( array_fill() );
+
+// More than expected number of arguments
+echo "-- Testing array_fill() function with more than expected no. of arguments --\n";
+$start_key = 0;
+$num = 2;
+$val = 1;
+$extra_arg = 10;
+var_dump( array_fill($start_key,$num,$val, $extra_arg) );
+
+// Less than the expected number of arguments
+echo "-- Testing array_fill() function with less than expected no. of arguments --\n";
+$start_key = 0;
+$num = 2;
+var_dump( array_fill($start_key,$num) );
+
+//calling array_fill with negative values for 'num' parameter
+$num = -1;
+var_dump( array_fill($start_key,$num,$val) );
+
+//callin array_fill with 'num' equal to zero value
+$num = 0;
+var_dump( array_fill($start_key,$num,$val) );
+
+echo "Done";
+?>
+--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--
+<?php
+ var_dump(array_fill_keys('test', 1));
+ var_dump(array_fill_keys(array(), 1));
+ var_dump(array_fill_keys(array('foo', 'bar'), NULL));
+ var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123));
+ var_dump(array_fill_keys(array('test', TRUE, 10, 100), ''));
+?>
+--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--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_fill_keys() : error conditions ***\n";
+
+$keys = array(1, 2);
+$val = 1;
+$extra_arg = 10;
+
+echo "\n-- Testing array_fill_keys() function with more than expected no. of arguments --\n";
+var_dump( array_fill_keys($keys, $val, $extra_arg) );
+
+echo "\n-- Testing array_fill_keys() function with less than expected no. of arguments --\n";
+var_dump( array_fill_keys($keys) );
+
+echo "\n-- Testing array_fill_keys() function with no argumets --\n";
+var_dump( array_fill_keys() );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$nullVal = null;
+$simpleStr = "simple";
+$fp = fopen(__FILE__, "r");
+$emptyArr = array();
+$bool = false;
+$float = 2.4;
+
+class classA {
+ public function __toString() { return "Class A object"; }
+}
+$obj = new classA();
+
+
+echo "\n-- Testing array_fill_keys() function with empty arguments --\n";
+var_dump( array_fill_keys($emptyArr, $nullVal) );
+
+echo "\n-- Testing array_fill_keys() function with keyed array --\n";
+$keyedArray = array("two" => 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--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/* Testing with reference types for the arguments */
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$nullVal = null;
+$simpleStr = "simple";
+$refString = &$simpleStr;
+$fp = fopen(__FILE__, "r");
+$emptyArr = array();
+$bool = false;
+$float = 2.4;
+
+class classA {
+ public function __toString() { return "Class A object"; }
+}
+$obj = new classA();
+
+
+echo "\n-- Testing array_fill_keys() function with reference value --\n";
+$keyedArray = array("one", "two");
+var_dump(array_fill_keys($keyedArray, $refString));
+
+echo "\n-- Testing array_fill_keys() function with reference keys --\n";
+$refKeys = array("one", &$simpleStr);
+$res = array_fill_keys($refKeys, $simpleStr);
+var_dump($res);
+$simpleStr = "bob";
+var_dump($res);
+
+
+echo "\n-- Testing array_fill_keys() function with reference array input --\n";
+$newArray = array("one", "two");
+$refArray = &$newArray;
+var_dump(array_fill_keys($refArray, $simpleStr));
+
+fclose($fp);
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/* Testing with unexpected argument types */
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$simpleStr = "simple";
+$fp = fopen(__FILE__, "r");
+$bool = false;
+$float = 2.4;
+$array = array("one", "two");
+$nullVal = null;
+
+echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n";
+var_dump( array_fill_keys($bool, $float) );
+
+echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n";
+var_dump( array_fill_keys($array, $fp) );
+
+echo "\n-- Testing array_fill_keys() function with mixed array --\n";
+var_dump( array_fill_keys($nullVal, $simpleStr) );
+
+fclose($fp);
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array array_fill_keys(array keys, mixed val)
+ * Description: Create an array using the elements of the first parameter as keys each initialized to val
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/* Testing with unexpected argument types */
+
+echo "*** Testing array_fill_keys() : parameter variations ***\n";
+
+$fp = fopen(__FILE__, "r");
+$bool = false;
+$float = 2.4;
+$array = array("one");
+$nullVal = null;
+$unset_var = 10;
+unset ($unset_var);
+
+
+class classA {
+ public function __toString() { return "Class A object"; }
+}
+$obj = new classA();
+
+echo "\n-- Testing array_fill_keys() function with float --\n";
+var_dump( array_fill_keys($array, $float) );
+
+echo "\n-- Testing array_fill_keys() function with null --\n";
+var_dump( array_fill_keys($array, $nullVal) );
+
+echo "\n-- Testing array_fill_keys() function with object --\n";
+var_dump( array_fill_keys($array, $obj) );
+
+echo "\n-- Testing array_fill_keys() function with boolean --\n";
+var_dump( array_fill_keys($array, $bool) );
+
+echo "\n-- Testing array_fill_keys() function with resource --\n";
+var_dump( array_fill_keys($array, $fp) );
+
+echo "\n-- Testing array_fill_keys() function with unset var --\n";
+var_dump( array_fill_keys($array, $unset_var) );
+
+fclose($fp);
+echo "Done";
+?>
+--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--
+<?php if (version_compare(zend_version(), '2.4.0', '>=')) die('skip ZendEngine 2.3 or below needed'); ?>
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing various object values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+// class without a member
+class Test
+{
+}
+
+//class with public member, static member , constant and consturctor to initialize the public member
+class Test1
+{
+ const test1_constant = "test1";
+ public static $test1_static = 0;
+ public $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1 , $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test1
+class Child_test1 extends Test1
+{
+ public $member2;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ parent::__construct($value1 , $value2);
+ $this->member2 = $value3;
+ }
+}
+
+//class with private member, static member, constant and constructor to initialize the private member
+class Test2
+{
+ const test2_constant = "test2";
+ public static $test2_static = 0;
+ private $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1 , $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test2
+class Child_test2 extends Test2
+{
+ private $member1;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ parent::__construct($value1 , $value2);
+ $this->member1 = $value3;
+ }
+}
+
+// class with protected member, static member, constant and consturctor to initialize the protected member
+class Test3
+{
+ const test3_constant = "test3";
+ public static $test3_static = 0;
+ protected $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1 , $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test3
+class Child_test3 extends Test3
+{
+ protected $member1;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ parent::__construct($value1 , $value2);
+ $this->member1 = $value3;
+ }
+}
+
+// class with public, private, protected members, static, constant members and constructor to initialize all the members
+class Test4
+{
+ const test4_constant = "test4";
+ public static $test4_static = 0;
+ public $member1;
+ private $member2;
+ protected $member3;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ $this->member1 = $value1;
+ $this->member2 = $value2;
+ $this->member3 = $value3;
+ }
+}
+
+// child class which inherits parent class test4
+class Child_test4 extends Test4
+{
+ var $var1;
+
+ function __construct($value1 , $value2 , $value3 , $value4)
+ {
+ parent::__construct($value1 , $value2 , $value3);
+ $this->var1 = $value4;
+ }
+}
+
+// abstract class with public, private, protected members
+abstract class AbstractClass
+{
+ public $member1;
+ private $member2;
+ protected $member3;
+ var $var1 = 30;
+
+ abstract protected function display();
+}
+
+// implement abstract 'AbstractClass' class
+class ConcreteClass1 extends AbstractClass
+{
+ protected function display()
+ {
+ echo "class name is ConcreteClass1 \n";
+ }
+}
+
+
+// declarationn of the interface 'iTemplate'
+interface iTemplate
+{
+ public function display();
+}
+
+// implement the interface 'iTemplate'
+class Template1 implements iTemplate
+{
+ public function display()
+ {
+ echo "class name is Template1\n";
+ }
+}
+
+//array of object values for 'val' argument
+$objects = array(
+
+ /* 1 */ new Test(),
+ new Test1(100 , 101),
+ new Child_test1(100 , 101 , 102),
+ new Test2(100 , 101),
+ /* 5 */ new Child_test2(100 , 101 , 102),
+ new Test3(100 , 101),
+ new Child_test3(100 , 101 , 102),
+ new Test4( 100 , 101 , 102),
+ new Child_test4(100 , 101 , 102 , 103),
+ new ConcreteClass1(),
+ /* 11 */ new Template1()
+);
+
+// loop through each element of the array for 'val' argument
+// check the working of array_fill()
+echo "--- Testing array_fill() with different object values for 'val' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($objects); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $objects[$index];
+
+ var_dump( array_fill($start_key,$num,$val) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different object values for 'val' argument ---
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ object(Test)#%d (0) {
+ }
+ [1]=>
+ object(Test)#%d (0) {
+ }
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ object(Test1)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test1)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ object(Child_test1)#%d (4) {
+ ["member2"]=>
+ int(102)
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Child_test1)#%d (4) {
+ ["member2"]=>
+ int(102)
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ object(Test2)#%d (3) {
+ ["member1":"Test2":private]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test2)#%d (3) {
+ ["member1":"Test2":private]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ object(Child_test2)#%d (4) {
+ ["member1":"Child_test2":private]=>
+ int(102)
+ ["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--
+<?php if (version_compare(zend_version(), '2.4.0', '<')) die('skip ZendEngine 2.4 needed'); ?>
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing various object values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+// class without a member
+class Test
+{
+}
+
+//class with public member, static member , constant and consturctor to initialize the public member
+class Test1
+{
+ const test1_constant = "test1";
+ public static $test1_static = 0;
+ public $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1 , $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test1
+class Child_test1 extends Test1
+{
+ public $member2;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ parent::__construct($value1 , $value2);
+ $this->member2 = $value3;
+ }
+}
+
+//class with private member, static member, constant and constructor to initialize the private member
+class Test2
+{
+ const test2_constant = "test2";
+ public static $test2_static = 0;
+ private $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1 , $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test2
+class Child_test2 extends Test2
+{
+ private $member1;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ parent::__construct($value1 , $value2);
+ $this->member1 = $value3;
+ }
+}
+
+// class with protected member, static member, constant and consturctor to initialize the protected member
+class Test3
+{
+ const test3_constant = "test3";
+ public static $test3_static = 0;
+ protected $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1 , $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test3
+class Child_test3 extends Test3
+{
+ protected $member1;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ parent::__construct($value1 , $value2);
+ $this->member1 = $value3;
+ }
+}
+
+// class with public, private, protected members, static, constant members and constructor to initialize all the members
+class Test4
+{
+ const test4_constant = "test4";
+ public static $test4_static = 0;
+ public $member1;
+ private $member2;
+ protected $member3;
+
+ function __construct($value1 , $value2 , $value3)
+ {
+ $this->member1 = $value1;
+ $this->member2 = $value2;
+ $this->member3 = $value3;
+ }
+}
+
+// child class which inherits parent class test4
+class Child_test4 extends Test4
+{
+ var $var1;
+
+ function __construct($value1 , $value2 , $value3 , $value4)
+ {
+ parent::__construct($value1 , $value2 , $value3);
+ $this->var1 = $value4;
+ }
+}
+
+// abstract class with public, private, protected members
+abstract class AbstractClass
+{
+ public $member1;
+ private $member2;
+ protected $member3;
+ var $var1 = 30;
+
+ abstract protected function display();
+}
+
+// implement abstract 'AbstractClass' class
+class ConcreteClass1 extends AbstractClass
+{
+ protected function display()
+ {
+ echo "class name is ConcreteClass1 \n";
+ }
+}
+
+
+// declarationn of the interface 'iTemplate'
+interface iTemplate
+{
+ public function display();
+}
+
+// implement the interface 'iTemplate'
+class Template1 implements iTemplate
+{
+ public function display()
+ {
+ echo "class name is Template1\n";
+ }
+}
+
+//array of object values for 'val' argument
+$objects = array(
+
+ /* 1 */ new Test(),
+ new Test1(100 , 101),
+ new Child_test1(100 , 101 , 102),
+ new Test2(100 , 101),
+ /* 5 */ new Child_test2(100 , 101 , 102),
+ new Test3(100 , 101),
+ new Child_test3(100 , 101 , 102),
+ new Test4( 100 , 101 , 102),
+ new Child_test4(100 , 101 , 102 , 103),
+ new ConcreteClass1(),
+ /* 11 */ new Template1()
+);
+
+// loop through each element of the array for 'val' argument
+// check the working of array_fill()
+echo "--- Testing array_fill() with different object values for 'val' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($objects); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $objects[$index];
+
+ var_dump( array_fill($start_key,$num,$val) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different object values for 'val' argument ---
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ object(Test)#%d (0) {
+ }
+ [1]=>
+ object(Test)#%d (0) {
+ }
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ object(Test1)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test1)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ object(Child_test1)#%d (4) {
+ ["member2"]=>
+ int(102)
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Child_test1)#%d (4) {
+ ["member2"]=>
+ int(102)
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ object(Test2)#%d (3) {
+ ["member1":"Test2":private]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test2)#%d (3) {
+ ["member1":"Test2":private]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ object(Child_test2)#%d (4) {
+ ["member1":"Child_test2":private]=>
+ int(102)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ ["member1":"Test2":private]=>
+ int(100)
+ }
+ [1]=>
+ object(Child_test2)#%d (4) {
+ ["member1":"Child_test2":private]=>
+ int(102)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ ["member1":"Test2":private]=>
+ int(100)
+ }
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ object(Test3)#%d (3) {
+ ["member1":protected]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test3)#%d (3) {
+ ["member1":protected]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ object(Child_test3)#%d (3) {
+ ["member1":protected]=>
+ int(102)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Child_test3)#%d (3) {
+ ["member1":protected]=>
+ int(102)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ object(Test4)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["member2":"Test4":private]=>
+ int(101)
+ ["member3":protected]=>
+ int(102)
+ }
+ [1]=>
+ object(Test4)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["member2":"Test4":private]=>
+ int(101)
+ ["member3":protected]=>
+ int(102)
+ }
+}
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ object(Child_test4)#%d (4) {
+ ["var1"]=>
+ int(103)
+ ["member1"]=>
+ int(100)
+ ["member2":"Test4":private]=>
+ int(101)
+ ["member3":protected]=>
+ int(102)
+ }
+ [1]=>
+ object(Child_test4)#%d (4) {
+ ["var1"]=>
+ int(103)
+ ["member1"]=>
+ int(100)
+ ["member2":"Test4":private]=>
+ int(101)
+ ["member3":protected]=>
+ int(102)
+ }
+}
+-- Iteration 10 --
+array(2) {
+ [0]=>
+ object(ConcreteClass1)#%d (4) {
+ ["member1"]=>
+ NULL
+ ["member2":"AbstractClass":private]=>
+ NULL
+ ["member3":protected]=>
+ NULL
+ ["var1"]=>
+ int(30)
+ }
+ [1]=>
+ object(ConcreteClass1)#%d (4) {
+ ["member1"]=>
+ NULL
+ ["member2":"AbstractClass":private]=>
+ NULL
+ ["member3":protected]=>
+ NULL
+ ["var1"]=>
+ int(30)
+ }
+}
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ object(Template1)#%d (0) {
+ }
+ [1]=>
+ object(Template1)#%d (0) {
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected value for 'start_key' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$num = 2;
+$val = 100;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'start_key' argument
+$values = array(
+
+ // float values
+ /* 1 */ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.34567890006E-10,
+ .5,
+
+ // array values
+ /* 6 */ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected value for 'start_key' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$num = 2;
+$val = 100;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'start_key' argument
+$values = array(
+
+ // float values
+ /* 1 */ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.34567890006E-10,
+ .5,
+
+ // array values
+ /* 6 */ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected values for 'num' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$val = 100;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'num' argument
+$values = array(
+
+ // float values
+ /* 1 */ 2.5,
+ -2.5,
+ 0.5e1,
+ 0.5E-1,
+ .5,
+
+ // array values
+ /* 6 */ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'val' argument
+$values = array(
+ // empty string
+ /* 1 */ "",
+ '',
+ // objects
+ /* 3 */ new test(),
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ /* 5 */ @$unset_var,
+);
+
+// loop through each element of the array for 'val' argument
+// check the working of array_fill()
+echo "--- Testing array_fill() with different values for 'val' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $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 '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--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/* passing array_fill() as the 'val' argument in array_fill() function */
+
+echo "*** Testing array_fill() : variation ***\n";
+
+$start_key = 0;
+$num = 2;
+$heredoc = <<<HERE_DOC
+Hello
+HERE_DOC;
+
+// array of possible valid values for 'val' arugment
+$values = array (
+
+ /* 1 */ NULL,
+ 0,
+ 1,
+ /* 4 */ 1.0,
+ 'hi',
+ "hi",
+ /* 7 */ $heredoc
+);
+
+echo "*** Filling 2 dimensional array with all basic valid values ***\n";
+$counter = 1;
+for($i =0; $i < count($values); $i ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $values[$i];
+
+ var_dump( array_fill($start_key,$num,array_fill($start_key,$num,$val)) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different types of array values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+
+//array of different types of array values for 'val' argument
+$values = array(
+
+ /* 1 */ array(),
+ array(1 , 2 , 3 , 4),
+ array(1 => "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--
+<?php
+function odd($var)
+{
+ return($var & 1);
+}
+
+function even($var)
+{
+ return(!($var & 1));
+}
+
+$array1 = array("a"=>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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+
+echo "*** Testing array_filter() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$input = array(1, 2, 3, 0, -1); // 0 will be considered as FALSE and removed in default callback
+
+/* Callback function
+ * Prototype : bool even(array $input)
+ * Parameters : $input - input array each element of which will be checked in function even()
+ * Return type : boolean - true if element is even and false otherwise
+ * Description : This function takes array as parameter and checks for each element of array.
+ * It returns true if the element is even number else returns false
+ */
+function even($input)
+{
+ return ($input % 2 == 0);
+}
+
+// with all possible arguments
+var_dump( array_filter($input,"even") );
+
+// with default arguments
+var_dump( array_filter($input) );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_filter() : error conditions ***\n";
+
+// zero arguments
+echo "-- Testing array_filter() function with Zero arguments --";
+var_dump( array_filter() );
+
+$input = array(0, 1, 2, 3, 5);
+/* callback function
+ * Prototype : bool odd(array $input)
+ * Parameters : $input - array for which each elements should be checked into the function
+ * Return Type : bool - true if element is odd and returns false otherwise
+ * Description : Function takes array as input and checks for its each elements.
+*/
+function odd($input)
+{
+ return ($input % 2 != 0);
+}
+$extra_arg = 10;
+
+// with one more than the expected number of arguments
+echo "-- Testing array_filter() function with more than expected no. of arguments --";
+var_dump( array_filter($input, "odd", $extra_arg) );
+
+// with incorrect callback function
+echo "-- Testing array_filter() function with incorrect callback --";
+var_dump( array_filter($input, "even") );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/* This file uses 'input' array with different types of objects and passes
+ * it to array_filter() to test object functionality
+ * i.e. object of simple class with members and functions
+ * object of empty class
+ * object of child class extending abstract class
+ * object of class containing static member
+ */
+
+echo "*** Testing array_filter() : object functionality ***\n";
+
+// simple class with members - variable and method
+class SimpleClass
+{
+ public $var1 = 10;
+ public function check() {
+ return $var1;
+ }
+}
+
+// class without members
+class EmptyClass
+{
+}
+
+// abstract class
+abstract class AbstractClass
+{
+ protected $var2 = 5;
+ abstract function emptyMethod();
+}
+
+// class deriving above abstract class
+class ChildClass extends AbstractClass
+{
+ private $var3;
+ public function emptyMethod() {
+ echo "defined in child";
+ }
+}
+
+// class with final method
+class FinalClass
+{
+ private $var4;
+ final function finalMethod() {
+ echo 'This can not be overloaded';
+ }
+}
+
+// class with static members
+class StaticClass
+{
+ static $var5 = 5;
+ public static function staticMethod() {
+ echo 'this is static method';
+ }
+}
+
+// Callback function which returns always true
+function always_true($input)
+{
+ return true;
+}
+
+// Callback function which returns always false
+function always_false($input)
+{
+ return false;
+}
+
+// 'input' array containing objects as elements
+$input = array(
+ new SimpleClass(),
+ new EmptyClass(),
+ new ChildClass(),
+ new FinalClass(),
+ new StaticClass()
+);
+
+
+// with default callback
+var_dump( array_filter($input) );
+
+// with always_true callback function
+var_dump( array_filter($input, "always_true") );
+
+// with always_false callback function
+var_dump( array_filter($input, "always_false") );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/* Passing different scalar and nonscalar values for 'input' argument
+*/
+echo "*** Testing array_filter() : usage variations - unexpected values for 'input'***\n";
+
+/* Callback function
+ * Prototype : bool always_true(array $input)
+ * Parameters : array for which each elements needs to be used in function
+ * Return value : Returns true for each element
+ * Discription : function applied to each element of the passed array and returns true
+ */
+function always_true($input)
+{
+ return true;
+}
+
+
+// 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');
+
+// different values for 'input' argument
+$input_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new MyClass(),
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of the array for input
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_filter($input_values[$count],"always_true") );
+};
+
+// closing resource
+fclose($fp);
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/* Passing different scalar and nonscalar values in place of 'callback' argument
+*/
+echo "*** Testing array_filter() : usage variations - unexpected values for 'callback' function***\n";
+
+// Initialise variables
+$input = array('value1', 'value2', 'value3', 'value4');
+
+//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');
+
+// different scalar and nonscalar values in place of callback function
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+
+ // 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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of array as 'input' argument.
+*/
+
+// callback function returning always false
+function always_false($input)
+{
+ return false;
+}
+
+// callback function returning always true
+function always_true($input)
+{
+ return true;
+}
+
+echo "*** Testing array_filter() : usage variations - different types of array for 'input' argument***\n";
+
+// different types of 'input' array
+$input_values = array(
+ array(0, 1, 2, -1, 034, 0X4A), // integer values
+ array(0.0, 1.2, 1.2e3, 1.2e-3), // float values
+ array('value1', "value2", '', " ", ""), // string values
+ array(true, false, TRUE, FALSE), // bool values
+ array(null, NULL), // null values
+ array(1 => '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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of callback functions to array_filter()
+* with parameters and return
+* without parameter and with return
+* with parameter and without return
+* without parameter and without return
+*/
+
+echo "*** Testing array_filter() : usage variation - different 'callback' functions***\n";
+
+// Initialize variables
+$input = array(0, -1, 2, 3.4E-3, 'hello', "value", "key" => 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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* With default callback function argument, array_filter() removes elements which are interpreted as false
+* Here Testing all the false array element possibilities
+*/
+
+// callback function always_true
+function always_true($input)
+{
+ return true;
+}
+
+// callback function always_false
+function always_false($input)
+{
+ return false;
+}
+
+echo "*** Testing array_filter() : usage variations - different false elements in 'input' ***\n";
+
+// unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// empty heredoc string
+$empty_heredoc =<<<EOT
+EOT;
+
+// input array with different false elements
+$input = array(
+ false,
+ False,
+ '',
+ "",
+ 0,
+ 0.0,
+ null,
+ NULL,
+ "0",
+ '0',
+ array(),
+ !1,
+ 1==2,
+ $empty_heredoc,
+ @$unset_var,
+ @$undefined_var,
+);
+
+// With default callback function
+var_dump( array_filter($input) );
+
+// With callback function which returns always true
+var_dump( array_filter($input, 'always_true') );
+
+// With callback function which returns always false
+var_dump( array_filter($input, 'always_false') );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing 'input' array which contains elements as reference to other data
+*/
+
+echo "*** Testing array_filter() : usage variations - 'input' containing references ***\n";
+
+// Callback function
+/* Prototype : bool callback(array $input)
+ * Parameter : $input - array of which each element need to be checked in function
+ * Return Type : returns true or false
+ * Description : This function checks each element of an input array if element > 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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different anonymous callback functions with passed by value and reference arguments
+*/
+
+echo "*** Testing array_filter() : usage variations - Anonymous callback functions ***\n";
+
+$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
+
+// anonymous callback function
+echo "Anonymous callback function with regular parameter and statement\n";
+var_dump( array_filter($input, create_function('$input', 'return ($input > 1);') ) );
+
+// 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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* callback functions are expected to return bool value for array_filter()
+* here testing callback functions for return values other than bool
+*/
+
+echo "*** Testing array_filter() : usage variations - callback function with different return values***\n";
+
+$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null, true);
+
+// callback functions
+// int as return value
+function callback1($input)
+{
+ return 5;
+}
+echo "callback function with int return value\n";
+var_dump( array_filter($input, 'callback1') );
+
+// float as return value
+function callback2($input)
+{
+ return 3.4;
+}
+echo "callback function with float return value\n";
+var_dump( array_filter($input, 'callback2') );
+
+// string as return value
+function callback3($input)
+{
+ return 'value';
+}
+echo "callback function with string return value\n";
+var_dump( array_filter($input, 'callback3') );
+
+// null as return value
+function callback4($input)
+{
+ return null;
+}
+echo "callback function with null return value\n";
+var_dump( array_filter($input, 'callback4') );
+
+// array as return value
+function callback5($input)
+{
+ return array(8);
+}
+echo "callback function with array as return value\n";
+var_dump( array_filter($input, 'callback5') );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing built-in functions and different language constructs as 'callback' argument
+*/
+
+echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
+
+$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
+
+// using built-in function 'is_int' as 'callback'
+var_dump( array_filter($input, 'is_int') );
+
+// using built-in function 'chr' as 'callback'
+var_dump( array_filter($input, 'chr') );
+
+// using language construct 'echo' as 'callback'
+var_dump( array_filter($input, 'echo') );
+
+// using language construct 'exit' as 'callback'
+var_dump( array_filter($input, 'exit') );
+
+echo "Done"
+?>
+--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--
+<?php
+$trans = array("a" => 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--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> 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--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> 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--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> 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
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation2.phpt
Binary files 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
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation3.phpt
Binary files 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--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> 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--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> 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--
+<?php
+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("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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect_assoc() by passing different arrays for the arguments.
+* Function is tested by passing associative array as well as array with default keys.
+*/
+
+echo "*** Testing array_intersect_assoc() : basic functionality ***\n";
+
+// array with default keys
+$arr_default_keys = array(1, 2, "hello", 'world');
+
+// associative array
+$arr_associative = array("one" => 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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_intersect_assoc() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_intersect_assoc() function with Zero arguments --\n";
+var_dump( array_intersect_assoc() );
+
+// Testing array_intersect_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_intersect_assoc($arr1) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect_assoc() function by passing values to $arr1 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr2 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing non-array values to \$arr1 argument ***\n";
+
+// array to be passsed to $arr2 as default argument
+$arr2 = array(1, 2);
+
+// additional array to be passed for intersection
+$arr3 = array(1, 2, "one" => 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 = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr1 argument
+$arrays = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($unexpected_value, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments
+ var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect_assoc() by passing array with
+* binary values for $arr1 and $arr2 argument.
+*/
+
+echo "*** Testing array_intersect_assoc() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+// simple array
+$arr_normal = array("hello", "world");
+
+// array with binary value for $arr1 argument
+var_dump( array_intersect_assoc($arr_binary, $arr_normal) );
+
+// array with binary value for $arr2 argument
+var_dump( array_intersect_assoc($arr_normal, $arr_binary) );
+
+// array with binary value for both $arr1 and $arr2 argument
+var_dump( array_intersect_assoc($arr_binary, $arr_binary) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect_assoc() function by passing values to $arr2 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing non-array values to \$arr2 argument ***\n";
+
+// array to be passsed to $arr1 as default argument
+$arr1 = array(1, 2);
+
+// additional array to be passed for intersection
+$arr3 = array(1, 2, "one" => 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 = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr2 argument
+$arrays = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1,$unexpected_value) );
+
+ // Calling array_intersect_assoc() with more arguments
+ var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr1 argument and testing whether
+* array_intersect_assoc() behaves in an expected way with the other arguments passed to the function
+* The $arr2 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing different types of arrays to \$arr1 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr1 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// 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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr2 argument and testing whether
+* array_intersect_assoc() behaves in an expected way with the other arguments passed to the function.
+* The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing different types of arrays to \$arr2 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr2 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// 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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible keys to $arr1 argument.
+ * The $arr2 argument passed is a fixed array
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+/*10*/ array(@$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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible keys to $arr2 argument.
+ * The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with 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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible values to $arr1 argument.
+ * The $arr2 argument passed is a fixed array
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff values to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// 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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible values to $arr2 argument.
+ * The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff values to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// 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--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect_assoc() by passing 2-D arrays
+* to both $arr1 and $arr2 argument.
+* Optional argument takes the same value as that of $arr1
+*/
+
+echo "*** Testing array_intersect_assoc() : passing two dimensional array to both \$arr1 and \$arr2 arguments ***\n";
+
+// two dimensional arrays for $arr1 and $arr2 argument
+$arr1 = array (
+
+ // arrays with default keys
+ array(1, 2, "hello", 'world'),
+ array(1, 2, 3, 4),
+
+ // arrays with explicit keys
+ array(1 => "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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect() by passing different arrays for the arguments.
+* Function is tested by passing associative array as well as array with default keys.
+*/
+
+echo "*** Testing array_intersect() : basic functionality ***\n";
+
+// array with default keys
+$arr_default_keys = array(1, 2, "hello", 'world');
+
+// associative array
+$arr_associative = array("one" => 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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_intersect() : error conditions ***\n";
+
+// Testing array_intersect() with zero arguments
+echo "\n-- Testing array_intersect() function with Zero arguments --\n";
+var_dump( array_intersect() );
+
+// Testing array_intersect() with one less than the expected number of arguments
+echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_intersect($arr1) );
+
+echo "Done";
+?>
+--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--
+<?php
+$a = array(1, 6, 2, -20, 15, 1200, -2500);
+$b = array(0, 7, 2, -20, 11, 1100, -2500);
+$c = array(0, 6, 2, -20, 19, 1000, -2500);
+$d = array(3, 8,-2, -20, 14, 900, -2600);
+
+$a_f = array_flip($a);
+$b_f = array_flip($b);
+$c_f = array_flip($c);
+$d_f = array_flip($d);
+
+/* give nicer values */
+foreach ($a_f as $k=> &$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--
+<?php
+/*
+* proto array array_intersect_key(array arr1, array arr2 [, array ...])
+* Function is implemented in ext/standard/array.c
+*/
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_intersect_key($array1, $array2));
+?>
+--EXPECT--
+array(2) {
+ ["blue"]=>
+ int(1)
+ ["green"]=>
+ int(3)
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : error conditions ***\n";
+
+//Initialise function arguments
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array2 = array('blue' => 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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('blue' => 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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array1 = array('blue' => 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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$input_array = array(0 => '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--
+<?php
+/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_key() : usage variation ***\n";
+
+/// Initialise function arguments not being substituted (if any)
+$array1 = array(
+
+ 'first' => 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--
+<?php
+/*
+* array array_intersect_uassoc ( array $array1, array $array2 [, array $..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($a, $b) {
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b) ? 1 : -1;
+}
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
+$array2 = array("a" => "green", "yellow", "red");
+$result = array_intersect_uassoc($array1, $array2, "key_compare_func");
+var_dump($result);
+?>
+--EXPECT--
+array(1) {
+ ["a"]=>
+ string(5) "green"
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : error conditions ***\n";
+
+// Initialise function arguments
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments
+$array2 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments
+$array1 = array("a" => "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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments
+$array1 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments
+$array1 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments
+$array1 = array("a" => "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 = <<<EOT
+hello world
+EOT;
+
+// 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,
+
+ // 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$arr_default_int = array(1, 2 );
+$arr_float = array(0 => 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$arr_float = array(0 => 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$arr1_string_int = array('1', '2');
+$arr2_string_int = array('1', '3');
+$arr1_string_float = array('1.00', '2.00');
+$arr2_string_float = array('1.00', '3.00');
+
+function key_compare_func($a, $b)
+{
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$ref_var = 'a';
+$array1 = array('a', $ref_var);
+$array2 = array('a' => 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--
+<?php
+/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$array1 = array("a" => "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--
+<?php
+/*
+* proto array array_intersect_ukey ( array $array1, array $array2 [, array $ ..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($key1, $key2) {
+ if ($key1 == $key2) return 0;
+ else if ($key1 > $key2) return 1;
+ else return -1;
+}
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_intersect_ukey($array1, $array2, 'key_compare_func'));
+?>
+--EXPECT--
+array(2) {
+ ["blue"]=>
+ int(1)
+ ["green"]=>
+ int(3)
+}
diff --git a/ext/standard/tests/array/array_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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : error conditions ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialise arguments
+$array2 = array('green' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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 = <<<EOT
+hello world
+EOT;
+
+//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_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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialize variables
+$arr_default_int = array(1, 2 );
+$arr_float = array(0 => 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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialize variables
+$arr_float = array(0.00 => 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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialize variables
+$arr1_string_int = array('0' => '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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
+ * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_intersect_ukey() : usage variation ***\n";
+
+//Initialise arguments
+$array1 = array('blue' => 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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect() function by passing values to $arr1 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr2 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing non-array values to \$arr1 argument ***\n";
+
+// array to be passsed to $arr2 as default argument
+$arr2 = array(1, 2);
+
+// array to be passed to optional argument
+$arr3 = array(1, 2, "one" => 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 = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr1 argument
+$arrays = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($unexpected_value,$arr2) );
+
+ // Calling array_intersect() with more arguments
+ var_dump( array_intersect($unexpected_value, $arr2, $arr3) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect() by passing array with
+* binary values for $arr1 and $arr2 argument.
+*/
+
+echo "*** Testing array_intersect() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+// simple array
+$arr_normal = array("hello", "world");
+
+// array with binary value for $arr1 argument
+var_dump( array_intersect($arr_binary, $arr_normal) );
+
+// array with binary value for $arr2 argument
+var_dump( array_intersect($arr_normal, $arr_binary) );
+
+// array with binary value for both $arr1 and $arr2 argument
+var_dump( array_intersect($arr_binary, $arr_binary) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect() function by passing values to $arr2 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing non-array values to \$arr2 argument ***\n";
+
+// array to be passsed to $arr1 as default argument
+$arr1 = array(1, 2);
+
+// arrays to be passed to optional argument
+$arr3 = array(1, 2, "one" => 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 = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr2 argument
+$arrays = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1,$unexpected_value) );
+
+ // Calling array_intersect() with more arguments
+ var_dump( array_intersect($arr1, $unexpected_value, $arr3) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr1 argument and testing whether
+* array_intersect() behaves in expected way with the other arguments passed to the function
+* The $arr2 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing different types of arrays to \$arr1 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr1 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// 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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr2 argument and testing whether
+* array_intersect() behaves in expected way with the other arguments passed to the function.
+* The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing different types of arrays to \$arr2 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr2 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// 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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible keys to $arr1 argument.
+ * The $arr2 argument is a fixed array
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff keys to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with 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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible keys to $arr2 argument.
+ * The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff keys to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with 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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible values to $arr1 argument.
+ * The $arr2 argument is a fixed array
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff values to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible values to $arr2 argument.
+ * The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff values to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.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--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect() by passing 2-D arrays
+* to both $arr1 and $arr2 argument.
+* Optional argument takes the same value as that of $arr1
+*/
+
+echo "*** Testing array_intersect() : passing two dimensional array to both \$arr1 and \$arr2 arguments ***\n";
+
+// two dimensional arrays for $arr1 and $arr2 argument
+$arr1 = array (
+
+ // arrays with default keys
+ array(1, 2, "hello", 'world'),
+ array(1, 2, 3, 4),
+
+ // arrays with explicit keys
+ array(1 => "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--
+<?php
+/* Prototype:
+ * bool array_key_exists ( mixed $key, array $search );
+ * Description:
+ * Returns TRUE if the given key is set in the array.
+ * key can be any value possible for an array index.
+ * Also also works on objects.
+ */
+
+echo "*** Testing basic functionalities ***\n";
+/* Arrays with regular values */
+$search_arrays = array(
+ array(1,2,3,4),
+ array('a','b','c'),
+ array('abc', 'bcd', 'dcf'),
+ array("test", "rest", "enjoy"),
+ array("Name" => "Jack", "Loc" => "Mars", "Id" => "MS123"),
+ array('Red' => 'Rose', 'I' => 'You'),
+ array(0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => "Three" ),
+ array(0.1 => 'Zero', 1.1 => 'One', 2.2 => 'Two', 3.3 => "Three" )
+ );
+/* keys to search in $search_arrays. $keys[0]
+ is the key to be searched in $search_arrays[0] and so on */
+$keys = array( 1, 'a', 2, 4, "Name", "Red", 0, 3 );
+
+$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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Test basic functionality of array_key_exists()
+ */
+
+echo "*** Testing array_key_exists() : basic functionality ***\n";
+
+$key1 = 'key';
+$key2 = 'val';
+$search = array('one', 'key' => 'value', 'val');
+var_dump(array_key_exists($key1, $search));
+var_dump(array_key_exists($key2, $search));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_key_exists() : basic functionality ***
+bool(true)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_error.phpt b/ext/standard/tests/array/array_key_exists_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass incorrect number of arguments to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : error conditions ***\n";
+
+//Test array_key_exists with one more than the expected number of arguments
+echo "\n-- Testing array_key_exists() function with more than expected no. of arguments --\n";
+$key = 1;
+$search = array(1, 2);
+$extra_arg = 10;
+var_dump( array_key_exists($key, $search, $extra_arg) );
+
+// Testing array_key_exists with one less than the expected number of arguments
+echo "\n-- Testing array_key_exists() function with less than expected no. of arguments --\n";
+$key = 1;
+var_dump( array_key_exists($key) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : error conditions ***
+
+-- Testing array_key_exists() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Test basic functionality of array_key_exists() with objects
+ */
+
+echo "*** Testing array_key_exists() : object functionality ***\n";
+
+class myClass {
+ var $var1;
+ var $var2;
+ var $var3;
+
+ function __construct($a, $b, $c = null) {
+ $this->var1 = $a;
+ $this->var2 = $b;
+ if (!is_null($c)) {
+ $this->var3 = $c;
+ }
+ }
+}
+
+echo "\n-- Do not assign a value to \$class1->var3 --\n";
+$class1 = new myClass ('a', 'b');
+echo "\$key = var1:\n";
+var_dump(array_key_exists('var1', $class1));
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class1));
+echo "\$class1:\n";
+var_dump($class1);
+
+echo "\n-- Assign a value to \$class2->var3 --\n";
+$class2 = new myClass('x', 'y', 'z');
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class2));
+echo "\$class2:\n";
+var_dump($class2);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : object functionality ***
+
+-- Do not assign a value to $class1->var3 --
+$key = var1:
+bool(true)
+$key = var3:
+bool(true)
+$class1:
+object(myClass)#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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass array_key_exists() an object with private and protected properties
+ */
+
+echo "*** Testing array_key_exists() : object functionality ***\n";
+
+class myClass {
+ public $var1;
+ protected $var2;
+ private $var3;
+
+ function __construct($a, $b, $c = null) {
+ $this->var1 = $a;
+ $this->var2 = $b;
+ if (!is_null($c)) {
+ $this->var3 = $c;
+ }
+ }
+}
+
+echo "\n-- Do not assign a value to \$class1->var3 --\n";
+$class1 = new myClass ('a', 'b');
+echo "\$key = var1:\n";
+var_dump(array_key_exists('var1', $class1));
+echo "\$key = var2:\n";
+var_dump(array_key_exists('var2', $class1));
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class1));
+echo "\$class1:\n";
+var_dump($class1);
+
+echo "\n-- Assign a value to \$class2->var3 --\n";
+$class2 = new myClass('x', 'y', 'z');
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class2));
+echo "\$class2:\n";
+var_dump($class2);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : object functionality ***
+
+-- Do not assign a value to $class1->var3 --
+$key = var1:
+bool(true)
+$key = var2:
+bool(false)
+$key = var3:
+bool(false)
+$class1:
+object(myClass)#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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass different data types as $key argument to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$search = array ('zero', 'key' => 'val', 'two');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "key";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+key
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $key argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "key",
+ 'key',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_key_exists()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_key_exists($input, $search) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass different data types as $search argument to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$key = 'val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $search argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_key_exists()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_key_exists($key, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_key_exists() 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass floats as $key argument, then cast float values
+ * to integers and pass as $key argument
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$keys = array(1.2345678900E-10, 1.00000000000001, 1.99999999999999);
+
+$search = array ('zero', 'one', 'two');
+
+$iterator = 1;
+foreach($keys as $key) {
+ echo "\n-- Iteration $iterator --\n";
+ echo "Pass float as \$key:\n";
+ var_dump(array_key_exists($key, $search));
+ echo "Cast float to int:\n";
+ var_dump(array_key_exists((int)$key, $search));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1 --
+Pass float as $key:
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Cast float to int:
+bool(true)
+
+-- Iteration 1 --
+Pass float as $key:
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Cast float to int:
+bool(true)
+
+-- Iteration 1 --
+Pass float as $key:
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Cast float to int:
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation4.phpt b/ext/standard/tests/array/array_key_exists_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass referenced variables as arguments to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$array = array('one' => 1, 'two' => 2, 'three' => 3);
+
+echo "\n-- \$search is a reference to \$array --\n";
+$search = &$array;
+var_dump(array_key_exists('one', $search));
+
+echo "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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Test how array_key_exists() behaves with multi-dimensional arrays
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$multi_array = array ('zero' => 'val1',
+ 'one' => 'val2',
+ 'sub1' => array (1, 2, 3));
+
+echo "\n-- Attempt to match key in sub-array --\n";
+// this key is in the sub-array
+var_dump(array_key_exists(0, $multi_array));
+
+echo "\n-- \$search arg points to sub-array --\n";
+var_dump(array_key_exists(0, $multi_array['sub1']));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Attempt to match key in sub-array --
+bool(false)
+
+-- $search arg points to sub-array --
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation6.phpt b/ext/standard/tests/array/array_key_exists_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass certain data types that can be taken as a key in an array
+ * and test whether array_key_exists(() thinks they are equal and therefore
+ * returns true when searching for them
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$unset = 10;
+unset($unset);
+$array = array ('null' => null,
+ 'NULL' => NULL,
+ 'empty single quoted string' => '',
+ "empty double quoted string" => "",
+ 'undefined variable' => @$undefined,
+ 'unset variable' => @$unset);
+
+//iterate through original array
+foreach($array as $name => $input) {
+ $iterator = 1;
+ echo "\n-- Key in \$search array is : $name --\n";
+ $search[$input] = 'test';
+
+ //iterate through array again to see which values are considered equal
+ foreach($array as $key) {
+ echo "Iteration $iterator: ";
+ var_dump(array_key_exists($key, $search));
+ $iterator++;
+ }
+ $search = null;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Key in $search array is : null --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : NULL --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : empty single quoted string --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : empty double quoted string --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : undefined variable --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : unset variable --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation7.phpt b/ext/standard/tests/array/array_key_exists_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Check the position of the internal array pointer after calling array_key_exists()
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
+
+echo "\n-- Call array_key_exists() --\n";
+var_dump($result = array_key_exists('one', $input));
+
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Call array_key_exists() --
+bool(true)
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass an array where the keys are different data types as the $search argument
+ * then pass many different data types as $key argument to test where array_key_exist()
+ * returns true.
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+string
+EOT;
+
+// different data types to be iterated over
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*3*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*4*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*5*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*6*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*8*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*9*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_key_exists()
+$iterator = 1;
+foreach($inputs as $type => $input) {
+ echo "\n-- Iteration $iterator: $type data --\n";
+
+ //iterate over again to get all different key values
+ foreach ($inputs as $new_type => $new_input) {
+ echo "-- \$key arguments are $new_type data:\n";
+ foreach ($new_input as $key => $search) {
+ var_dump(array_key_exists($key, $input));
+ }
+ }
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1: int data --
+-- $key arguments are int data:
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(true)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(true)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 2: float data --
+-- $key arguments are int data:
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(true)
+bool(true)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 3: extreme floats data --
+-- $key arguments are int data:
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(true)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 4: null uppercase data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 5: null lowercase data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 6: bool lowercase data --
+-- $key arguments are int data:
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(true)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(true)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 7: bool uppercase data --
+-- $key arguments are int data:
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(true)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(true)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 8: empty double quotes data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 9: empty single quotes data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 10: string data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(true)
+bool(true)
+bool(true)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 11: undefined data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 12: unset data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_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--
+<?php
+
+echo "*** Testing array_keys() on basic array operation ***\n";
+$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
+ array(1,2,3));
+var_dump(array_keys($basic_arr));
+
+echo "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--
+<?php
+
+echo "\n*** Testing error conditions ***";
+var_dump(array_keys(100));
+var_dump(array_keys("string"));
+var_dump(array_keys(new stdclass)); // object
+var_dump(array_keys()); // Zero arguments
+var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
+var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+echo "\n*** Testing array_keys() on various arrays ***";
+$arrays = array(
+ array(),
+ array(0),
+ array( array() ),
+ array("Hello" => "World"),
+ array("" => ""),
+ array(1,2,3, "d" => array(4,6, "d")),
+ array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
+ array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
+ array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
+ array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
+ array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
+ array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
+);
+
+$i = 0;
+/* loop through to test array_keys() with different arrays */
+foreach ($arrays as $array) {
+ echo "\n-- Iteration $i --\n";
+ var_dump(array_keys($array));
+ $i++;
+}
+
+echo "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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "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--
+<?php
+
+echo "*** Testing array_keys() on all the types other than arrays ***\n";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ 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--
+<?php
+
+echo "*** Testing array_keys() on all the types other than arrays ***\n";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ 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--
+<?php
+
+echo "\n*** Testing array_keys() with resource type ***\n";
+$resource1 = fopen( __FILE__, "r");
+$resource2 = opendir( "." );
+
+/* creating an array with resource types as elements */
+$arr_resource = array($resource1, $resource2);
+
+var_dump(array_keys($arr_resource, $resource1)); // loose type checking
+var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
+var_dump(array_keys($arr_resource, $resource2)); // loose type checking
+var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
+
+/* Closing the resource handles */
+fclose( $resource1 );
+closedir( $resource2 );
+
+?>
+--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--
+<?php
+
+$a = array(1,2,3);
+
+function foo() {
+ throw new exception(1);
+}
+
+try {
+ array_map("foo", $a, array(2,3));
+} catch (Exception $e) {
+ var_dump("exception caught!");
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_map() : basic functionality ***\n";
+
+function multiply($p, $q) {
+ return ($p * $q);
+}
+
+function square($p) {
+ return ($p * $p);
+}
+
+function concatenate($a, $b) {
+ return "$a = $b";
+}
+
+// integer array
+$arr1 = array(1, 2, 3);
+$arr2 = array(4, 5, 6);
+
+echo "-- With two integer array --\n";
+var_dump( array_map('multiply', $arr1, $arr2) );
+
+echo "-- With single integer array --\n";
+var_dump( array_map('square', $arr1) );
+
+// string array
+$arr1 = array("one", "two");
+$arr2 = array("single", "double");
+
+echo "-- With string array --\n";
+var_dump( array_map('concatenate', $arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : basic functionality ***
+-- With two integer array --
+array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(10)
+ [2]=>
+ int(18)
+}
+-- With single integer array --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+ [2]=>
+ int(9)
+}
+-- With string array --
+array(2) {
+ [0]=>
+ string(12) "one = single"
+ [1]=>
+ string(12) "two = double"
+}
+Done
diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_map() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_map() function with Zero arguments --\n";
+var_dump( array_map() );
+
+// Testing array_map with one less than the expected number of arguments
+echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n";
+function callback1() {
+ return 1;
+}
+var_dump( array_map('callback1') );
+
+echo "\n-- Testing array_map() function with less no. of arrays than callback function arguments --\n";
+$arr1 = array(1, 2);
+function callback2($p, $q) {
+ return $p * $q;
+}
+var_dump( array_map('callback2', $arr1) );
+
+echo "\n-- Testing array_map() function with more no. of arrays than callback function arguments --\n";
+$arr2 = array(3, 4);
+$arr3 = array(5, 6);
+var_dump( array_map('callback2', $arr1, $arr2, $arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : error conditions ***
+
+-- Testing array_map() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Testing array_map() for object functionalities:
+ * 1) simple class with variable and method
+ * 2) class without members
+ * 3) class with only one method and no variable
+ * 4) abstract and child class
+ * 5) class with static and final members
+ * 6) interface and implemented class
+ */
+echo "*** Testing array_map() : object functionality ***\n";
+
+echo "-- simple class with public variable and method --\n";
+class SimpleClass
+{
+ public $var1 = 1;
+ public function square($n) {
+ return $n * $n;
+ }
+}
+function test($cb, $args) {
+ echo join('::', $cb) . "\n";
+ var_dump(array_map($cb, $args));
+}
+test(array('SimpleClass', 'square'), array(1, 2));
+
+echo "\n-- simple class with private variable and method --\n";
+class SimpleClassPri
+{
+ private $var1 = 10;
+ private function add($n) {
+ return $var + $n;
+ }
+}
+test(array('SimpleClassPri', 'add'), array(1));
+
+echo "\n-- simple class with protected variable and method --\n";
+class SimpleClassPro
+{
+ protected $var1 = 5;
+ protected function mul($n) {
+ return $var1 * $n;
+ }
+}
+test(array('SimpleClassPro', 'mul'), array(2));
+
+echo "\n-- class without members --\n";
+class EmptyClass
+{
+}
+test(array('EmptyClass'), array(1, 2));
+
+echo "\n-- abstract class --\n";
+abstract class AbstractClass
+{
+ protected $var2 = 5;
+ abstract function emptyFunction();
+}
+
+// class deriving the above abstract class
+class ChildClass extends AbstractClass
+{
+ private $var3;
+ public function emptyFunction() {
+ echo "defined in child\n";
+ }
+}
+test(array('ChildClass', 'emptyFunction'), array(1, 2));
+
+echo "\n-- class with final method --\n";
+class FinalClass
+{
+ private $var4;
+ final function finalMethod() {
+ echo "This function can't be overloaded\n";
+ }
+}
+test(array('FinalClass', 'finalMethod'), array(1, 2));
+
+echo "\n-- class with static members --\n";
+class StaticClass
+{
+ static $var5 = 2;
+ public static function square($n) {
+ return ($n * $n);
+ }
+ private static function cube($n) {
+ return ($n * $n * $n);
+ }
+ protected static function retVal($n) {
+ return array($n);
+ }
+}
+test(array('StaticClass', 'square'), array(1, 2));
+test(array('StaticClass', 'cube'), array(2));
+test(array('StaticClass', 'retVal'), array(3, 4));
+
+echo "-- class implementing an interface --\n";
+interface myInterface
+{
+ public function toImplement();
+}
+class InterClass implements myInterface
+{
+ public static function square($n) {
+ return ($n * $n);
+ }
+ public function toImplement() {
+ return 1;
+ }
+}
+test(array('InterClass', 'square'), array(1, 2));
+
+?>
+===DONE===
+<?php exit(0); ?>
+--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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Testing array_map() for following object functionalities:
+ * 1) non-existent class
+ * 2) existent class and non-existent function
+ */
+echo "*** Testing array_map() : with non-existent class and method ***\n";
+
+class SimpleClass
+{
+ public $var1 = 1;
+ public function square($n) {
+ return $n * $n;
+ }
+ public static function cube($n) {
+ return $n * $n * $n;
+ }
+}
+
+echo "-- with non-existent class --\n";
+var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
+
+echo "-- with existent class and non-existent method --\n";
+var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : with non-existent class and method ***
+-- with non-existent class --
+
+Warning: array_map() 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Testing array_map() for object functionality with following callback function variations:
+ * 1) child class method using parent object
+ * 2) parent class method using child object
+ * 3) child class method using parent class
+ * 4) parent class method using child class
+ */
+echo "*** Testing array_map() : class methods as callback function ***\n";
+
+$arr1 = array(1, 5, 7);
+
+class ParentClass
+{
+ public $var1 = 10;
+ public static function staticParent1($n) {
+ return $n;
+ }
+ private static function staticParent2($n) {
+ return $n;
+ }
+}
+
+class ChildClass extends ParentClass
+{
+ var $parent_obj;
+ public function __construct ( ) {
+ $this->parent_obj = new ParentClass();
+ }
+ public $var2 = 5;
+ public static function staticChild($n) {
+ return $n;
+ }
+ public function nonstaticChild($n) {
+ return $n;
+ }
+}
+
+$childobj = new ChildClass();
+$parentobj = new ParentClass();
+
+echo "-- accessing parent method from child class --\n";
+var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) );
+
+echo "-- accessing child method from parent class --\n";
+var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) );
+
+echo "-- accessing parent method using child class object --\n";
+var_dump( array_map(array($childobj, 'staticParent1'), $arr1) );
+
+echo "-- accessing child method using parent class object --\n";
+var_dump( array_map(array($parentobj, 'staticChild'), $arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : class methods as callback function ***
+-- accessing parent method from child class --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(7)
+}
+-- accessing child method from parent class --
+
+Warning: array_map() 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--
+<?php
+
+/* Prototype : array array_map(mixed callback, array input1 [, array input2 ,...])
+ * Description: Applies the callback to the elements in given arrays.
+ * Source code: ext/standard/array.c
+*/
+
+
+
+echo "*** Testing array_map() : string keys ***\n";
+
+$arr = array("stringkey" => "value");
+function cb1 ($a) {return array ($a);};
+function cb2 ($a,$b) {return array ($a,$b);};
+var_dump( array_map("cb1", $arr));
+var_dump( array_map("cb2", $arr,$arr));
+var_dump( array_map(null, $arr));
+var_dump( array_map(null, $arr, $arr));
+echo "Done";
+?>
+
+--EXPECT--
+*** Testing array_map() : string keys ***
+array(1) {
+ ["stringkey"]=>
+ array(1) {
+ [0]=>
+ string(5) "value"
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ }
+}
+array(1) {
+ ["stringkey"]=>
+ string(5) "value"
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing anoymous callback function with following variations
+ */
+
+echo "*** Testing array_map() : anonymous callback function ***\n";
+
+$array1 = array(1, 2, 3);
+$array2 = array(3, 4, 5);
+
+echo "-- anonymous function with all parameters and body --\n";
+var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1, $array2));
+
+echo "-- anonymous function with two parameters and passing one array --\n";
+var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1));
+
+echo "-- anonymous function with NULL parameter --\n";
+var_dump( array_map( create_function(NULL, 'return NULL;'), $array1));
+
+echo "-- anonymous function with NULL body --\n";
+var_dump( array_map( create_function('$a', NULL), $array1));
+
+echo "-- passing NULL as 'arr1' --\n";
+var_dump( array_map( create_function('$a', 'return array($a);'), NULL));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : anonymous callback function ***
+-- anonymous function with all parameters and body --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(5)
+ }
+}
+-- anonymous function with two parameters and passing one array --
+
+Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d
+
+Notice: Undefined variable: b in %s(20) : runtime-created function on line %d
+
+Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d
+
+Notice: Undefined variable: b in %s(20) : runtime-created function on line %d
+
+Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d
+
+Notice: Undefined variable: b in %s(20) : runtime-created function on line %d
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ NULL
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ NULL
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ NULL
+ }
+}
+-- anonymous function with NULL parameter --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- anonymous function with NULL body --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- passing NULL as 'arr1' --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation11.phpt b/ext/standard/tests/array/array_map_variation11.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing subarrays and recursive callback function
+ */
+
+echo "*** Testing array_map() : recursive callback function ***\n";
+
+// callback function
+function square_recur_single_array($var) {
+ if (is_array($var))
+ return array_map('square_recur_single_array', $var);
+ return $var * $var;
+}
+
+$array1 = array(1, array(2, 3, array(5)), array(4));
+
+var_dump( array_map('square_recur_single_array', $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : recursive callback function ***
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(9)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(25)
+ }
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(16)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing buit-in function as callback function
+ */
+
+echo "*** Testing array_map() : built-in function ***\n";
+
+$array1 = array(1, 2, 3);
+$array2 = array(3, 4, 5);
+
+echo "-- with built-in function 'pow' and two parameters --\n";
+var_dump( array_map('pow', $array1, $array2));
+
+echo "-- with built-in function 'pow' and one parameter --\n";
+var_dump( array_map('pow', $array1));
+
+echo "-- with language construct --\n";
+var_dump( array_map('echo', $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : built-in function ***
+-- with built-in function 'pow' and two parameters --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(16)
+ [2]=>
+ int(243)
+}
+-- with built-in function 'pow' and one parameter --
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- with language construct --
+
+Warning: array_map() 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing different callback function returning:
+ * int, string, bool, null values
+ */
+
+echo "*** Testing array_map() : callback with diff return value ***\n";
+
+$array1 = array(1, 2, 3);
+$array2 = array(3, 4, 5);
+
+echo "-- with integer return value --\n";
+function callback_int($a, $b)
+{
+ return $a + $b;
+}
+var_dump( array_map('callback_int', $array1, $array2));
+
+echo "-- with string return value --\n";
+function callback_string($a, $b)
+{
+ return "$a"."$b";
+}
+var_dump( array_map('callback_string', $array1, $array2));
+
+echo "-- with bool return value --\n";
+function callback_bool($a, $b)
+{
+ return TRUE;
+}
+var_dump( array_map('callback_bool', $array1, $array2));
+
+echo "-- with null return value --\n";
+function callback_null($array1)
+{
+ return NULL;
+}
+var_dump( array_map('callback_null', $array1));
+
+echo "-- with no return value --\n";
+function callback_without_ret($arr1)
+{
+ echo "callback_without_ret called\n";
+}
+var_dump( array_map('callback_without_ret', $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : callback with diff return value ***
+-- with integer return value --
+array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(6)
+ [2]=>
+ int(8)
+}
+-- with string return value --
+array(3) {
+ [0]=>
+ string(2) "13"
+ [1]=>
+ string(2) "24"
+ [2]=>
+ string(2) "35"
+}
+-- with bool return value --
+array(3) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(true)
+}
+-- with null return value --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- with no return value --
+callback_without_ret called
+callback_without_ret called
+callback_without_ret called
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing null values for $callback argument and testing whether shortest
+ * array will be extended with empty elements
+ */
+
+echo "*** Testing array_map() : null value for 'callback' argument ***\n";
+
+// arrays to be passed as arguments
+$arr1 = array(1, 2);
+$arr2 = array("one", "two");
+$arr3 = array(1.1, 2.2);
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+/* calling array_map() with null callback */
+
+echo "-- with null --\n";
+var_dump( array_map(null, $arr1, $arr2, $arr3) );
+var_dump( array_map(NULL, $arr1, $arr2, $arr3) );
+
+echo "-- with unset variable --\n";
+var_dump( array_map(@$unset_var, $arr1, $arr2, $arr3) );
+
+echo "-- with undefined variable --\n";
+var_dump( array_map(@$undefined_var, $arr1) );
+
+echo "-- with empty string --\n";
+var_dump( array_map("", $arr1, $arr2) );
+
+echo "-- with empty array --\n";
+var_dump( array_map(array(), $arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : null value for 'callback' argument ***
+-- with null --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ float(1.1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ float(2.2)
+ }
+}
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ float(1.1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ float(2.2)
+ }
+}
+-- with unset variable --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ float(1.1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ float(2.2)
+ }
+}
+-- with undefined variable --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- with empty string --
+
+Warning: array_map() 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing non existent function for $callback argument
+ */
+
+echo "*** Testing array_map() : non existent 'callback' function ***\n";
+
+// arrays to be passed as arguments
+$arr1 = array(1, 2);
+$arr2 = array("one", "two");
+$arr3 = array(1.1, 2.2);
+
+var_dump( array_map('non_existent', $arr1, $arr2, $arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : non existent 'callback' function ***
+
+Warning: array_map() 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing non-permmited built-in functions and language constructs i.e.
+ * echo(), array(), empty(), eval(), exit(), isset(), list(), print()
+ */
+
+echo "*** Testing array_map() : non-permmited built-in functions ***\n";
+
+// array to be passed as arguments
+$arr1 = array(1, 2);
+
+// built-in functions & language constructs
+$callback_names = array(
+/*1*/ 'echo',
+ 'array',
+ 'empty',
+/*4*/ 'eval',
+ 'exit',
+ 'isset',
+ 'list',
+/*8*/ 'print'
+);
+for($count = 0; $count < count($callback_names); $count++)
+{
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_map($callback_names[$count], $arr1) );
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : non-permmited built-in functions ***
+-- Iteration 1 --
+
+Warning: array_map() 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing different scalar/nonscalar values in place of $callback
+ */
+
+echo "*** Testing array_map() : unexpected values for 'callback' argument ***\n";
+
+$arr1 = array(1, 2, 3);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$unexpected_callbacks = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // boolean data
+/*10*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*14*/ "",
+ '',
+
+ // array data
+/*16*/ array(),
+ array(1, 2),
+ array(1, array(2)),
+
+ // object data
+/*19*/ new classA(),
+
+ // resource variable
+/*20*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_map
+for($count = 0; $count < count($unexpected_callbacks); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --";
+ var_dump( array_map($unexpected_callbacks[$count], $arr1));
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : unexpected values for 'callback' argument ***
+
+-- Iteration 1 --
+Warning: array_map() 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing non array values in place of $arr1
+ */
+
+echo "*** Testing array_map() : unexpected values for 'arr1' ***\n";
+
+function callback($a)
+{
+ return $a;
+}
+
+//get an unset array variable
+$unset_var1 = array(1, 2);
+unset ($unset_var1);
+
+// get an unset variable
+$unset_var2 = 10;
+unset ($unset_var2);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// different scalar/non-scalar values for array input
+$unexpected_inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var1,
+ @$unset_var2,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $unexpected_inputs to check the behavior of array_map
+for($count = 0; $count < count($unexpected_inputs); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_map('callback', $unexpected_inputs[$count]));
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : unexpected values for 'arr1' ***
+-- Iteration 1 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d%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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() with a pass-by-value callback forced to behave as a pass-by-reference function.
+ */
+
+$arr1 = array('original.0', 'original.1');
+$arr2 = array('original.0', 'original.1');
+
+function callback($a) {
+ $a = "changed";
+}
+
+array_map('callback', $arr1);
+var_dump($arr1);
+
+$ref =& $arr2[0];
+array_map("callback", $arr2);
+var_dump($arr2);
+?>
+--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--
+<?php
+
+/* Prototype : array array_map(mixed callback, array input1 [, array input2 ,...])
+ * Description: Applies the callback to the elements in given arrays.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_map() : references ***\n";
+$arr = array("k1" => "v1","k2"=>"v2");
+$arr[]=&$arr["k1"];
+$arr[]=&$arr;
+function cb1 ($a) {var_dump ($a);return array ($a);};
+function cb2 (&$a) {var_dump ($a);return array (&$a);};
+var_dump( array_map("cb1", $arr));
+var_dump( array_map("cb2", $arr,$arr));
+var_dump( array_map(null, $arr));
+var_dump( array_map(null, $arr, $arr));
+
+// break cycles
+$arr[0] = null;
+$arr[1] = null;
+
+echo "Done";
+?>
+
+--EXPECT--
+*** Testing array_map() : references ***
+string(2) "v1"
+string(2) "v2"
+string(2) "v1"
+array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing different arrays for $arr1 argument
+ */
+
+echo "*** Testing array_map() : different arrays for 'arr1' argument ***\n";
+
+function callback($a)
+{
+ return ($a);
+}
+
+// different arrays
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 2.2), // array with default keys & float values
+ array( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+/*8*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through the various elements of $arrays to test array_map()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_map('callback', $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : different arrays for 'arr1' argument ***
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(0) {
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(4) "aaaa"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(4) "bbbb"
+ [4]=>
+ string(1) "c"
+ [5]=>
+ string(5) "ccccc"
+}
+-- Iteration 8 --
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+}
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+-- Iteration 10 --
+array(4) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(20)
+ [4]=>
+ int(40)
+ [3]=>
+ int(30)
+}
+-- Iteration 11 --
+array(3) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+}
+-- Iteration 12 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 13 --
+array(3) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- Iteration 14 --
+array(4) {
+ [1]=>
+ string(4) "true"
+ [0]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 15 --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- Iteration 16 --
+array(6) {
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+-- Iteration 17 --
+array(3) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+}
+-- Iteration 18 --
+array(3) {
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing associative array with different keys for $arr1 argument
+ */
+
+echo "*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***\n";
+
+function callback($a)
+{
+ return ($a);
+}
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing the array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+/*2*/ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"),
+
+ // arrays with string keys
+ array('\tHello' => 111, 're\td' => 'color', '\v\fworld' => 2.2, 'pen\n' => 33),
+/*8*/ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed values
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// loop through the various elements of $arrays to test array_map()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_map('callback', $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***
+
+Warning: Illegal offset type in %s on line %d%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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing associative array with different values for $arr1 argument
+ */
+
+echo "*** Testing array_map() : associative array with diff. values for 'arr1' argument ***\n";
+
+function callback($a)
+{
+ return ($a);
+}
+//get an unset variable
+$unset_var = array(1, 2);
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing the array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.3333),
+
+ // arrays with string values
+ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// loop through the various elements of $arrays to test array_map()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_map('callback', $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : associative array with diff. values for 'arr1' argument ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ int(1)
+}
+-- Iteration 4 --
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [4]=>
+ int(4)
+}
+-- Iteration 5 --
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+array(4) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+ ["f4"]=>
+ float(33333333.3333)
+}
+-- Iteration 7 --
+array(4) {
+ [111]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+ [3]=>
+ string(4) "pen
+"
+}
+-- Iteration 8 --
+array(4) {
+ [111]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+ [3]=>
+ string(5) "pen\n"
+}
+-- Iteration 9 --
+array(2) {
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 10 --
+array(3) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+-- Iteration 11 --
+array(8) {
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [222]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ ["float"]=>
+ float(444.432)
+ ["unset"]=>
+ NULL
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation6.phpt b/ext/standard/tests/array/array_map_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having different subarrays
+ */
+
+echo "*** Testing array_map() : array having subarrays ***\n";
+
+function callback($a)
+{
+ return $a;
+}
+
+// different subarrays
+$arr1 = array(
+ array(),
+ array(1, 2),
+ array('a', 'b'),
+ array(1, 2, 'a', 'b'),
+ array(1 => 'a', 'b' => 2)
+);
+
+var_dump( array_map('callback', $arr1));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : array having subarrays ***
+array(5) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ [3]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ string(1) "b"
+ }
+ [4]=>
+ array(2) {
+ [1]=>
+ string(1) "a"
+ ["b"]=>
+ int(2)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation7.phpt b/ext/standard/tests/array/array_map_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having different size
+ * 1) first array as empty array
+ * 2) second array as empty array
+ * 3) second array shorter than first array
+ * 4) first array shorter than second array
+ * 5) one more array than callback function arguments
+ */
+
+echo "*** Testing array_map() : arrays with diff. size ***\n";
+
+function callback($a, $b)
+{
+ return array($a => $b);
+}
+
+// calling array_map with different arrays
+var_dump( array_map('callback', array(1, 2, 3), array()) );
+var_dump( array_map('callback', array(), array('a', 'b', 'c')) );
+var_dump( array_map('callback', array(1, 2, 3), array('a', 'b')) );
+var_dump( array_map('callback', array(012, 0x2F, 0X1A), array(2.3, 12.4e2)) );
+var_dump( array_map('callback', array(), array(1, 2, 3), array('a', 'b')) ); // passing more no. of arrays than callback function argument
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : arrays with diff. size ***
+array(3) {
+ [0]=>
+ array(1) {
+ [1]=>
+ NULL
+ }
+ [1]=>
+ array(1) {
+ [2]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [3]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [""]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(1) {
+ [""]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(1) {
+ [""]=>
+ string(1) "c"
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [1]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(1) {
+ [2]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(1) {
+ [3]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [10]=>
+ float(2.3)
+ }
+ [1]=>
+ array(1) {
+ [47]=>
+ float(1240)
+ }
+ [2]=>
+ array(1) {
+ [26]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [""]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [""]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [""]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation8.phpt b/ext/standard/tests/array/array_map_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having reference values for $arr1 argument
+ */
+
+echo "*** Testing array_map() : array with references for 'arr1' argument ***\n";
+
+function callback1($a)
+{
+ return ($a);
+}
+
+function callback_cat($a, $b)
+{
+ return ($a . $b);
+}
+
+// reference variables
+$value1 = 10;
+$value2 = "hello";
+$value3 = 0;
+$value4 = &$value2;
+
+// array containing reference variables
+$arr1 = array(
+ 0 => 0,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => "hello",
+ 4 => &$value3,
+ $value4 => &$value2
+);
+echo "-- with one array --\n";
+var_dump( array_map('callback1', $arr1) );
+
+echo "-- with two arrays --\n";
+var_dump( array_map('callback_cat', $arr1, $arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : array with references for 'arr1' argument ***
+-- with one array --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ int(0)
+ ["hello"]=>
+ string(5) "hello"
+}
+-- with two arrays --
+array(6) {
+ [0]=>
+ string(2) "00"
+ [1]=>
+ string(10) "hellohello"
+ [2]=>
+ string(10) "hellohello"
+ [3]=>
+ string(10) "hellohello"
+ [4]=>
+ string(2) "00"
+ [5]=>
+ string(10) "hellohello"
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation9.phpt b/ext/standard/tests/array/array_map_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having binary values for $arr1 argument
+ */
+
+echo "*** Testing array_map() : array with binary data for 'arr1' argument ***\n";
+
+function callback1($a)
+{
+ return ($a);
+}
+function callback2($a, $b)
+{
+ return array($a => $b);
+}
+
+// array with binary data
+$arr1 = array(b"hello", b"world", "1", b"22.22");
+
+echo "-- checking binary safe array with one parameter callback function --\n";
+var_dump( array_map('callback1', $arr1) );
+
+echo "-- checking binary safe array with two parameter callback function --\n";
+var_dump( array_map(b"callback2", $arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : array with binary data for 'arr1' argument ***
+-- checking binary safe array with one parameter callback function --
+array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "22.22"
+}
+-- checking binary safe array with two parameter callback function --
+
+Warning: Missing argument 2 for callback2() in %s on line %d%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--
+<?php
+/* Prototype: array array_merge(array $array1 [, array $array2 [, array $...]]);
+ Description: Merge one or more arrays
+*/
+
+echo "\n*** Testing array_merge() basic functionality ***";
+$begin_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"))
+);
+
+$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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_merge()
+ */
+
+echo "*** Testing array_merge() : basic functionality ***\n";
+
+//indexed array
+$array1 = array ('zero', 'one', 'two');
+//associative array
+$array2 = array ('a' => 1, 'b' => 2, 'c' => 3);
+
+var_dump(array_merge($array1, $array2));
+
+var_dump(array_merge($array2, $array1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : basic functionality ***
+array(6) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+}
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_error.phpt b/ext/standard/tests/array/array_merge_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_merge() to test behaviour
+ */
+
+echo "*** Testing array_merge() : error conditions ***\n";
+
+// Testing array_merge with zero arguments
+echo "\n-- Testing array_merge() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_merge() );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge() : error conditions ***
+
+-- Testing array_merge() function with less than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_merge_recursive() : array with default keys ***\n";
+
+// Initialise the arrays
+$arr1 = array(1, array(1, 2));
+$arr2 = array(3, array("hello", 'world'));
+$arr3 = array(array(6, 7), array("str1", 'str2'));
+
+// Calling array_merge_recursive() with default arguments
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+// Calling array_merge_recursive() with more arguments
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1,$arr2) );
+var_dump( array_merge_recursive($arr1,$arr2,$arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with default keys ***
+-- With default argument --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+-- With more arguments --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ int(3)
+ [3]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+}
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ int(3)
+ [3]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [4]=>
+ array(2) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(7)
+ }
+ [5]=>
+ array(2) {
+ [0]=>
+ string(4) "str1"
+ [1]=>
+ string(4) "str2"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_basic2.phpt b/ext/standard/tests/array/array_merge_recursive_basic2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_merge_recursive() : associative arrays ***\n";
+
+// Initialise the arrays
+$arr1 = array(1 => "one", 2 => array(1, 2));
+$arr2 = array(2 => 'three', "four" => array("hello", 'world'));
+$arr3 = array(1 => array(6, 7), 'four' => array("str1", 'str2'));
+
+// Calling array_merge_recursive() with default arguments
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+// Calling array_merge_recursive() with more arguments
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1,$arr2) );
+var_dump( array_merge_recursive($arr1,$arr2,$arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : associative arrays ***
+-- With default argument --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+-- With more arguments --
+array(4) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+ ["four"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+}
+array(5) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+ ["four"]=>
+ array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(4) "str1"
+ [3]=>
+ string(4) "str2"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(7)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_error.phpt b/ext/standard/tests/array/array_merge_recursive_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_merge_recursive() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_merge_recursive() function with Zero arguments --\n";
+var_dump( array_merge_recursive() );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : error conditions ***
+
+-- Testing array_merge_recursive() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing non array values to 'arr1' argument of array_merge_recursive() and see
+ * that the function outputs proper warning messages wherever expected.
+*/
+
+echo "*** Testing array_merge_recursive() : Passing non array values to \$arr1 argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+// public $var = 10;
+ public function __toString() {
+ return "object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr1 argument
+$arrays = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+ // resource variable
+/*23*/ $fp,
+
+ // object data
+/*24*/ new A()
+);
+
+// initialise the second argument
+$arr2 = array(1, array("hello", 'world'));
+
+// loop through each element of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "\n-- Iteration $iterator --";
+
+ // with default argument
+ echo "\n-- With default argument --";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : Passing non array values to $arr1 argument ***
+
+-- Iteration 1 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation10.phpt b/ext/standard/tests/array/array_merge_recursive_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * two dimensional arrays for $arr1 argument.
+*/
+
+echo "*** Testing array_merge_recursive() : two dimensional array for \$arr1 argument ***\n";
+
+// initialize the 2-d array
+$arr1 = array(
+ array(1, 2, 3, 1),
+ "array" => array("hello", "world", "str1" => "hello", "str2" => 'world'),
+ array(1 => "one", 2 => "two", "one", 'two'),
+ array(1, 2, 3, 1)
+);
+
+// initialize the second argument
+$arr2 = array(1, "hello", "array" => array("hello", 'world'));
+
+echo "-- Passing the entire 2-d array --\n";
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "-- Passing the sub-array --\n";
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1["array"]) );
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1["array"], $arr2["array"]) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : two dimensional array for $arr1 argument ***
+-- Passing the entire 2-d array --
+-- With default argument --
+array(4) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+ ["array"]=>
+ array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+ ["array"]=>
+ array(6) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+ [3]=>
+ int(1)
+ [4]=>
+ string(5) "hello"
+}
+-- Passing the sub-array --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing non array values to 'arr2' argument of array_merge_recursive() and see
+ * that the function outputs proper warning messages wherever expected.
+*/
+
+echo "*** Testing array_merge_recursive() : Passing non array values to \$arr2 argument ***\n";
+
+// initialise the first argument
+$arr1 = array(1, array("hello", 'world'));
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+// public $var = 10;
+ public function __toString() {
+ return "object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr2 argument
+$arrays = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+ // resource variable
+/*23*/ $fp,
+
+ // object data
+/*24*/ new A()
+);
+
+// loop through each element of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : Passing non array values to $arr2 argument ***
+
+-- Iteration 1 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation3.phpt b/ext/standard/tests/array/array_merge_recursive_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different arrays to $arr1 argument and testing whether
+* array_merge_recursive() behaves in an expected way.
+*/
+
+echo "*** Testing array_merge_recursive() : Passing different arrays to \$arr1 argument ***\n";
+
+/* Different heredoc strings */
+
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// arrays passed to $arr1 argument
+$arrays = array (
+/*1*/ array(1, 2,), // with default keys and numeric values
+ array(1.1, 2.2), // with default keys & float values
+ array(false, true), // with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // with NULL
+ array("a\v\f", "aaaa\r", "b", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f', 'aaaa\r', 'b', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings
+ array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces), // with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "1" => 1 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array containing embedded arrays
+/*15*/ array("str1", "array" => array("hello", 'world'), array(1, 2))
+);
+
+// initialise the second argument
+$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c"));
+
+// loop through each sub array of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // with default argument
+ echo "-- With default argument --\n";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --\n";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : Passing different arrays to $arr1 argument ***
+-- Iteration 1 --
+-- With default argument --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 2 --
+-- With default argument --
+array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 3 --
+-- With default argument --
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 4 --
+-- With default argument --
+array(0) {
+}
+-- With more arguments --
+array(4) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 5 --
+-- With default argument --
+array(1) {
+ [0]=>
+ NULL
+}
+-- With more arguments --
+array(5) {
+ [0]=>
+ NULL
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 6 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 7 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 8 --
+-- With default argument --
+array(3) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(88) "hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+-- With more arguments --
+array(7) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(88) "hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 9 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 10 --
+-- With default argument --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+-- With more arguments --
+array(7) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 11 --
+-- With default argument --
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(40)
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(40)
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 12 --
+-- With default argument --
+array(2) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+}
+-- With more arguments --
+array(6) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 13 --
+-- With default argument --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(4) "four"
+}
+-- With more arguments --
+array(7) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(4) "four"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 14 --
+-- With default argument --
+array(3) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 15 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(4) "true"
+ [1]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(4) "true"
+ [1]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 16 --
+-- With default argument --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 17 --
+-- With default argument --
+array(6) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ bool(false)
+ [5]=>
+ bool(true)
+}
+-- With more arguments --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ bool(false)
+ [5]=>
+ bool(true)
+ [6]=>
+ string(3) "one"
+ [7]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 18 --
+-- With default argument --
+array(3) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 19 --
+-- With default argument --
+array(3) {
+ [0]=>
+ string(4) "str1"
+ ["array"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(4) "str1"
+ ["array"]=>
+ array(5) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(1) "a"
+ [3]=>
+ string(1) "b"
+ [4]=>
+ string(1) "c"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing different
+ * associative arrays having different keys to $arr1 argument.
+*/
+
+echo "*** Testing array_merge_recursive() : assoc. array with diff. keys to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different associative arrays to be passed to $arr1 argument
+$arrays = array (
+/*1*/ // arrays with integer keys
+ array(0 => "0", 1 => array(1 => "one")),
+ array(1 => "1", 2 => array(1 => "one", 2 => "two", 3 => 1, 4 => "4")),
+
+ // arrays with float keys
+/*3*/ array(2.3333 => "float", 44.44 => array(1.1 => "float")),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => array(1.1 => "f1"), 3333333.333333 => "f4"),
+
+ // arrays with string keys
+/*5*/ array('\tHello' => array("hello", 'world'), '\v\fworld' => 2.2, 'pen\n' => 111),
+ array("\tHello" => array("hello", 'world'), "\v\fworld" => 2.2, "pen\n" => 111),
+ array("hello", $heredoc => array("heredoc", 'string'), "string"),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello")
+);
+
+// initialise the second array
+$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c"));
+
+// loop through each sub array of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // with default argument
+ echo "-- With default argument --\n";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --\n";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : assoc. array with diff. keys to $arr1 argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(3) "one"
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(3) "one"
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 2 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(1)
+ [4]=>
+ string(1) "4"
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(1)
+ [4]=>
+ string(1) "4"
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 3 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(5) "float"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(5) "float"
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(5) "float"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(5) "float"
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 4 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(2) "f1"
+ [1]=>
+ string(2) "f2"
+ [2]=>
+ array(1) {
+ [1]=>
+ string(2) "f1"
+ }
+ [3]=>
+ string(2) "f4"
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(2) "f1"
+ [1]=>
+ string(2) "f2"
+ [2]=>
+ array(1) {
+ [1]=>
+ string(2) "f1"
+ }
+ [3]=>
+ string(2) "f4"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 5 --
+-- With default argument --
+array(3) {
+ ["\tHello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(111)
+}
+-- With more arguments --
+array(7) {
+ ["\tHello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(111)
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 6 --
+-- With default argument --
+array(3) {
+ [" Hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(111)
+}
+-- With more arguments --
+array(7) {
+ [" Hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(111)
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 7 --
+-- With default argument --
+array(3) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ array(2) {
+ [0]=>
+ string(7) "heredoc"
+ [1]=>
+ string(6) "string"
+ }
+ [1]=>
+ string(6) "string"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ array(2) {
+ [0]=>
+ string(7) "heredoc"
+ [1]=>
+ string(6) "string"
+ }
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 8 --
+-- With default argument --
+array(3) {
+ [""]=>
+ array(1) {
+ [0]=>
+ string(5) "unset"
+ }
+ [0]=>
+ int(11)
+ [1]=>
+ string(5) "hello"
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ array(1) {
+ [0]=>
+ string(5) "unset"
+ }
+ [0]=>
+ int(11)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation5.phpt b/ext/standard/tests/array/array_merge_recursive_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing different
+ * associative arrays having different values to $arr1 argument.
+*/
+
+echo "*** Testing array_merge_recursive() : assoc. array with diff. values to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different associative arrays to be passed to $arr1 argument
+$arrays = array (
+// arrays with integer values
+/*1*/ array('0' => 0, '1' => 0),
+ array("one" => 1, 'two' => 2, "three" => 1, 4 => 1),
+
+ // arrays with float values
+/*3*/ array("f1" => 2.3333, "f2" => 2.3333, "f3" => array(1.1, 2.22)),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => array(1.2, 'f4' => 1.2)),
+
+ // arrays with string values
+/*5*/ array(111 => "\tHello", "array" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"),
+ array(111 => '\tHello', 'array' => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'),
+ array(1 => "hello", "string" => $heredoc, $heredoc),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(11 => new classA(), "string" => @$unset_var, "resource" => $fp, new classA(), $fp),
+);
+
+// initialise the second array
+$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c"));
+
+// loop through each sub array of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // with default argument
+ echo "-- With default argument --\n";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --\n";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : assoc. array with diff. values to $arr1 argument ***
+-- Iteration 1 --
+-- With default argument --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 2 --
+-- With default argument --
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+-- With more arguments --
+array(8) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(1)
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 3 --
+-- With default argument --
+array(3) {
+ ["f1"]=>
+ float(2.3333)
+ ["f2"]=>
+ float(2.3333)
+ ["f3"]=>
+ array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.22)
+ }
+}
+-- With more arguments --
+array(7) {
+ ["f1"]=>
+ float(2.3333)
+ ["f2"]=>
+ float(2.3333)
+ ["f3"]=>
+ array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.22)
+ }
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 4 --
+-- With default argument --
+array(4) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [0]=>
+ float(4.8999992284)
+ ["f4"]=>
+ array(2) {
+ [0]=>
+ float(1.2)
+ ["f4"]=>
+ float(1.2)
+ }
+}
+-- With more arguments --
+array(8) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [0]=>
+ float(4.8999992284)
+ ["f4"]=>
+ array(2) {
+ [0]=>
+ float(1.2)
+ ["f4"]=>
+ float(1.2)
+ }
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 5 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(6) " Hello"
+ ["array"]=>
+ string(6) "col or"
+ [1]=>
+ string(7) " world"
+ [2]=>
+ string(6) " Hello"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ string(6) " Hello"
+ ["array"]=>
+ array(4) {
+ [0]=>
+ string(6) "col or"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(1) "c"
+ }
+ [1]=>
+ string(7) " world"
+ [2]=>
+ string(6) " Hello"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+}
+-- Iteration 6 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(7) "\tHello"
+ ["array"]=>
+ string(7) "col\tor"
+ [1]=>
+ string(9) "\v\fworld"
+ [2]=>
+ string(7) "\tHello"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ string(7) "\tHello"
+ ["array"]=>
+ array(4) {
+ [0]=>
+ string(7) "col\tor"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(1) "c"
+ }
+ [1]=>
+ string(9) "\v\fworld"
+ [2]=>
+ string(7) "\tHello"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+}
+-- Iteration 7 --
+-- With default argument --
+array(3) {
+ [0]=>
+ string(5) "hello"
+ ["string"]=>
+ string(11) "Hello world"
+ [1]=>
+ string(11) "Hello world"
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(5) "hello"
+ ["string"]=>
+ array(2) {
+ [0]=>
+ string(11) "Hello world"
+ [1]=>
+ string(5) "hello"
+ }
+ [1]=>
+ string(11) "Hello world"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 8 --
+-- With default argument --
+array(5) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ ["string"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ resource(%d) of type (stream)
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ ["string"]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "hello"
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ resource(%d) of type (stream)
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation6.phpt b/ext/standard/tests/array/array_merge_recursive_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * array having duplicate keys.
+*/
+
+echo "*** Testing array_merge_recursive() : array with duplicate keys for \$arr1 argument ***\n";
+
+/* initialize the array having duplicate keys */
+// array with numeric keys
+$arr1_numeric_key = array( 1 => "one", 2 => "two", 2 => array(1, 2), 3 => "three", 1 => array("duplicate", 'strings'));
+// array with string keys
+$arr1_string_key = array("str1" => "hello", "str2" => 111, "str1" => "world", "str2" => 111.111);
+
+// initialize the second argument
+$arr2 = array("one", "str1" => "two", array("one", "two"));
+
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1_numeric_key) );
+var_dump( array_merge_recursive($arr1_string_key) );
+
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1_numeric_key, $arr2) );
+var_dump( array_merge_recursive($arr1_string_key, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with duplicate keys for $arr1 argument ***
+-- With default argument --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(9) "duplicate"
+ [1]=>
+ string(7) "strings"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ ["str1"]=>
+ string(5) "world"
+ ["str2"]=>
+ float(111.111)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(9) "duplicate"
+ [1]=>
+ string(7) "strings"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+ [3]=>
+ string(3) "one"
+ ["str1"]=>
+ string(3) "two"
+ [4]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+}
+array(4) {
+ ["str1"]=>
+ array(2) {
+ [0]=>
+ string(5) "world"
+ [1]=>
+ string(3) "two"
+ }
+ ["str2"]=>
+ float(111.111)
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation7.phpt b/ext/standard/tests/array/array_merge_recursive_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * array having reference variables.
+*/
+
+echo "*** Testing array_merge_recursive() : array with reference variables for \$arr1 argument ***\n";
+
+$value1 = 10;
+$value2 = "hello";
+$value3 = 0;
+$value4 = &$value2;
+
+// input array containing elements as reference variables
+$arr1 = array(
+ 0 => 0,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => "hello",
+ 4 => &$value3,
+ $value4 => &$value2
+);
+
+// initialize the second argument
+$arr2 = array($value4 => "hello", &$value2);
+
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with reference variables for $arr1 argument ***
+-- With default argument --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ &string(5) "hello"
+ [2]=>
+ &string(5) "hello"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ &int(0)
+ ["hello"]=>
+ &string(5) "hello"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ &string(5) "hello"
+ [2]=>
+ &string(5) "hello"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ &int(0)
+ ["hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "hello"
+ }
+ [5]=>
+ &string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation8.phpt b/ext/standard/tests/array/array_merge_recursive_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing an array having binary values.
+*/
+
+echo "*** Testing array_merge_recursive() : array with binary data for \$arr1 argument ***\n";
+
+// array with binary values
+$arr1 = array(b"1", b"hello" => "hello", b"world", "str1" => b"hello", "str2" => "world");
+
+// initialize the second argument
+$arr2 = array(b"str1" => b"binary", b"hello" => "binary", b"str2" => b"binary");
+
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with binary data for $arr1 argument ***
+-- With default argument --
+array(5) {
+ [0]=>
+ string(1) "1"
+ ["hello"]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+}
+-- With more arguments --
+array(5) {
+ [0]=>
+ string(1) "1"
+ ["hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(6) "binary"
+ }
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(6) "binary"
+ }
+ ["str2"]=>
+ array(2) {
+ [0]=>
+ string(5) "world"
+ [1]=>
+ string(6) "binary"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation9.phpt b/ext/standard/tests/array/array_merge_recursive_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * arrays having common key and value.
+*/
+
+echo "*** Testing array_merge_recursive() : arrays with common key and value ***\n";
+
+/* initialize the array having duplicate values */
+
+// integer values
+$arr1 = array("a" => 1, "b" => 2);
+$arr2 = array("b" => 2, "c" => 4);
+echo "-- Integer values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// float values
+$arr1 = array("a" => 1.1, "b" => 2.2);
+$arr2 = array("b" => 2.2, "c" => 3.3);
+echo "-- Float values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// string values
+$arr1 = array("a" => "hello", "b" => "world");
+$arr2 = array("b" => "world", "c" => "string");
+echo "-- String values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// boolean values
+$arr1 = array("a" => true, "b" => false);
+$arr2 = array("b" => false);
+echo "-- Boolean values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// null values
+$arr1 = array( "a" => NULL);
+$arr2 = array( "a" => NULL);
+echo "-- Null values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : arrays with common key and value ***
+-- Integer values --
+array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ }
+ ["c"]=>
+ int(4)
+}
+-- Float values --
+array(3) {
+ ["a"]=>
+ float(1.1)
+ ["b"]=>
+ array(2) {
+ [0]=>
+ float(2.2)
+ [1]=>
+ float(2.2)
+ }
+ ["c"]=>
+ float(3.3)
+}
+-- String values --
+array(3) {
+ ["a"]=>
+ string(5) "hello"
+ ["b"]=>
+ array(2) {
+ [0]=>
+ string(5) "world"
+ [1]=>
+ string(5) "world"
+ }
+ ["c"]=>
+ string(6) "string"
+}
+-- Boolean values --
+array(2) {
+ ["a"]=>
+ bool(true)
+ ["b"]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+-- Null values --
+array(1) {
+ ["a"]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $arr1 argument to test behaviour
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr2 = array (1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_merge()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_merge($input, $arr2) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+-- Iteration 19 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_variation10.phpt b/ext/standard/tests/array/array_merge_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check the position of the internal array pointer after calling array_merge().
+ * This test is also passing more than two arguments to array_merge().
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+$arr1 = array ('zero', 'one', 'two');
+$arr2 = array ('zero', 'un', 'deux');
+$arr3 = array ('null', 'eins', 'zwei');
+
+echo "\n-- Call array_merge() --\n";
+var_dump($result = array_merge($arr1, $arr2, $arr3));
+
+echo "\n-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo "\$arr1: ";
+echo key($arr1) . " => " . current ($arr1) . "\n";
+echo "\$arr2: ";
+echo key($arr2) . " => " . current ($arr2) . "\n";
+echo "\$arr3: ";
+echo key($arr3) . " => " . current ($arr3) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Call array_merge() --
+array(9) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(4) "zero"
+ [4]=>
+ string(2) "un"
+ [5]=>
+ string(4) "deux"
+ [6]=>
+ string(4) "null"
+ [7]=>
+ string(4) "eins"
+ [8]=>
+ string(4) "zwei"
+}
+
+-- Position of Internal Pointer in Result: --
+0 => zero
+
+-- Position of Internal Pointer in Original Array: --
+$arr1: 0 => zero
+$arr2: 0 => zero
+$arr3: 0 => null
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $arr2 argument to array_merge() to test behaviour
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr1 = array (1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr2 argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_merge()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_merge($arr1, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+-- Iteration 19 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_variation3.phpt b/ext/standard/tests/array/array_merge_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of different data types to test how array_merge adds them
+ * onto an existing array
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr = array (1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// arrays of different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_merge
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_merge($input, $arr) );
+ var_dump( array_merge($arr, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1: int data --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+}
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(12345)
+ [5]=>
+ int(-2345)
+}
+
+-- Iteration 2: float data --
+array(7) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+ [5]=>
+ int(1)
+ [6]=>
+ int(2)
+}
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(10.5)
+ [3]=>
+ float(-10.5)
+ [4]=>
+ float(123456789000)
+ [5]=>
+ float(1.23456789E-9)
+ [6]=>
+ float(0.5)
+}
+
+-- Iteration 3: null data --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+
+-- Iteration 4: bool data --
+array(6) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+}
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(true)
+ [5]=>
+ bool(false)
+}
+
+-- Iteration 5: empty string data --
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+}
+
+-- Iteration 6: empty array data --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+-- Iteration 7: string data --
+array(5) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(11) "hello world"
+ [3]=>
+ int(1)
+ [4]=>
+ int(2)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+ [3]=>
+ string(6) "string"
+ [4]=>
+ string(11) "hello world"
+}
+
+-- Iteration 8: object data --
+array(3) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9: undefined data --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+}
+
+-- Iteration 10: unset data --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+}
+
+-- Iteration 11: resource data --
+array(3) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation4.phpt b/ext/standard/tests/array/array_merge_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array with different data types as keys to test how array_merge
+ * adds it onto an existing array
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr = array ('one' => 1, 'two' => 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays with keys as different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_merge
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_merge($input, $arr) );
+ var_dump( array_merge($arr, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1: int data --
+array(6) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(6) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+}
+
+-- Iteration 2: float data --
+array(5) {
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(5) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+}
+
+-- Iteration 3: extreme floats data --
+array(4) {
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+}
+
+-- Iteration 4: null uppercase data --
+array(3) {
+ [""]=>
+ string(6) "null 1"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5: null lowercase data --
+array(3) {
+ [""]=>
+ string(6) "null 2"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6: bool lowercase data --
+array(4) {
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7: bool uppercase data --
+array(4) {
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8: empty double quotes data --
+array(3) {
+ [""]=>
+ string(6) "emptyd"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9: empty single quotes data --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10: string data --
+array(5) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(5) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11: undefined data --
+array(3) {
+ [""]=>
+ string(9) "undefined"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12: unset data --
+array(3) {
+ [""]=>
+ string(5) "unset"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation5.phpt b/ext/standard/tests/array/array_merge_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_merge() arrays with only numeric keys to test behaviour.
+ * $arr2 contains a duplicate element to $arr1.
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+//numeric keys
+$arr1 = array('zero', 'one', 'two', 'three');
+$arr2 = array(1 => 'one', 20 => 'twenty', 30 => 'thirty');
+
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+array(7) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ string(6) "twenty"
+ [6]=>
+ string(6) "thirty"
+}
+array(7) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(6) "twenty"
+ [2]=>
+ string(6) "thirty"
+ [3]=>
+ string(4) "zero"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ string(3) "two"
+ [6]=>
+ string(5) "three"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation6.phpt b/ext/standard/tests/array/array_merge_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_merge arrays with string keys to test behaviour.
+ * $arr2 has a duplicate key to $arr1
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+//string keys
+$arr1 = array('zero' => 'zero', 'one' => 'un', 'two' => 'deux');
+$arr2 = array('zero' => 'zero', 'un' => 'eins', 'deux' => 'zwei');
+
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+array(5) {
+ ["zero"]=>
+ string(4) "zero"
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+ ["un"]=>
+ string(4) "eins"
+ ["deux"]=>
+ string(4) "zwei"
+}
+array(5) {
+ ["zero"]=>
+ string(4) "zero"
+ ["un"]=>
+ string(4) "eins"
+ ["deux"]=>
+ string(4) "zwei"
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation7.phpt b/ext/standard/tests/array/array_merge_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_merge() arrays with mixed keys to test how it attaches them to
+ * existing arrays
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+//mixed keys
+$arr1 = array('zero', 20 => 'twenty', 'thirty' => 30, true => 'bool');
+$arr2 = array(0, 1, 2, null => 'null', 1.234E-10 => 'float');
+
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+array(8) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(6) "twenty"
+ ["thirty"]=>
+ int(30)
+ [2]=>
+ string(4) "bool"
+ [3]=>
+ string(5) "float"
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+ [""]=>
+ string(4) "null"
+}
+array(8) {
+ [0]=>
+ string(5) "float"
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [""]=>
+ string(4) "null"
+ [3]=>
+ string(4) "zero"
+ [4]=>
+ string(6) "twenty"
+ ["thirty"]=>
+ int(30)
+ [5]=>
+ string(4) "bool"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation8.phpt b/ext/standard/tests/array/array_merge_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_merge() with multi-dimensional arrays
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+$arr1 = array('zero', 'one', 'two', array(0));
+$arr2 = array(1, 2, 3);
+
+echo "\n-- Merge a two-dimensional and a one-dimensional array --\n";
+var_dump(array_merge($arr1, $arr2));
+
+echo "\n-- Merge an array and a sub-array --\n";
+var_dump(array_merge($arr1[3], $arr2));
+var_dump(array_merge($arr2, $arr1[3]));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Merge a two-dimensional and a one-dimensional array --
+array(7) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+ [6]=>
+ int(3)
+}
+
+-- Merge an array and a sub-array --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(0)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation9.phpt b/ext/standard/tests/array/array_merge_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/* Test array_merge() when:
+ * 1. Passed an array made up of referenced variables
+ * 2. Passed an array as the first argument and a reference to that array as the second.
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+$val1 = 'foo';
+$val2 = 'bar';
+$val3 = 'baz';
+
+$arr1 = array(&$val1, &$val2, &$val3);
+$arr2 = array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3');
+
+echo "\n-- Merge an array made up of referenced variables to an assoc. array --\n";
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+$val2 = 'hello world';
+
+echo "\n-- Change \$val2 --\n";
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : basic functionality ***\n";
+
+// Initialise all required variables
+$ar1 = array("row1" => 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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : basic functionality - renumbering of numeric keys ***\n";
+
+// Initialise all required variables
+$ar1 = array( "strkey" => 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--
+<?php
+/* Prototype : 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], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : case-sensitive\n";
+
+$a = array(
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
+);
+
+$b = array(
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
+);
+
+array_multisort($b, SORT_STRING, $a);
+
+var_dump($a, $b);
+
+?>
+===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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_multisort() function with Zero arguments --\n";
+var_dump( array_multisort() );
+
+echo "\n-- Testing array_multisort() function with repeated flags --\n";
+$ar1 = array(1);
+var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) );
+
+echo "\n-- Testing array_multisort() function with repeated flags --\n";
+$ar1 = array(1);
+var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) );
+
+?>
+===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--
+<?php
+/* Prototype : 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], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : case-insensitive\n";
+
+$a = array(
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
+);
+
+$b = array(
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
+);
+
+array_multisort($b, SORT_STRING | SORT_FLAG_CASE, $a);
+
+var_dump($a, $b);
+
+?>
+===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--
+<?php
+/* Prototype : 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], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : natural sorting\n";
+
+$a = array(
+ 'Second',
+ 'First',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
+);
+
+$b = array(
+ '2 a',
+ '1 b',
+ '20 c',
+ '10 d',
+ '3 e',
+);
+
+array_multisort($b, SORT_NATURAL, $a);
+
+var_dump($a, $b);
+
+?>
+===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--
+<?php
+/* Prototype : 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], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : natural sorting case-sensitive\n";
+
+$a = array(
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
+);
+
+$b = array(
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
+);
+
+array_multisort($b, SORT_NATURAL, $a);
+
+var_dump($a, $b);
+
+?>
+===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--
+<?php
+/* Prototype : 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], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : natural sorting case-insensitive\n";
+
+$a = array(
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
+);
+
+$b = array(
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
+);
+
+array_multisort($b, SORT_NATURAL | SORT_FLAG_CASE, $a);
+
+var_dump($a, $b);
+
+?>
+===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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : usage variation ***\n";
+
+// 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');
+
+$ar2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : Testing with anonymous arguments ***\n";
+
+var_dump(array_multisort(array(1,3,2,4)));
+
+?>
+===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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : Testing with empty array ***\n";
+
+var_dump(array_multisort(array()));
+
+?>
+===DONE===
+<?php exit(0); ?>
+--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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$ar1 = array(1, 2);
+$ar2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$ar1 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : Testing with multiple array arguments ***\n";
+
+$arr1 = array (4,3,3,3);
+$arr2 = array (9,3,2,2);
+$arr3 = array (9,9,2,1);
+
+var_dump(array_multisort($arr1, $arr2, $arr3));
+
+var_dump($arr1);
+var_dump($arr2);
+var_dump($arr3);
+
+?>
+===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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : Testing all array sort specifiers ***\n";
+
+$ar = array( 2, "aa" , "1");
+
+array_multisort($ar, SORT_REGULAR, SORT_ASC);
+var_dump($ar);
+
+array_multisort($ar, SORT_STRING, SORT_ASC);
+var_dump($ar);
+
+array_multisort($ar, SORT_NUMERIC, SORT_ASC);
+var_dump($ar);
+
+
+?>
+===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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : Testing all array sort specifiers ***\n";
+
+$ar = array( 2, "aa" , "1");
+
+array_multisort($ar, SORT_REGULAR, SORT_DESC);
+var_dump($ar);
+
+array_multisort($ar, SORT_STRING, SORT_DESC);
+var_dump($ar);
+
+array_multisort($ar, SORT_NUMERIC, SORT_DESC);
+var_dump($ar);
+
+
+?>
+===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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
+
+// define some classes
+class classWithToString {
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString { }
+
+$inputs = array(
+ 'int 0' => 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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ // We're testing sort order not errors so ignore.
+}
+set_error_handler('test_error_handler');
+
+// define some classes
+class classWithToString {
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString { }
+
+$inputs = array(
+ 'int 0' => 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--
+<?php
+/* Prototype : 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]], ...])
+ * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
+
+// define some classes
+class classWithToString {
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString { }
+
+$inputs = array(
+ 'int 0' => 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--
+<?php
+function f() {
+ return array(1, 2);
+}
+var_dump(next(f()));
+?>
+--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--
+<?php
+function f() {
+ return array(1, 2);
+}
+var_dump(next(array(1, 2)));
+?>
+--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--
+<?php
+
+var_dump(array_pad());
+var_dump(array_pad(array()));
+var_dump(array_pad(array(), 1));
+var_dump(array_pad(array(), 1, 0));
+
+var_dump(array_pad(array(), 0, 0));
+var_dump(array_pad(array(), -1, 0));
+var_dump(array_pad(array("", -1, 2.0), 5, 0));
+var_dump(array_pad(array("", -1, 2.0), 5, array()));
+var_dump(array_pad(array("", -1, 2.0), 2, array()));
+var_dump(array_pad(array("", -1, 2.0), -3, array()));
+var_dump(array_pad(array("", -1, 2.0), -4, array()));
+var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
+var_dump(array_pad("", 2000000, 0));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_pad() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_pad() function with Zero arguments --\n";
+var_dump( array_pad() );
+
+//Test array_pad with one more than the expected number of arguments
+echo "\n-- Testing array_pad() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$pad_size = 10;
+$pad_value = 1;
+$extra_arg = 10;
+var_dump( array_pad($input, $pad_size, $pad_value, $extra_arg) );
+
+// Testing array_pad with less than the expected number of arguments
+echo "\n-- Testing array_pad() function with less than expected no. of arguments --\n";
+$input = array(1, 2);
+$pad_size = 10;
+var_dump( array_pad($input, $pad_size) );
+var_dump( array_pad($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : error conditions ***
+
+-- Testing array_pad() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_pad() function by passing values to $input argument other than arrays
+* and see that function outputs proper warning messages wherever expected.
+* The $pad_size and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : passing non array values to \$input argument ***\n";
+
+// Initialise $pad_size and $pad_value
+$pad_size = 10;
+$pad_value = 1;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_pad()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+ var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : passing non array values to $input argument ***
+
+-- Iteration 1 --
+Warning: array_pad() 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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_pad() function by passing values to $pad_size argument other than integers
+* and see that function outputs proper warning messages wherever expected.
+* The $input and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : passing non integer values to \$pad_size argument ***\n";
+
+// Initialise $input and $pad_value arguments
+$input = array(1, 2);
+$pad_value = 1;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+//array of values to iterate over
+$pad_sizes = array(
+
+ // float data
+/*1*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ -12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*6*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // string data
+/*19*/ "string",
+ 'string',
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $pad_sizes to check the behavior of array_pad()
+$iterator = 1;
+foreach($pad_sizes as $pad_size) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_pad($input, $pad_size, $pad_value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : passing non integer values to $pad_size argument ***
+-- Iteration 1 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [7]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(1)
+}
+-- Iteration 2 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [7]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(2)
+}
+-- Iteration 3 --
+
+Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
+bool(false)
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 7 --
+
+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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_pad() function for expected behavior by passing
+* different possible values for $pad_value argument.
+* $input and $pad_size arguments take fixed value.
+*/
+
+echo "*** Testing array_pad() : possible values for \$pad_value argument ***\n";
+
+// Initialise $input and $pad_size argument
+$input = array(1, 2);
+$pad_size = 4;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a reference variable
+$value = "hello";
+$reference = &$value;
+
+// different values to be passed to $pad_value argument
+$pad_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+ $heredoc,
+
+ // strings with different white spaces
+/*26*/ "\v\fHello\t world!! \rstring\n",
+ '\v\fHello\t world!! \rstring\n',
+
+ // object data
+/*28*/ new classA(),
+
+ // undefined data
+/*29*/ @$undefined_var,
+
+ // unset data
+/*30*/ @$unset_var,
+
+ // resource variable
+/*31*/ $fp,
+
+ // reference variable
+/*32*/ $reference
+);
+
+// loop through each element of $pad_values to check the behavior of array_pad()
+$iterator = 1;
+foreach($pad_values as $pad_value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+ var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : possible values for $pad_value argument ***
+-- Iteration 1 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(12345)
+}
+array(4) {
+ [0]=>
+ int(12345)
+ [1]=>
+ int(12345)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 4 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(-2345)
+ [3]=>
+ int(-2345)
+}
+array(4) {
+ [0]=>
+ int(-2345)
+ [1]=>
+ int(-2345)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(10.5)
+ [3]=>
+ float(10.5)
+}
+array(4) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(10.5)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(-10.5)
+ [3]=>
+ float(-10.5)
+}
+array(4) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(123456789000)
+}
+array(4) {
+ [0]=>
+ float(123456789000)
+ [1]=>
+ float(123456789000)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 8 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(1.23456789E-9)
+ [3]=>
+ float(1.23456789E-9)
+}
+array(4) {
+ [0]=>
+ float(1.23456789E-9)
+ [1]=>
+ float(1.23456789E-9)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 9 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.5)
+}
+array(4) {
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(0.5)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 10 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(0) {
+ }
+ [3]=>
+ array(0) {
+ }
+}
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+}
+array(4) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 12 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+array(4) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 13 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 14 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [3]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [1]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 15 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 16 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 17 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 18 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 19 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 20 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 21 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+}
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 22 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+}
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 23 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+ [3]=>
+ string(6) "string"
+}
+array(4) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 24 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+ [3]=>
+ string(6) "string"
+}
+array(4) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 25 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(11) "hello world"
+ [3]=>
+ string(11) "hello world"
+}
+array(4) {
+ [0]=>
+ string(11) "hello world"
+ [1]=>
+ string(11) "hello world"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 26 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(25) " Hello world!! string
+"
+ [3]=>
+ string(25) " Hello world!! string
+"
+}
+array(4) {
+ [0]=>
+ string(25) " Hello world!! string
+"
+ [1]=>
+ string(25) " Hello world!! string
+"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 27 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+ [3]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+}
+array(4) {
+ [0]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+ [1]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 28 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [3]=>
+ object(classA)#%d (0) {
+ }
+}
+array(4) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 29 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 30 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 31 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ resource(%d) of type (stream)
+ [3]=>
+ resource(%d) of type (stream)
+}
+array(4) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 32 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "hello"
+}
+array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation4.phpt b/ext/standard/tests/array/array_pad_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing binary values to $pad_value argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $input and $pad_size arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing binary values to \$pad_value argument ***\n";
+
+// initialize the $input and $pad_size argument
+$input = array(1, 2, 3);
+$pad_size = 6;
+
+// initialize $pad_value with reference variable
+$binary = b"hello";
+
+var_dump( array_pad($input, $pad_size, $binary) ); // positive 'pad_size'
+var_dump( array_pad($input, -$pad_size, $binary) ); // negative 'pad_size'
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing binary values to $pad_value argument ***
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ string(5) "hello"
+ [5]=>
+ string(5) "hello"
+}
+array(6) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ int(1)
+ [4]=>
+ int(2)
+ [5]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation5.phpt b/ext/standard/tests/array/array_pad_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing two dimensional array to $pad_value argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $input and $pad_size arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing 2-d array to \$pad_value argument ***\n";
+
+// initialize the $input and $pad_size argument
+$input = array(1, 2, 3);
+$pad_size = 5;
+
+// initialize $pad_value
+$pad_value = array (
+ array(1),
+ array("hello", 'world'),
+ array("one" => 1, 'two' => 2)
+);
+
+var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_value'
+var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_value'
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing 2-d array to $pad_value argument ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+}
+array(5) {
+ [0]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation6.phpt b/ext/standard/tests/array/array_pad_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different arrays to $input argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $pad_size and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing different arrays to \$input argument ***\n";
+
+/* Different heredoc strings */
+
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// different arrays to be passed to $input argument
+$inputs = array (
+/*1*/ array(1, 2), // with default keys and numeric values
+ array(1.1, 2.2), // with default keys & float values
+ array(false,true), // with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // with NULL
+ array("a\v\f", "aaaa\r", "b\tbbb", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f', 'aaaa\r', 'b\tbbb', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings
+ array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// initialize the $pad_size and $pad_value arguments
+$pad_size = 6;
+$pad_value = "HELLO";
+
+// loop through each sub-array within $inputs to check the behavior of array_pad()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+ var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing different arrays to $input argument ***
+-- Iteration 1 --
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+}
+-- Iteration 2 --
+array(6) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ float(1.1)
+ [5]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ bool(false)
+ [5]=>
+ bool(true)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+-- Iteration 5 --
+array(6) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ NULL
+}
+-- Iteration 6 --
+array(6) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(5) "b bbb"
+ [3]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(3) "a "
+ [3]=>
+ string(5) "aaaa "
+ [4]=>
+ string(5) "b bbb"
+ [5]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(6) "b\tbbb"
+ [3]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "a\v\f"
+ [3]=>
+ string(6) "aaaa\r"
+ [4]=>
+ string(6) "b\tbbb"
+ [5]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 8 --
+array(6) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(86) "hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [0]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(86) "hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [2]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+}
+-- Iteration 9 --
+array(6) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(5) "three"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ [5]=>
+ string(5) "three"
+}
+-- Iteration 10 --
+array(6) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+-- Iteration 11 --
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(40)
+ [3]=>
+ int(30)
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ int(10)
+ [3]=>
+ int(20)
+ [4]=>
+ int(40)
+ [5]=>
+ int(30)
+}
+-- Iteration 12 --
+array(6) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+}
+-- Iteration 13 --
+array(6) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(4) "four"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["one"]=>
+ int(1)
+ [3]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 14 --
+array(6) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- Iteration 15 --
+array(6) {
+ [0]=>
+ string(4) "true"
+ [1]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(4) "true"
+ [3]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 16 --
+array(6) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(6) {
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+array(6) {
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+-- Iteration 18 --
+array(6) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [""]=>
+ int(4)
+ [3]=>
+ int(5)
+ [4]=>
+ int(6)
+}
+-- Iteration 19 --
+array(6) {
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation7.phpt b/ext/standard/tests/array/array_pad_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing two dimensional array to $input argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $pad_size and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing 2-D array to \$input argument ***\n";
+
+// initialize the 2-d array
+$input = array (
+ array(1, 2, 3),
+ array("hello", 'world'),
+ array("one" => 1, "two" => 2)
+);
+
+// initialize the $pad_size and $pad_value arguments
+$pad_size = 5;
+$pad_value = "HELLO";
+
+// entire 2-d array
+echo "-- Entire 2-d array for \$input argument --\n";
+var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+
+// sub array
+echo "-- Sub array for \$input argument --\n";
+var_dump( array_pad($input[1], $pad_size, $pad_value) ); // positive 'pad_size'
+var_dump( array_pad($input[1], -$pad_size, $pad_value) ); // negative 'pad_size'
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing 2-D array to $input argument ***
+-- Entire 2-d array for $input argument --
+array(5) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(5) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [4]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+}
+-- Sub array for $input argument --
+array(5) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(5) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_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--
+<?php
+
+array_pop($GLOBALS);
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* 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--
+<?php
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+
+/* Zero argument */
+var_dump( array_pop() );
+
+/* Scalar argument */
+var_dump( array_pop($number) );
+
+/* String argument */
+var_dump( array_pop($str) );
+
+/* Invalid Number of arguments */
+var_dump( array_pop($mixed_array[1],$mixed_array[2]) );
+
+/* Empty Array as argument */
+var_dump( array_pop($empty_array) );
+
+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--
+<?php
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+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--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_product() function with Zero arguments --\n";
+var_dump( array_product() );
+
+//Test array_product with one more than the expected number of arguments
+echo "\n-- Testing array_product() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_product($input, $extra_arg) );
+
+echo "\n-- Testing array_product() function incorrect argument type --\n";
+var_dump( array_product("bob") );
+
+?>
+===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--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : variation - using non numeric values ***\n";
+
+class A {
+ static function help() { echo "hello\n"; }
+}
+$fp = fopen(__FILE__, "r");
+
+$types = array("boolean (true)" => 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--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : variations ***\n";
+
+echo "\n-- Testing array_product() function with a keyed array array --\n";
+var_dump( array_product(array("bob" => 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--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : variations - negative numbers***\n";
+
+echo "\n-- Testing array_product() function with one negative number --\n";
+var_dump( array_product(array(-2)) );
+
+echo "\n-- Testing array_product() function with two negative numbers --\n";
+var_dump( array_product(array(-2, -3)) );
+
+echo "\n-- Testing array_product() function with three negative numbers --\n";
+var_dump( array_product(array(-2, -3, -4)) );
+
+echo "\n-- Testing array_product() function with negative floats --\n";
+var_dump( array_product(array(-1.5)));
+
+echo "\n-- Testing array_product() function with negative floats --\n";
+var_dump( array_product(array(-99999999.9, 99999999.1)));
+
+
+?>
+===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--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : variations ***\n";
+
+echo "\n-- Testing array_product() function with a very large array --\n";
+
+$array = array();
+
+for ($i = 0; $i < 999; $i++) {
+ $array[] = 999;
+}
+
+var_dump( array_product($array) );
+?>
+===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--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+
+/* Prototype: int array_push( array &array );
+ * Description: Push one or more elements onto the end of array
+ and returns the new number of elements in the array.
+ */
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* 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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_push with indexed and associative arrays
+ */
+
+echo "*** Testing array_push() : basic functionality ***\n";
+
+$array = array ('zero', 'one', 'two');
+$var1 = 'three';
+$var2 = 'four';
+
+echo "\n-- Push values onto an indexed array --\n";
+var_dump(array_push($array, $var1, $var2));
+var_dump($array);
+
+$array_assoc = array ('one' => 'un', 'two' => 'deux');
+
+echo "\n-- Push values onto an associative array --\n";
+var_dump(array_push($array_assoc, $var1, $var2));
+var_dump($array_assoc);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_push() : basic functionality ***
+
+-- Push values onto an indexed array --
+int(5)
+array(5) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(4) "four"
+}
+
+-- Push values onto an associative array --
+int(4)
+array(4) {
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(4) "four"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_error1.phpt b/ext/standard/tests/array/array_push_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_push() to test behaviour
+ */
+
+echo "*** Testing array_push() : error conditions ***\n";
+
+// Testing array_push with one less than the expected number of arguments
+echo "\n-- Testing array_push() function with less than expected no. of arguments --\n";
+$stack = array(1, 2);
+var_dump( array_push($stack) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : error conditions ***
+
+-- Testing array_push() function with less than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Use PHP's maximum integer value as array key
+ * then try and push new elements onto the array
+ */
+
+echo "*** Testing array_push() : error conditions ***\n";
+
+$array = array(PHP_INT_MAX => '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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $stack argument to array_push() to test behaviour
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$var = 'value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_push()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_push($input, $var) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_push() 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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $var argument to array_push to test behaviour
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$stack = array (1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $var argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_push()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $temp_array = $stack;
+ var_dump( array_push($temp_array, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Iteration 1 --
+int(3)
+
+-- Iteration 2 --
+int(3)
+
+-- Iteration 3 --
+int(3)
+
+-- Iteration 4 --
+int(3)
+
+-- Iteration 5 --
+int(3)
+
+-- Iteration 6 --
+int(3)
+
+-- Iteration 7 --
+int(3)
+
+-- Iteration 8 --
+int(3)
+
+-- Iteration 9 --
+int(3)
+
+-- Iteration 10 --
+int(3)
+
+-- Iteration 11 --
+int(3)
+
+-- Iteration 12 --
+int(3)
+
+-- Iteration 13 --
+int(3)
+
+-- Iteration 14 --
+int(3)
+
+-- Iteration 15 --
+int(3)
+
+-- Iteration 16 --
+int(3)
+
+-- Iteration 17 --
+int(3)
+
+-- Iteration 18 --
+int(3)
+
+-- Iteration 19 --
+int(3)
+
+-- Iteration 20 --
+int(3)
+
+-- Iteration 21 --
+int(3)
+
+-- Iteration 22 --
+int(3)
+
+-- Iteration 23 --
+int(3)
+
+-- Iteration 24 --
+int(3)
+
+-- Iteration 25 --
+int(3)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_variation3.phpt b/ext/standard/tests/array/array_push_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_push when passed:
+ * 1. an array as $var arg
+ * 2. as sub-array as $stack arg
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+echo "\n-- Pass array as \$var argument --\n";
+$array = array(1, 2, 3);
+$sub_array = array('one', 'two');
+var_dump(array_push($array, $sub_array));
+var_dump($array);
+
+echo "\n-- Pass sub-array as \$stack argument --\n";
+var_dump(array_push($array[3], 'a'));
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Pass array as $var argument --
+int(4)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+}
+
+-- Pass sub-array as $stack argument --
+int(3)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(1) "a"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check the position of the internal array pointer after calling array_push()
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+$stack = array ('one' => 'un', 'two' => 'deux');
+$var0 = 'zero';
+
+echo "\n-- Call array_push() --\n";
+var_dump($result = array_push($stack, $var0));
+
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($stack) . " => " . current ($stack) . "\n";
+
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing array_push() : usage variations ***
+
+-- Call array_push() --
+int(3)
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done
diff --git a/ext/standard/tests/array/array_push_variation6.phpt b/ext/standard/tests/array/array_push_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_push arrays where the keys are different data types.
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$var = 'value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays of different data types as keys to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*3*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*4*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*5*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*6*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*8*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*9*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_push()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ echo "Before : ";
+ var_dump(count($input));
+ echo "After : ";
+ var_dump( array_push($input, $var) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Iteration 1 : int data --
+Before : int(4)
+After : int(5)
+
+-- Iteration 2 : float data --
+Before : int(3)
+After : int(4)
+
+-- Iteration 3 : extreme floats data --
+Before : int(2)
+After : int(3)
+
+-- Iteration 4 : null uppercase data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 5 : null lowercase data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 6 : bool lowercase data --
+Before : int(2)
+After : int(3)
+
+-- Iteration 7 : bool uppercase data --
+Before : int(2)
+After : int(3)
+
+-- Iteration 8 : empty double quotes data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 9 : empty single quotes data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 10 : string data --
+Before : int(3)
+After : int(4)
+
+-- Iteration 11 : undefined data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 12 : unset data --
+Before : int(1)
+After : int(2)
+Done
diff --git a/ext/standard/tests/array/array_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--
+<?php
+
+var_dump(array_rand());
+var_dump(array_rand(array()));
+var_dump(array_rand(array(), 0));
+var_dump(array_rand(0, 0));
+var_dump(array_rand(array(1,2,3), 0));
+var_dump(array_rand(array(1,2,3), -1));
+var_dump(array_rand(array(1,2,3), 10));
+var_dump(array_rand(array(1,2,3), 3));
+var_dump(array_rand(array(1,2,3), 2));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Test array_rand() when array with default keys is passed to 'input' argument
+*/
+
+echo "*** Testing array_rand() : array with default keys ***\n";
+
+
+// Initialise the 'input' and 'num_req' variables
+$input = array(10, 20, 30, 40, 50, 60, 70);
+$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() : 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--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Test array_rand() when associative array is passed to 'input' argument
+*/
+
+echo "*** Testing array_rand() : with associative array ***\n";
+
+
+// Initialise the 'input' and 'num_req' variables
+$input = array(
+ 'one' => 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--
+<?php
+/* Prototype : mixed array_rand(array input [, int num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_rand() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_rand() function with Zero arguments --\n";
+var_dump( array_rand() );
+
+//Test array_rand with one more than the expected number of arguments
+echo "\n-- Testing array_rand() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$num_req = 10;
+$extra_arg = 10;
+var_dump( array_rand($input,$num_req, $extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : mixed array_rand(array input [, int num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test array_rand() with different types of values other than arrays passed to the 'input' parameter
+* to see that function works with unexpeced data and generates warning message as required.
+*/
+
+echo "*** Testing array_rand() : unexpected values for 'input' parameter ***\n";
+
+// Initialise function arguments
+$num_req = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "object";
+ }
+}
+
+//array of different values for 'input' parameter
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new test(),
+
+ // resource data
+/*21*/ $fp,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+/* loop through each element of the array to test array_rand() function
+ * for different values for 'input' argument
+*/
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_rand($value,$num_req) );
+ $count++;
+};
+
+// closing the resource
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : mixed array_rand(array input [, int num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test array_rand() with different types of values other than int passed to 'num_req' argument
+* to see that function works with unexpeced data and generates warning message as required.
+*/
+
+echo "*** Testing array_rand() : unexpected values for 'num_req' parameter ***\n";
+
+// Initialise function arguments
+$input = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "3object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new test(),
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+);
+
+
+// loop through each element of the array for different values for 'num_req' argument
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_rand($input,$value) );
+ $count++;
+};
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() function when multi-dimensional array
+* is passed to 'input' argument
+*/
+
+echo "*** Testing array_rand() : with multi-dimensional array ***\n";
+
+// initialise the multi-dimensional array
+$input = array(
+ // array with int values
+/*1*/ array(1, 2, 0, -0, -1, -2),
+
+ // array with float values
+ array(1.23, -1.23, 0.34, -0.34, 0e2, 2e-3, -2e2, -40e-2),
+
+ // array with single quoted strings
+/*3*/ array('one', '123numbers', 'hello\tworld', 'hello world\0', '12.34floatnum'),
+
+ // array with double quoted strings
+ array("one","123numbers", "hello\tworld", "hello world\0", "12.34floatnum"),
+
+ // array with bool values
+/*5*/ array(true, TRUE, FALSE, false, TrUe, FaLsE),
+
+ // array with hexa values
+ array(0x123, -0x123, 0xabc, 0xABC, 0xab),
+
+ // array with null values
+/*7*/ array(null, NULL, "\0", Null, NuLl)
+
+);
+
+// initialise 'num_req' variable
+$num_req = 3;
+
+// calling array_rand() function with multi-dimensional array
+var_dump( array_rand($input, $num_req) );
+
+// looping to test array_rand() with each sub-array in the multi-dimensional array
+echo "\n*** Testing array_rand() with arrays having different types of values ***\n";
+$counter = 1;
+foreach($input as $arr) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( array_rand($arr) ); // with default arguments
+ var_dump( array_rand($arr, 3) ); // with default as well as optional arguments
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() function when associative array is passed to
+* the 'input' parameter in the function call
+*/
+
+echo "*** Testing array_rand() : with associative arrays ***\n";
+
+// initialise associative arrays
+$asso_arrays = array(
+
+ // array with numeric keys
+/*1*/ array(1 => '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--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() function when associative array and
+* various invalid values are passed to the 'input' and 'req_num'
+* parameters respectively
+*/
+
+echo "*** Testing array_rand() : with invalid values for 'req_num' ***\n";
+
+// initialise associative arrays
+$input = array(
+ 1 => '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--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() when keys of the 'input' array is heredoc string
+*/
+
+echo "*** Testing array_rand() : with keys of input array as heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$input = array(
+ $empty_heredoc => "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--
+<?php
+/* Prototype: array array_reduce(array $array, mixed $callback, mixed $initial);
+ Description: Iteratively reduce the array to a single value via the callback
+*/
+
+$array = array('foo', 'foo', 'bar', 'qux', 'qux', 'quux');
+
+echo "\n*** Testing array_reduce() to integer ***\n";
+function reduce_int($w, $v) { return $w + strlen($v); }
+$initial = 42;
+var_dump(array_reduce($array, 'reduce_int', $initial), $initial);
+
+echo "\n*** Testing array_reduce() to float ***\n";
+function reduce_float($w, $v) { return $w + strlen($v) / 10; }
+$initial = 4.2;
+var_dump(array_reduce($array, 'reduce_float', $initial), $initial);
+
+echo "\n*** Testing array_reduce() to string ***\n";
+function reduce_string($w, $v) { return $w . $v; }
+$initial = 'quux';
+var_dump(array_reduce($array, 'reduce_string', $initial), $initial);
+
+echo "\n*** Testing array_reduce() to array ***\n";
+function reduce_array($w, $v) { $w[$v]++; return $w; }
+$initial = array('foo' => 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--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : error conditions ***\n";
+
+
+//Test array_reduce with one more than the expected number of arguments
+echo "\n-- Testing array_reduce() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$callback = 1;
+$initial = 10;
+$extra_arg = 10;
+var_dump( array_reduce($input, $callback, $initial, $extra_arg) );
+
+// Testing array_reduce with one less than the expected number of arguments
+echo "\n-- Testing array_reduce() function with less than expected no. of arguments --\n";
+$input = array(1, 2);
+var_dump( array_reduce($input) );
+
+?>
+===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--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation ***\n";
+
+
+function oneArg($v) {
+ return $v;
+}
+
+function threeArgs($v, $w, $x) {
+ return $v + $w + $x;
+}
+
+$array = array(1);
+
+echo "\n--- Testing with a callback with too few parameters ---\n";
+var_dump(array_reduce($array, "oneArg", 2));
+
+echo "\n--- Testing with a callback with too many parameters ---\n";
+var_dump(array_reduce($array, "threeArgs", 2));
+
+?>
+===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--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation - invalid parameters ***\n";
+
+
+$array = array(1);
+
+var_dump(array_reduce($array, "bogusbogus"));
+
+var_dump(array_reduce("bogusarray", "max"));
+
+var_dump(array_reduce(new stdClass(), "max"));
+
+?>
+===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--
+<?php
+/* Prototype : mixed array_reduce(array input, mixed callback [, int initial])
+ * Description: Iteratively reduce the array to a single value via the callback.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_reduce() : variation - object callbacks ***\n";
+
+class A {
+ static function adder($a, $b) {return $a + $b;}
+ public function adder2($a, $b) {return $a + $b;}
+}
+
+$array = array(1);
+
+echo "\n--- Static method callback ---\n";
+var_dump(array_reduce($array, array("A", "adder")));
+
+echo "\n--- Instance method callback ---\n";
+var_dump(array_reduce($array, array(new A(), "adder2")));
+
+?>
+===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--
+<?php
+
+$array1 = array(
+ 0 => '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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_reverse() by giving a simple array for $array argument
+*/
+
+echo "*** Testing array_reverse() : basic functionality ***\n";
+
+// Initialise the array
+$array = array("a", "green", "red", '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(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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_reverse() with associative array for $array argument
+*/
+
+echo "*** Testing array_reverse() : basic functionality ***\n";
+
+// Initialise the array
+$array = array("a" => "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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_reverse() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing array_reverse() function with Zero arguments --\n";
+var_dump( array_reverse() );
+
+// more than the expected number of arguments
+echo "\n-- Testing array_diff() function with more than expected no. of arguments --\n";
+$array = array(1, 2, 3, 4, 5, 6);
+$extra_arg = 10;
+var_dump( array_reverse($array, true, $extra_arg) );
+var_dump( array_reverse($array, false, $extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_reverse() : usage variations - unexpected values for 'array' argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//get a heredoc string
+$heredoc_string = <<<EOT
+Hello world\t\n
+EOT;
+
+//array of values to iterate over
+$arrays = 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
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+ 'Hello world',
+ "Hello world",
+ $heredoc_string,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+
+);
+
+// loop through each element of the array $arrays to check the behavior of array_reverse()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "\n-- Iteration $iterator --";
+ // with default argument
+ var_dump( array_reverse($array) );
+ // with all possible arguments
+ var_dump( array_reverse($array, true) );
+ var_dump( array_reverse($array, false) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing the functionality of array_reverse() by giving unexpected values for $preserve_keys argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+// Initialise the array
+$array = array("a" => "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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_reverse() by giving
+ * different array values for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 2.2), // array with default keys & float values
+ array( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+/*8*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through the various elements of $arrays to test array_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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_reverse() by giving associative arrays with different
+ * keys for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing the array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"),
+
+ // arrays with string keys
+ 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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_reverse() by giving associative arrays with different
+ * values for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing the array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.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--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing the functionality of array_reverse() by giving 2-D arrays for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+// Initializing the 2-d arrays
+$two_dimensional_array = array(
+
+ // associative array
+ array('color' => '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
--- /dev/null
+++ b/ext/standard/tests/array/array_search.phpt
Binary files 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--
+<?php
+
+$a = array(1=>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--
+<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+echo "*** Testing error conditions of array_search() ***\n";
+/* zero argument */
+var_dump( array_search() );
+
+/* unexpected no.of arguments in array_search() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( array_search(1, $var, 0, "test") );
+var_dump( array_search("test") );
+
+/* unexpected second argument in array_search() */
+$var="test";
+var_dump( array_search("test", $var) );
+var_dump( array_search(1, 123) );
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test array_search() with different possible needle values */
+
+echo "*** Testing array_search() with different needle values ***\n";
+$arrays = array (
+ array(0),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
+ array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
+ array(TRUE, FALSE),
+ array("", array()),
+ array("abcd\x00abcd\x00abcd"),
+ array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
+);
+
+$array_compare = array (
+ 4,
+ "4",
+ 4.00,
+ "b",
+ "5",
+ -2,
+ -2.0,
+ -2.98989,
+ "-.9",
+ "True",
+ "",
+ array(),
+ NULL,
+ "ab",
+ "abcd",
+ 0.0,
+ -0,
+ "abcd\x00abcd\x00abcd"
+);
+/* loop to check if elements in $array_compare exist in $arrays
+ using 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--
+<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test array_search() with different possible haystack values */
+
+echo "*** Testing array_search() with different haystack values ***\n";
+
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using 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--
+<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* checking for sub-arrays with array_search() */
+echo "*** Testing sub-arrays with array_search() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "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--
+<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* checking for Resources */
+echo "*** Testing resource type with array_search() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( array_search($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( array_search((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with array_search() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( array_search("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( array_search("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( array_search(0, array("this")) );
+// false in strict mode
+var_dump( array_search(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( array_search("this", array(0)) );
+// false in stric mode
+var_dump( array_search("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( array_search(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_shift()
+ */
+
+echo "*** Testing array_shift() : basic functionality ***\n";
+
+$array = array('zero', 'one', '3' => 'three', 'four' => 4);
+echo "\n-- Before shift: --\n";
+var_dump($array);
+
+echo "\n-- After shift: --\n";
+echo "Returned value:\t";
+var_dump(array_shift($array));
+echo "New array:\n";
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : basic functionality ***
+
+-- Before shift: --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+
+-- After shift: --
+Returned value: string(4) "zero"
+New array:
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_error.phpt b/ext/standard/tests/array/array_shift_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_shift() to test behaviour
+ */
+
+echo "*** Testing array_shift() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_shift() function with Zero arguments --\n";
+var_dump( array_shift() );
+
+//Test array_shift with one more than the expected number of arguments
+echo "\n-- Testing array_shift() function with more than expected no. of arguments --\n";
+$stack = array(1, 2);
+$extra_arg = 10;
+var_dump( array_shift($stack, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : error conditions ***
+
+-- Testing array_shift() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $stack argument to array_shift() to test behaviour
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_shift()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_shift($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_shift() 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where values are of one data type to test behaviour of array_shift()
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// arrays of different data types to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_shift
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_shift($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+fclose($fp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Iteration 1: int data --
+int(0)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(12345)
+ [2]=>
+ int(-2345)
+}
+
+-- Iteration 2: float data --
+float(10.5)
+array(4) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(123456789000)
+ [2]=>
+ float(1.23456789E-9)
+ [3]=>
+ float(0.5)
+}
+
+-- Iteration 3: null data --
+NULL
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 4: bool data --
+bool(true)
+array(3) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+}
+
+-- Iteration 5: empty string data --
+string(0) ""
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 6: empty array data --
+NULL
+array(0) {
+}
+
+-- Iteration 7: string data --
+string(6) "string"
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(11) "hello world"
+}
+
+-- Iteration 8: object data --
+object(classA)#%d (0) {
+}
+array(0) {
+}
+
+-- Iteration 9: undefined data --
+NULL
+array(0) {
+}
+
+-- Iteration 10: unset data --
+NULL
+array(0) {
+}
+
+-- Iteration 11: resource data --
+resource(%d) of type (stream)
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation3.phpt b/ext/standard/tests/array/array_shift_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays with different data types as keys to test how array_shift() re-assigns keys
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_shift()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ var_dump( array_shift($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Iteration 1 : int data --
+string(4) "zero"
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(8) "positive"
+ [2]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 : float data --
+string(8) "positive"
+array(2) {
+ [0]=>
+ string(8) "negative"
+ [1]=>
+ string(4) "half"
+}
+
+-- Iteration 3 : extreme floats data --
+string(5) "large"
+array(1) {
+ [0]=>
+ string(5) "small"
+}
+
+-- Iteration 4 : null uppercase data --
+string(6) "null 1"
+array(0) {
+}
+
+-- Iteration 5 : null lowercase data --
+string(6) "null 2"
+array(0) {
+}
+
+-- Iteration 6 : bool lowercase data --
+string(6) "lowert"
+array(1) {
+ [0]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7 : bool uppercase data --
+string(6) "uppert"
+array(1) {
+ [0]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8 : empty double quotes data --
+string(6) "emptyd"
+array(0) {
+}
+
+-- Iteration 9 : empty single quotes data --
+string(6) "emptys"
+array(0) {
+}
+
+-- Iteration 10 : string data --
+string(7) "stringd"
+array(2) {
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11 : undefined data --
+string(9) "undefined"
+array(0) {
+}
+
+-- Iteration 12 : unset data --
+string(5) "unset"
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation4.phpt b/ext/standard/tests/array/array_shift_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test popping elements from a sub-array and popping an array from an array
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+$stack_first = array(array(1, 2, 3), 'one', 'two');
+$stack_last = array ('zero', 'one', array (1, 2, 3));
+echo "\n-- Before shift: --\n";
+echo "---- \$stack_first:\n";
+var_dump($stack_first);
+echo "---- \$stack_last:\n";
+var_dump($stack_last);
+
+echo "\n-- After shift: --\n";
+echo "---- Pop array from array:\n";
+echo "Returned value:\t";
+var_dump(array_shift($stack_first));
+echo "New array:\n";
+var_dump($stack_first);
+
+echo "---- Pop element from array within array:\n";
+echo "Returned value:\t";
+var_dump(array_shift($stack_last[2]));
+echo "New array:\n";
+var_dump($stack_last);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Before shift: --
+---- $stack_first:
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+---- $stack_last:
+array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- After shift: --
+---- Pop array from array:
+Returned value: array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+New array:
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+---- Pop element from array within array:
+Returned value: int(1)
+New array:
+array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation5.phpt b/ext/standard/tests/array/array_shift_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Use the result of one call to array_shift
+ * as the $stack argument of another call to array_shift()
+ * When done in one statement causes strict error messages.
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+$stack = array ( array ( array ('zero', 'one', 'two'), 'un', 'deux'), 'eins', 'zwei');
+
+// not following strict standards
+echo "\n-- Incorrect Method: --\n";
+var_dump(array_shift(array_shift(array_shift($stack))));
+
+$stack = array (array( array('zero', 'one', 'two'), 'un', 'deux'), 'eins', 'zwei');
+// correct way of doing above:
+echo "\n-- Correct Method: --\n";
+$result1 = array_shift($stack);
+$result2 = array_shift($result1);
+var_dump(array_shift($result2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Incorrect Method: --
+
+Strict Standards: Only variables should be passed by reference in %s on line %d
+
+Strict Standards: Only variables should be passed by reference in %s on line %d
+string(4) "zero"
+
+-- Correct Method: --
+string(4) "zero"
+Done
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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_shift when passed:
+ * 1. a variable that is referenced to an array
+ * 2. an array that contains a referenced array
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+echo "\n-- Variable is referenced array --\n";
+$original_array = array('zero', 'one', 'two');
+$copied_array = &$original_array;
+
+echo "Result: ";
+var_dump(array_shift($copied_array));
+echo "\n\$original_array:\n";
+var_dump($original_array);
+echo "\n\$copied_array:\n";
+var_dump($copied_array);
+
+echo "\n-- Element is referenced array --\n";
+$new_array = array (&$copied_array, 1, 'two');
+echo "Result: ";
+var_dump(array_shift($new_array[0]));
+echo "\n\$new_array:\n";
+var_dump($new_array);
+echo "\n\$copied_array\n";
+var_dump($copied_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Variable is referenced array --
+Result: string(4) "zero"
+
+$original_array:
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+
+$copied_array:
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+
+-- Element is referenced array --
+Result: string(3) "one"
+
+$new_array:
+array(3) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ string(3) "two"
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+}
+
+$copied_array
+array(1) {
+ [0]=>
+ string(3) "two"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation7.phpt b/ext/standard/tests/array/array_shift_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test that the internal pointer is reset after calling array_shift()
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+$stack = array ('one' => 'un', 'two' => 'deux');
+
+echo "\n-- Call array_shift() --\n";
+var_dump($result = array_shift($stack));
+
+echo "\n-- Position of Internal Pointer in Passed Array: --\n";
+echo key($stack) . " => " . current ($stack) . "\n";
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Call array_shift() --
+string(2) "un"
+
+-- Position of Internal Pointer in Passed Array: --
+two => deux
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation8.phpt b/ext/standard/tests/array/array_shift_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * From a comment left by Traps on 09-Jul-2007 on the array_shift documentation page:
+ * For those that may be trying to use array_shift() with an array containing references
+ * (e.g. working with linked node trees), beware that array_shift() may not work as you expect:
+ * it will return a *copy* of the first element of the array,
+ * and not the element itself, so your reference will be lost.
+ * The solution is to reference the first element before removing it with array_shift():
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+// using only array_shift:
+echo "\n-- Reference result of array_shift: --\n";
+$a = 1;
+$array = array(&$a);
+$b =& array_shift($array);
+$b = 2;
+echo "a = $a, b = $b\n";
+
+// solution: referencing the first element first:
+echo "\n-- Reference first element before array_shift: --\n";
+$a = 1;
+$array = array(&$a);
+$b =& $array[0];
+array_shift($array);
+$b = 2;
+echo "a = $a, b = $b\n";
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Reference result of array_shift: --
+
+Strict Standards: Only variables should be assigned by reference in %s on line %d
+a = 1, b = 2
+
+-- Reference first element before array_shift: --
+a = 2, b = 2
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shuffle_basic.phpt b/ext/standard/tests/array/array_shuffle_basic.phpt
new file mode 100644
index 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--
+<?php
+/*
+* proto bool shuffle ( array &$array )
+* Function is implemented in ext/standard/array.c
+*/
+$numbers = range(1, 20);
+echo "*** testing array_shuffle \n";
+$a = array();
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(1);
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(2 => 1);
+var_dump(shuffle($a));
+var_dump($a);
+$a = array("a" => 1);
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(array(1, 2, 3));
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(1, 1, 1, 1);
+var_dump(shuffle($a));
+var_dump($a);
+$arr1 = array(5 => 1, 6 => 2, 7 => 3, 8 => 9);
+$arr2 = array(5 => 1, 6 => 2, 7 => 3, 8 => 9);
+shuffle($arr1);
+echo "this should be 0->...." . count(array_diff($arr1, $arr2)) . "\n";
+echo "this should be 4->...." . count(array_intersect($arr1, $arr2)) . "\n";
+$bigarray = range(1, 400);
+shuffle($bigarray);
+echo "this should be 400->...." . count($bigarray) . "\n";
+echo "*** testing pass by reference \n";
+$original = $bigarray;
+shuffle($bigarray);
+$diffarray = array_diff_assoc($original, $bigarray);
+if (count($diffarray) < 350) {
+ // with 400 entries, the probability that 50 entries or more get the same
+ // key-> value association should be so close to zero it wont happen in the lifetime of the
+ // universe.
+ echo "shuffled array seems to be similar to original\n";
+ var_dump($original);
+ var_dump($bigarray);
+} else {
+ echo "test passed \n";
+}
+?>
+--EXPECT--
+*** testing array_shuffle
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+}
+this should be 0->....0
+this should be 4->....4
+this should be 400->....400
+*** testing pass by reference
+test passed \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice.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--
+<?php
+
+$var_array = array(
+ array(),
+ array(1,2,3,4,5,6,7,8,9),
+ array("One", "Two", "Three", "Four", "Five"),
+ array(6, "six", 7, "seven", 8, "eight", 9, "nine"),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee"),
+ array("1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"),
+ array(1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five"),
+ array("f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five"),
+ 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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_slice()
+ */
+
+echo "*** Testing array_slice() : basic functionality ***\n";
+
+
+$input = array('one' => 1, 'two' => 2, 3, 23 => 4);
+$offset = 2;
+$length = 2;
+$preserve_keys = true;
+
+// Calling array_slice() with all possible arguments
+echo "\n-- All arguments --\n";
+var_dump( array_slice($input, $offset, $length, $preserve_keys) );
+
+// Calling array_slice() with mandatory arguments
+echo "\n-- Mandatory arguments --\n";
+var_dump( array_slice($input, $offset) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : basic functionality ***
+
+-- All arguments --
+array(2) {
+ [0]=>
+ int(3)
+ [23]=>
+ int(4)
+}
+
+-- Mandatory arguments --
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_error.phpt b/ext/standard/tests/array/array_slice_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : error conditions ***\n";
+
+//Test array_slice with one more than the expected number of arguments
+echo "\n-- Testing array_slice() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$offset = 10;
+$length = 10;
+$preserve_keys = true;
+$extra_arg = 10;
+var_dump( array_slice($input, $offset, $length, $preserve_keys, $extra_arg) );
+
+// Testing array_slice with one less than the expected number of arguments
+echo "\n-- Testing array_slice() function with less than expected no. of arguments --\n";
+var_dump( array_slice($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_slice() : error conditions ***
+
+-- Testing array_slice() function with more than expected no. of arguments --
+
+Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+
+-- Testing array_slice() function with less than expected no. of arguments --
+
+Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt
new file mode 100644
index 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--
+<?php
+
+var_dump(array_slice(range(1, 3), 0, NULL, 1));
+var_dump(array_slice(range(1, 3), 0, 0, 1));
+var_dump(array_slice(range(1, 3), 0, NULL));
+var_dump(array_slice(range(1, 3), 0, 0));
+
+var_dump(array_slice(range(1, 3), -1, 0));
+var_dump(array_slice(range(1, 3), -1, 0, 1));
+var_dump(array_slice(range(1, 3), -1, NULL));
+var_dump(array_slice(range(1, 3), -1, NULL, 1));
+
+
+$a = 'foo';
+var_dump(array_slice(range(1, 3), 0, $a));
+var_dump(array_slice(range(1, 3), 0, $a));
+var_dump($a);
+
+?>
+
+--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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check position of internal array pointer after calling array_slice()
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 23 => 'twenty-three', 'zero');
+
+echo "\n-- Call array_slice() --\n";
+var_dump($result = array_slice($input, 2));
+
+echo "-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Call array_slice() --
+array(2) {
+ [0]=>
+ string(12) "twenty-three"
+ [1]=>
+ string(4) "zero"
+}
+-- Position of Internal Pointer in Result: --
+0 => twenty-three
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different arguments as $input argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$offset = 2;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input, $offset) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(0) {
+}
+
+-- Iteration 19 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_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--
+<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $offset argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$input_array = array('one' => 1, 2, 'three' => 3, 4);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $offset argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input_array, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 2 --
+array(3) {
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 3 --
+array(0) {
+}
+
+-- Iteration 4 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 5 --
+array(0) {
+}
+
+-- Iteration 6 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 7 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 8 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 9 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 10 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 11 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 12 --
+array(3) {
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 13 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 14 --
+array(3) {
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 15 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 16 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_slice() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 23 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation3.phpt b/ext/standard/tests/array/array_slice_variation3.phpt
new file mode 100644
index 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--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $length argument to array_slice to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$input_array = array('one' => 1, 2, 'three' => 3, 4);
+$offset = 2;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $length argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_slice
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input_array, $offset, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+array(0) {
+}
+
+-- Iteration 2 --
+array(1) {
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 3 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 4 --
+array(0) {
+}
+
+-- Iteration 5 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 6 --
+array(0) {
+}
+
+-- Iteration 7 --
+array(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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $preserve_keys argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$input_array = array('one' => 1, 2, 99 => 3, 4);
+$offset = 0;
+$length = 3;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $preserve_keys argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input_array, $offset, $length, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 2 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 3 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 4 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 5 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 6 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 7 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 11 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 12 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 13 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 14 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 15 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 16 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 17 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 18 --
+
+Warning: array_slice() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 20 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 21 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 22 --
+
+Warning: array_slice() expects parameter 4 to be boolean, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 24 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation5.phpt b/ext/standard/tests/array/array_slice_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different integers as $offset argument to test how array_slice() behaves
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
+
+for ($i = -7; $i <= 7; $i++) {
+ echo "\n-- \$offset is $i --\n";
+ var_dump(array_slice($input, $i));
+}
+echo "\n-- \$offset is maximum integer value --\n";
+var_dump(array_slice($input, PHP_INT_MAX));
+
+echo "\n-- \$offset is minimum integer value --\n";
+var_dump(array_slice($input, -PHP_INT_MAX));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- $offset is -7 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -6 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -5 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -4 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -3 --
+array(3) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -2 --
+array(2) {
+ [0]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -1 --
+array(1) {
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 0 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 1 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 2 --
+array(3) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 3 --
+array(2) {
+ [0]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 4 --
+array(1) {
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 5 --
+array(0) {
+}
+
+-- $offset is 6 --
+array(0) {
+}
+
+-- $offset is 7 --
+array(0) {
+}
+
+-- $offset is maximum integer value --
+array(0) {
+}
+
+-- $offset is minimum integer value --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation6.phpt b/ext/standard/tests/array/array_slice_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different integer values as $length argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
+$offset = 1;
+
+for ($i = -6; $i <= 6; $i++) {
+ echo "\n-- \$length is $i --\n";
+ var_dump(array_slice($input, $offset, $i));
+}
+echo "\n-- \$length is maximum integer value --\n";
+var_dump(array_slice($input, $offset, PHP_INT_MAX));
+
+echo "\n-- \$length is minimum integer value --\n";
+var_dump(array_slice($input, $offset, -PHP_INT_MAX));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- $length is -6 --
+array(0) {
+}
+
+-- $length is -5 --
+array(0) {
+}
+
+-- $length is -4 --
+array(0) {
+}
+
+-- $length is -3 --
+array(1) {
+ [0]=>
+ string(3) "two"
+}
+
+-- $length is -2 --
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+}
+
+-- $length is -1 --
+array(3) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+}
+
+-- $length is 0 --
+array(0) {
+}
+
+-- $length is 1 --
+array(1) {
+ [0]=>
+ string(3) "two"
+}
+
+-- $length is 2 --
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+}
+
+-- $length is 3 --
+array(3) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+}
+
+-- $length is 4 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is 5 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is 6 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is maximum integer value --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is minimum integer value --
+array(0) {
+}
+Done
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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as keys in an array to array_slice()
+ * to test how $preserve_keys treats them
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$offset = 0;
+$length = 10; // to ensure all elements are displayed
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays of different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $type => $input) {
+ echo "\n-- Iteration $iterator : key type is $type --\n";
+ echo "\$preserve_keys = TRUE\n";
+ var_dump( array_slice($input, $offset, $length, true) );
+ echo "\$preserve_keys = FALSE\n";
+ var_dump( array_slice($input, $offset, $length, false) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 : key type is int --
+$preserve_keys = TRUE
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [-2345]=>
+ string(8) "negative"
+}
+$preserve_keys = FALSE
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 : key type is float --
+$preserve_keys = TRUE
+array(3) {
+ [10]=>
+ string(8) "positive"
+ [-10]=>
+ string(8) "negative"
+ [0]=>
+ string(4) "half"
+}
+$preserve_keys = FALSE
+array(3) {
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+}
+
+-- Iteration 3 : key type is extreme floats --
+$preserve_keys = TRUE
+array(2) {
+ [12345678]=>
+ string(5) "large"
+ [0]=>
+ string(5) "small"
+}
+$preserve_keys = FALSE
+array(2) {
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+}
+
+-- Iteration 4 : key type is null uppercase --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5 : key type is null lowercase --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6 : key type is bool lowercase --
+$preserve_keys = TRUE
+array(2) {
+ [1]=>
+ string(6) "lowert"
+ [0]=>
+ string(6) "lowerf"
+}
+$preserve_keys = FALSE
+array(2) {
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7 : key type is bool uppercase --
+$preserve_keys = TRUE
+array(2) {
+ [1]=>
+ string(6) "uppert"
+ [0]=>
+ string(6) "upperf"
+}
+$preserve_keys = FALSE
+array(2) {
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8 : key type is empty double quotes --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9 : key type is empty single quotes --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10 : key type is string --
+$preserve_keys = TRUE
+array(3) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+$preserve_keys = FALSE
+array(3) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11 : key type is undefined --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12 : key type is unset --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation8.phpt b/ext/standard/tests/array/array_slice_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_slice when passed
+ * 1. a two-dimensional array as $input argument
+ * 2. a sub-array as $input argument
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('zero', 'one', array('zero', 'un', 'deux'), 9 => 'nine');
+
+echo "\n-- Slice a two-dimensional array --\n";
+var_dump(array_slice($input, 1, 3));
+
+echo "\n-- \$input is a sub-array --\n";
+var_dump(array_slice($input[2], 1, 2));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Slice a two-dimensional array --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(2) "un"
+ [2]=>
+ string(4) "deux"
+ }
+ [2]=>
+ string(4) "nine"
+}
+
+-- $input is a sub-array --
+array(2) {
+ [0]=>
+ string(2) "un"
+ [1]=>
+ string(4) "deux"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation9.phpt b/ext/standard/tests/array/array_slice_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_slice() when:
+ * 1. Passed an array of referenced variables
+ * 2. $input argument is passed by reference
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$val1 = 'one';
+$val2 = 'two';
+$val3 = 'three';
+
+echo "\n-- Array of referenced variables (\$preserve_keys = default) --\n";
+$input = array(3 => &$val1, 2 => &$val2, 1 => &$val3);
+var_dump(array_slice($input, 1, 2));
+
+echo "-- Change \$val2 (\$preserve_keys = TRUE) --\n";
+$val2 = 'hello, world';
+var_dump(array_slice($input, 1, 2, true));
+
+echo "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--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "*** Testing array_splice() basic operations ***\n";
+echo "test truncation \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 2));
+var_dump ($input);
+// $input is now array("red", "green")
+
+echo "test removing entries from the middle \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 1, -1));
+var_dump ($input);
+// $input is now array("red", "yellow")
+
+echo "test substitution at end \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 1, count($input), "orange"));
+var_dump ($input);
+// $input is now array("red", "orange")
+
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, -1, 1, array("black", "maroon")));
+var_dump ($input);
+// $input is now array("red", "green",
+// "blue", "black", "maroon")
+
+echo "test insertion \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 3, 0, "purple"));
+var_dump ($input);
+// $input is now array("red", "green",
+// "blue", "purple", "yellow");
+
+
+?>
+--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--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing error conditions of array_splice() ***\n";
+
+$int=1;
+$array=array(1,2);
+var_dump (array_splice());
+var_dump (array_splice($int));
+var_dump (array_splice($array));
+var_dump (array_splice($int,$int));
+$obj= new stdclass;
+var_dump (array_splice($obj,0,1));
+echo "Done\n";
+
+?>
+--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--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+
+echo "test behaviour when input array is in a reference set\n";
+
+$input_array=array (array(1,2));
+$input_array[]=&$input_array[0];
+var_dump (array_splice ($input_array[0],1,1));
+var_dump ($input_array);
+
+echo "Test behaviour of input arrays containing references \n";
+/*
+ * There are three regions to test:, before cut, the cut and after the cut.
+ * For reach we check a plain value, a reference value with integer key and a
+ * reference value with a string key.
+ */
+$numbers=array(0,1,2,3,4,5,6,7,8,9,10,11,12);
+$input_array=array(0,1,&$numbers[2],"three"=>&$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--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+$array=array(0,1,2);
+var_dump (array_splice($array,1,1,3,4,5,6,7,8,9));
+var_dump ($array);
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "*** array_splice() function : usage variations - lengths and offsets\n";
+
+
+function test_splice ($offset, $length)
+{
+ echo " - No replacement\n";
+ $input_array=array(0,1,2,3,4,5);
+ var_dump (array_splice ($input_array,$offset,$length));
+ var_dump ($input_array);
+ echo " - With replacement\n";
+ $input_array=array(0,1,2,3,4,5);
+ var_dump (array_splice ($input_array,$offset,$length,array ("A","B","C")));
+ var_dump ($input_array);
+}
+
+echo "absolute offset - absolute length - cut from beginning\n";
+test_splice (0,2);
+echo "absolute offset - absolute length - cut from middle\n";
+test_splice (2,2);
+echo "absolute offset - absolute length - cut from end\n";
+test_splice (4,2);
+echo "absolute offset - absolute length - attempt to cut past end\n";
+test_splice (4,4);
+echo "absolute offset - absolute length - cut everything\n";
+test_splice (0,7);
+echo "absolute offset - absolute length - cut nothing\n";
+test_splice (3,0);
+
+echo "absolute offset - relative length - cut from beginning\n";
+test_splice (0,-4);
+
+echo "absolute offset - relative length - cut from middle\n";
+test_splice (2,-2);
+
+echo "absolute offset - relative length - attempt to cut form before beginning \n";
+test_splice (0,-7);
+
+echo "absolute offset - relative length - cut nothing\n";
+test_splice (2,-7);
+
+echo "relative offset - absolute length - cut from beginning\n";
+test_splice (-6,2);
+
+echo "relative offset - absolute length - cut from middle\n";
+test_splice (-4,2);
+echo "relative offset - absolute length - cut from end\n";
+test_splice (-2,2);
+echo "relative offset - absolute length - attempt to cut past end\n";
+test_splice (-2,4);
+echo "relative offset - absolute length - cut everything\n";
+test_splice (-6,6);
+echo "relative offset - absolute length - cut nothing\n";
+test_splice (-6,0);
+
+echo "relative offset - relative length - cut from beginning\n";
+test_splice (-6,-4);
+
+echo "relative offset - relative length - cut from middle\n";
+test_splice (-4,-2);
+
+echo "relative offset - relative length - cut nothing\n";
+test_splice (-4,-7);
+echo "Done\n";
+?>
+
+--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--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+function test_splice ($replacement)
+{
+ $input_array=array(0,1);
+ var_dump (array_splice ($input_array,2,0,$replacement));
+ var_dump ($input_array);
+}
+
+test_splice (2);
+
+test_splice (2.1);
+
+test_splice (true);
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+test_splice ($file_handle);
+echo "Done\n";
+?>
+--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--
+<?php
+$i = 0;
+while ($i++ < 1000) {
+ $a[] = $i;
+ $b[] = (string)$i;
+}
+$s1 = array_sum($a);
+$s2 = array_sum($b);
+var_dump($s1, $s2);
+
+$j = 0;
+while ($j++ < 100000) {
+ $c[] = $j;
+ $d[] = (string) $j;
+}
+$s3 = array_sum($c);
+$s4 = array_sum($d);
+var_dump($s3, $s4);
+?>
+--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--
+<?php
+/* Prototype : mixed array_sum(array &input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_sum() : basic functionality ***\n";
+
+// array with integer values
+$input = array(1, 2, 3, 4, 5);
+echo "-- array_sum() with integer array entries --\n";
+var_dump( array_sum($input) );
+
+// array with float values
+$input = array(1.0, 2.2, 3.4, 4.6);
+echo "-- array_sum() with float array entries --\n";
+var_dump( array_sum($input) );
+
+// array with integer and float values
+$input = array(1, 2.3, 4, 0.6, 10);
+echo "-- array_sum() with integer/float array entries --\n";
+var_dump( array_sum($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : basic functionality ***
+-- array_sum() with integer array entries --
+int(15)
+-- array_sum() with float array entries --
+float(11.2)
+-- array_sum() with integer/float array entries --
+float(17.9)
+Done
diff --git a/ext/standard/tests/array/array_sum_error.phpt b/ext/standard/tests/array/array_sum_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_sum(array &input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_sum() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing array_sum() function with zero arguments --\n";
+var_dump( array_sum() );
+
+// One more than the expected number of arguments
+echo "-- Testing array_sum() function with more than expected no. of arguments --\n";
+$input = array(1, 2, 3, 4);
+$extra_arg = 10;
+var_dump( array_sum($input, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : error conditions ***
+-- Testing array_sum() function with zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different scalar/nonscalar values as 'input' argument to array_sum()
+*/
+
+echo "*** Testing array_sum() : unexpected values for 'input' ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// Class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+// different scalar/non scalar values for 'input' argument
+$input_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new MyClass(),
+
+ // resource data
+/*21*/ $fp = fopen(__FILE__,'r'),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of the array for input
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_sum($input_values[$count]) );
+};
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : unexpected values for 'input' ***
+-- Iteration 1 --
+
+Warning: array_sum() 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--
+<?php
+/* Prototype : mixed array_sum(array &input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with different types of integer arrays containing data of following type:
+* integer, octal, hexadecimal, maximum and minimum integer values & mixed of all integers
+*/
+
+echo "*** Testing array_sum() : different integer array ***\n";
+
+// Int array
+$int_values = array(3, 2, 100, 150, 25, 350, 0, -3, -1200);
+echo "-- Sum of Integer array --\n";
+var_dump( array_sum($int_values) );
+
+// Octal array
+$octal_values = array(056, 023, 090, 015, -045, 01, -078);
+echo "-- Sum of Octal array --\n";
+var_dump( array_sum($octal_values) );
+
+// Hexadecimal array
+$hex_values = array(0xAE, 0x2B, 0X10, -0xCF, 0X12, -0XF2);
+echo "-- Sum of Hex array --\n";
+var_dump( array_sum($hex_values) );
+
+// Mixed values int, octal & hex
+$mixed_int_value = array(2, 5, -1, 054, 0X3E, 0, -014, -0x2A);
+echo "-- Sum of mixed integer values --\n";
+var_dump( array_sum($mixed_int_value) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : different integer array ***
+-- Sum of Integer array --
+int(-573)
+-- Sum of Octal array --
+int(35)
+-- Sum of Hex array --
+int(-198)
+-- Sum of mixed integer values --
+int(58)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation3.phpt b/ext/standard/tests/array/array_sum_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * sum of array containing different float values
+*/
+
+echo "*** Testing array_sum() : array with different float values ***\n";
+
+// Simple float array
+$float_input = array( 1.1, 2.3, 0.0, 0.5, -2.3, -0.8, .5);
+echo "-- simple float array --\n";
+var_dump( array_sum($float_input) );
+
+// float array with scientific notations
+$float_input = array( 1.2e2, 23.4e3, -4.1e2, 0.2e2, 2.1e-2, .5e3);
+echo "-- float array with scientific notations e and E --\n";
+var_dump( array_sum($float_input) );
+$float_input = array( 1.2E2, 23.4E3, -4.1E2, 0.2E2, 2.1E-2, .5E3);
+var_dump( array_sum($float_input) );
+
+// Mixed float array
+$float_input = array(
+ 1.2,
+ 0.5
+ -5.8,
+ 6.334,
+ -0.65,
+ 1.2e3,
+ -2.3e2,
+ 5.56E3,
+ -3.82E-2
+);
+echo "-- Mixed float array --\n";
+var_dump( array_sum($float_input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with different float values ***
+-- simple float array --
+float(1.3)
+-- float array with scientific notations e and E --
+float(23630.021)
+float(23630.021)
+-- Mixed float array --
+float(6531.5458)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation4.phpt b/ext/standard/tests/array/array_sum_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Checking array_sum() with integer and float array containing duplicate values
+*/
+
+echo "*** Testing array_sum() : array with duplicate values ***\n";
+
+// integer array with duplicate values
+$int_input = array( 2, 5, 7, 5, 0, -4, 2, 100);
+echo "-- With integer array --\n";
+var_dump( array_sum($int_input) );
+
+// float array with duplicate values
+$float_input = array( 2.3, 1.9, -4.1, 0.5, 1.9, -4.1, 3.6, 0.5);
+echo "-- With float array --\n";
+var_dump( array_sum($float_input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with duplicate values ***
+-- With integer array --
+int(117)
+-- With float array --
+float(2.5)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation5.phpt b/ext/standard/tests/array/array_sum_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with 'input' having reference variables as elements
+*/
+
+echo "*** Testing array_sum() : array with elements as reference ***\n";
+
+$value1 = -5;
+$value2 = 100;
+$value3 = 0;
+$value4 = &$value1;
+
+// input array containing elements as reference variables
+$input = array(
+ 0 => 10,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => 200,
+ 4 => &$value3,
+);
+
+var_dump( array_sum($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with elements as reference ***
+int(305)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation6.phpt b/ext/standard/tests/array/array_sum_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with associative array as 'input' argument
+*/
+
+echo "*** Testing array_sum() : with associative array ***\n";
+
+// array with numeric keys
+$input = array(0 => 1, 1 => 10, 2 => 0, 3 => -2, 4 => 23.56);
+echo "-- with numeric keys --\n";
+var_dump( array_sum($input) );
+
+// array with string keys
+$input = array('a' => 20, "b" => 50, 'c' => 0, 'd' => -30, "e" => 100);
+echo "-- with string keys --\n";
+var_dump( array_sum($input) );
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : with associative array ***
+-- with numeric keys --
+float(32.56)
+-- with string keys --
+int(140)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation7.phpt b/ext/standard/tests/array/array_sum_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with array having other than numeric entries
+* strings, bool, null, subarrays & objects
+*/
+
+echo "*** Testing array_sum() : array with unexpected entries ***\n";
+
+// empty array
+$input = array();
+echo "-- empty array --\n";
+var_dump( array_sum($input) );
+
+// string array
+$input = array('Apple', 'Banana', 'Carrot', 'Mango', 'Orange');
+echo "-- array with string values --\n";
+var_dump( array_sum($input) );
+
+// bool array
+$input = array( true, true, false, true, false);
+echo "-- array with bool values --\n";
+var_dump( array_sum($input) );
+
+// array with null entry
+$input = array(null, NULL);
+echo "-- array with null values --\n";
+var_dump( array_sum($input) );
+
+// array with subarray
+$input = array(
+ array(1, 2),
+ array(),
+ array(0)
+);
+echo "-- array with subarrays --\n";
+var_dump( array_sum($input) );
+
+class MyClass
+{
+ public $value;
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+}
+// array of objects
+$input = array(
+ new MyClass(2),
+ new MyClass(5),
+ new MyClass(10),
+ new MyClass(0)
+);
+echo "-- array with object values --\n";
+var_dump( array_sum($input) );
+
+// Mixed values
+$input = array( 5, -8, 7.2, -1.2, "10", "apple", 'Mango', true, false, null, NULL, array( array(1,2), array(0), array()));
+echo "-- array with mixed values --\n";
+var_dump( array_sum($input) );
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with unexpected entries ***
+-- empty array --
+int(0)
+-- array with string values --
+int(0)
+-- array with bool values --
+int(3)
+-- array with null values --
+int(0)
+-- array with subarrays --
+int(0)
+-- array with object values --
+int(0)
+-- array with mixed values --
+float(14)
+Done
diff --git a/ext/standard/tests/array/array_udiff_assoc_basic.phpt b/ext/standard/tests/array/array_udiff_assoc_basic.phpt
new file mode 100644
index 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--
+<?php
+/*
+* proto array array_udiff_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(3) {
+ ["0.1"]=>
+ object(cr)#%d (1) {
+ ["priv_member":"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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : error conditions ***\n";
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+$extra_arg = 10;
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+
+//Test array_udiff_assoc with one more than the expected number of arguments
+echo "\n-- Testing array_udiff_assoc() function with more than expected no. of arguments --\n";
+var_dump( array_udiff_assoc($arr1, $arr2, $key_comp_func, $extra_arg) );
+
+// Testing array_udiff_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_udiff_assoc() function with less than expected no. of arguments --\n";
+var_dump( array_udiff_assoc($arr1, $arr2) );
+
+?>
+===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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : variation - testing with multiple array arguments ***\n";
+
+include('compare_function.inc');
+$key_compare_function = 'compare_function';
+
+// Initialise all required variables
+$arr1 = array("one" => "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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing array_udiff_assoc() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_udiff_assoc($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_udiff_assoc($arr1, $arr2, 'too_few_parameters'));
+
+
+?>
+===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--
+<?php
+/*
+* proto array array_udiff ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_udiff($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(2) {
+ ["0.5"]=>
+ object(cr)#%d (1) {
+ ["priv_member":"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--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : error conditions ***\n";
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$extra_arg = 10;
+
+
+//Test array_udiff with one more than the expected number of arguments
+echo "\n-- Testing array_udiff() function with more than expected no. of arguments --\n";
+var_dump( array_udiff($arr1, $arr2, $data_comp_func, $extra_arg) );
+
+// Testing array_udiff with one less than the expected number of arguments
+echo "\n-- Testing array_udiff() function with less than expected no. of arguments --\n";
+var_dump( array_udiff($arr1, $arr2) );
+
+?>
+===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--
+<?php
+/*
+* proto array array_udiff_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+ static function comp_func_key($a, $b) {
+ if ($a === $b) return 0;
+ return ($a > $b) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
+var_dump($result);
+?>
+--EXPECTF--
+array(3) {
+ ["0.1"]=>
+ object(cr)#%d (1) {
+ ["priv_member":"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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : error conditions ***\n";
+
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+$extra_arg = 10;
+
+//Test array_udiff_uassoc with one more than the expected number of arguments
+echo "\n-- Testing array_udiff_uassoc() function with more than expected no. of arguments --\n";
+var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func, $key_comp_func, $extra_arg) );
+
+// Testing array_udiff_uassoc with one less than the expected number of arguments
+echo "\n-- Testing array_udiff_uassoc() function with less than expected no. of arguments --\n";
+var_dump( array_udiff_uassoc($arr1, $arr2, $data_comp_func) );
+
+?>
+===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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+$key_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
+ * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff_uassoc() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_udiff_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_udiff_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
+
+?>
+===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--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_comp_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_udiff() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1);
+$arr2 = array(1);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_udiff($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 0;
+}
+var_dump(array_udiff($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 0;
+}
+var_dump(array_udiff($arr1, $arr2, 'too_few_parameters'));
+
+?>
+===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--
+<?php
+/*
+* proto array array_uintersect_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_uintersect_assoc($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(2) {
+ [1]=>
+ object(cr)#%d (1) {
+ ["priv_member":"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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : basic functionality - testing with multiple array arguments ***\n";
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+// Initialise all required variables
+$arr1 = array("one" => "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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : error conditions ***\n";
+
+//Test array_uintersect_assoc with one more than the expected number of arguments
+echo "\n-- Testing array_uintersect_assoc() function with more than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+$extra_arg = 10;
+var_dump( array_uintersect_assoc($arr1, $arr2, $data_compare_function, $extra_arg) );
+
+// Testing array_uintersect_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_uintersect_assoc() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+var_dump( array_uintersect_assoc($arr1, $arr2) );
+
+?>
+===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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: U
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_assoc() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect_assoc($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect_assoc($arr1, $arr2, 'too_few_parameters'));
+
+?>
+
+===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--
+<?php
+/*
+* proto array array_uintersect ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_uintersect($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(3) {
+ ["0.1"]=>
+ object(cr)#%d (1) {
+ ["priv_member":"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--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : error conditions ***\n";
+
+
+//Test array_uintersect with one more than the expected number of arguments
+echo "\n-- Testing array_uintersect() function with more than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+$extra_arg = 10;
+var_dump( array_uintersect($arr1, $arr2, $data_compare_function, $extra_arg) );
+
+// Testing array_uintersect with one less than the expected number of arguments
+echo "\n-- Testing array_uintersect() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+var_dump( array_uintersect($arr1, $arr2) );
+
+?>
+===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--
+<?php
+/*
+* proto array array_uintersect_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+ static function comp_func_key($a, $b) {
+ if ($a === $b) return 0;
+ return ($a > $b) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
+var_dump($result);
+?>
+--EXPECTF--
+array(2) {
+ [1]=>
+ object(cr)#%d (1) {
+ ["priv_member":"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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : error conditions ***\n";
+
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+$extra_arg = 10;
+
+
+//Test array_uintersect_uassoc with one more than the expected number of arguments
+echo "\n-- Testing array_uintersect_uassoc() function with more than expected no. of arguments --\n";
+var_dump( array_uintersect_uassoc($arr1, $arr2, $data_compare_func, $key_compare_func, $extra_arg) );
+
+// Testing array_uintersect_uassoc with one less than the expected number of arguments
+echo "\n-- Testing array_uintersect_uassoc() function with less than expected no. of arguments --\n";
+var_dump( array_uintersect_uassoc($arr1, $arr2, $data_compare_func) );
+
+?>
+===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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_func = 'compare_function';
+$key_compare_func = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
+
+?>
+===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--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$arr1 = array(1, 2);
+$arr2 = array(1, 2);
+
+include('compare_function.inc');
+$data_compare_function = 'compare_function';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
+ * Description: 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.
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_uintersect() : usage variation - differing comparison functions***\n";
+
+$arr1 = array(1);
+$arr2 = array(1,2);
+
+echo "\n-- comparison function with an incorrect return value --\n";
+function incorrect_return_value ($val1, $val2) {
+ return array(1);
+}
+var_dump(array_uintersect($arr1, $arr2, 'incorrect_return_value'));
+
+echo "\n-- comparison function taking too many parameters --\n";
+function too_many_parameters ($val1, $val2, $val3) {
+ return 1;
+}
+var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters'));
+
+echo "\n-- comparison function taking too few parameters --\n";
+function too_few_parameters ($val1) {
+ return 1;
+}
+var_dump(array_uintersect($arr1, $arr2, 'too_few_parameters'));
+
+?>
+
+===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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_unique() : basic functionality ***\n";
+
+// array with default keys
+$input = array(1, 2, "1", '2');
+var_dump( array_unique($input) );
+
+// associative array
+$input = array("1" => "one", 1 => "one", 2 => "two", '2' => "two");
+var_dump( array_unique($input) );
+
+// mixed array
+$input = array("1" => "one", "two", "one", 2 => "two", "three");
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : basic functionality ***
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(5) "three"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_error.phpt b/ext/standard/tests/array/array_unique_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_unique() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_unique() function with zero arguments --\n";
+var_dump( array_unique() );
+
+//Test array_unique with one more than the expected number of arguments
+echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing non array values to 'input' argument of array_unique() and see
+ * that the function outputs proper warning messages wherever expected.
+*/
+
+echo "*** Testing array_unique() : Passing non array values to \$input argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs and check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : Passing non array values to $input argument ***
+-- Iteration 1 --
+
+Warning: array_unique() 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different arrays to $input argument and testing whether
+* array_unique() behaves in an expected way.
+*/
+
+echo "*** Testing array_unique() : Passing different arrays to \$input argument ***\n";
+
+/* Different heredoc strings passed as argument to arrays */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// arrays passed to $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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing different
+ * associative arrays having different keys to $input argument.
+*/
+
+echo "*** Testing array_unique() : assoc. array with diff. keys passed to \$input argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different associative arrays to be passed to $input argument
+$inputs = array (
+/*1*/ // arrays with integer keys
+ array(0 => "0", 1 => "0"),
+ array(1 => "1", 2 => "2", 3 => 1, 4 => "4"),
+
+ // arrays with float keys
+/*3*/ array(2.3333 => "float", 44.44 => "float"),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f1", 3333333.333333 => "f4"),
+
+ // arrays with string keys
+/*5*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 111),
+ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 111),
+ array("hello", $heredoc => "string", "string"),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : assoc. array with diff. keys passed to $input argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 2 --
+array(3) {
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [4]=>
+ string(1) "4"
+}
+-- Iteration 3 --
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+-- Iteration 4 --
+array(3) {
+ [1]=>
+ string(2) "f1"
+ [3]=>
+ string(2) "f2"
+ [3333333]=>
+ string(2) "f4"
+}
+-- Iteration 5 --
+array(3) {
+ ["\tHello"]=>
+ int(111)
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+}
+-- Iteration 6 --
+array(3) {
+ [" Hello"]=>
+ int(111)
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iteration 8 --
+array(2) {
+ [""]=>
+ string(5) "hello"
+ [0]=>
+ int(11)
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation4.phpt b/ext/standard/tests/array/array_unique_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing different
+ * associative arrays having different values to $input argument.
+*/
+
+echo "*** Testing array_unique() : assoc. array with diff. values to \$input argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// associative arrays with different values
+$inputs = array (
+ // arrays with integer values
+/*1*/ array('0' => 0, '1' => 0),
+ array("one" => 1, 'two' => 2, "three" => 1, 4 => 1),
+
+ // arrays with float values
+/*3*/ array("float1" => 2.3333, "float2" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2),
+
+ // arrays with string values
+/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'),
+ array(1 => "hello", "heredoc" => $heredoc, $heredoc),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp, new classA(), $fp),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : assoc. array with diff. values to $input argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 2 --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+-- Iteration 3 --
+array(1) {
+ ["float1"]=>
+ float(2.3333)
+}
+-- Iteration 4 --
+array(3) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+}
+-- Iteration 5 --
+array(3) {
+ [111]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+}
+-- Iteration 6 --
+array(3) {
+ [111]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+}
+-- Iteration 7 --
+array(2) {
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 8 --
+array(3) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation5.phpt b/ext/standard/tests/array/array_unique_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing
+ * array having duplicate keys as values.
+*/
+
+echo "*** Testing array_unique() : array with duplicate keys for \$input argument ***\n";
+
+// initialize the array having duplicate keys
+$input = array( 1 => "one", 2 => "two", 2 => "2", 3 => "three", 1 => "1", "1", "2");
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : array with duplicate keys for $input argument ***
+array(3) {
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(5) "three"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation6.phpt b/ext/standard/tests/array/array_unique_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing
+ * array having reference variables as values.
+*/
+
+echo "*** Testing array_unique() : array with reference variables for \$input argument ***\n";
+
+$value1 = 10;
+$value2 = "hello";
+$value3 = 0;
+$value4 = &$value2;
+
+// input array containing elements as reference variables
+$input = array(
+ 0 => 0,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => "hello",
+ 4 => &$value3,
+ 5 => $value4
+);
+
+var_dump( array_unique($input, 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing an array having binary values.
+*/
+
+echo "*** Testing array_unique() : array with binary data for \$input argument ***\n";
+
+// array with binary values
+$input = array( b"1", b"hello", "world", "str1" => "hello", "str2" => "world");
+
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : array with binary data for $input argument ***
+array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing
+ * two dimensional arrays for $input argument.
+*/
+
+echo "*** Testing array_unique() : two dimensional array for \$input argument ***\n";
+
+// initialize the 2-d array
+$input = array(
+ array(1, 2, 3, 1),
+ array("hello", "world", "str1" => "hello", "str2" => 'world'),
+ array(1 => "one", 2 => "two", "one", 'two'),
+ array(1, 2, 3, 1)
+);
+
+var_dump( array_unique($input, 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--
+<?php
+
+$a = array();
+$s = "";
+var_dump(array_unshift($a, $s));
+var_dump($a);
+var_dump(array_unshift($s, $a));
+var_dump($a);
+var_dump(array_unshift($a, $a));
+var_dump($a);
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_unshift() by giving array with default keys for $array argument
+*/
+
+echo "*** Testing array_unshift() : basic functionality with default key array ***\n";
+
+// Initialise the array
+$array = array(1, 2);
+
+// 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 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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_unshift() by giving associative arrays for $array argument
+*/
+
+echo "*** Testing array_unshift() : basic functionality with associative array ***\n";
+
+// Initialise the array
+$array = array('f' => "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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_unshift() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_unshift() function with Zero arguments --\n";
+var_dump( array_unshift() );
+
+// Testing array_unshift with one less than the expected number of arguments
+echo "\n-- Testing array_unshift() function with less than expected no. of arguments --\n";
+$array = array(1, 2);
+var_dump( array_unshift($array) );
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing
+ * an object to the $var argument
+*/
+
+echo "*** Testing array_unshift() : Passing object to \$var argument ***\n";
+
+// simple class with a variable and method
+class SimpleClass
+{
+ public $var1 = 1;
+ public function fun1() {
+ return $var1;
+ }
+}
+
+// class without members
+class EmptyClass
+{
+}
+
+// abstract class
+abstract class AbstractClass
+{
+ protected $var2 = 5;
+ abstract function emptyFunction();
+}
+
+// class deriving the above abstract class
+class ChildClass extends AbstractClass
+{
+ private $var3;
+ public function emptyFunction() {
+ echo "defined in child";
+ }
+}
+
+// class with final method
+class FinalClass
+{
+ private $var4;
+ final function finalMethod() {
+ echo "This function can't be overloaded";
+ }
+}
+
+// class with static members
+class StaticClass
+{
+ static $var5 = 2;
+ public static function staticMethod() {
+ echo "This is a static method";
+ }
+}
+
+// array to be passed to $array argument
+$array = array('f' => "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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the behavior of array_unshift() by giving values
+ * other than array values for $array argument
+*/
+
+echo "*** Testing array_unshift() : unexpected values for \$array argument ***\n";
+
+// Initialise $var argument
+$var = 12;
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// array of unexpected values to be passed to $array argument
+$arrays = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $arrays to test the functionality of array_unshift()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "\n-- Iteration $iterator --";
+
+ /* with default 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) );
+
+ // 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() : 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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_unshift() by giving all the possible values for $var argument
+*/
+
+echo "*** Testing array_unshift() : all possible values for \$var argument ***\n";
+
+// array to be passed to $array argument
+$array = array('f' => "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 = <<<EOT
+hello world
+EOT;
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// different types of values to be passed to $var argument
+$vars = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*26*/ new classA(),
+
+ // undefined data
+ @$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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the behavior of array_unshift() by passing different types of arrays
+ * to $array argument to which the $var arguments will be prepended
+*/
+
+echo "*** Testing array_unshift() : different arrays for \$array argument ***\n";
+
+// initialize $var argument
+$var = 10;
+
+// different arrays to be passed to $array 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( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+/*8*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through the various elements of $arrays to test array_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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * associative arrays having different possible keys to $array argument.
+ * The $var argument passed is a fixed value
+*/
+
+echo "*** Testing array_unshift() : associative array with different keys ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing $var argument
+$var = 10;
+
+// different variations of associative arrays to be passed to $array argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+ 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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * associative arrays having different possible values to $array argument.
+ * The $var argument passed is a fixed value
+*/
+
+echo "*** Testing array_unshift() : associative array with different values ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing $var argument
+$var = 10;
+
+// different variations of associative arrays to be passed to $array argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by giving two-dimensional
+ * arrays and also sub-arrays within the two-dimensional array for $array argument.
+ * The $var argument passed is a fixed value
+*/
+
+echo "*** Testing array_unshift() : two dimensional arrays for \$array argument ***\n";
+
+// initializing $var argument
+$var = 10;
+
+// two-dimensional array to be passed to $array argument
+$two_dimensional_array = array(
+
+ // associative array
+ array('color' => '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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * double quoted strings for $var argument that is prepended to the array
+ * passed through $array argument
+*/
+
+echo "*** Testing array_unshift() : double quoted strings for \$var argument ***\n";
+
+// array to be passed to $array argument
+$array = array('f' => "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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * single quoted strings for $var argument that is prepended to the array
+ * passed through $array argument
+*/
+
+echo "*** Testing array_unshift() : single quoted strings for \$var argument ***\n";
+
+// array to be passed to $array argument
+$array = array('f' => "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--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * heredoc strings for $var argument that is prepended to the array
+ * passed through $array argument
+*/
+
+echo "*** Testing array_unshift() : heredoc strings for \$var argument ***\n";
+
+// heredoc with empty value
+$empty_string = <<<EOT
+EOT;
+
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+This's a string with quotes:
+"strings in double quote";
+'strings in single quote';
+this\line is single quoted /with\slashes
+EOT;
+
+// array to be passed to $array argument
+$array = array('f' => "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--
+<?php
+$arr = array("A" => 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
--- /dev/null
+++ b/ext/standard/tests/array/array_values.phpt
Binary files 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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_values()
+ */
+
+echo "*** Testing array_values() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$input = array('zero', 'one', 'two', 'three' => 3, 10 => 'ten');
+
+// Calling array_values() with all possible arguments
+var_dump( array_values($input) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : basic functionality ***
+array(5) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(3)
+ [4]=>
+ string(3) "ten"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_values to test behaviour
+ */
+
+echo "*** Testing array_values() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_values() function with Zero arguments --\n";
+var_dump( array_values() );
+
+//Test array_values with one more than the expected number of arguments
+echo "\n-- Testing array_values() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_values($input, $extra_arg) );
+
+echo "Done";
+?>
+
+--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--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+/* Invalid number of args */
+var_dump( array_values() ); // Zero arguments
+var_dump( array_values(array(1,2,3), "") ); // No. of args > 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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing array_values() with resource type ***\n";
+$resource1 = fopen(__FILE__, "r"); // Creating a file resource
+$resource2 = opendir("."); // Creating a dir resource
+
+/* creating an array with resources as elements */
+$arr_resource = array( "a" => $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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $input argument to array_values() to test behaviour
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_values()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_values($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_values() 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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of different data types as $input argument to array_values() to test behaviour
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// arrays of different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_values()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_values($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+}
+
+-- Iteration 2: float data --
+array(5) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+}
+
+-- Iteration 3: null data --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+-- Iteration 4: bool data --
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+
+-- Iteration 5: empty string data --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+
+-- Iteration 6: empty array data --
+array(0) {
+}
+
+-- Iteration 7: string data --
+array(3) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(11) "hello world"
+}
+
+-- Iteration 8: object data --
+array(1) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9: undefined data --
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 10: unset data --
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 11: resource data --
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation3.phpt b/ext/standard/tests/array/array_values_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where the keys are different data types as $input argument
+ * to array_values() to test behaviour
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_values()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_values($input) );
+ $iterator++;
+};
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+}
+
+-- Iteration 2: float data --
+array(3) {
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+}
+
+-- Iteration 3: extreme floats data --
+array(2) {
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+}
+
+-- Iteration 4: null uppercase data --
+array(1) {
+ [0]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5: null lowercase data --
+array(1) {
+ [0]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6: bool lowercase data --
+array(2) {
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7: bool uppercase data --
+array(2) {
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8: empty double quotes data --
+array(1) {
+ [0]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9: empty single quotes data --
+array(1) {
+ [0]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10: string data --
+array(3) {
+ [0]=>
+ string(7) "stringd"
+ [1]=>
+ string(7) "strings"
+ [2]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11: undefined data --
+array(1) {
+ [0]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12: unset data --
+array(1) {
+ [0]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation4.phpt b/ext/standard/tests/array/array_values_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_values when:
+ * 1. Passed a two-dimensional array as $input argument
+ * 2. Passed a sub-array as $input argument
+ * 3. Passed an infinitely recursive multi-dimensional array
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+$input = array ('zero' => 'zero', 'un' => 'one', 'sub' => array (1, 2, 3));
+
+echo "\n-- Array values of a two-dimensional array --\n";
+var_dump(array_values($input));
+
+echo "\n-- Array values of a sub-array --\n";
+var_dump(array_values($input['sub']));
+
+// get an infinitely recursive array
+$input[] = &$input;
+echo "\n-- Array values of an infinitely recursive array --\n";
+var_dump(array_values($input));
+
+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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test the position of the internal array pointer after a call to array_values
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
+
+echo "\n-- Call array_values() --\n";
+var_dump($result = array_values($input));
+
+echo "-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Call array_values() --
+array(3) {
+ [0]=>
+ string(2) "un"
+ [1]=>
+ string(4) "deux"
+ [2]=>
+ string(5) "trois"
+}
+-- Position of Internal Pointer in Result: --
+0 => un
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation6.phpt b/ext/standard/tests/array/array_values_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_values() when:
+ * 1. Passed an array made up of referenced variables
+ * 2. Passed an array by reference
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+$val1 = 'one';
+$val2 = 'two';
+$val3 = 'three';
+
+echo "\n-- \$input is an array made up of referenced variables: --\n";
+$input = array(&$val1, &$val2, &$val3);
+var_dump($result1 = array_values($input));
+
+echo "Change \$val2 and check result of array_values():\n";
+$val2 = 'deux';
+var_dump($result1);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- $input is an array made up of referenced variables: --
+array(3) {
+ [0]=>
+ &string(3) "one"
+ [1]=>
+ &string(3) "two"
+ [2]=>
+ &string(5) "three"
+}
+Change $val2 and check result of array_values():
+array(3) {
+ [0]=>
+ &string(3) "one"
+ [1]=>
+ &string(4) "deux"
+ [2]=>
+ &string(5) "three"
+}
+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--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check that array_values is re-assigning keys according to the internal order of the array,
+ * and is not dependant on the \$input argument's keys
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+// populate array with 'default' keys in reverse order
+$input = array(3 => 'three', 2 => 'two', 1 => 'one', 0 => 'zero');
+
+echo "\n-- \$input argument: --\n";
+var_dump($input);
+
+echo "\n-- Result of array_values() --\n";
+var_dump(array_values($input));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- $input argument: --
+array(4) {
+ [3]=>
+ string(5) "three"
+ [2]=>
+ string(3) "two"
+ [1]=>
+ string(3) "one"
+ [0]=>
+ string(4) "zero"
+}
+
+-- Result of array_values() --
+array(4) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ string(4) "zero"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing array_values() with resource type ***\n";
+$resource1 = fopen(__FILE__, "r"); // Creating a file resource
+$resource2 = opendir("."); // Creating a dir resource
+
+/* creating an array with resources as elements */
+$arr_resource = array( "a" => $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--
+<?php
+
+var_dump(array_walk());
+$var = 1;
+var_dump(array_walk($var,1));
+$var = array();
+var_dump(array_walk($var,""));
+
+function foo($v1, $v2, $v3) {
+ var_dump($v1);
+ var_dump($v2);
+ var_dump($v3);
+}
+
+$var = array(1,2);
+var_dump(array_walk($var, "foo", "data"));
+
+function foo2($v1, $v2, $v3) {
+ throw new Exception($v3);
+}
+
+try {
+ var_dump(array_walk($var,"foo2", "data"));
+} catch (Exception $e) {
+ var_dump($e->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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk() : basic functionality ***\n";
+
+// regular array
+$fruits = array("lemon", "orange", "banana", "apple");
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - item in key/item pair
+ * key - key in key/item pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+function with_userdata($item, $key, $user_data)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($user_data); // user supplied data
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk() with default parameters to show array contents --\n";
+var_dump( array_walk($fruits, 'test_print'));
+
+echo "-- Using array_walk() with all parameters --\n";
+var_dump( array_walk($fruits, 'with_userdata', "Added"));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk() : basic functionality ***
+-- Using array_walk() with default parameters to show array contents --
+string(5) "lemon"
+int(0)
+
+string(6) "orange"
+int(1)
+
+string(6) "banana"
+int(2)
+
+string(5) "apple"
+int(3)
+
+bool(true)
+-- Using array_walk() with all parameters --
+string(5) "lemon"
+int(0)
+string(5) "Added"
+
+string(6) "orange"
+int(1)
+string(5) "Added"
+
+string(6) "banana"
+int(2)
+string(5) "Added"
+
+string(5) "apple"
+int(3)
+string(5) "Added"
+
+bool(true)
+Done
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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk() : basic functionality ***\n";
+
+// associative array
+$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
+
+// User defined callback functions
+/* Prototype : test_alter(mixed $item, mixed $key, string $prefix)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * prefix - string to be added
+ * Description : alters the array values by appending prefix string
+ */
+function test_alter(&$item, $key, $prefix)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($prefix); // additional agument passed to callback function
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk with default parameters to show array contents --\n";
+var_dump(array_walk($fruits, 'test_print'));
+
+echo "-- Using array_walk with one optional parameter to modify contents --\n";
+var_dump (array_walk($fruits, 'test_alter', 'fruit'));
+
+echo "-- Using array_walk with default parameters to show modified array contents --\n";
+var_dump (array_walk($fruits, 'test_print'));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk() : basic functionality ***
+-- Using array_walk with default parameters to show array contents --
+string(5) "lemon"
+string(1) "d"
+
+string(6) "orange"
+string(1) "a"
+
+string(6) "banana"
+string(1) "b"
+
+string(5) "apple"
+string(1) "c"
+
+bool(true)
+-- Using array_walk with one optional parameter to modify contents --
+string(5) "lemon"
+string(1) "d"
+string(5) "fruit"
+
+string(6) "orange"
+string(1) "a"
+string(5) "fruit"
+
+string(6) "banana"
+string(1) "b"
+string(5) "fruit"
+
+string(5) "apple"
+string(1) "c"
+string(5) "fruit"
+
+bool(true)
+-- Using array_walk with default parameters to show modified array contents --
+string(5) "lemon"
+string(1) "d"
+
+string(6) "orange"
+string(1) "a"
+
+string(6) "banana"
+string(1) "b"
+
+string(5) "apple"
+string(1) "c"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_error1.phpt b/ext/standard/tests/array/array_walk_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+$input = array(1, 2);
+
+/* Prototype : callback(mixed value, mixed key, mixed user_data)
+ * Parameters : value - value in key/value pair
+ * key - key in key/value pair
+ * user_data - extra parameter
+ */
+function callback ($value, $key, $user_data) {
+ echo "\ncallback() invoked \n";
+}
+
+echo "*** Testing array_walk() : error conditions ***\n";
+
+echo "-- Testing array_walk() function with zero arguments --\n";
+var_dump( array_walk() );
+
+echo "-- Testing array_walk() function with one argument --\n";
+var_dump( array_walk($input) );
+
+echo "-- Testing array_walk() function with non existent callback function --\n";
+var_dump( array_walk($input, "non_existent") );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk() : error conditions ***
+-- Testing array_walk() function with zero arguments --
+
+Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+-- Testing array_walk() function with one argument --
+
+Warning: array_walk() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+-- Testing array_walk() function with non existent callback function --
+
+Warning: array_walk() 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() by passing more number of parameters to callback function
+ */
+$input = array(1);
+
+function callback1($value, $key, $user_data ) {
+ echo "\ncallback1() invoked \n";
+}
+
+function callback2($value, $key, $user_data1, $user_data2) {
+ echo "\ncallback2() invoked \n";
+}
+echo "*** Testing array_walk() : error conditions - callback parameters ***\n";
+
+// expected: Missing argument Warning
+var_dump( array_walk($input, "callback1") );
+var_dump( array_walk($input, "callback2", 4) );
+
+// expected: Warning is supressed
+var_dump( @array_walk($input, "callback1") );
+var_dump( @array_walk($input, "callback2", 4) );
+
+echo "-- Testing array_walk() function with too many callback parameters --\n";
+var_dump( array_walk($input, "callback1", 20, 10) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk() : error conditions - callback parameters ***
+
+Warning: Missing argument 3 for callback1() in %s on line %d
+
+callback1() invoked
+bool(true)
+
+Warning: Missing argument 4 for callback2() in %s on line %d
+
+callback2() invoked
+bool(true)
+
+callback1() invoked
+bool(true)
+
+callback2() invoked
+bool(true)
+-- Testing array_walk() function with too many callback parameters --
+
+Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Pasing object in place of 'input' argument to test object functionatlity
+*/
+
+echo "*** Testing array_walk() : object functionality ***\n";
+
+/*
+ * Prototype : callback(mixed $value, mixed $key, int $addvalue
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * $addvalue - value to be added
+ * Description : Function adds the addvalue to each element of an array
+*/
+
+function callback($value, $key, $user_data)
+{
+ var_dump($key);
+ var_dump($value);
+ var_dump($user_data);
+ echo "\n";
+}
+
+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;
+ }
+};
+
+// 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_walk() with an array of objects
+*/
+
+echo "*** Testing array_walk() : array of objects ***\n";
+
+/*
+ * Prototype : callback(mixed $value, mixed $key, int $addvalue
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * $addvalue - value to be added
+ * Description : Function adds the addvalue to each element of an array
+*/
+function callback_private($value, $key, $addValue)
+{
+ echo "value : ";
+ var_dump($value->getValue());
+ echo "key : ";
+ var_dump($key);
+}
+
+function callback_public($value, $key)
+{
+ echo "value : ";
+ var_dump($value->pub_value);
+}
+function callback_protected($value, $key)
+{
+ echo "value : ";
+ var_dump($value->get_pro_value());
+}
+
+class MyClass
+{
+ private $pri_value;
+ public $pub_value;
+ protected $pro_value;
+ public function __construct($setVal)
+ {
+ $this->pri_value = $setVal;
+ $this->pub_value = $setVal;
+ $this->pro_value = $setVal;
+ }
+ public function getValue()
+ {
+ return $this->pri_value;
+ }
+ public function get_pro_value()
+ {
+ return $this->pro_value;
+ }
+};
+
+// array containing objects of MyClass
+$input = array (
+ new MyClass(3),
+ new MyClass(10),
+ new MyClass(20),
+ new MyClass(-10)
+);
+
+echo "-- For private member --\n";
+var_dump( array_walk($input, "callback_private", 1));
+echo "-- For public member --\n";
+var_dump( array_walk($input, "callback_public"));
+echo "-- For protected member --\n";
+var_dump( array_walk($input, "callback_protected"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : array of objects ***
+-- For private member --
+value : int(3)
+key : int(0)
+value : int(10)
+key : int(1)
+value : int(20)
+key : int(2)
+value : int(-10)
+key : int(3)
+bool(true)
+-- For public member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+-- For protected member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_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--
+<?php
+
+function walk($key, $value) {
+ var_dump($value, $key);
+}
+
+class test {
+ private $var_pri = "test_private";
+ protected $var_pro = "test_protected";
+ public $var_pub = "test_public";
+}
+
+$stdclass = new stdclass;
+$stdclass->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--
+<?php
+
+function walk($key, $value) {
+ var_dump($value, $key);
+}
+
+class test {
+ private $var_pri = "test_private";
+ protected $var_pro = "test_protected";
+ public $var_pub = "test_public";
+}
+
+$stdclass = new stdclass;
+$stdclass->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--
+<?php
+function foo($value) {
+ echo $value . " foo\n";
+}
+
+function bar($value) {
+ echo $value . " bar\n";
+}
+
+$arr = array (1,2,3);
+var_dump (array_walk_recursive ($arr, 'foo'));
+var_dump (array_walk_recursive ($arr, 'bar'));
+
+?>
+--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--
+<?php
+
+var_dump(array_walk_recursive());
+$var = 1;
+var_dump(array_walk_recursive($var,1));
+$var = array();
+var_dump(array_walk_recursive($var,""));
+
+function foo($v1, $v2, $v3) {
+ var_dump($v1);
+ var_dump($v2);
+ var_dump($v3);
+}
+
+$var = array(1,2, array(2,3));
+var_dump(array_walk_recursive($var, "foo", "data"));
+
+function foo2($v1, $v2, $v3) {
+ throw new Exception($v3);
+}
+
+try {
+ var_dump(array_walk_recursive($var,"foo2", "data"));
+} catch (Exception $e) {
+ var_dump($e->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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk_recursive() : basic functionality ***\n";
+
+// regular array
+$fruits = array("lemon", array("orange", "banana"), array("apple"));
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - item in key/item pair
+ * key - key in key/item pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+function with_userdata($item, $key, $user_data)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($user_data); // user supplied data
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk_recursive() with default parameters to show array contents --\n";
+var_dump( array_walk_recursive($fruits, 'test_print'));
+
+echo "-- Using array_walk_recursive() with all parameters --\n";
+var_dump( array_walk_recursive($fruits, 'with_userdata', "Added"));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk_recursive() : basic functionality ***
+-- Using array_walk_recursive() with default parameters to show array contents --
+string(5) "lemon"
+int(0)
+
+string(6) "orange"
+int(0)
+
+string(6) "banana"
+int(1)
+
+string(5) "apple"
+int(0)
+
+bool(true)
+-- Using array_walk_recursive() with all parameters --
+string(5) "lemon"
+int(0)
+string(5) "Added"
+
+string(6) "orange"
+int(0)
+string(5) "Added"
+
+string(6) "banana"
+int(1)
+string(5) "Added"
+
+string(5) "apple"
+int(0)
+string(5) "Added"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_basic2.phpt b/ext/standard/tests/array/array_walk_recursive_basic2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk_recursive() : basic functionality ***\n";
+
+// associative array
+$fruits = array("a" => "lemon", "b" => array( "c" => "orange", "d" => "banana"), "e" => array("f" => "apple"));
+
+// User defined callback functions
+/* Prototype : test_alter(mixed $item, mixed $key, string $prefix)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * prefix - string to be added
+ * Description : alters the array values by appending prefix string
+ */
+function test_alter(&$item, $key, $prefix)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($prefix); // additional agument passed to callback function
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk_recursive with default parameters to show array contents --\n";
+var_dump(array_walk_recursive($fruits, 'test_print'));
+
+echo "-- Using array_walk_recursive with one optional parameter to modify contents --\n";
+var_dump (array_walk_recursive($fruits, 'test_alter', 'fruit'));
+
+echo "-- Using array_walk_recursive with default parameters to show modified array contents --\n";
+var_dump (array_walk_recursive($fruits, 'test_print'));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk_recursive() : basic functionality ***
+-- Using array_walk_recursive with default parameters to show array contents --
+string(5) "lemon"
+string(1) "a"
+
+string(6) "orange"
+string(1) "c"
+
+string(6) "banana"
+string(1) "d"
+
+string(5) "apple"
+string(1) "f"
+
+bool(true)
+-- Using array_walk_recursive with one optional parameter to modify contents --
+string(5) "lemon"
+string(1) "a"
+string(5) "fruit"
+
+string(6) "orange"
+string(1) "c"
+string(5) "fruit"
+
+string(6) "banana"
+string(1) "d"
+string(5) "fruit"
+
+string(5) "apple"
+string(1) "f"
+string(5) "fruit"
+
+bool(true)
+-- Using array_walk_recursive with default parameters to show modified array contents --
+string(5) "lemon"
+string(1) "a"
+
+string(6) "orange"
+string(1) "c"
+
+string(6) "banana"
+string(1) "d"
+
+string(5) "apple"
+string(1) "f"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_error1.phpt b/ext/standard/tests/array/array_walk_recursive_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+$input = array(1, 2);
+
+/* Prototype : callback(mixed value, mixed key, mixed user_data)
+ * Parameters : value - value in key/value pair
+ * key - key in key/value pair
+ * user_data - extra parameter
+ */
+function callback ($value, $key, $user_data) {
+ echo "\ncallback() invoked \n";
+}
+
+echo "*** Testing array_walk_recursive() : error conditions ***\n";
+
+echo "-- Testing array_walk_recursive() function with zero arguments --\n";
+var_dump( array_walk_recursive() );
+
+echo "-- Testing array_walk_recursive() function with one argument --\n";
+var_dump( array_walk_recursive($input) );
+
+$input = array( array(1, 2), array(3), array(4, 5));
+echo "-- Testing array_walk_recursive() function with non existent callback function --\n";
+var_dump( array_walk_recursive($input, "non_existent") );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : error conditions ***
+-- Testing array_walk_recursive() function with zero arguments --
+
+Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+-- Testing array_walk_recursive() function with one argument --
+
+Warning: array_walk_recursive() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+-- Testing array_walk_recursive() function with non existent callback function --
+
+Warning: array_walk_recursive() 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() by passing more number of parameters to callback function
+ */
+$input = array(1);
+
+function callback1($value, $key, $user_data ) {
+ echo "\ncallback1() invoked \n";
+}
+
+function callback2($value, $key, $user_data1, $user_data2) {
+ echo "\ncallback2() invoked \n";
+}
+echo "*** Testing array_walk_recursive() : error conditions - callback parameters ***\n";
+
+// expected: Missing argument Warning
+var_dump( array_walk_recursive($input, "callback1") );
+var_dump( array_walk_recursive($input, "callback2", 4) );
+
+// expected: Warning is supressed
+var_dump( @array_walk_recursive($input, "callback1") );
+var_dump( @array_walk_recursive($input, "callback2", 4) );
+
+echo "-- Testing array_walk_recursive() function with too many callback parameters --\n";
+var_dump( array_walk_recursive($input, "callback1", 20, 10) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : error conditions - callback parameters ***
+
+Warning: Missing argument 3 for callback1() in %s on line %d
+
+callback1() invoked
+bool(true)
+
+Warning: Missing argument 4 for callback2() in %s on line %d
+
+callback2() invoked
+bool(true)
+
+callback1() invoked
+bool(true)
+
+callback2() invoked
+bool(true)
+-- Testing array_walk_recursive() function with too many callback parameters --
+
+Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/* Passing object in place of an 'input' argument to test object functionality
+ */
+echo "*** Testing array_walk_recursive() : object functionality ***\n";
+
+/*
+ * Prototype : callback(mixed $value, mixed $key, int $addvalue
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * $addvalue - value to be added
+ * Description : Function adds the addvalue to each element of an array
+*/
+
+function callback($value, $key, $user_data)
+{
+ var_dump($key);
+ var_dump($value);
+ var_dump($user_data);
+ echo "\n";
+}
+
+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;
+ }
+};
+
+// 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_walk_recursive() with an array of objects
+*/
+
+echo "*** Testing array_walk_recursive() : array of objects ***\n";
+
+/*
+ * Prototype : callback(mixed $value, mixed $key, int $addvalue
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * $addvalue - value to be added
+ * Description : Function adds the addvalue to each element of an array
+*/
+function callback_private($value, $key, $addValue)
+{
+ echo "value : ";
+ var_dump($value->getValue());
+ echo "key : ";
+ var_dump($key);
+}
+
+function callback_public($value, $key)
+{
+ echo "value : ";
+ var_dump($value->pub_value);
+}
+function callback_protected($value, $key)
+{
+ echo "value : ";
+ var_dump($value->get_pro_value());
+}
+
+class MyClass
+{
+ private $pri_value;
+ public $pub_value;
+ protected $pro_value;
+ public function __construct($setVal)
+ {
+ $this->pri_value = $setVal;
+ $this->pub_value = $setVal;
+ $this->pro_value = $setVal;
+ }
+ public function getValue()
+ {
+ return $this->pri_value;
+ }
+ public function get_pro_value()
+ {
+ return $this->pro_value;
+ }
+};
+
+// array containing objects of MyClass
+$input = array (
+ array(
+ new MyClass(3),
+ new MyClass(10),
+ ),
+ new MyClass(20),
+ array(new MyClass(-10))
+);
+
+echo "-- For private member --\n";
+var_dump( array_walk_recursive($input, "callback_private", 1));
+echo "-- For public member --\n";
+var_dump( array_walk_recursive($input, "callback_public"));
+echo "-- For protected member --\n";
+var_dump( array_walk_recursive($input, "callback_protected"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : array of objects ***
+-- For private member --
+value : int(3)
+key : int(0)
+value : int(10)
+key : int(1)
+value : int(20)
+key : int(1)
+value : int(-10)
+key : int(0)
+bool(true)
+-- For public member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+-- For protected member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation1.phpt b/ext/standard/tests/array/array_walk_recursive_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'input' argument
+*/
+
+echo "*** Testing array_walk_recursive() : unexpected values for 'input' argument ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values given in input array
+ * $key - keys given in input array
+ * Description : Function prints each element of an array with key
+ */
+function callback($value, $key)
+{
+ echo "key : ";
+ var_dump($key);
+ echo "value : ";
+ var_dump($value);
+}
+
+// extra parameter passed to array_walk_recursive()
+$user_data = 10;
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get resource variable
+$fp = fopen(__FILE__, 'r');
+
+// different scalar/nonscalar values to be used in place of an 'input' argument
+$input_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/* 10*/ NULL,
+ null,
+
+ // boolean data
+/* 12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 16*/ "",
+ '',
+
+ // string data
+/* 18*/ "string",
+ 'string',
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/* 22*/ @$unset_var,
+);
+
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk_recursive($input_values[$count], "callback") );
+ var_dump( array_walk_recursive($input_values[$count], "callback", $user_data) );
+}
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : unexpected values for 'input' argument ***
+-- Iteration 1 --
+
+Warning: array_walk_recursive() 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'funcname' argument
+*/
+
+echo "*** Testing array_walk_recursive() : unexpected values for 'funcname' argument ***\n";
+
+$input = array(1, array(2, 3));
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+$user_data = 20;
+
+// class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+// different scalar/nonscalar values to be used in place of callback function
+$funcname_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+/* 10*/ array(),
+ array(0),
+ array(1),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/* 14*/ NULL,
+ null,
+
+ // boolean data
+/* 16*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 20*/ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // resource data
+/* 23*/ $fp = 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() with following types of 'input' arrays:
+ * integer, float, string, bool, null, empty & mixed
+*/
+
+// callback function
+/*
+ * Prototype : print_value(mixed $value, int $key, int $count)
+ * Parameters : $value - array entries(values)
+ * $key - keys in given input array
+ * $count - extra parameter used as an index
+ * Description : prints the array values with keys and count value
+ */
+function print_value($value, $key, $count)
+{
+ echo $count." : ".$key." ".$value."\n";
+}
+
+echo "*** Testing array_walk_recursive() : 'input' array with different values***\n";
+
+// different arrays as input
+$input_values = array(
+
+ // integer values
+/*1*/ array(array(1, 0, -10), array(023, -041), array(0x5A, 0X1F, -0x6E)),
+
+ // float value
+ array(array(3.4, 0.8, -2.9), array(6.25e2, 8.20E-3)),
+
+ // string values
+ array('Mango', array("Apple", 'Orange', "Lemon")),
+
+ // bool values
+/*4*/ array( array(true, false), array(TRUE, FALSE)),
+
+ // null values
+ array( array(null), array(NULL)),
+
+ // empty array
+ array(),
+
+ // binary array
+ array(array(b'binary')),
+
+ // mixed array
+/*8*/ array(16, 8.345, array("Fruits"), array(true, null), array(FALSE), array(-98, 0.005, 'banana'))
+);
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk_recursive($input_values[$count], "print_value", $count+1));
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : 'input' array with different values***
+
+-- Iteration 1 --
+1 : 0 1
+1 : 1 0
+1 : 2 -10
+1 : 0 19
+1 : 1 -33
+1 : 0 90
+1 : 1 31
+1 : 2 -110
+bool(true)
+
+-- Iteration 2 --
+2 : 0 3.4
+2 : 1 0.8
+2 : 2 -2.9
+2 : 0 625
+2 : 1 0.0082
+bool(true)
+
+-- Iteration 3 --
+3 : 0 Mango
+3 : 0 Apple
+3 : 1 Orange
+3 : 2 Lemon
+bool(true)
+
+-- Iteration 4 --
+4 : 0 1
+4 : 1
+4 : 0 1
+4 : 1
+bool(true)
+
+-- Iteration 5 --
+5 : 0
+5 : 0
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+7 : 0 binary
+bool(true)
+
+-- Iteration 8 --
+8 : 0 16
+8 : 1 8.345
+8 : 0 Fruits
+8 : 0 1
+8 : 1
+8 : 0
+8 : 0 -98
+8 : 1 0.005
+8 : 2 banana
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation4.phpt b/ext/standard/tests/array/array_walk_recursive_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() with an array having subarrays as elements
+*/
+
+echo "*** Testing array_walk_recursive() : array with subarray ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values in given 'input' array
+ * $key - keys in given 'input' array
+ * Description : It prints the count of an array elements, passed as argument
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+$input = array(
+ array(),
+ array(1),
+ array(1,2,3),
+ array("Mango", "Orange"),
+ array(array(1, 2, 3), array(1))
+);
+
+var_dump( array_walk_recursive( $input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : array with subarray ***
+int(0)
+int(1)
+
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+int(2)
+int(3)
+
+int(0)
+string(5) "Mango"
+
+int(1)
+string(6) "Orange"
+
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+int(2)
+int(3)
+
+int(0)
+int(1)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation5.phpt b/ext/standard/tests/array/array_walk_recursive_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() with an array having reference variables
+*/
+
+echo "*** Testing array_walk_recursive() : array with references ***\n";
+
+$value1 = 10;
+$value2 = -20;
+$value3 = &$value1;
+$value4 = 50;
+
+// 'input' array containing references to above variables
+$input = array(&$value1, array(&$value2, -35), array(&$value3, 0), array(&$value4));
+
+// callback function
+/* Prototype : callback(int $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : function checks for the value whether positive or negative and displays according to that
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+var_dump( array_walk_recursive($input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : array with references ***
+int(0)
+int(10)
+
+int(0)
+int(-20)
+
+int(1)
+int(-35)
+
+int(0)
+int(10)
+
+int(1)
+int(0)
+
+int(0)
+int(50)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation6.phpt b/ext/standard/tests/array/array_walk_recursive_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing 'input' argument as an associative array
+ * with Numeric & string keys
+*/
+
+echo "*** Testing array_walk_recursive() : 'input' as an associative array ***\n";
+
+// callback functions
+/* Prototype : for_numeric( int $value, int $key, int $user_data)
+ * Parameters : $value - value from key/value pair of the array
+ * $key - key from key/value pair of the array
+ * $user_data - data to be added to 'value'
+ * Description : Function adds values with keys & user_data
+ */
+function for_numeric($value, $key, $user_data)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ var_dump($user_data);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_string( string $value, string $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function appends key to the value
+ */
+function for_string($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_mixed( mixed $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function displays each element of an array with keys
+ */
+function for_mixed($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+// Numeric keys
+$input = array( 0 => array(1 => 25, 5 => 12, 0 => -80), 1 => array(-2 => 100, 5 => 30));
+echo "-- Associative array with numeric keys --\n";
+var_dump( array_walk_recursive($input, "for_numeric", 10));
+
+// String keys
+$input = array( "a" => "Apple", 'z' => array('b' => 'Bananna', "c" => "carrot"), 'x' => array('o' => "Orange"));
+echo "-- Associative array with string keys --\n";
+var_dump( array_walk_recursive($input, "for_string"));
+
+// binary 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--
+<?php
+/* Prototype : proto bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing anonymous(run-time) callback function with following variations:
+* with one parameter
+* two parameters
+* three parameters
+* extra parameters
+* without parameters
+*/
+
+echo "*** Testing array_walk_recursive() : anonymous function as callback ***\n";
+
+$input = array( array(2, 5), array(10, 0));
+
+echo "-- Anonymous function with one argument --\n";
+var_dump( array_walk_recursive($input, create_function('$value', 'var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with two arguments --\n";
+var_dump( array_walk_recursive($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with three arguments --\n";
+var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10));
+
+echo "-- Anonymous function with one more argument --\n";
+var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30));
+
+echo "-- Anonymous function with null argument --\n";
+var_dump( array_walk_recursive( $input, create_function(null, 'echo "1\n";')));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : anonymous function as callback ***
+-- Anonymous function with one argument --
+int(2)
+
+int(5)
+
+int(10)
+
+int(0)
+
+bool(true)
+-- Anonymous function with two arguments --
+int(0)
+int(2)
+
+int(1)
+int(5)
+
+int(0)
+int(10)
+
+int(1)
+int(0)
+
+bool(true)
+-- Anonymous function with three arguments --
+int(0)
+int(2)
+int(10)
+
+int(1)
+int(5)
+int(10)
+
+int(0)
+int(10)
+int(10)
+
+int(1)
+int(0)
+int(10)
+
+bool(true)
+-- Anonymous function with one more argument --
+
+Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+-- Anonymous function with null argument --
+1
+1
+1
+1
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different buit-in functionns as callback function
+ * pow function
+ * min function
+ * echo language construct
+*/
+
+echo "*** Testing array_walk_recursive() : built-in function as callback ***\n";
+
+$input = array(array(2 => 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--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different types of callback functions to array_walk_recursive()
+ * without parameters
+ * with less and more parameters
+*/
+
+echo "*** Testing array_walk_recursive() : callback function variation ***\n";
+
+$input = array(array('Apple', 'Banana'), 'Mango', array('Orange'));
+
+echo "-- callback function with both parameters --\n";
+function callback_two_parameter($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk_recursive($input, 'callback_two_parameter'));
+
+echo "-- callback function with only one parameter --\n";
+function callback_one_parameter($value)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk_recursive($input, 'callback_one_parameter'));
+
+echo "-- callback function without parameters --\n";
+function callback_no_parameter()
+{
+ echo "callback3() called\n";
+}
+var_dump( array_walk_recursive($input, 'callback_no_parameter'));
+
+echo "-- passing one more parameter to function with two parameters --\n";
+var_dump( array_walk_recursive($input, 'callback_two_parameter', 10));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : callback function variation ***
+-- callback function with both parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(1)
+string(5) "Mango"
+
+int(0)
+string(6) "Orange"
+
+bool(true)
+-- callback function with only one parameter --
+string(5) "Apple"
+
+string(6) "Banana"
+
+string(5) "Mango"
+
+string(6) "Orange"
+
+bool(true)
+-- callback function without parameters --
+callback3() called
+callback3() called
+callback3() called
+callback3() called
+bool(true)
+-- passing one more parameter to function with two parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(1)
+string(5) "Mango"
+
+int(0)
+string(6) "Orange"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation1.phpt b/ext/standard/tests/array/array_walk_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'input' argument
+*/
+
+echo "*** Testing array_walk() : unexpected values for 'input' argument ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values given in input array
+ * $key - keys given in input array
+ * Description : Function prints each element of an array with key
+ */
+function callback($value, $key)
+{
+ echo "key : ";
+ var_dump($key);
+ echo "value : ";
+ var_dump($value);
+}
+
+// extra parameter passed to array_walk()
+$user_data = 10;
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get resource variable
+$fp = fopen(__FILE__, 'r');
+
+// different scalar/nonscalar values to be used in place of an 'input' argument
+$input_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/* 10*/ NULL,
+ null,
+
+ // boolean data
+/* 12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 16*/ "",
+ '',
+
+ // string data
+/* 18*/ "string",
+ 'string',
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/* 22*/ @$unset_var,
+);
+
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk($input_values[$count], "callback") );
+ var_dump( array_walk($input_values[$count], "callback", $user_data) );
+}
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : unexpected values for 'input' argument ***
+-- Iteration 1 --
+
+Warning: array_walk() 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'funcname' argument
+*/
+
+echo "*** Testing array_walk() : unexpected values for 'funcname' argument ***\n";
+
+$input = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+$user_data = 20;
+
+// class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+// different scalar/nonscalar values to be used in place of callback function
+$funcname_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+/* 10*/ array(),
+ array(0),
+ array(1),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/* 14*/ NULL,
+ null,
+
+ // boolean data
+/* 16*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 20*/ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // resource data
+/* 23*/ $fp = 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() with following types of 'input' arrays:
+ * integer, float, string, bool, null, empty & mixed
+*/
+
+// callback function
+/*
+ * Prototype : print_value(mixed $value, int $key, int $count)
+ * Parameters : $value - array entries(values)
+ * $key - keys in given input array
+ * $count - extra parameter used as an index
+ * Description : prints the array values with keys and count value
+ */
+function print_value($value, $key, $count)
+{
+ echo $count." : ".$key." ".$value."\n";
+}
+
+echo "*** Testing array_walk() : 'input' array with different values***\n";
+
+// different arrays as input
+$input_values = array(
+
+ // integer values
+/*1*/ array(1, 0, -10, 023, -041, 0x5A, 0X1F, -0x6E),
+
+ // float value
+ array(3.4, 0.8, -2.9, 6.25e2, 8.20E-3),
+
+ // string values
+ array('Mango', "Apple", 'Orange', "Lemon"),
+
+ // bool values
+/*4*/ array(true, false, TRUE, FALSE),
+
+ // null values
+ array(null, NULL),
+
+ // empty array
+ array(),
+
+ // binary array
+ array(b"binary"),
+
+ // mixed array
+/*8*/ array(16, 8.345, "Fruits", true, null, FALSE, -98, 0.005, 'banana')
+);
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk($input_values[$count], "print_value", $count+1));
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : 'input' array with different values***
+
+-- Iteration 1 --
+1 : 0 1
+1 : 1 0
+1 : 2 -10
+1 : 3 19
+1 : 4 -33
+1 : 5 90
+1 : 6 31
+1 : 7 -110
+bool(true)
+
+-- Iteration 2 --
+2 : 0 3.4
+2 : 1 0.8
+2 : 2 -2.9
+2 : 3 625
+2 : 4 0.0082
+bool(true)
+
+-- Iteration 3 --
+3 : 0 Mango
+3 : 1 Apple
+3 : 2 Orange
+3 : 3 Lemon
+bool(true)
+
+-- Iteration 4 --
+4 : 0 1
+4 : 1
+4 : 2 1
+4 : 3
+bool(true)
+
+-- Iteration 5 --
+5 : 0
+5 : 1
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+7 : 0 binary
+bool(true)
+
+-- Iteration 8 --
+8 : 0 16
+8 : 1 8.345
+8 : 2 Fruits
+8 : 3 1
+8 : 4
+8 : 5
+8 : 6 -98
+8 : 7 0.005
+8 : 8 banana
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation4.phpt b/ext/standard/tests/array/array_walk_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() with an array having subarrays as elements
+*/
+
+echo "*** Testing array_walk() : array with subarray ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values in given 'input' array
+ * $key - keys in given 'input' array
+ * Description : It prints the count of an array elements, passed as argument
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+$input = array(
+ array(),
+ array(1),
+ array(1,2,3),
+ array("Mango", "Orange"),
+ array(array(1, 2, 3))
+);
+
+var_dump( array_walk( $input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : array with subarray ***
+int(0)
+array(0) {
+}
+
+int(1)
+array(1) {
+ [0]=>
+ int(1)
+}
+
+int(2)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+
+int(3)
+array(2) {
+ [0]=>
+ string(5) "Mango"
+ [1]=>
+ string(6) "Orange"
+}
+
+int(4)
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation5.phpt b/ext/standard/tests/array/array_walk_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() with an array having reference variables
+*/
+
+echo "*** Testing array_walk() : array with references ***\n";
+
+$value1 = 10;
+$value2 = -20;
+$value3 = &$value1;
+$value4 = 50;
+
+// 'input' array containing references to above variables
+$input = array(&$value1, &$value2, -35, &$value3, 0, &$value4);
+
+// callback function
+/* Prototype : callback(int $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : function checks for the value whether positive or negative and displays according to that
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+var_dump( array_walk($input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : array with references ***
+int(0)
+int(10)
+
+int(1)
+int(-20)
+
+int(2)
+int(-35)
+
+int(3)
+int(10)
+
+int(4)
+int(0)
+
+int(5)
+int(50)
+
+bool(true)
+Done
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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing 'input' argument as an associative array
+ * with Numeric & string keys
+*/
+
+echo "*** Testing array_walk() : 'input' as an associative array ***\n";
+
+// callback functions
+/* Prototype : for_numeric( int $value, int $key, int $user_data)
+ * Parameters : $value - value from key/value pair of the array
+ * $key - key from key/value pair of the array
+ * $user_data - data to be added to 'value'
+ * Description : Function adds values with keys & user_data
+ */
+function for_numeric($value, $key, $user_data)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ var_dump($user_data);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_string( string $value, string $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function appends key to the value
+ */
+function for_string($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_mixed( mixed $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function displays each element of an array with keys
+ */
+function for_mixed($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+// Numeric keys
+$input = array( 1 => 25, 5 => 12, 0 => -80, -2 => 100, 5 => 30);
+echo "-- Associative array with numeric keys --\n";
+var_dump( array_walk($input, "for_numeric", 10));
+
+// String keys
+$input = array( "a" => "Apple", 'b' => 'Bananna', "c" => "carrot", 'o' => "Orange");
+echo "-- Associative array with string keys --\n";
+var_dump( array_walk($input, "for_string"));
+
+// binary keys
+$input = array( b"a" => "Apple", b"b" => "Banana");
+echo "-- Associative array with binary keys --\n";
+var_dump( array_walk($input, "for_string"));
+
+// Mixed keys - numeric/string
+$input = array( 0 => 1, 1 => 2, "a" => "Apple", "b" => "Banana", 2 =>3);
+echo "-- Associative array with numeric/string keys --\n";
+var_dump( array_walk($input, "for_mixed"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : 'input' as an associative array ***
+-- Associative array with numeric keys --
+int(1)
+int(25)
+int(10)
+
+int(5)
+int(30)
+int(10)
+
+int(0)
+int(-80)
+int(10)
+
+int(-2)
+int(100)
+int(10)
+
+bool(true)
+-- Associative array with string keys --
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(7) "Bananna"
+
+string(1) "c"
+string(6) "carrot"
+
+string(1) "o"
+string(6) "Orange"
+
+bool(true)
+-- Associative array with binary keys --
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(6) "Banana"
+
+bool(true)
+-- Associative array with numeric/string keys --
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(6) "Banana"
+
+int(2)
+int(3)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing anonymous(run-time) callback function with following variations:
+* with one parameter
+* two parameters
+* three parameters
+* extra parameters
+* without parameters
+*/
+
+echo "*** Testing array_walk() : anonymous function as callback ***\n";
+
+$input = array(2, 5, 10, 0);
+
+echo "-- Anonymous function with one argument --\n";
+var_dump( array_walk($input, create_function('$value', 'var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with two arguments --\n";
+var_dump( array_walk($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with three arguments --\n";
+var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10));
+
+echo "-- Anonymous function with one more argument --\n";
+var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30));
+
+echo "-- Anonymous function with null argument --\n";
+var_dump( array_walk( $input, create_function(null, 'echo "1\n";')));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : anonymous function as callback ***
+-- Anonymous function with one argument --
+int(2)
+
+int(5)
+
+int(10)
+
+int(0)
+
+bool(true)
+-- Anonymous function with two arguments --
+int(0)
+int(2)
+
+int(1)
+int(5)
+
+int(2)
+int(10)
+
+int(3)
+int(0)
+
+bool(true)
+-- Anonymous function with three arguments --
+int(0)
+int(2)
+int(10)
+
+int(1)
+int(5)
+int(10)
+
+int(2)
+int(10)
+int(10)
+
+int(3)
+int(0)
+int(10)
+
+bool(true)
+-- Anonymous function with one more argument --
+
+Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+-- Anonymous function with null argument --
+1
+1
+1
+1
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different buit-in functionns as callback function
+ * pow function
+ * min function
+ * echo language construct
+*/
+
+echo "*** Testing array_walk() : built-in function as callback ***\n";
+
+$input = array(2 => 1, 65, 98, 100, 6 => -4);
+
+echo "-- With 'pow' built-in function --\n";
+var_dump( array_walk($input, 'pow'));
+
+echo "-- With 'min' built-in function --\n";
+var_dump( array_walk($input, "min"));
+
+echo "-- With 'echo' language construct --\n";
+var_dump( array_walk($input, "echo"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : built-in function as callback ***
+-- With 'pow' built-in function --
+bool(true)
+-- With 'min' built-in function --
+bool(true)
+-- With 'echo' language construct --
+
+Warning: array_walk() 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--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different types of callback functions to array_walk()
+ * without parameters
+ * with less and more parameters
+*/
+
+echo "*** Testing array_walk() : callback function variation ***\n";
+
+$input = array('Apple', 'Banana', 'Mango', 'Orange');
+
+echo "-- callback function with both parameters --\n";
+function callback_two_parameter($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk($input, 'callback_two_parameter'));
+
+echo "-- callback function with only one parameter --\n";
+function callback_one_parameter($value)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk($input, 'callback_one_parameter'));
+
+echo "-- callback function without parameters --\n";
+function callback_no_parameter()
+{
+ echo "callback3() called\n";
+}
+var_dump( array_walk($input, 'callback_no_parameter'));
+
+echo "-- passing one more parameter to function with two parameters --\n";
+var_dump( array_walk($input, 'callback_two_parameter', 10));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : callback function variation ***
+-- callback function with both parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(2)
+string(5) "Mango"
+
+int(3)
+string(6) "Orange"
+
+bool(true)
+-- callback function with only one parameter --
+string(5) "Apple"
+
+string(6) "Banana"
+
+string(5) "Mango"
+
+string(6) "Orange"
+
+bool(true)
+-- callback function without parameters --
+callback3() called
+callback3() called
+callback3() called
+callback3() called
+bool(true)
+-- passing one more parameter to function with two parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(2)
+string(5) "Mango"
+
+int(3)
+string(6) "Orange"
+
+bool(true)
+Done
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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing integer/string arrays to check the basic functionality
+ * with following flag values.
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing arsort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$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( 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--
+<?php
+/* Prototype : bool arsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing arsort() function with all possible error conditions
+*/
+
+echo "*** Testing arsort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing arsort() function with Zero arguments --\n";
+var_dump( arsort() );
+
+//Test arsort with more than the expected number of arguments
+echo "\n-- Testing arsort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and setting all possible flag values
+foreach($flags as $key => $flag){
+ echo "\nSort flag = $key\n";
+ var_dump( arsort($array_arg,$flag, $extra_arg) );
+
+ // dump the input array to ensure that it wasn't changed
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing arsort() : error conditions ***
+
+-- Testing arsort() function with Zero arguments --
+
+Warning: arsort() expects at least 1 parameter, 0 given in %sarsort_error.php on line %d
+bool(false)
+
+-- Testing arsort() function with more than expected no. of arguments --
+
+Sort flag = SORT_REGULAR
+
+Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_STRING
+
+Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_NUMERIC
+
+Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ * 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing arsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_arsort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing arsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_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;
+ }
+
+}
+
+// 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--
+<?php
+/* Prototype : bool arsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing different unexpected values for array argument with following flag values.
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of values with indices to iterate over
+$unexpected_values = array (
+
+ // int data
+ 0 => 0,
+ 1 => 1,
+ 2 => 12345,
+ 3 => -2345,
+
+ // float data
+ 4 => 10.5,
+ 5 => -10.5,
+ 6 => 10.5e3,
+ 7 => 10.6E-2,
+ 8 => .5,
+
+ // null data
+ 9 => NULL,
+ 10 => null,
+
+ // boolean data
+ 11 => true,
+ 12 => false,
+ 13 => TRUE,
+ 14 => FALSE,
+
+ // empty data
+ 15 => "",
+ 16 => '',
+
+ // string data
+ 17 => "string",
+ 18 => 'string',
+
+ // object data
+ 19 => new stdclass(),
+
+ // undefined data
+ 20 => @undefined_var,
+
+ // unset data
+ 21 => @unset_var,
+
+ // resource variable
+ 22 => $fp
+
+);
+
+// loop though each element of the array and check the working of arsort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing arsort() by supplying different unexpected values for 'array' argument --\n";
+echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ var_dump( arsort($value) ); // expecting : bool(false)
+ var_dump( arsort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( arsort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( arsort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation10.phpt b/ext/standard/tests/array/arsort_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing different octal array for $array argument with following flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// an array contains unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01235, 0321 => 0321, 0345 => 0345, 066 => 066, 0772 => 0772,
+ 077 => 077, -066 => -066, -0345 => -0345, 0 => 0
+);
+
+echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( arsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [669]=>
+ int(669)
+ [506]=>
+ int(506)
+ [229]=>
+ int(229)
+ [209]=>
+ int(209)
+ [63]=>
+ int(63)
+ [54]=>
+ int(54)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-54)
+ [-229]=>
+ int(-229)
+}
+
+-- Testing arsort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [669]=>
+ int(669)
+ [506]=>
+ int(506)
+ [229]=>
+ int(229)
+ [209]=>
+ int(209)
+ [63]=>
+ int(63)
+ [54]=>
+ int(54)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-54)
+ [-229]=>
+ int(-229)
+}
+
+-- Testing arsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [669]=>
+ int(669)
+ [506]=>
+ int(506)
+ [229]=>
+ int(229)
+ [209]=>
+ int(209)
+ [63]=>
+ int(63)
+ [54]=>
+ int(54)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-54)
+ [-229]=>
+ int(-229)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation11.phpt b/ext/standard/tests/array/arsort_variation11.phpt
new file mode 100644
index 0000000..e8bfd77
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/arsort_variation2.phpt b/ext/standard/tests/array/arsort_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool arsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// temperory array for checking unexpected behavior
+$unsorted_values = array(1 => 10, 2 => 2, 3 => 45);
+
+//array of values to iterate over
+$unexpected_values = array(
+
+ // int data
+/*1*/ -2345,
+
+ // float data
+/*2*/ 10.5,
+ -10.5,
+ 10.5e2,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*7*/ NULL,
+ null,
+
+ // boolean data
+/*9*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*13*/ "",
+ '',
+
+ // string data
+/*15*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var,
+
+ // resource variable
+/*19*/ $fp
+
+);
+
+// loop though each element of the array and check the working of arsort()
+// when $flag arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing arsort() by supplying different unexpected values for 'sort_flags' argument --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ $temp_array = $unsorted_values;
+ var_dump( arsort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing different integer/float value arrays for $array argument with following values
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// group of various arrays with indices
+$various_arrays = array(
+ // negative/posative integer array
+ array(1 => 11, 2 => -11, 3 => 21, 4 => -21, 5 => 31, 6 => -31, 7 => 0, 8 => 41, 10 =>-41),
+
+ // float value array
+ array(1 => 10.5, 2 => -10.5, 3 => 10.5e2, 4 => 10.6E-2, 5 => .5, 6 => .0001, 7 => -.1),
+
+ // mixed value array
+ array(1 => .0001, 2 => .0021, 3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, 8 => -.9, 9 => 10.6E-2, 10 => -10.6E-2, 11 => 33),
+
+ // array values contains minimum and maximum ranges
+ array(1 => 2147483647, 2 => 2147483648, 3 => -2147483647, 4 => -2147483648, 5 => -0, 6 => 0, 7 => -2147483649)
+);
+
+// set of possible flag values
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing arsort() by supplying various integer/float arrays --\n";
+
+// loop through to test arsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flag_value array and setting all possible flag values
+ foreach($flag_value as $key => $flag){
+ echo "- Sort_flag = $key -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [7]=>
+ int(0)
+ [2]=>
+ int(-11)
+ [4]=>
+ int(-21)
+ [6]=>
+ int(-31)
+ [10]=>
+ int(-41)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [7]=>
+ int(0)
+ [2]=>
+ int(-11)
+ [4]=>
+ int(-21)
+ [6]=>
+ int(-31)
+ [10]=>
+ int(-41)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [7]=>
+ int(0)
+ [2]=>
+ int(-11)
+ [4]=>
+ int(-21)
+ [6]=>
+ int(-31)
+ [10]=>
+ int(-41)
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(7) {
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [5]=>
+ float(0.5)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+ [7]=>
+ float(-0.1)
+ [2]=>
+ float(-10.5)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [5]=>
+ float(0.5)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+ [7]=>
+ float(-0.1)
+ [2]=>
+ float(-10.5)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [5]=>
+ float(0.5)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+ [7]=>
+ float(-0.1)
+ [2]=>
+ float(-10.5)
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [6]=>
+ float(0.09)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [5]=>
+ int(0)
+ [3]=>
+ float(-0.01)
+ [10]=>
+ float(-0.106)
+ [8]=>
+ float(-0.9)
+ [4]=>
+ int(-1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [6]=>
+ float(0.09)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [5]=>
+ int(0)
+ [3]=>
+ float(-0.01)
+ [10]=>
+ float(-0.106)
+ [8]=>
+ float(-0.9)
+ [4]=>
+ int(-1)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [6]=>
+ float(0.09)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [5]=>
+ int(0)
+ [3]=>
+ float(-0.01)
+ [10]=>
+ float(-0.106)
+ [8]=>
+ float(-0.9)
+ [4]=>
+ int(-1)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(7) {
+ [2]=>
+ %s(2147483648)
+ [1]=>
+ int(2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [3]=>
+ int(-2147483647)
+ [4]=>
+ %s(-2147483648)
+ [7]=>
+ %s(-2147483649)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [2]=>
+ %s(2147483648)
+ [1]=>
+ int(2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [3]=>
+ int(-2147483647)
+ [4]=>
+ %s(-2147483648)
+ [7]=>
+ %s(-2147483649)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [2]=>
+ %s(2147483648)
+ [1]=>
+ int(2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [3]=>
+ int(-2147483647)
+ [4]=>
+ %s(-2147483648)
+ [7]=>
+ %s(-2147483649)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation4.phpt b/ext/standard/tests/array/arsort_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing reference variable array with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing arsort() :usage variations ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( 1 => &$value1 , 2 => &$value2, 3 => &$value3);
+
+echo "\n-- Testing arsort() by supplying reference variable array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( arsort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() :usage variations ***
+
+-- Testing arsort() by supplying reference variable array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ [3]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- Testing arsort() by supplying reference variable array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [3]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- Testing arsort() by supplying reference variable array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(3) {
+ [3]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation5.phpt b/ext/standard/tests/array/arsort_variation5.phpt
new file mode 100644
index 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing different string arrays for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+$various_arrays = array (
+ // group of escape sequences
+ array ("null"=> null, "NULL" => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e",
+ "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh",
+ "\ddd" => "\ddd", "\v" => "\v"
+ ),
+
+ // array contains combination of capital/small letters
+ array ('l' => "lemoN", 'O' => "Orange", 'b' => "banana", 'a' => "apple", 'Te' => "Test",
+ 'T' => "TTTT", 't' => "ttt", 'w' => "ww", 'x' => "x", 'X' => "X", 'o' => "oraNGe",
+ 'B' => "BANANA"
+ )
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+echo "\n-- Testing arsort() by supplying various string arrays --\n";
+
+// loop through to test arsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and setting all possible flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort_flag = $key -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(12) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing different hexa-decimal array for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// an array contains unsorted hexadecimal values
+// There are multiple keys which are duplicate and the later should be picked
+$unsorted_hex_array = array ( 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB,
+ 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
+ );
+
+echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(arsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation7.phpt b/ext/standard/tests/array/arsort_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: This function arsorts an array.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing bool value array for $array argument with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (1 => true, 2 => false, 3 => TRUE, 4 => FALSE);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying bool value array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+
+-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+
+-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+
+-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation8.phpt b/ext/standard/tests/array/arsort_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing arrays contains sub arrays for $array argument with flowing flag values
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * Note: arrays are sorted based on total count of elements inside it, when all the elements are arrays
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// array of arrays
+$various_arrays = array (
+ // null array
+ "array[0]" => array(),
+
+ // array contains null sub array
+ "array[1]" => array( "sub_array[1][0]" => array() ),
+
+ // array of arrays along with some values
+ "array[2]" => array("data[2,0]" => 44, "data[2,1]" => 11, "sub_array[2][0] " => array(64,61) ),
+
+ // array contains sub arrays
+ "array[3]" => array ( "sub_array[3][0]" => array(33,-5,6), "sub_array[3][1]" => array(11),
+ "sub_array[3][2]" => array(22,-55), "sub_array[3][3]" => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing arsort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test arsort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ // testing arsort() function by supplying different arrays, flag value is default
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array) );
+ var_dump($temp_array);
+
+ // testing arsort() function by supplying different arrays, flag value = SORT_REGULAR
+ echo "- Sort_flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various arrays containing sub arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(0) {
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(1) {
+ ["sub_array[1][0]"]=>
+ array(0) {
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ ["sub_array[1][0]"]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ ["sub_array[2][0] "]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ ["data[2,0]"]=>
+ int(44)
+ ["data[2,1]"]=>
+ int(11)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["sub_array[2][0] "]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ ["data[2,0]"]=>
+ int(44)
+ ["data[2,1]"]=>
+ int(11)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(4) {
+ ["sub_array[3][0]"]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ ["sub_array[3][2]"]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ ["sub_array[3][1]"]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ ["sub_array[3][3]"]=>
+ array(0) {
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["sub_array[3][0]"]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ ["sub_array[3][2]"]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ ["sub_array[3][1]"]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ ["sub_array[3][3]"]=>
+ array(0) {
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation9.phpt b/ext/standard/tests/array/arsort_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing arrays with key values for $array argument with following flag values.
+ * 1.flag value as default
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// list of arrays with/without key values
+$various_arrays = array (
+ array(5 => 55, 66, 22, 33, 11),
+ array ("a" => "orange", "banana", "c" => "apple"),
+ array(1, 2, 3, 4, 5, 6),
+ array("first", 5 => "second", "third"),
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ array('bar' => 'baz', "foo" => 1),
+ array('a'=>1,'b'=>array('e'=>2,'f'=>3),'c'=>array('g'=>4),'d'=>5),
+);
+
+$count = 1;
+echo "\n-- Testing arsort() by supplying various arrays with key values --\n";
+
+// loop through to test arsort() with different arrays,
+// to test the new keys for the elements in the sorted array
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort_flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various arrays with key values --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(5) {
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [9]=>
+ int(11)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [9]=>
+ int(11)
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ ["a"]=>
+ string(6) "orange"
+ [0]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["a"]=>
+ string(6) "orange"
+ [0]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ [6]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+ [0]=>
+ string(5) "first"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [6]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+ [0]=>
+ string(5) "first"
+}
+
+-- Iteration 5 --
+- With default sort_flag -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 6 --
+- With default sort_flag -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+
+-- Iteration 7 --
+- With default sort_flag -
+bool(true)
+array(4) {
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+ ["a"]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+ ["a"]=>
+ int(1)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing integer/string arrays to check the basic functionality
+ * with following flag values.
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing asort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$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( 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--
+<?php
+/* Prototype : bool asort(array &array_arg [, int sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing asort() function with all possible error conditions
+*/
+
+echo "*** Testing asort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing asort() function with Zero arguments --\n";
+var_dump( asort() );
+
+//Test asort with more than the expected number of arguments
+echo "\n-- Testing asort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and setting all possible flag values
+foreach($flags as $key => $flag){
+ echo "\nSort flag = $key\n";
+ var_dump( 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ * 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing asort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_asort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing asort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_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;
+ }
+
+}
+
+// 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--
+<?php
+/* Prototype : bool asort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different unexpected values for array argument with following flag values.
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of values with indices to iterate over
+$unexpected_values = array (
+
+ // int data
+ 0 => 0,
+ 1 => 1,
+ 2 => 12345,
+ 3 => -2345,
+
+ // float data
+ 4 => 10.5,
+ 5 => -10.5,
+ 6 => 10.5e3,
+ 7 => 10.6E-2,
+ 8 => .5,
+
+ // null data
+ 9 => NULL,
+ 10 => null,
+
+ // boolean data
+ 11 => true,
+ 12 => false,
+ 13 => TRUE,
+ 14 => FALSE,
+
+ // empty data
+ 15 => "",
+ 16 => '',
+
+ // string data
+ 17 => "string",
+ 18 => 'string',
+
+ // object data
+ 19 => new stdclass(),
+
+ // undefined data
+ 20 => @undefined_var,
+
+ // unset data
+ 21 => @unset_var,
+
+ // resource variable
+ 22 => $fp
+
+);
+
+// loop though each element of the array and check the working of 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different octal array for $array argument with following flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// an array contains unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01235, 0321 => 0321, 0345 => 0345, 066 => 066, 0772 => 0772,
+ 077 => 077, -066 => -066, -0345 => -0345, 0 => 0
+);
+
+echo "\n-- Testing 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
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation11.phpt
Binary files 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--
+<?php
+/* Prototype : proto bool asort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// temperory array for checking unexpected behavior
+$unsorted_values = array(1 => 10, 2 => 2, 3 => 45);
+
+//array of values to iterate over
+$unexpected_values = array(
+
+ // int data
+/*1*/ -2345,
+
+ // float data
+/*2*/ 10.5,
+ -10.5,
+ 10.5e2,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*7*/ NULL,
+ null,
+
+ // boolean data
+/*9*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*13*/ "",
+ '',
+
+ // string data
+/*15*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var,
+
+ // resource variable
+/*19*/ $fp
+
+);
+
+// loop though each element of the array and check the working of 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing different integer/float value arrays for $array argument with following values
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// group of various arrays with indices
+$various_arrays = array(
+ // negative/posative integer array
+ array(1 => 11, 2 => -11, 3 => 21, 4 => -21, 5 => 31, 6 => -31, 7 => 0, 8 => 41, 10 =>-41),
+
+ // float value array
+ array(1 => 10.5, 2 => -10.5, 3 => 10.5e2, 4 => 10.6E-2, 5 => .5, 6 => .0001, 7 => -.1),
+
+ // mixed value array
+ array(1 => .0001, 2 => .0021, 3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, 8 => -.9, 9 => 10.6E-2, 10 => -10.6E-2, 11 => 33),
+
+ // array values contains minimum and maximum ranges
+ array(1 => 2147483647, 2 => 2147483648, 3 => -2147483647, 4 => -2147483648, 5 => -0, 6 => 0, 7 => -2147483649)
+);
+
+// set of possible flag values
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing reference variable array with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() :usage variations ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( 1 => &$value1 , 2 => &$value2, 3 => &$value3);
+
+echo "\n-- Testing 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different string arrays for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+$various_arrays = array (
+ // group of escape sequences
+ array ("null"=> null, "NULL" => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e",
+ "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh",
+ "\ddd" => "\ddd", "\v" => "\v"
+ ),
+
+ // array contains combination of capital/small letters
+ array ('l' => "lemoN", 'O' => "Orange", 'b' => "banana", 'a' => "apple", 'Te' => "Test",
+ 'T' => "TTTT", 't' => "ttt", 'w' => "ww", 'x' => "x", 'X' => "X", 'o' => "oraNGe",
+ 'B' => "BANANA"
+ )
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+echo "\n-- Testing 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different hexa-decimal array for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// an array contains unsorted hexadecimal values
+// There are multiple keys which are duplicate and the later should be picked
+$unsorted_hex_array = array ( 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB,
+ 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
+ );
+
+echo "\n-- Testing 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: This function asorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing bool value array for $array argument with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (1 => 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing arrays contains sub arrays for $array argument with flowing flag values
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * Note: arrays are sorted based on total count of elements inside it, when all the elements are arrays
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// array of arrays
+$various_arrays = array (
+ // null array
+ "array[0]" => array(),
+
+ // array contains null sub array
+ "array[1]" => array( "sub_array[1][0]" => array() ),
+
+ // array of arrays along with some values
+ "array[2]" => array("data[2,0]" => 44, "data[2,1]" => 11, "sub_array[2][0] " => array(64,61) ),
+
+ // array contains sub arrays
+ "array[3]" => array ( "sub_array[3][0]" => array(33,-5,6), "sub_array[3][1]" => array(11),
+ "sub_array[3][2]" => array(22,-55), "sub_array[3][3]" => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing 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--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing arrays with key values for $array argument with following flag values.
+ * 1.flag value as default
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// list of arrays with/without key values
+$various_arrays = array (
+ array(5 => 55, 66, 22, 33, 11),
+ array ("a" => "orange", "banana", "c" => "apple"),
+ array(1, 2, 3, 4, 5, 6),
+ array("first", 5 => "second", "third"),
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ array('bar' => 'baz', "foo" => 1),
+ array('a'=>1,'b'=>array('e'=>2,'f'=>3),'c'=>array('g'=>4),'d'=>5),
+);
+
+$count = 1;
+echo "\n-- Testing 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--
+<?php
+
+function test($val,$key)
+{
+ global $globalArray;
+ $globalArray[]=$key; // this will end up crashing
+ $globalArray[]=(string)$key; // this will end up OK
+ print "val: $val; key: $key\n"; flush();
+}
+
+$arr=array('k'=>'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--
+<?php
+ $arr = array (b"foo\0bar" => 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--
+<?php
+$a = array(
+ 'a1' => 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--
+<?php
+ $ta = array(1, 2, 3);
+ $ta[NULL] = "Null Value";
+
+ var_dump(array_key_exists(NULL, $ta));
+?>
+--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--
+<?php
+$a = "20"; $b = "30";
+echo "a1: $a\n";
+$result = range($a, $b);
+echo "a2: $a : type : " . gettype($a) . "\n";
+?>
+--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--
+<?php
+
+echo "==Mixed==\n";
+$a = array(-1=>'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--
+<?php
+
+$a = array("a", "b", "c");
+
+var_dump(key($a));
+var_dump(array_pop($a));
+var_dump(key($a));
+var_dump(array_pop($a));
+var_dump(key($a));
+var_dump(array_pop($a));
+var_dump(key($a));
+
+?>
+--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--
+<?php
+
+$a = array('a', 'b', 'c');
+$last = array_shift ($a);
+$a[] = 'a';
+var_dump($a);
+
+$a = array('a' => 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--
+<?php
+
+function a($ary) {
+ return (is_array($ary) ? array_reduce($ary, 'cb', 0) : 1);
+}
+
+function cb($v, $elem) {
+ return $v + a($elem);
+}
+
+$ary = array(
+ array(
+ array(
+ array(
+ array(
+ array(0, 1, 2, 3, 4)
+ )
+ )
+ )
+ )
+);
+
+var_dump(a($ary));
+?>
+--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--
+<?php
+var_dump(
+ array_map(
+ NULL,
+ array(1,2,3),
+ array(4,5,6),
+ array(7,8,9)
+ )
+);
+?>
+--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--
+<?php
+$numeric = 123;
+$bool = true;
+$foo = array(&$numeric, &$bool);
+var_dump($foo);
+str_replace("abc", "def", $foo);
+var_dump($foo);
+?>
+--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--
+<?php
+$c = array('a' => '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--
+<?php
+ var_dump(range("2003", "2004"));
+ var_dump(range("a", "z"));
+ var_dump(range("1", "10"));
+?>
+--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--
+<?php
+
+error_reporting(E_ALL);
+
+$a = unpack('C2', "\0224V");
+$b = array(1 => 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--
+<?php
+$a = array(1 => 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--
+<?php
+/* test #1: numeric data */
+function add_up($running_total, $current_value)
+{
+ echo "running_total is ".(int)$running_total.", current_value is {$current_value}\n";
+ $running_total += $current_value * $current_value;
+ return $running_total;
+}
+
+$numbers = array (2,3,5,7);
+$total = array_reduce($numbers, 'add_up');
+print "Total is $total\n";
+
+/* test #2: string data */
+$a = array("a", "b", "c");
+function foo ($a, $b)
+{
+ return $a . $b;
+}
+var_dump(array_reduce($a, "foo"));
+
+/* test #3: basic test (used to leak memory) */
+function rsum($v, $w)
+{
+ $v += $w;
+ return $v;
+}
+function rmul($v, $w)
+{
+ $v *= $w;
+ return $v;
+}
+$a = array(1, 2, 3, 4, 5);
+$x = array();
+$b = array_reduce($a, "rsum");
+$c = array_reduce($a, "rmul", 10);
+$d = array_reduce($x, "rsum", 1);
+
+var_dump($b, $c, $d);
+?>
+--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--
+<?php
+
+function does_not_work()
+{
+ global $data; // Remove this line to make array_multisort() work
+
+ $data = array('first', 'fifth', 'second', 'forth', 'third');
+ $sort = array(1, 5, 2, 4, 3);
+ array_multisort($sort, $data);
+
+ var_dump($data);
+}
+
+does_not_work();
+
+?>
+--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--
+<?php
+function foo($ref, $alt) {
+ unset($GLOBALS['a']);
+ unset($GLOBALS['b']);
+ $GLOBALS['a'] = 1;
+ $GLOBALS['b'] = 2;
+
+ $org_a = $GLOBALS['a'];
+ $org_b = $GLOBALS['b'];
+
+ if ($ref) {
+ global $a, $b;
+ } else {
+ /* zval temp_var(NULL); // refcount = 1
+ * a = temp_var[x] // refcount = 2
+ */
+ $a = NULL;
+ $b = NULL;
+ }
+
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ if ($alt) {
+ $a = &$GLOBALS['a'];
+ $b = &$GLOBALS['b'];
+ } else {
+ extract($GLOBALS, EXTR_REFS);
+ }
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $a = &$GLOBALS['a'];
+ $b = &$GLOBALS['b'];
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $GLOBALS['b'] = 3;
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $a = 4;
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $c = $b;
+ debug_zval_dump($b, $GLOBALS['b'], $c);
+ echo "--\n";
+ $b = 'x';
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c);
+ echo "--\n";
+ debug_zval_dump($org_a, $org_b);
+ echo "----";
+ if ($ref) echo 'r';
+ if ($alt) echo 'a';
+ echo "\n";
+}
+
+$a = 'ok';
+$b = 'ok';
+$_a = $a;
+$_b = $b;
+
+foo(false, true);
+foo(true, true);
+foo(false, false);
+foo(true, false);
+
+debug_zval_dump($_a, $_b);
+?>
+--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--
+<?php
+ $a = array ("quote'" => 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
--- /dev/null
+++ b/ext/standard/tests/array/bug26458.phpt
Binary files 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--
+<?php
+class p {
+ public $x;
+ function __construct($x){$this->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--
+<?php
+$a = $b = $c = array(0,1,2,3,4,5);
+print_r($a);
+// this is ok:
+print_r(array_slice($a,2,2147483645));
+
+// this is wrong:
+print_r(array_slice($a,2,2147483646));
+echo 'print_r(array_splice($a,2,1));'."\n";
+print_r(array_splice($a,2,1));
+echo "\$a is :";
+print_r($a);
+echo 'print_r(array_splice($b,2,2147483645));'."\n";
+print_r(array_splice($b,2,2147483645));
+echo "\$b is :";
+print_r($b);
+
+// this is wrong:
+echo 'print_r(array_splice($c,2,2147483646));'."\n";
+print_r(array_splice($c,2,2147483646));
+echo "\$c is :";
+print_r($c);
+?>
+--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--
+<?php
+$zz = $GLOBALS;
+$gg = 'afad';
+var_dump(@array_diff_assoc($GLOBALS, $zz));
+var_dump($gg);
+?>
+--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--
+<?php
+function t1()
+{
+ $a = array('foo' => '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--
+<?php
+error_reporting(E_ALL & ~E_NOTICE); // We don't want the notice for $undefined
+$result = extract(array('a'=>$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--
+<?php
+class testc
+{
+ public $b = "c";
+
+ function crash($val)
+ {
+ $this->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--
+<?php
+
+$foo = array('abc', '0000');
+var_dump($foo);
+
+$count = array_count_values( $foo );
+var_dump($count);
+
+var_dump($foo);
+
+echo "Done\n";
+?>
+--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--
+<?php
+function __(){
+ $GLOBALS['a'] = "bug\n";
+ array_splice($GLOBALS,0,count($GLOBALS));
+ /* All global variables including $GLOBALS are removed */
+ echo $GLOBALS['a'];
+}
+__();
+echo "ok\n";
+?>
+--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--
+<?php
+function test($use_extract) {
+ $a = 1;
+ $b = 1;
+
+ $arr = array(
+ '_a' => $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--
+<?php
+$foo = range('', 'z');
+var_dump($foo);
+?>
+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--
+<?php
+
+$array = array(1,2,3,4,5);
+
+sort($array);
+
+var_dump(array_reverse($array));
+
+echo "Done\n";
+?>
+--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--
+<?php
+$a="a";
+extract($GLOBALS, EXTR_REFS);
+echo "ok\n";
+?>
+--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--
+<?php
+
+ $order = array(
+ "DocID" => "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--
+<?php
+
+ $order = array(
+ "DocID" => "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--
+<?php
+
+class C
+{
+ function m1()
+ {
+ $this->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--
+<?php
+$ar = array(
+ 'element 1',
+ array('subelement1')
+ );
+
+func($ar);
+print_r($ar);
+
+function func($a) {
+ array_walk_recursive($a, 'apply');
+ print_r($a);
+}
+
+function apply(&$input, $key) {
+ $input = 'changed';
+}
+?>
+--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--
+<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
+--INI--
+precision=14
+--FILE--
+<?php
+$tests = array(
+ 'foo',
+ array(),
+ array(0),
+ array(3),
+ array(3, 3),
+ array(0.5, 2),
+ array(99999999, 99999999),
+ array(8.993, 7443241,988, sprintf("%u", -1)+0.44),
+ array(2,sprintf("%u", -1)),
+);
+
+foreach ($tests as $v) {
+ var_dump(array_product($v));
+}
+?>
+--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--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--INI--
+precision=14
+--FILE--
+<?php
+$tests = array(
+ 'foo',
+ array(),
+ array(0),
+ array(3),
+ array(3, 3),
+ array(0.5, 2),
+ array(99999999, 99999999),
+ array(8.993, 7443241,988, sprintf("%u", -1)+0.44),
+ array(2,sprintf("%u", -1)),
+);
+
+foreach ($tests as $v) {
+ var_dump(array_product($v));
+}
+?>
+--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--
+<?php
+$state = array("one" => 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--
+<?php
+
+class Element
+{
+ public function ThrowException ()
+ {
+ throw new Exception();
+ }
+
+ public static function CallBack(Element $elem)
+ {
+ $elem->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--
+<?php
+$a = array('aa', 'aa', 'bb', 'bb', 'cc', 'cc');
+$test = natcasesort($a);
+if ($test) {
+ echo "natcasesort success!\n";
+}
+$val = array_pop($a);
+$a[] = $val;
+var_dump($a);
+
+$b = array(1 => '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--
+<?php
+$array = array('-000', ' 001', 1, ' 123', '+123');
+var_dump(array_count_values($array));
+?>
+--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--
+<?php
+
+class Test {
+
+ public $_table = '';
+ public $_columns = array ();
+ public $_primary = array ();
+
+}
+
+$test = new Test ();
+$test->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--
+<?php if (!extension_loaded('spl')) die("skip SPL is not available"); ?>
+--FILE--
+<?php
+
+$arrObj = new ArrayObject();
+$arrObj->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--
+<?php
+function CommaSeperatedList($a, $b) {
+ if($a == null)
+ return $b;
+ else
+ return $a.','.$b;
+}
+
+$arr1 = array(1,2,3);
+$arr2 = array(1);
+
+echo "result for arr1: ".array_reduce($arr1,'CommaSeperatedList')."\n";
+echo "result for arr2: ".array_reduce($arr2,'CommaSeperatedList')."\n";
+echo "result for arr1: ".array_reduce($arr1,'CommaSeperatedList')."\n";
+echo "result for arr2: ".array_reduce($arr2,'CommaSeperatedList')."\n";
+
+echo "Done\n";
+?>
+--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--
+<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
+--FILE--
+<?php
+
+// posotive steps
+var_dump(range(2147483400, 2147483600, 100));
+var_dump( range(2147483646, 2147483648, 1 ) );
+var_dump( range(2147483646, 2147483657, 1 ) );
+var_dump( range(2147483630, 2147483646, 5 ) );
+
+// negative steps
+var_dump( range(-2147483645, -2147483648, 1 ) );
+var_dump( range(-2147483645, -2147483649, 1 ) );
+var_dump( range(-2147483630, -2147483646, 5 ) );
+
+// low > 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--
+<?php
+$a = array(1,2,3);
+$b = array('a'=>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--
+<?php
+
+$a1 = array( 'key1' => 1, 'key3' => 2 );
+$a2 = array();
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+unset( $a1, $a2 );
+
+$a1 = array();
+$a2 = array( 'key1' => 1, 'key3' => 2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+unset( $a1, $a2 );
+
+$a1 = array();
+$a2 = array( 'key1' => &$a1 );
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+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--
+<?php
+
+$test = array(
+ 'a' => '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--
+<?php
+
+function key_compare_func($a, $b)
+{
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b)? 1:-1;
+}
+
+$array1 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red');
+$array2 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red');
+
+$result = array_diff_uassoc($array1, $array2, "key_compare_func");
+print_r($result);
+
+?>
+--EXPECT--
+Array
+(
+)
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--
+<?php
+
+// Bug #42850
+$data = array ('key1' => 'val1', array('key2' => 'val2'));
+function apply_dumb($item, $key) {};
+var_dump($data);
+array_walk_recursive($data, 'apply_dumb');
+$data2 = $data;
+$data2[0] = 'altered';
+var_dump($data);
+var_dump($data2);
+
+// Bug #34982
+function myfunc($data) {
+ array_walk_recursive($data, 'apply_changed');
+}
+function apply_changed(&$input, $key) {
+ $input = 'changed';
+}
+myfunc($data);
+var_dump($data);
+
+--EXPECT--
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ array(1) {
+ ["key2"]=>
+ string(4) "val2"
+ }
+}
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ array(1) {
+ ["key2"]=>
+ string(4) "val2"
+ }
+}
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ string(7) "altered"
+}
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ array(1) {
+ ["key2"]=>
+ string(4) "val2"
+ }
+}
diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt
new file mode 100644
index 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--
+<?php
+$a=array("key1"=>array("key2"=>array()));
+$a["key1"]["key2"]["key3"]=&$a;
+
+$b=array("key1"=>array("key2"=>array()));
+$b["key1"]["key2"]["key3"]=&$b;
+
+array_merge_recursive($a,$b);
+
+/* Break recursion */
+$a["key1"]["key2"]["key3"] = null;
+$b["key1"]["key2"]["key3"] = null;
+
+echo "Done.\n";
+?>
+--EXPECTF--
+Warning: array_merge_recursive(): recursion detected in %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--
+<?php if (!extension_loaded('spl')) die("skip SPL is not available"); ?>
+--FILE--
+<?php
+class Test implements Countable {
+ public function count() {
+ return $some;
+ }
+}
+
+$obj = new Test();
+
+$a = array();
+$b =& $a['test'];
+var_dump($a);
+
+$t = count($obj);
+
+$a = array();
+$b =& $a['test'];
+var_dump($a);
+?>
+--EXPECT--
+array(1) {
+ ["test"]=>
+ &NULL
+}
+array(1) {
+ ["test"]=>
+ &NULL
+}
+
diff --git a/ext/standard/tests/array/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--
+<?php
+$arr = array(1, 2, 3, 4, 5, 6);
+
+var_dump(array_slice($arr, 0, (float)2));
+var_dump(array_slice($arr, 0, (int)2));
+?>
+--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--
+<?php
+$a = array('foo' => '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--
+<?php
+$a = array('foo' => '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--
+<?php
+$a = array(b'001',b'008',b'005',b'00011',b'03',b'000014',b'-123',b'0.002',b'00',b'0',b'0_0',b'0-0');
+natsort($a);
+var_dump($a);
+?>
+--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--
+<?php
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+ static function comp_func_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--
+<?php
+$foo = array('foo' => 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--
+<?php
+$a = range(0, 100);
+$a1 = array_rand($a, count($a));
+$a2 = array_rand($a, count($a));
+$a3 = array_rand($a, count($a));
+$a4 = array_rand($a, count($a));
+
+var_dump($a1 === $a2 && $a1 === $a3 && $a1 === $a4);
+
+?>
+--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--
+<?php
+var_dump(array_product(array()));
+?>
+--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--
+<?php
+
+$array1 = array(
+ 'friends' => 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--
+<?php
+
+$data = array(
+ 'bar-bazbazbaz.' => 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--
+<?php
+
+$data = array(
+ 'bar-bazbazbaz.',
+ 'bar-bazbazbaz-',
+ 'foo'
+);
+usort($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
+(
+ [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--
+<?php
+
+$data = array(
+ 'bar-bazbazbaz.',
+ 'bar-bazbazbaz-',
+ 'foo'
+);
+uasort($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
+(
+ [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--
+<?php
+function walk($element, $key, $p) {
+ $backtrace = debug_backtrace();
+ echo "$element\n";
+}
+
+$a = array(1,2,3,4,5,6,7,8,9,10);
+array_walk($a, 'walk', 'testthis');
+?>
+--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--
+<?php
+
+$aArray = array ( -1 => '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--
+<?php
+$array = array("hello", array("world"));
+$userdata = array();
+array_walk_recursive(
+ $array,
+ function ($value, $key, &$userdata) { },
+ $userdata
+);
+echo "Done";
+?>
+--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--
+<?php
+foreach (range(90, 100, .1) as $i => $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--
+<?php
+array_fill(PHP_INT_MAX, 2, '*');
+?>
+--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--
+<?php
+$myArray = array_fill(0, 10, 1);
+
+array_walk(
+ $myArray,
+ function($value, $key) use ($myArray)
+ {
+ reset($myArray);
+ }
+);
+
+array_walk(
+ $myArray,
+ function($value, $key) use (&$myArray)
+ {
+ var_dump($key);
+ unset($myArray[$key]);
+ unset($myArray[$key+1]);
+ unset($myArray[$key+2]);
+ }
+);
+
+
+
+print_r($myArray);
+--EXPECT--
+int(0)
+int(4)
+int(8)
+Array
+(
+ [3] => 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--
+<?php
+
+$çity = "San Francisco";
+$state = "CA";
+$event = "SIGGRAPH";
+
+$location_vars = array("c\u0327ity", "state");
+
+$result = compact("event", $location_vars);
+var_dump($result);
+?>
+--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--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+ * Description: Creates a hash containing variables and their values
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality
+ */
+
+echo "*** Testing compact() : basic functionality ***\n";
+
+$a=1;
+$b=0.2;
+$c=true;
+$d=array("key"=>"val");
+$e=NULL;
+$f="string";
+
+// simple array test
+var_dump (compact(array("a", "b", "c", "d", "e", "f")));
+// simple parameter test
+var_dump (compact("a", "b", "c", "d", "e", "f"));
+var_dump (compact(array("keyval"=>"a", "b"=>"b", "c"=>1)));
+
+// cases which should not yield any output.
+var_dump (compact(array(10, 0.3, true, array(20), NULL)));
+var_dump (compact(10, 0.3, true, array(20), NULL));
+var_dump (compact(array("g")));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing compact() : basic functionality ***
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(0.2)
+ ["c"]=>
+ bool(true)
+ ["d"]=>
+ array(1) {
+ ["key"]=>
+ string(3) "val"
+ }
+ ["e"]=>
+ NULL
+ ["f"]=>
+ string(6) "string"
+}
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(0.2)
+ ["c"]=>
+ bool(true)
+ ["d"]=>
+ array(1) {
+ ["key"]=>
+ string(3) "val"
+ }
+ ["e"]=>
+ NULL
+ ["f"]=>
+ string(6) "string"
+}
+array(2) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(0.2)
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/compact_error.phpt b/ext/standard/tests/array/compact_error.phpt
new file mode 100644
index 0000000..a7ef545
--- /dev/null
+++ b/ext/standard/tests/array/compact_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test compact() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+ * Description: Creates a hash containing variables and their values
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Error -tests test compact with zero arguments.
+ */
+
+echo "*** Testing compact() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing compact() function with Zero arguments --\n";
+var_dump( compact() );
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing compact() : error conditions ***
+
+-- Testing compact() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+* Description: Creates a hash containing variables and their values
+* Source code: ext/standard/array.c
+* Alias to functions:
+*/
+/*
+* compact variations - arrays with references
+*/
+echo "*** Testing compact() : usage variations - arrays containg references ***\n";
+$a = 1;
+$b = 2;
+$c = 3;
+$string = "c";
+$arr1 = array("a", &$arr1);
+$arr2 = array("a", array(array(array("b"))));
+$arr2[1][0][0][] = &$arr2;
+$arr2[1][0][0][] = &$arr2[1];
+$arr3 = array(&$string);
+var_dump(compact($arr1));
+var_dump(compact($arr2));
+var_dump(compact($arr3));
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+* Description: Creates a hash containing variables and their values
+* Source code: ext/standard/array.c
+* Alias to functions:
+*/
+echo "*** Testing compact() : usage variations - variables outside of current scope ***\n";
+
+$a = 'main.a';
+$b = 'main.b';
+
+function f() {
+ $b = 'f.b';
+ $c = 'f.c';
+ var_dump(compact('a','b','c'));
+ var_dump(compact(array('a','b','c')));
+}
+
+f();
+
+?>
+==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 @@
+<?php
+
+function compare_function($var1, $var2) {
+ if ($var1 == $var2) {
+ return 0;
+ } else if ($var1 < $var2) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+?> \ 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--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of count() using an array as $var argument
+ * and different values as $mode argument.
+ */
+
+echo "*** Testing count() : basic functionality ***\n";
+
+echo "\n-- One Dimensional Array: --\n";
+$array = array('zero', 'one', 'two');
+var_dump(count($array));
+
+echo "\n-- Two Dimensional Array: --\n";
+$array_multi = array('zero', array(1, 2, 3), 'two');
+echo "\$mode = COUNT_NORMAL: ";
+var_dump(count($array_multi, COUNT_NORMAL));
+echo "\$mode = 0: ";
+var_dump(count($array_multi, 0));
+echo "\$mode = COUNT_RECURSIVE: ";
+var_dump(count($array_multi, COUNT_RECURSIVE));
+echo "\$mode = 1: ";
+var_dump(count($array_multi, 1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : basic functionality ***
+
+-- One Dimensional Array: --
+int(3)
+
+-- Two Dimensional Array: --
+$mode = COUNT_NORMAL: int(3)
+$mode = 0: int(3)
+$mode = COUNT_RECURSIVE: int(6)
+$mode = 1: int(6)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_error.phpt b/ext/standard/tests/array/count_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int count(mixed var [, int mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to count() to test behaviour
+ */
+
+echo "*** Testing count() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing count() function with Zero arguments --\n";
+var_dump( count() );
+
+//Test count with one more than the expected number of arguments
+echo "\n-- Testing count() function with more than expected no. of arguments --\n";
+$var = 1;
+$mode = 10;
+$extra_arg = 10;
+var_dump( count($var, $mode, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : error conditions ***
+
+-- Testing count() function with Zero arguments --
+
+Warning: count() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing count() function with more than expected no. of arguments --
+
+Warning: count() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_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--
+<?php if (!extension_loaded("spl")) die("skip no SPL extension"); ?>
+--FILE--
+<?php
+/* Prototype: int count ( mixed $var [, int $mode] );
+ Discription: Count elements in an array, or properties in an object
+*/
+
+echo "*** Testing basic functionality of count() function ***\n";
+print "-- Testing NULL --\n";
+$arr = NULL;
+print "COUNT_NORMAL: should be 0, is ".count($arr, COUNT_NORMAL)."\n";
+print "COUNT_RECURSIVE: should be 0, is ".count($arr, COUNT_RECURSIVE)."\n";
+
+print "-- Testing arrays --\n";
+$arr = array(1, array(3, 4, array(6, array(8))));
+print "COUNT_NORMAL: should be 2, is ".count($arr, COUNT_NORMAL)."\n";
+print "COUNT_RECURSIVE: should be 8, is ".count($arr, COUNT_RECURSIVE)."\n";
+
+print "-- Testing hashes --\n";
+$arr = array("a" => 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--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * aPass different data types as $var argument to count() to test behaviour
+ */
+
+echo "*** Testing count() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $var argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( count($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : usage variations ***
+
+-- Iteration 1 --
+int(1)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(1)
+
+-- Iteration 5 --
+int(1)
+
+-- Iteration 6 --
+int(1)
+
+-- Iteration 7 --
+int(1)
+
+-- Iteration 8 --
+int(1)
+
+-- Iteration 9 --
+int(1)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(1)
+
+-- Iteration 18 --
+int(1)
+
+-- Iteration 19 --
+int(1)
+
+-- Iteration 20 --
+int(1)
+
+-- Iteration 21 --
+int(1)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(1)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_variation2.phpt b/ext/standard/tests/array/count_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $mode argument to count() to test behaviour
+ */
+
+echo "*** Testing count() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$var = array(1, 2, array ('one', 'two'));
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $mode argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( count($var, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : usage variations ***
+
+-- Iteration 1 --
+int(3)
+
+-- Iteration 2 --
+int(5)
+
+-- Iteration 3 --
+int(3)
+
+-- Iteration 4 --
+int(3)
+
+-- Iteration 5 --
+int(3)
+
+-- Iteration 6 --
+int(3)
+
+-- Iteration 7 --
+int(3)
+
+-- Iteration 8 --
+int(3)
+
+-- Iteration 9 --
+int(3)
+
+-- Iteration 10 --
+int(3)
+
+-- Iteration 11 --
+int(3)
+
+-- Iteration 12 --
+int(5)
+
+-- Iteration 13 --
+int(3)
+
+-- Iteration 14 --
+int(5)
+
+-- Iteration 15 --
+int(3)
+
+-- Iteration 16 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: count() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+int(3)
+
+-- Iteration 23 --
+int(3)
+
+-- Iteration 24 --
+
+Warning: count() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_variation3.phpt b/ext/standard/tests/array/count_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass count() an infinitely recursive array as $var argument
+ * This will stop the script before it reaches the end.
+ */
+
+echo "*** Testing count() : usage variations ***\n";
+
+$array1 = array (1, 2, 'three');
+// get an infinitely recursive array
+$array1[] = &$array1;
+
+echo "\n-- \$mode not set: --\n";
+var_dump(count ($array1));
+
+echo "\n-- \$mode = 1: --\n";
+var_dump(count ($array1, 1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : usage variations ***
+
+-- $mode not set: --
+int(4)
+
+-- $mode = 1: --
+
+Warning: count(): recursion detected in %s on line %d
+int(12)
+Done
diff --git a/ext/standard/tests/array/current_basic.phpt b/ext/standard/tests/array/current_basic.phpt
new file mode 100644
index 0000000..cec6959
--- /dev/null
+++ b/ext/standard/tests/array/current_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test current() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of current()
+ */
+
+echo "*** Testing current() : basic functionality ***\n";
+
+$array = array ('zero', 'one', 'two', 'three' => 3);
+var_dump(current($array));
+next($array);
+var_dump(current($array));
+end($array);
+var_dump(current($array));
+next($array);
+var_dump(current($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : basic functionality ***
+string(4) "zero"
+string(3) "one"
+int(3)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/current_error.phpt b/ext/standard/tests/array/current_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Pass incorrect number of arguments to current() to test behaviour
+ */
+
+echo "*** Testing current() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing current() function with Zero arguments --\n";
+var_dump( current() );
+
+//Test current with one more than the expected number of arguments
+echo "\n-- Testing current() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( current($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : error conditions ***
+
+-- Testing current() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Pass different data types as $array_arg argument to current() to test behaviour
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ var $var1;
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of current()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( current($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: current() 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--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Pass arrays of different data types as $array_arg to current() to test behaviour
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// arrays of different data types to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of current()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ var_dump( current($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Iteration 1 : int data --
+int(0)
+
+-- Iteration 2 : float data --
+float(10.5)
+
+-- Iteration 3 : null data --
+NULL
+
+-- Iteration 4 : bool data --
+bool(true)
+
+-- Iteration 5 : empty string data --
+string(0) ""
+
+-- Iteration 6 : empty array data --
+bool(false)
+
+-- Iteration 7 : string data --
+string(6) "string"
+
+-- Iteration 8 : object data --
+object(classA)#%d (0) {
+}
+
+-- Iteration 9 : undefined data --
+NULL
+
+-- Iteration 10 : unset data --
+NULL
+
+-- Iteration 11 : resource data --
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/array/current_variation3.phpt b/ext/standard/tests/array/current_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Test how the internal pointer is affected when two variables are referenced to each other
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(current($array1));
+next($array1);
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+echo "\n-- Position after calling next() --\n";
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Initial position of internal pointer --
+string(4) "zero"
+
+-- Position after calling next() --
+$array1: string(3) "one"
+$array2: string(3) "one"
+===DONE===
diff --git a/ext/standard/tests/array/current_variation4.phpt b/ext/standard/tests/array/current_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Test how current() behaves with muti-dimensional and recursive arrays
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+echo "\n-- Two Dimensional Array --\n";
+$multi_array = array ('zero', array (1, 2, 3), 'two');
+echo "Initial Position: ";
+var_dump(current($multi_array));
+
+echo "Next Position: ";
+next($multi_array);
+var_dump(current($multi_array));
+
+echo "End Position: ";
+end($multi_array);
+var_dump(current($multi_array));
+
+echo "\n-- Access an Array Within an Array --\n";
+//accessing an array within an array
+echo "Initial Position: ";
+var_dump(current($multi_array[1]));
+
+echo "\n-- Recursive, Multidimensional Array --\n";
+//create a recursive array
+$multi_array[] = &$multi_array;
+
+//See where internal pointer is after adding more elements
+echo "Current Position: ";
+var_dump(current($multi_array));
+
+//see if internal pointer is in same position as referenced array
+var_dump(current($multi_array[3][3][3]));
+// see if internal pointer is in the same position from when accessing this inner array
+var_dump(current($multi_array[3][3][3][1]));
+?>
+===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--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+echo "\n-- Function: reference parameter --\n";
+
+function current_variation5_ref(&$a)
+{
+ var_dump(current($a));
+ var_dump(next($a));
+}
+
+$a = array('yes', 'maybe', 'no');
+
+var_dump(current($a));
+var_dump(next($a));
+current_variation5($a);
+
+echo "\n-- Function: normal parameter --\n";
+
+function current_variation5($a)
+{
+ var_dump(current($a));
+ var_dump(next($a));
+}
+
+$a = array('yes', 'maybe', 'no');
+
+var_dump(current($a));
+var_dump(next($a));
+current_variation5($a);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--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
+$tmp = pow(2,24);
+$data = array(
+ 'PHP',
+ 17=>'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
--- /dev/null
+++ b/ext/standard/tests/array/each.phpt
Binary files differ
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test basic functionality of each()
+ */
+
+echo "*** Testing each() : basic functionality ***\n";
+
+$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty');
+echo "\n-- Passed array: --\n";
+var_dump($arr);
+
+echo "\n-- Initial position: --\n";
+var_dump(each($arr));
+
+echo "\n-- End position: --\n";
+end($arr);
+var_dump(each($arr));
+
+echo "\n-- Passed the end of array: --\n";
+var_dump(each($arr));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing each() : basic functionality ***
+
+-- Passed array: --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ string(4) "deux"
+ [20]=>
+ string(6) "twenty"
+}
+
+-- Initial position: --
+array(4) {
+ [1]=>
+ int(1)
+ ["value"]=>
+ int(1)
+ [0]=>
+ string(3) "one"
+ ["key"]=>
+ string(3) "one"
+}
+
+-- End position: --
+array(4) {
+ [1]=>
+ string(6) "twenty"
+ ["value"]=>
+ string(6) "twenty"
+ [0]=>
+ int(20)
+ ["key"]=>
+ int(20)
+}
+
+-- Passed the end of array: --
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to each() to test behaviour
+ */
+
+echo "*** Testing each() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing each() function with Zero arguments --\n";
+var_dump( each() );
+
+//Test each with one more than the expected number of arguments
+echo "\n-- Testing each() function with more than expected no. of arguments --\n";
+$arr = array(1, 2);
+$extra_arg = 10;
+var_dump( each($arr, $extra_arg) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : error conditions ***
+
+-- Testing each() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass different data types as $arr arg to each() to test behaviour
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of each()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( each($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass arrays of different data types as $arr argument to each() to test behaviour
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// arrays of different data types to be passed as $arr
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of each()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( each($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [1]=>
+ int(0)
+ ["value"]=>
+ int(0)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 2: float data --
+array(4) {
+ [1]=>
+ float(10.5)
+ ["value"]=>
+ float(10.5)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 3: null data --
+array(4) {
+ [1]=>
+ NULL
+ ["value"]=>
+ NULL
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 4: bool data --
+array(4) {
+ [1]=>
+ bool(true)
+ ["value"]=>
+ bool(true)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 5: empty string data --
+array(4) {
+ [1]=>
+ string(0) ""
+ ["value"]=>
+ string(0) ""
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 6: empty array data --
+bool(false)
+
+-- Iteration 7: string data --
+array(4) {
+ [1]=>
+ string(6) "string"
+ ["value"]=>
+ string(6) "string"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 8: object data --
+array(4) {
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ ["value"]=>
+ object(classA)#%d (0) {
+ }
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 9: undefined data --
+array(4) {
+ [1]=>
+ NULL
+ ["value"]=>
+ NULL
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 10: unset data --
+array(4) {
+ [1]=>
+ NULL
+ ["value"]=>
+ NULL
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 11: resource data --
+array(4) {
+ [1]=>
+ resource(%d) of type (stream)
+ ["value"]=>
+ resource(%d) of type (stream)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass each() arrays where the keys are different data types to test behaviour
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed as $arr
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of each()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( each($input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 2: float data --
+array(4) {
+ [1]=>
+ string(8) "positive"
+ ["value"]=>
+ string(8) "positive"
+ [0]=>
+ int(10)
+ ["key"]=>
+ int(10)
+}
+
+-- Iteration 3: extreme floats data --
+array(4) {
+ [1]=>
+ string(5) "large"
+ ["value"]=>
+ string(5) "large"
+ [0]=>
+ int(12345678)
+ ["key"]=>
+ int(12345678)
+}
+
+-- Iteration 4: null uppercase data --
+array(4) {
+ [1]=>
+ string(6) "null 1"
+ ["value"]=>
+ string(6) "null 1"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 5: null lowercase data --
+array(4) {
+ [1]=>
+ string(6) "null 2"
+ ["value"]=>
+ string(6) "null 2"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 6: bool lowercase data --
+array(4) {
+ [1]=>
+ string(6) "lowert"
+ ["value"]=>
+ string(6) "lowert"
+ [0]=>
+ int(1)
+ ["key"]=>
+ int(1)
+}
+
+-- Iteration 7: bool uppercase data --
+array(4) {
+ [1]=>
+ string(6) "uppert"
+ ["value"]=>
+ string(6) "uppert"
+ [0]=>
+ int(1)
+ ["key"]=>
+ int(1)
+}
+
+-- Iteration 8: empty double quotes data --
+array(4) {
+ [1]=>
+ string(6) "emptyd"
+ ["value"]=>
+ string(6) "emptyd"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 9: empty single quotes data --
+array(4) {
+ [1]=>
+ string(6) "emptys"
+ ["value"]=>
+ string(6) "emptys"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 10: string data --
+array(4) {
+ [1]=>
+ string(7) "stringd"
+ ["value"]=>
+ string(7) "stringd"
+ [0]=>
+ string(7) "stringd"
+ ["key"]=>
+ string(7) "stringd"
+}
+
+-- Iteration 11: undefined data --
+array(4) {
+ [1]=>
+ string(9) "undefined"
+ ["value"]=>
+ string(9) "undefined"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 12: unset data --
+array(4) {
+ [1]=>
+ string(5) "unset"
+ ["value"]=>
+ string(5) "unset"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test behaviour of each() when:
+ * 1. Passed an array made up of referenced variables
+ * 2. Passed an array as $arr argument by reference
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+echo "\n-- Array made up of referenced variables: --\n";
+$val1 = 'foo';
+$val2 = 'bar';
+
+$arr1 = array('one' => &$val1, &$val2);
+
+echo "-- Call each until at the end of the array: --\n";
+var_dump( each($arr1) );
+var_dump( each($arr1) );
+var_dump( each($arr1) );
+
+echo "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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test behaviour of each() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+$arr = array ('zero',
+ array(1, 2, 3),
+ 'one' => 'un',
+ array('a', 'b', 'c')
+ );
+
+echo "\n-- Pass each() a two-dimensional array --\n";
+for ($i = 1; $i < count($arr); $i++) {
+ var_dump( each($arr) );
+}
+
+echo "\n-- Pass each() a sub-array --\n";
+var_dump( each($arr[2]));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Pass each() a two-dimensional array --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+array(4) {
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["value"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [0]=>
+ int(1)
+ ["key"]=>
+ int(1)
+}
+array(4) {
+ [1]=>
+ string(2) "un"
+ ["value"]=>
+ string(2) "un"
+ [0]=>
+ string(3) "one"
+ ["key"]=>
+ string(3) "one"
+}
+
+-- Pass each() a sub-array --
+array(4) {
+ [1]=>
+ string(1) "a"
+ ["value"]=>
+ string(1) "a"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test the position of the internal array pointer after a call to each()
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+$arr = array('zero', 'one', 'two', 'abc', 'xyz');
+
+echo "\n-- Current position: --\n";
+echo key($arr) . " => " . current($arr) . "\n";
+
+echo "\n-- Call to each(): --\n";
+var_dump( each($arr) );
+
+echo "\n-- New position: --\n";
+echo key($arr) . " => " . current($arr) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Current position: --
+0 => zero
+
+-- Call to each(): --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- New position: --
+1 => one
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/end.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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed end ( array &$array );
+ Description: Advances internal pointer of array to last element, and returns its value.
+*/
+
+$arrays = array (
+ array( 0 ),
+ range(1, 100 ),
+ range('a', 'z', 2 ),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ),
+ array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ),
+ array(1.0005, 2.000000, -3.000000, -4.9999999 ),
+ array(true, false),
+ array("PHP", "Web2.0", "SOA"),
+ array(1, array() ),
+ array(1, 2, "" ),
+ array(" "),
+ array(2147483647, 2147483648, -2147483647, -2147483648 ),
+ array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ),
+ array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 )
+);
+/* loop through $arrays to print the last element of each sub-array */
+echo "*** Testing end() on different arrays ***\n";
+$counter = 1;
+foreach ($arrays as $sub_array){
+ echo "-- Iteration $counter --\n";
+ var_dump( end($sub_array) );
+ /* ensure that internal pointer is moved to last element */
+ var_dump( current($sub_array) );
+ $counter++;
+}
+
+/* checking for end() on sub-arrays */
+echo "\n*** Testing end() with sub-arrays ***\n";
+$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") );
+var_dump( end($test_array) );
+var_dump( end($test_array[1]) );
+
+/* checking working of end() when array elements are deleted */
+echo "\n*** Testing end() when array elements are deleted ***\n";
+$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008");
+
+// remove first element from array
+echo "\n-- Remove first element from array --\n";
+unset($array_test[0]);
+var_dump( end($array_test) );
+
+// remove last element from array, rewind and check end()
+echo "\n-- Remove last element from array --\n";
+unset($array_test['-.008']);
+var_dump( end($array_test) );
+reset( $array_test );
+var_dump( end($array_test) );
+
+// remove any element !first, !last, rewind and check end()
+echo "\n-- Remove any element from array apart from first and last element --\n";
+unset($array_test[7]);
+var_dump( end($array_test) );
+var_dump( reset($array_test) );
+var_dump( end($array_test) );
+
+/* Checking on OBJECTS type */
+echo "\n*** Testing end() on objects ***\n";
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+class foo1
+{
+ function __toString() {
+ return "Object1";
+ }
+}
+
+$object1 = new foo(); //new object created
+$object2 = new foo1();
+
+$array_object = array();
+$array_object[0] = &$object1;
+$array_object[1] = &$object2;
+var_dump( end($array_object) );
+var_dump($array_object);
+
+/* Checking on RESOURCE type */
+echo "\n*** Testing end() on resource type ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array
+$resources = array($file_handle, $dir_handle);
+var_dump( end($resources) );
+var_dump( current($resources) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for unexpected number of arguments */
+var_dump( end() );
+var_dump( end($array[0], $array[0]) );
+
+/* checking for unexpected type of arguments */
+$var=1;
+$var1="string";
+var_dump( end($var) );
+var_dump( end($var1) );
+
+/* checking null array */
+$null_array = array();
+var_dump( end($null_array) );
+
+echo "Done\n";
+
+
+/* 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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed end ( array &$array );
+ Description: Advances internal pointer of array to last element, and returns its value.
+*/
+
+$arrays = array (
+ array( 0 ),
+ range(1, 100 ),
+ range('a', 'z', 2 ),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ),
+ array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ),
+ array(1.0005, 2.000000, -3.000000, -4.9999999 ),
+ array(true, false),
+ array("PHP", "Web2.0", "SOA"),
+ array(1, array() ),
+ array(1, 2, "" ),
+ array(" "),
+ array(2147483647, 2147483648, -2147483647, -2147483648 ),
+ array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ),
+ array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 )
+);
+/* loop through $arrays to print the last element of each sub-array */
+echo "*** Testing end() on different arrays ***\n";
+$counter = 1;
+foreach ($arrays as $sub_array){
+ echo "-- Iteration $counter --\n";
+ var_dump( end($sub_array) );
+ /* ensure that internal pointer is moved to last element */
+ var_dump( current($sub_array) );
+ $counter++;
+}
+
+/* checking for end() on sub-arrays */
+echo "\n*** Testing end() with sub-arrays ***\n";
+$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") );
+var_dump( end($test_array) );
+var_dump( end($test_array[1]) );
+
+/* checking working of end() when array elements are deleted */
+echo "\n*** Testing end() when array elements are deleted ***\n";
+$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008");
+
+// remove first element from array
+echo "\n-- Remove first element from array --\n";
+unset($array_test[0]);
+var_dump( end($array_test) );
+
+// remove last element from array, rewind and check end()
+echo "\n-- Remove last element from array --\n";
+unset($array_test['-.008']);
+var_dump( end($array_test) );
+reset( $array_test );
+var_dump( end($array_test) );
+
+// remove any element !first, !last, rewind and check end()
+echo "\n-- Remove any element from array apart from first and last element --\n";
+unset($array_test[7]);
+var_dump( end($array_test) );
+var_dump( reset($array_test) );
+var_dump( end($array_test) );
+
+/* Checking on OBJECTS type */
+echo "\n*** Testing end() on objects ***\n";
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+class foo1
+{
+ function __toString() {
+ return "Object1";
+ }
+}
+
+$object1 = new foo(); //new object created
+$object2 = new foo1();
+
+$array_object = array();
+$array_object[0] = &$object1;
+$array_object[1] = &$object2;
+var_dump( end($array_object) );
+var_dump($array_object);
+
+/* Checking on RESOURCE type */
+echo "\n*** Testing end() on resource type ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array
+$resources = array($file_handle, $dir_handle);
+var_dump( end($resources) );
+var_dump( current($resources) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for unexpected number of arguments */
+var_dump( end() );
+var_dump( end($array[0], $array[0]) );
+
+/* checking for unexpected type of arguments */
+$var=1;
+$var1="string";
+var_dump( end($var) );
+var_dump( end($var1) );
+
+/* checking null array */
+$null_array = array();
+var_dump( end($null_array) );
+
+echo "Done\n";
+
+?>
+
+--CLEAN--
+/* cleaning resource handles */
+fclose( $file_handle ); //file resource handle deleted
+closedir( $dir_handle ); //dir resource handle deleted
+
+--EXPECTF--
+*** Testing end() on different arrays ***
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(100)
+int(100)
+-- Iteration 3 --
+string(1) "y"
+string(1) "y"
+-- Iteration 4 --
+NULL
+NULL
+-- Iteration 5 --
+int(5)
+int(5)
+-- Iteration 6 --
+float(-0.9)
+float(-0.9)
+-- Iteration 7 --
+float(-4.9999999)
+float(-4.9999999)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+string(3) "SOA"
+string(3) "SOA"
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+string(0) ""
+string(0) ""
+-- Iteration 12 --
+string(1) " "
+string(1) " "
+-- Iteration 13 --
+int(-2147483648)
+int(-2147483648)
+-- Iteration 14 --
+int(-2147483648)
+int(-2147483648)
+-- Iteration 15 --
+float(2)
+float(2)
+
+*** Testing end() with sub-arrays ***
+array(3) {
+ [1]=>
+ string(3) "one"
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(1) "f"
+}
+string(1) "f"
+
+*** Testing end() when array elements are deleted ***
+
+-- Remove first element from array --
+string(7) "neg.008"
+
+-- Remove last element from array --
+int(-4)
+int(-4)
+
+-- Remove any element from array apart from first and last element --
+int(-4)
+string(1) "b"
+int(-4)
+
+*** Testing end() on objects ***
+object(foo1)#%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--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of end()
+ */
+
+echo "*** Testing end() : basic functionality ***\n";
+
+$array = array('zero', 'one', 200 => 'two');
+
+echo "\n-- Initial Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Call to end() --\n";
+var_dump(end($array));
+
+echo "\n-- Current Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Add a new element to array --\n";
+$array[2] = 'foo';
+var_dump(end($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : basic functionality ***
+
+-- Initial Position: --
+0 => zero
+
+-- Call to end() --
+string(3) "two"
+
+-- Current Position: --
+200 => two
+
+-- Add a new element to array --
+string(3) "foo"
+===DONE===
diff --git a/ext/standard/tests/array/end_error.phpt b/ext/standard/tests/array/end_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to end() to test behaviour
+ */
+
+echo "*** Testing end() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing end() function with Zero arguments --\n";
+var_dump( end() );
+
+//Test end with one more than the expected number of arguments
+echo "\n-- Testing end() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( end($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : error conditions ***
+
+-- Testing end() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg to test behaviour of end()
+ */
+
+echo "*** Testing end() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ var $foo = 'hello, world';
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of end()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( end($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: end() 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--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test end() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ * as $array_arg argument.
+ */
+
+echo "*** Testing end() : usage variations ***\n";
+
+$array_arg = array ('a' => 'z', array(9, 8, 7));
+
+echo "\n-- Pass a two-dimensional array as \$array_arg --\n";
+var_dump(end($array_arg));
+
+echo "\n-- Pass a sub-array as \$array_arg --\n";
+var_dump(end($array_arg[0]));
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : usage variations ***
+
+-- Pass a two-dimensional array as $array_arg --
+array(3) {
+ [0]=>
+ int(9)
+ [1]=>
+ int(8)
+ [2]=>
+ int(7)
+}
+
+-- Pass a sub-array as $array_arg --
+int(7)
+===DONE===
diff --git a/ext/standard/tests/array/end_variation3.phpt b/ext/standard/tests/array/end_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how the internal pointer is affected when two variables are referenced to each other
+ */
+
+echo "*** Testing end() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(current($array1));
+end($array1);
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+echo "\n-- Position after calling end() --\n";
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : usage variations ***
+
+-- Initial position of internal pointer --
+string(4) "zero"
+
+-- Position after calling end() --
+$array1: string(3) "two"
+$array2: string(3) "two"
+===DONE===
diff --git a/ext/standard/tests/array/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--
+<?php
+
+/* Testing Error Conditions */
+echo "*** Testing Error Conditions ***\n";
+
+/* Zero Arguments */
+var_dump( extract() );
+
+/* Invalid second argument ( only 0-6 is valid) */
+$arr = array(1);
+var_dump( extract($arr, -1 . "wddr") );
+var_dump( extract($arr, 7 , "wddr") );
+
+/* scalar argument */
+$val = 1;
+var_dump( extract($val) );
+
+/* string argument */
+$str = "test";
+var_dump( extract($str) );
+
+/* More than valid number of arguments i.e. 3 args */
+var_dump( extract($arr, EXTR_SKIP, "aa", "ee") );
+
+/* Two Arguments, second as prefix but without prefix string as third argument */
+var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
+
+echo "Done\n";
+?>
+
+--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--
+<?php
+$str = "John";
+debug_zval_dump($GLOBALS["str"]);
+
+/* Extracting Global Variables */
+$splat = array("foo" => "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--
+<?php
+
+$val = 4;
+$str = "John";
+
+debug_zval_dump($val);
+debug_zval_dump($str);
+
+/* Extracting Global Variables */
+var_dump(extract($GLOBALS, EXTR_REFS));
+debug_zval_dump($val);
+debug_zval_dump($str);
+
+echo "\nDone";
+?>
+
+--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--
+<?php
+$a = array('foo' => '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--
+<?php
+$a = array('foo' => '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--
+<?php
+
+/* various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "Two", "Three", "Four", "Five" ),
+);
+
+$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(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--
+<?php
+
+/* various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+);
+
+$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--
+<?php
+
+$mixed_array = array(
+ 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' ),
+);
+
+$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--
+<?php
+
+$mixed_array = array(
+ 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 )
+);
+
+$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--
+<?php
+
+/* EXTR_REFS as second Argument */
+$a = array ('foo' => '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--
+<?php
+
+/* EXTR_PREFIX_ALL called twice with same prefix string */
+echo "\n*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***\n";
+$a = array( "1" => "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--
+<?php
+
+/* To show variables with numerical prefixes cannot be extracted */
+$var["i"] = 1;
+$var["j"] = 2;
+$var["k"] = 3;
+echo "\n*** Testing for Numerical prefixes ***\n";
+var_dump(extract($var));
+
+$var1["m"] = 1;
+$var1[2] = 2;
+$var1[] = 3;
+var_dump ( extract($var1));
+
+echo "\nDone";
+?>
+
+--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--
+<?php
+/* Using Class and objects */
+echo "\n*** Testing for object ***\n";
+class classA
+{
+ public $v;
+}
+
+$A = new classA();
+var_dump ( extract(get_object_vars($A),EXTR_REFS));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+echo "\n*** Testing error conditions of in_array() ***\n";
+/* zero argument */
+var_dump( in_array() );
+
+/* unexpected no.of arguments in in_array() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( in_array(1, $var, 0, "test") );
+var_dump( in_array("test") );
+
+/* unexpected second argument in in_array() */
+$var="test";
+var_dump( in_array("test", $var) );
+var_dump( in_array(1, 123) );
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with different possible needle values */
+
+echo "*** Testing in_array() with different needle values ***\n";
+$arrays = array (
+ array(0),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
+ array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
+ array(TRUE, FALSE),
+ array("", array()),
+ array("abcd\x00abcd\x00abcd"),
+ array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
+);
+
+$array_compare = array (
+ 4,
+ "4",
+ 4.00,
+ "b",
+ "5",
+ -2,
+ -2.0,
+ -2.98989,
+ "-.9",
+ "True",
+ "",
+ array(),
+ NULL,
+ "ab",
+ "abcd",
+ 0.0,
+ -0,
+ "abcd\x00abcd\x00abcd"
+);
+/* loop to check if elements in $array_compare exist in $arrays
+ using in_array() */
+$counter = 1;
+foreach($arrays as $array) {
+ foreach($array_compare as $compare) {
+ echo "-- Iteration $counter --\n";
+ //strict option OFF
+ var_dump(in_array($compare,$array));
+ //strict option ON
+ var_dump(in_array($compare,$array,TRUE));
+ //strict option OFF
+ var_dump(in_array($compare,$array,FALSE));
+ $counter++;
+ }
+}
+
+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--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with different possible haystack values */
+
+echo "*** Testing in_array() with different haystack values ***\n";
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using in_array();
+ checking PHP type comparison tables
+*/
+$counter = 1;
+foreach($array_type as $type) {
+ echo "-- Iteration $counter --\n";
+ //loose type checking
+ var_dump( in_array($type,$misc_array ) );
+ //strict type checking
+ var_dump( in_array($type,$misc_array,true) );
+ //loose type checking
+ var_dump( in_array($type,$misc_array,false) );
+ $counter++;
+}
+
+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--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with haystack as sub-array and object */
+
+/* checking for sub-arrays with in_array() */
+echo "*** Testing sub-arrays with in_array() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "two", "three" => 3),
+ 4 => "four",
+ "five" => 5,
+ array('', 'i')
+);
+var_dump( in_array("four", $sub_array) );
+//checking for element in a sub-array
+var_dump( in_array(3, $sub_array[1]) );
+var_dump( in_array(array('','i'), $sub_array) );
+
+/* checking for objects in in_array() */
+echo "\n*** Testing objects with in_array() ***\n";
+class in_array_check {
+ public $array_var = array(1=>"one", "two"=>2, 3=>3);
+ public function foo() {
+ echo "Public function\n";
+ }
+}
+
+$in_array_obj = new in_array_check(); //creating new object
+//error: as wrong datatype for second argument
+var_dump( in_array("array_var", $in_array_obj) );
+//error: as wrong datatype for second argument
+var_dump( in_array("foo", $in_array_obj) );
+//element found as "one" exists in array $array_var
+var_dump( in_array("one", $in_array_obj->array_var) );
+
+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--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with haystack as resouce and multidimentional arrays */
+
+/* checking for Resources */
+echo "*** Testing resource type with in_array() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( in_array($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( in_array((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with in_array() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( in_array("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( in_array("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( in_array(0, array("this")) );
+// false in strict mode
+var_dump( in_array(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( in_array("this", array(0)) );
+// false in stric mode
+var_dump( in_array("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( in_array(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( in_array('123abc', array(123)) );
+var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode
+
+echo "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--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of key()
+ */
+
+echo "*** Testing key() : basic functionality ***\n";
+
+$array = array ('zero', 99 => 'one', 'two', 'three' => 3);
+echo "\n-- Initial Position: --\n";
+var_dump(key($array));
+
+echo "\n-- Next Position: --\n";
+next($array);
+var_dump(key($array));
+
+echo "\n-- End Position: --\n";
+end($array);
+var_dump(key($array));
+
+echo "\n-- Past end of the array --\n";
+next($array);
+var_dump(key($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : basic functionality ***
+
+-- Initial Position: --
+int(0)
+
+-- Next Position: --
+int(99)
+
+-- End Position: --
+string(5) "three"
+
+-- Past end of the array --
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/key_error.phpt b/ext/standard/tests/array/key_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to key() to test behaviour
+ */
+
+echo "*** Testing key() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing key() function with Zero arguments --\n";
+var_dump( key() );
+
+//Test current with one more than the expected number of arguments
+echo "\n-- Testing key() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( key($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : error conditions ***
+
+-- Testing key() function with Zero arguments --
+
+Warning: 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--
+<?php
+echo "*** test key_exists() by calling it with its expected arguments ***\n";
+$a = array('bar' => 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--
+<?php
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$a = array('bar' => 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--
+<?php
+echo "*** test key_exists() by calling it with its expected arguments ***\n";
+$a = array('bar' => 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--
+<?php
+echo "*** test key_exists() by using mixed type of arrays ***\n";
+
+// there is not a index = 0 element
+$a = array(1 => '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--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to test behaviour of key()
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ var $var1;
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of key()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( key($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: key() 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--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where keys are different data types as $array_arg to key() to test behaviour
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed as $array_arg
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of key()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ while (key($input) !== NULL) {
+ var_dump(key($input));
+ next($input);
+ }
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Iteration 1 : int data --
+int(0)
+int(1)
+int(12345)
+int(-2345)
+
+-- Iteration 2 : float data --
+int(10)
+int(-10)
+int(0)
+
+-- Iteration 3 : extreme floats data --
+int(12345678)
+int(0)
+
+-- Iteration 4 : null uppercase data --
+string(0) ""
+
+-- Iteration 5 : null lowercase data --
+string(0) ""
+
+-- Iteration 6 : bool lowercase data --
+int(1)
+int(0)
+
+-- Iteration 7 : bool uppercase data --
+int(1)
+int(0)
+
+-- Iteration 8 : empty double quotes data --
+string(0) ""
+
+-- Iteration 9 : empty single quotes data --
+string(0) ""
+
+-- Iteration 10 : string data --
+string(7) "stringd"
+string(7) "strings"
+string(11) "hello world"
+
+-- Iteration 11 : undefined data --
+string(0) ""
+
+-- Iteration 12 : unset data --
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/array/key_variation3.phpt b/ext/standard/tests/array/key_variation3.phpt
new file mode 100644
index 0000000..a231917
--- /dev/null
+++ b/ext/standard/tests/array/key_variation3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test key() function : usage variations
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how the internal pointer is affected when two variables are referenced to each other
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(key($array1));
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+
+next($array1);
+
+echo "\n-- Position after calling next() --\n";
+echo "\$array1: ";
+var_dump(key($array1));
+echo "\$array2: ";
+var_dump(key($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Initial position of internal pointer --
+int(0)
+
+-- Position after calling next() --
+$array1: int(1)
+$array2: int(1)
+===DONE===
diff --git a/ext/standard/tests/array/key_variation4.phpt b/ext/standard/tests/array/key_variation4.phpt
new file mode 100644
index 0000000..147d55a
--- /dev/null
+++ b/ext/standard/tests/array/key_variation4.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test key() function : usage variations
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how key() behaves with muti-dimensional and recursive arrays
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+echo "\n-- Two Dimensional Array --\n";
+$multi_array = array ('zero', array (1, 2, 3), 'two');
+echo "Initial Position: ";
+var_dump(key($multi_array));
+
+echo "Next Position: ";
+next($multi_array);
+var_dump(key($multi_array));
+
+echo "End Position: ";
+end($multi_array);
+var_dump(key($multi_array));
+
+echo "\n-- Access an Array Within an Array --\n";
+//accessing an array within an array
+echo "Initial Position: ";
+var_dump(key($multi_array[1]));
+
+echo "\n-- Recursive, Multidimensional Array --\n";
+//create a recursive array
+$multi_array[] = &$multi_array;
+
+//See where internal pointer is after adding more elements
+echo "Current Position: ";
+var_dump(key($multi_array));
+
+//see if internal pointer is in same position as referenced array
+var_dump(key($multi_array[3][3][3]));
+// see if internal pointer is in the same position from when accessing this inner array
+var_dump(key($multi_array[3][3][3][1]));
+?>
+===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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing array of integer/string values to check the basic functionality
+ * with following flag values :
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+ * 4.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing krsort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$unsorted_strings = array( "lemon" => "l", "orange" => "o", "banana" => "b" );
+$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--
+<?php
+/* Prototype : bool krsort(array &array_arg [, int asort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing krsort() function with all possible error conditions
+*/
+
+echo "*** Testing krsort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing krsort() function with zero arguments --\n";
+var_dump( krsort() );
+
+//Test krsort with more than the expected number of arguments
+echo "\n-- Testing krsort() function with more than expected no. of arguments --\n";
+$array_arg = array(1 => 1, 2 => 2);
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and call krsort with all possible sort flag values
+foreach($flags as $key => $flag){
+ echo "\n- Sort flag = $key -\n";
+ $temp_array = $array_arg;
+ var_dump( krsort($temp_array,$flag, $extra_arg) );
+ var_dump($temp_array);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing krsort() : error conditions ***
+
+-- Testing krsort() function with zero arguments --
+
+Warning: krsort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing krsort() function with more than expected no. of arguments --
+
+- Sort flag = SORT_REGULAR -
+
+Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_STRING -
+
+Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_NUMERIC -
+
+Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_object.phpt b/ext/standard/tests/array/krsort_object.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+/*
+ * testing krsort() by providing array of integer/string objects with following flag values:
+ * 1.Defualt flag value
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing krsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class Integer
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+}
+
+// class declaration for string objects
+class String
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects with different key values
+$unsorted_int_obj = array (
+ 10 => new Integer(11), 20 => new Integer(66),
+ 3 => new Integer(23), 4 => new Integer(-5),
+ 50 => new Integer(0.001), 6 => new Integer(0)
+);
+
+// array of string objects with different key values
+$unsorted_str_obj = array (
+ "axx" => new String("axx"), "t" => new String("t"),
+ "w" => new String("w"), "py" => new String("py"),
+ "apple" => new String("apple"), "Orange" => new String("Orange"),
+ "Lemon" => new String("Lemon"), "aPPle" => new String("aPPle")
+);
+
+
+echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing krsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(krsort($temp_array) );
+var_dump($temp_array);
+
+// testing krsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(krsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing krsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(krsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing krsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(krsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : object functionality ***
+
+-- Testing krsort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(6) {
+ [50]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [20]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [10]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [6]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [4]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [3]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+}
+bool(true)
+array(8) {
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+
+-- Testing krsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(6) {
+ [50]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [20]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [10]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [6]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [4]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [3]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+}
+bool(true)
+array(8) {
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation1.phpt b/ext/standard/tests/array/krsort_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing different unexpected values for array argument
+ * with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+ * 4.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+$unexpected_values = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e3,
+ 10.6E-2,
+ 0.5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*15*/ "",
+ '',
+
+ // string data
+/*17*/ "string",
+ 'string',
+
+ // object data
+/*19*/ new stdclass(),
+
+ // undefined data
+/*20*/ @undefined_var,
+
+ // unset data
+/*21*/ @unset_var,
+
+ // resource variable
+/*22*/ $fp
+);
+
+// loop though each element of the array and check the working of krsort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing krsort() by supplying different unexpected values for 'array' argument --\n";
+echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ var_dump( krsort($value) ); // expecting : bool(false)
+ var_dump( krsort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( krsort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( krsort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/krsort_variation10.phpt b/ext/standard/tests/array/krsort_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of heredoc strings for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// Different heredoc strings to be sorted
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+$array = array (
+ $simple_heredoc1 => "Heredoc",
+ $simple_heredoc2 => "HEREDOC",
+ $multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!"
+);
+
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --\n";
+$temp_array = $array;
+var_dump(krsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $array;
+var_dump(krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_STRING --\n";
+$temp_array = $array;
+var_dump(krsort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+}
+
+-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+}
+
+-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation11.phpt b/ext/standard/tests/array/krsort_variation11.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of boolean values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is defualt --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/krsort_variation2.phpt b/ext/standard/tests/array/krsort_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// an array for checking unexpected behavior
+$unsorted_values = array(10 => 10, 2 => 2, 45 => 45);
+
+//array of unexpected values to iterate over
+$unexpected_values = array (
+
+ // int data
+/*1*/ -2345,
+
+ // float data
+/*2*/ 10.5,
+ -10.5,
+ 10.5e2,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*7*/ NULL,
+ null,
+
+ // boolean data
+/*9*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*13*/ "",
+ '',
+
+ // string data
+/*15*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var,
+
+ // resource variable
+/*19*/ $fp
+
+);
+
+// loop though each element of the array and check the working of krsort()
+// when 'sort_flags' arugment is supplied with different values
+echo "\n-- Testing krsort() by supplying different unexpected values for 'sort_flags' argument --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ $temp_array = $unsorted_values;
+ var_dump( krsort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing array of integer/float/mixed values for $array argument
+ * with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// diff. associative arrays to sort
+$various_arrays = array(
+ // negative/posative integer key value array
+ array(1 => 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41),
+
+ // float key values
+ array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1),
+
+ // mixed value array with different types of keys
+ array(1 => .0001, 2 => .0021, -3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, -8 => -.9, 9 => 10.6E-2,
+ -10 => -10.6E-2, 11 => 33)
+);
+
+// set of possible flag values
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing krsort() by supplying various integer/float arrays --\n";
+
+// loop through to test krsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flags array and call krsort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [7]=>
+ int(0)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [-2]=>
+ int(-11)
+ [-4]=>
+ int(-21)
+ [-6]=>
+ int(-31)
+ [-10]=>
+ int(-41)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [7]=>
+ int(0)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [-2]=>
+ int(-11)
+ [-4]=>
+ int(-21)
+ [-6]=>
+ int(-31)
+ [-10]=>
+ int(-41)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [7]=>
+ int(0)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [-2]=>
+ int(-11)
+ [-4]=>
+ int(-21)
+ [-6]=>
+ int(-31)
+ [-10]=>
+ int(-41)
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [0]=>
+ float(0.5)
+ [-7]=>
+ float(-0.1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [0]=>
+ float(0.5)
+ [-7]=>
+ float(-0.1)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(6) {
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [0]=>
+ float(0.5)
+ [-7]=>
+ float(-0.1)
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [6]=>
+ float(0.09)
+ [5]=>
+ int(0)
+ [4]=>
+ int(-1)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [-3]=>
+ float(-0.01)
+ [-8]=>
+ float(-0.9)
+ [-10]=>
+ float(-0.106)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [6]=>
+ float(0.09)
+ [5]=>
+ int(0)
+ [4]=>
+ int(-1)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [-3]=>
+ float(-0.01)
+ [-8]=>
+ float(-0.9)
+ [-10]=>
+ float(-0.106)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [6]=>
+ float(0.09)
+ [5]=>
+ int(0)
+ [4]=>
+ int(-1)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [-3]=>
+ float(-0.01)
+ [-8]=>
+ float(-0.9)
+ [-10]=>
+ float(-0.106)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation4.phpt b/ext/standard/tests/array/krsort_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of octal values for $array argument
+ * with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01, 0321 => 02, 0345 => 03, 066 => 04, 0772 => 05,
+ 077 => 06, -066 => -01, -0345 => -02, 0 => 0
+);
+
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( krsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( krsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [669]=>
+ int(1)
+ [506]=>
+ int(5)
+ [229]=>
+ int(3)
+ [209]=>
+ int(2)
+ [63]=>
+ int(6)
+ [54]=>
+ int(4)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-1)
+ [-229]=>
+ int(-2)
+}
+
+-- Testing krsort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [669]=>
+ int(1)
+ [506]=>
+ int(5)
+ [229]=>
+ int(3)
+ [209]=>
+ int(2)
+ [63]=>
+ int(6)
+ [54]=>
+ int(4)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-1)
+ [-229]=>
+ int(-2)
+}
+
+-- Testing krsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [669]=>
+ int(1)
+ [506]=>
+ int(5)
+ [229]=>
+ int(3)
+ [209]=>
+ int(2)
+ [63]=>
+ int(6)
+ [54]=>
+ int(4)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-1)
+ [-229]=>
+ int(-2)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation5.phpt b/ext/standard/tests/array/krsort_variation5.phpt
new file mode 100644
index 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of string values for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+$various_arrays = array (
+ // diff. escape sequence chars with key values
+ array ( null => null, NULL => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e",
+ "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh",
+ "\ddd" => "\ddd", "\v" => "\v"
+ ),
+
+ // array containing different strings with key values
+ array ( 'Lemon' => "lemoN", 'o' => "Orange", 'B' => "banana", 'Apple' => "apple", 'te' => "Test",
+ 't' => "TTTT", 'T' => "ttt", 'W' => "ww", 'X' => "x", 'x' => "X", 'O' => "oraNGe",
+ 'B' => "BANANA"
+ )
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+echo "\n-- Testing krsort() by supplying various string arrays --\n";
+
+// loop through to test krsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and call krsort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of hexa-decimal values for $array argument
+ * with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// an array containing unsorted hexadecimal values with keys
+$unsorted_hex_array = array (
+ 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB,
+ 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
+);
+
+echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(krsort( $temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(krsort( $temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(krsort( $temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation7.phpt b/ext/standard/tests/array/krsort_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing arrays contains sub arrays for $array argument
+ * with flowing flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// array with diff sub arrays to be sorted
+$various_arrays = array (
+ // null array
+ 1 => array(),
+
+ // array contains null sub array
+ 2 => array( 1 => array() ),
+
+ // array of arrays along with some values
+ 3 => array(4 => 44, 1 => 11, 3 => array(64,61) ),
+
+ // array contains sub arrays
+ 4 => array ( 3 => array(33,-5,6), 1 => array(11),
+ 2 => array(22,-55), 0 => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing krsort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test krsort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various arrays containing sub arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(0) {
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(1) {
+ [1]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ [1]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [4]=>
+ int(44)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(11)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [4]=>
+ int(44)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(11)
+}
+
+-- Iteration 4 --
+- With defualt sort flag -
+bool(true)
+array(4) {
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [0]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [0]=>
+ array(0) {
+ }
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation8.phpt b/ext/standard/tests/array/krsort_variation8.phpt
new file mode 100644
index 0000000..20276ad
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/array/krsort_variation9.phpt b/ext/standard/tests/array/krsort_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing arrays with/without key values for $array argument
+ * with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// list of arrays with/without key values
+$various_arrays = array (
+ array(5 => 55, 66, 22, 33, 11),
+ array ("a" => "orange", "banana", "c" => "apple"),
+ array(1, 2, 3, 4, 5, 6),
+ array("first", 5 => "second", 1 => "third"),
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ array('bar' => 'baz', "foo" => 1),
+ array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
+);
+
+$count = 1;
+echo "\n-- Testing krsort() by supplying various arrays with/without key values --\n";
+
+// loop through to test krsort() with different arrays,
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various arrays with/without key values --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(5) {
+ [9]=>
+ int(11)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [9]=>
+ int(11)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ ["c"]=>
+ string(5) "apple"
+ [0]=>
+ string(6) "banana"
+ ["a"]=>
+ string(6) "orange"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["c"]=>
+ string(5) "apple"
+ [0]=>
+ string(6) "banana"
+ ["a"]=>
+ string(6) "orange"
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 4 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [5]=>
+ string(6) "second"
+ [1]=>
+ string(5) "third"
+ [0]=>
+ string(5) "first"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [5]=>
+ string(6) "second"
+ [1]=>
+ string(5) "third"
+ [0]=>
+ string(5) "first"
+}
+
+-- Iteration 5 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [8]=>
+ int(1)
+ [4]=>
+ int(1)
+ [3]=>
+ int(13)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [8]=>
+ int(1)
+ [4]=>
+ int(1)
+ [3]=>
+ int(13)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 6 --
+- With defualt sort flag -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+
+-- Iteration 7 --
+- With defualt sort flag -
+bool(true)
+array(4) {
+ ["d"]=>
+ int(5)
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["a"]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["d"]=>
+ int(5)
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["a"]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_basic.phpt b/ext/standard/tests/array/ksort_basic.phpt
new file mode 100644
index 0000000..dd9f7a2
--- /dev/null
+++ b/ext/standard/tests/array/ksort_basic.phpt
@@ -0,0 +1,243 @@
+--TEST--
+Test ksort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing array of integer/string values to check the basic functionality with following flag values :
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+ * 4.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$unsorted_strings = array(
+ "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 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--
+<?php
+/* Prototype : bool ksort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing ksort() function with all possible error conditions
+*/
+
+echo "*** Testing ksort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ksort() function with Zero arguments --\n";
+var_dump( ksort() );
+
+//Test ksort with more than the expected number of arguments
+echo "\n-- Testing ksort() function with more than expected no. of arguments --\n";
+$array_arg = array(1 => 1, 2 => 2);
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and call krsort with all possible sort flag values
+foreach($flag_value as $key => $flag){
+ echo "\n- Sort flag = $key -\n";
+ $temp_array = $array_arg;
+ var_dump( ksort($temp_array,$flag, $extra_arg) );
+ var_dump( $temp_array);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ksort() : error conditions ***
+
+-- Testing ksort() function with Zero arguments --
+
+Warning: ksort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing ksort() function with more than expected no. of arguments --
+
+- Sort flag = SORT_REGULAR -
+
+Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_STRING -
+
+Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_NUMERIC -
+
+Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_object.phpt b/ext/standard/tests/array/ksort_object.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+/*
+ * testing ksort() by providing array ofinteger/string objects with following flag values:
+ * 1.SORT_NUMERIC - compare items numerically
+ * 2.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : object functionality ***\n";
+
+// class declaration for integer objects
+class Integer
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class String
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 11 => new Integer(11), 66 => new Integer(66),
+ 23 => new Integer(23), -5 => new Integer(-5),
+ 1 => new Integer(0.001), 0 => new Integer(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "axx" => new String("axx"), "t" => new String("t"),
+ "w" => new String("w"), "py" => new String("py"),
+ "apple" => new String("apple"), "Orange" => new String("Orange"),
+ "Lemon" => new String("Lemon"), "aPPle" => new String("aPPle")
+);
+echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing ksort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(ksort($temp_array) );
+var_dump($temp_array);
+
+// testing ksort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(ksort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing ksort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(ksort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing ksort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(ksort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : object functionality ***
+
+-- Testing ksort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(6) {
+ [-5]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [0]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [1]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [11]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [23]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [66]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+
+-- Testing ksort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(6) {
+ [-5]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [0]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [1]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [11]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [23]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [66]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation1.phpt b/ext/standard/tests/array/ksort_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort(array &array [, int sort_flags])
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing different unexpected values for array argument with following flag values:
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+$unexpected_values = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e3,
+ 10.6E-2,
+ 0.5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*15*/ "",
+ '',
+
+ // string data
+/*17*/ "string",
+ 'string',
+
+ // object data
+/*19*/ new stdclass(),
+
+ // undefined data
+/*20*/ @undefined_var,
+
+ // unset data
+/*21*/ @unset_var,
+
+ // resource variable
+/*22*/ $fp
+
+);
+
+// loop though each element of the array and check the working of ksort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing ksort() by supplying different unexpected values for 'array' argument --\n";
+echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ var_dump( ksort($value) ); // expecting : bool(false)
+ var_dump( ksort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( ksort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( ksort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/ksort_variation10.phpt b/ext/standard/tests/array/ksort_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of octal values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01, 0321 => 02, 0345 => 03, 066 => 04, 0772 => 05,
+ 077 => 06, -066 => -01, -0345 => -02, 0 => 0
+);
+
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( ksort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( ksort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-2)
+ [-54]=>
+ int(-1)
+ [0]=>
+ int(0)
+ [54]=>
+ int(4)
+ [63]=>
+ int(6)
+ [209]=>
+ int(2)
+ [229]=>
+ int(3)
+ [506]=>
+ int(5)
+ [669]=>
+ int(1)
+}
+
+-- Testing ksort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-2)
+ [-54]=>
+ int(-1)
+ [0]=>
+ int(0)
+ [54]=>
+ int(4)
+ [63]=>
+ int(6)
+ [209]=>
+ int(2)
+ [229]=>
+ int(3)
+ [506]=>
+ int(5)
+ [669]=>
+ int(1)
+}
+
+-- Testing ksort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-2)
+ [-54]=>
+ int(-1)
+ [0]=>
+ int(0)
+ [54]=>
+ int(4)
+ [63]=>
+ int(6)
+ [209]=>
+ int(2)
+ [229]=>
+ int(3)
+ [506]=>
+ int(5)
+ [669]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation11.phpt b/ext/standard/tests/array/ksort_variation11.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of heredoc strings for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// Different heredoc strings to be sorted
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+$array = array (
+ $simple_heredoc1 => "Heredoc",
+ $simple_heredoc2 => "HEREDOC",
+ $multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!"
+);
+
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --\n";
+$temp_array = $array;
+var_dump(ksort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $array;
+var_dump(ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_STRING --\n";
+$temp_array = $array;
+var_dump(ksort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+
+-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+
+-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation2.phpt b/ext/standard/tests/array/ksort_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// an array for checking unexpected behavior
+$unsorted_values = array(10 => 10, 2 => 2, 45 => 45);
+
+//array of unexpected values to iterate over
+$unexpected_values = array (
+
+ // int data
+/*1*/ -2345,
+
+ // float data
+/*2*/ 10.5,
+ -10.5,
+ 10.5e2,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*7*/ NULL,
+ null,
+
+ // boolean data
+/*9*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*13*/ "",
+ '',
+
+ // string data
+/*15*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var,
+
+ // resource variable
+/*19*/ $fp
+
+);
+
+// loop though each element of the array and check the working of ksort()
+// when 'sort_flags' arugment is supplied with different values
+echo "\n-- Testing ksort() by supplying different unexpected values for 'sort_flags' argument --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ $temp_array = $unsorted_values;
+ var_dump( ksort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing array of integer/float/mixed values for $array argument
+ * with following flag values:
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// diff. associative arrays to sort
+$various_arrays = array(
+ // negative/posative integer key value array
+ array(1 => 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41),
+
+ // float key values
+ array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1),
+
+ // mixed value array with different types of keys
+ array(1 => .0001, 2 => .0021, -3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, -8 => -.9,
+ 9 => 10.6E-2, -10 => -10.6E-2, 11 => 33)
+);
+
+// set of possible flag values
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing ksort() by supplying various integer/float arrays --\n";
+
+// loop through to test ksort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flags array and call ksort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(9) {
+ [-10]=>
+ int(-41)
+ [-6]=>
+ int(-31)
+ [-4]=>
+ int(-21)
+ [-2]=>
+ int(-11)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [7]=>
+ int(0)
+ [8]=>
+ int(41)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [-10]=>
+ int(-41)
+ [-6]=>
+ int(-31)
+ [-4]=>
+ int(-21)
+ [-2]=>
+ int(-11)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [7]=>
+ int(0)
+ [8]=>
+ int(41)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [-10]=>
+ int(-41)
+ [-6]=>
+ int(-31)
+ [-4]=>
+ int(-21)
+ [-2]=>
+ int(-11)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [7]=>
+ int(0)
+ [8]=>
+ int(41)
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [-7]=>
+ float(-0.1)
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [-7]=>
+ float(-0.1)
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(6) {
+ [-7]=>
+ float(-0.1)
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ [-10]=>
+ float(-0.106)
+ [-8]=>
+ float(-0.9)
+ [-3]=>
+ float(-0.01)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [4]=>
+ int(-1)
+ [5]=>
+ int(0)
+ [6]=>
+ float(0.09)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [11]=>
+ int(33)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [-10]=>
+ float(-0.106)
+ [-8]=>
+ float(-0.9)
+ [-3]=>
+ float(-0.01)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [4]=>
+ int(-1)
+ [5]=>
+ int(0)
+ [6]=>
+ float(0.09)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [11]=>
+ int(33)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [-10]=>
+ float(-0.106)
+ [-8]=>
+ float(-0.9)
+ [-3]=>
+ float(-0.01)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [4]=>
+ int(-1)
+ [5]=>
+ int(0)
+ [6]=>
+ float(0.09)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [11]=>
+ int(33)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation4.phpt b/ext/standard/tests/array/ksort_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of boolean values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is defualt --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_STRING --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation5.phpt b/ext/standard/tests/array/ksort_variation5.phpt
new file mode 100644
index 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of string values for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+$various_arrays = array (
+ // diff. escape sequence chars with key values
+ array ( null => null, NULL => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e",
+ "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh",
+ "\ddd" => "\ddd", "\v" => "\v"
+ ),
+
+ // array containing different strings with key values
+ array ( 'Lemon' => "lemoN", 'o' => "Orange", 'B' => "banana", 'Apple' => "apple", 'te' => "Test",
+ 't' => "TTTT", 'T' => "ttt", 'W' => "ww", 'X' => "x", 'x' => "X", 'O' => "oraNGe",
+ 'B' => "BANANA"
+ )
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+echo "\n-- Testing ksort() by supplying various string arrays --\n";
+
+// loop through to test ksort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and call ksort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ [""]=>
+ NULL
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [""]=>
+ 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of hexa-decimal values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// an array containng unsorted hexadecimal values with keys
+// There are multiple keys which are duplicate and the later should be picked
+$unsorted_hex_array = array (
+ 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB,
+ 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
+);
+
+echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(ksort( $temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(ksort( $temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(ksort( $temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [-682]=>
+ int(-682)
+ [-255]=>
+ int(-255)
+ [0]=>
+ int(0)
+ [15]=>
+ int(15)
+ [187]=>
+ int(187)
+ [255]=>
+ int(255)
+ [427]=>
+ int(427)
+ [682]=>
+ int(682)
+ [4095]=>
+ int(4095)
+}
+
+-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [-682]=>
+ int(-682)
+ [-255]=>
+ int(-255)
+ [0]=>
+ int(0)
+ [15]=>
+ int(15)
+ [187]=>
+ int(187)
+ [255]=>
+ int(255)
+ [427]=>
+ int(427)
+ [682]=>
+ int(682)
+ [4095]=>
+ int(4095)
+}
+
+-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [-682]=>
+ int(-682)
+ [-255]=>
+ int(-255)
+ [0]=>
+ int(0)
+ [15]=>
+ int(15)
+ [187]=>
+ int(187)
+ [255]=>
+ int(255)
+ [427]=>
+ int(427)
+ [682]=>
+ int(682)
+ [4095]=>
+ int(4095)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation7.phpt b/ext/standard/tests/array/ksort_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing arrays containing sub arrays for $array argument
+ * with flowing flag values:
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// array with diff sub arrays to be sorted
+$various_arrays = array (
+ // null array
+ 1 => array(),
+
+ // array contains null sub array
+ 2 => array( 1 => array() ),
+
+ // array of arrays along with some values
+ 3 => array(4 => 44, 1 => 11, 3 => array(64,61) ),
+
+ // array contains sub arrays
+ 4 => array ( 3 => array(33,-5,6), 1 => array(11),
+ 2 => array(22,-55), 0 => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing ksort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test ksort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various arrays containing sub arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(0) {
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(1) {
+ [1]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ [1]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [1]=>
+ int(11)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [4]=>
+ int(44)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [1]=>
+ int(11)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [4]=>
+ int(44)
+}
+
+-- Iteration 4 --
+- With defualt sort flag -
+bool(true)
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation8.phpt b/ext/standard/tests/array/ksort_variation8.phpt
new file mode 100644
index 0000000..787e71d
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/array/ksort_variation9.phpt b/ext/standard/tests/array/ksort_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing arrays with/without key values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// list of arrays with/without key values
+$various_arrays = array (
+ array(5 => 55, 66, 22, 33, 11),
+ array ("a" => "orange", "banana", "c" => "apple"),
+ array(1, 2, 3, 4, 5, 6),
+ array("first", 5 => "second", 1 => "third"),
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ array('bar' => 'baz', "foo" => 1),
+ array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
+);
+
+$count = 1;
+echo "\n-- Testing ksort() by supplying various arrays with/without key values --\n";
+
+// loop through to test ksort() with different arrays,
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various arrays with/without key values --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(5) {
+ [5]=>
+ int(55)
+ [6]=>
+ int(66)
+ [7]=>
+ int(22)
+ [8]=>
+ int(33)
+ [9]=>
+ int(11)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [5]=>
+ int(55)
+ [6]=>
+ int(66)
+ [7]=>
+ int(22)
+ [8]=>
+ int(33)
+ [9]=>
+ int(11)
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ ["c"]=>
+ string(5) "apple"
+ [0]=>
+ string(6) "banana"
+ ["a"]=>
+ string(6) "orange"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["c"]=>
+ string(5) "apple"
+ [0]=>
+ string(6) "banana"
+ ["a"]=>
+ string(6) "orange"
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+}
+
+-- Iteration 4 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "first"
+ [1]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "first"
+ [1]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+}
+
+-- Iteration 5 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(19)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(19)
+}
+
+-- Iteration 6 --
+- With defualt sort flag -
+bool(true)
+array(2) {
+ ["bar"]=>
+ string(3) "baz"
+ ["foo"]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ ["bar"]=>
+ string(3) "baz"
+ ["foo"]=>
+ int(1)
+}
+
+-- Iteration 7 --
+- With defualt sort flag -
+bool(true)
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+}
+Done
diff --git a/ext/standard/tests/array/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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Unix locale name only, not available on windows (and crashes with VC6)\n");
+}
+if (false == setlocale(LC_CTYPE, "fr_FR.ISO8859-1", "fr_FR")) {
+ die("skip setlocale() failed\n");
+}
+?>
+--INI--
+unicode.script_encoding=ISO8859-1
+unicode.output_encoding=ISO8859-1
+--FILE--
+<?php
+setlocale(LC_ALL, 'fr_FR.ISO8859-1', 'fr_FR');
+$table = array("AB" => "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--
+<?php
+
+var_dump(max());
+var_dump(max(1));
+var_dump(max(array()));
+var_dump(max(new stdclass));
+var_dump(max(2,1,2));
+var_dump(max(2.1,2.11,2.09));
+var_dump(max("", "t", "b"));
+var_dump(max(false, true, false));
+var_dump(max(true, false, true));
+var_dump(max(1, true, false, true));
+var_dump(max(0, true, false, true));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing sequences of numbers ***\n";
+
+var_dump(max(2,1,2));
+var_dump(max(-2,1,2));
+var_dump(max(2.1,2.11,2.09));
+var_dump(max("", "t", "b"));
+var_dump(max(false, true, false));
+var_dump(max(true, false, true));
+var_dump(max(1, true, false, true));
+var_dump(max(0, true, false, true));
+var_dump(max(0, 1, array(2,3)));
+
+echo "\nDone\n";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -MAX_64Bit - 1);
+define("MIN_32Bit", -MAX_32Bit - 1);
+
+$arrayVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MIN_64Bit + 1
+);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+ var_dump(max($arrayVals));
+ var_dump(max($longVals));
+
+?>
+===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--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+
+echo "\n*** Testing Error Conditions ***\n";
+
+var_dump(max());
+var_dump(max(1));
+var_dump(max(array()));
+var_dump(max(new stdclass));
+
+?>
+--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--
+<?php
+/*
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing boundary conditions ***\n";
+var_dump(max(2147483645, 2147483646) );
+var_dump(max(2147483647, 2147483648) );
+var_dump(max(2147483646, 2147483648) );
+var_dump(max(-2147483647, -2147483646) );
+var_dump(max(-2147483648, -2147483647) );
+var_dump(max(-2147483649, -2147483647) );
+
+echo "\n*** Testing large number of arguments ***\n";
+
+var_dump(max(0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,21));
+
+echo "\nDone\n";
+?>
+--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--
+<?php
+/*
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing arrays ***\n";
+
+var_dump(max(array(2,1,2)));
+var_dump(max(array(-2,1,2)));
+var_dump(max(array(2.1,2.11,2.09)));
+var_dump(max(array("", "t", "b")));
+var_dump(max(array(false, true, false)));
+var_dump(max(array(true, false, true)));
+var_dump(max(array(1, true, false, true)));
+var_dump(max(array(0, true, false, true)));
+var_dump(max(array(0, 1, array(2,3))));
+var_dump(max(array(2147483645, 2147483646)));
+var_dump(max(array(2147483647, 2147483648)));
+var_dump(max(array(2147483646, 2147483648)));
+var_dump(max(array(-2147483647, -2147483646)));
+var_dump(max(array(-2147483648, -2147483647)));
+var_dump(max(array(-2147483649, -2147483647)));
+
+echo "\nDone\n";
+
+?>
+--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--
+<?php
+
+var_dump(min());
+var_dump(min(1));
+var_dump(min(array()));
+var_dump(min(new stdclass));
+var_dump(min(2,1,2));
+var_dump(min(2.1,2.11,2.09));
+var_dump(min("", "t", "b"));
+var_dump(min(false, true, false));
+var_dump(min(true, false, true));
+var_dump(min(1, true, false, true));
+var_dump(min(0, true, false, true));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing sequences of numbers ***\n";
+
+var_dump(min(2,1,2));
+var_dump(min(-2,1,2));
+var_dump(min(2.1,2.11,2.09));
+var_dump(min("", "t", "b"));
+var_dump(min(false, true, false));
+var_dump(min(true, false, true));
+var_dump(min(1, true, false, true));
+var_dump(min(0, true, false, true));
+var_dump(min(0, 1, array(2,3)));
+
+echo "\nDone\n";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -MAX_64Bit - 1);
+define("MIN_32Bit", -MAX_32Bit - 1);
+
+$arrayVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MIN_64Bit + 1
+);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+ var_dump(min($arrayVals));
+ var_dump(min($longVals));
+
+?>
+===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--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+
+echo "\n*** Testing Error Conditions ***\n";
+
+var_dump(min());
+var_dump(min(1));
+var_dump(min(array()));
+var_dump(min(new stdclass));
+
+?>
+--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--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing boundary conditions ***\n";
+var_dump(min(2147483645, 2147483646) );
+var_dump(min(2147483647, 2147483648) );
+var_dump(min(2147483646, 2147483648) );
+var_dump(min(-2147483647, -2147483646) );
+var_dump(min(-2147483648, -2147483647) );
+var_dump(min(-2147483649, -2147483647) );
+
+echo "\n*** Testing large number of arguments ***\n";
+
+var_dump(min(0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,21));
+
+echo "\nDone\n";
+?>
+--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--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing arrays ***\n";
+
+var_dump(min(array(2,1,2)));
+var_dump(min(array(-2,1,2)));
+var_dump(min(array(2.1,2.11,2.09)));
+var_dump(min(array("", "t", "b")));
+var_dump(min(array(false, true, false)));
+var_dump(min(array(true, false, true)));
+var_dump(min(array(1, true, false, true)));
+var_dump(min(array(0, true, false, true)));
+var_dump(min(array(0, 1, array(2,3))));
+var_dump(min(array(2147483645, 2147483646)));
+var_dump(min(array(2147483647, 2147483648)));
+var_dump(min(array(2147483646, 2147483648)));
+var_dump(min(array(-2147483647, -2147483646)));
+var_dump(min(array(-2147483648, -2147483647)));
+var_dump(min(array(-2147483649, -2147483647)));
+
+echo "\nDone\n";
+
+?>
+--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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of natcasesort()
+ */
+
+echo "*** Testing natcasesort() : basic functionality ***\n";
+
+$array = array ('A01', 'a1', 'b10', 'a01', 'b01');
+echo "\n-- Before sorting: --\n";
+var_dump($array);
+
+echo "\n-- After Sorting: --\n";
+var_dump(natcasesort($array));
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : basic functionality ***
+
+-- Before sorting: --
+array(5) {
+ [0]=>
+ string(3) "A01"
+ [1]=>
+ string(2) "a1"
+ [2]=>
+ string(3) "b10"
+ [3]=>
+ string(3) "a01"
+ [4]=>
+ string(3) "b01"
+}
+
+-- After Sorting: --
+bool(true)
+array(5) {
+ [3]=>
+ string(3) "a01"
+ [0]=>
+ string(3) "A01"
+ [1]=>
+ string(2) "a1"
+ [4]=>
+ string(3) "b01"
+ [2]=>
+ string(3) "b10"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_error.phpt b/ext/standard/tests/array/natcasesort_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to natcasesort() to test behaviour
+ */
+
+echo "*** Testing natcasesort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing natcasesort() function with Zero arguments --\n";
+var_dump( natcasesort() );
+
+// Test natcasesort with one more than the expected number of arguments
+echo "\n-- Testing natcasesort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( natcasesort($array_arg, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : error conditions ***
+
+-- Testing natcasesort() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass natcasesort() an array of objects to test how it re-orders them
+ */
+
+echo "*** Testing natcasesort() : object functionality ***\n";
+
+// class declaration for string objects
+class for_string_natcasesort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->class_value;
+ }
+
+}
+
+
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_natcasesort("axx"), new for_string_natcasesort("t"),
+ new for_string_natcasesort("w"), new for_string_natcasesort("py"),
+ new for_string_natcasesort("apple"), new for_string_natcasesort("Orange"),
+ new for_string_natcasesort("Lemon"), new for_string_natcasesort("aPPle")
+);
+
+
+echo "\n-- Testing natcasesort() by supplying various object arrays --\n";
+
+// testing natcasesort() function by supplying string object array
+var_dump(natcasesort($unsorted_str_obj) );
+var_dump($unsorted_str_obj);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : object functionality ***
+
+-- Testing natcasesort() by supplying various object arrays --
+bool(true)
+array(8) {
+ [4]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [7]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [0]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [6]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ [5]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [3]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [1]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [2]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_object2.phpt b/ext/standard/tests/array/natcasesort_object2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass natcasesort() an array of objects which have properties of different
+ * visibilities to test how it re-orders the array.
+ */
+
+echo "*** Testing natcasesort() : object functionality ***\n";
+
+// class declaration for string objects
+class for_string_natcasesort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->public_class_value;
+ }
+
+}
+
+// array of string objects
+$unsorted_str_obj = array (
+new for_string_natcasesort("axx","AXX","ass"),
+new for_string_natcasesort("t","eee","abb"),
+new for_string_natcasesort("w","W", "c"),
+new for_string_natcasesort("py","PY", "pt"),
+);
+
+
+echo "\n-- Testing natcasesort() by supplying object arrays --\n";
+
+// testing natcasesort() function by supplying string object array
+$temp_array = $unsorted_str_obj;
+var_dump(natcasesort($temp_array) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : object functionality ***
+
+-- Testing natcasesort() by supplying object arrays --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_string_natcasesort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value":"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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to natcasesort() to test behaviour
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of natcasesort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Iteration 1 --
+
+Warning: natcasesort() 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check position of internal array pointer after calling natcasesort()
+ */
+
+echo "*** Testing natcasesort() : usage variations ***\n";
+
+$array_arg = array ('img13', 'img20', 'img2', 'img1');
+
+echo "\n-- Initial Position of Internal Pointer: --\n";
+echo key($array_arg) . " => " . current ($array_arg) . "\n";
+
+echo "\n-- Call natcasesort() --\n";
+var_dump(natcasesort($array_arg));
+var_dump($array_arg);
+
+echo "\n-- Position of Internal Pointer in Passed Array: --\n";
+echo key($array_arg) . " => " . current ($array_arg) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variations ***
+
+-- Initial Position of Internal Pointer: --
+0 => img13
+
+-- Call natcasesort() --
+bool(true)
+array(4) {
+ [3]=>
+ string(4) "img1"
+ [2]=>
+ string(4) "img2"
+ [0]=>
+ string(5) "img13"
+ [1]=>
+ string(5) "img20"
+}
+
+-- Position of Internal Pointer in Passed Array: --
+3 => img1
+Done
diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where the keys are different data types to test behaviour of natcasesort()
+ */
+
+echo "*** Testing natcasesort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays with keys as different data types to be passed as $array_arg
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+
+ // duplicate values
+/*13*/ 'duplicate' => array(
+ 'foo' => 'bar',
+ 'baz' => 'bar',
+ 'hello' => 'world'
+ ),
+
+);
+
+// loop through each element of $inputs to check the behavior of natcasesort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+array(4) {
+ [-2345]=>
+ string(8) "negative"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [0]=>
+ string(4) "zero"
+}
+
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [0]=>
+ string(4) "half"
+ [-10]=>
+ string(8) "negative"
+ [10]=>
+ string(8) "positive"
+}
+
+-- Iteration 3 --
+bool(true)
+array(2) {
+ [12345678]=>
+ string(5) "large"
+ [0]=>
+ string(5) "small"
+}
+
+-- Iteration 4 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6 --
+bool(true)
+array(2) {
+ [0]=>
+ string(6) "lowerf"
+ [1]=>
+ string(6) "lowert"
+}
+
+-- Iteration 7 --
+bool(true)
+array(2) {
+ [0]=>
+ string(6) "upperf"
+ [1]=>
+ string(6) "uppert"
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10 --
+bool(true)
+array(3) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["hello world"]=>
+ string(7) "stringh"
+ ["strings"]=>
+ string(7) "strings"
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12 --
+bool(true)
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+
+-- Iteration 13 --
+bool(true)
+array(3) {
+ ["foo"]=>
+ string(3) "bar"
+ ["baz"]=>
+ string(3) "bar"
+ ["hello"]=>
+ string(5) "world"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt
new file mode 100644
index 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--
+<?php
+
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of different data types to natcasesort() to test how they are sorted
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// arrays of different data types to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+// loop through each element of $inputs to check the behavior of natcasesort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Iteration 1 --
+bool(true)
+array(4) {
+ [3]=>
+ int(-2345)
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+}
+
+-- Iteration 2 --
+bool(true)
+array(5) {
+ [1]=>
+ float(-10.5)
+ [4]=>
+ float(0.5)
+ [3]=>
+ float(1.23456789E-9)
+ [0]=>
+ float(10.5)
+ [2]=>
+ float(123456789000)
+}
+
+-- Iteration 3 --
+bool(true)
+array(2) {
+ [1]=>
+ NULL
+ [0]=>
+ NULL
+}
+
+-- Iteration 4 --
+bool(true)
+array(4) {
+ [3]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [0]=>
+ bool(true)
+ [2]=>
+ bool(true)
+}
+
+-- Iteration 5 --
+bool(true)
+array(2) {
+ [1]=>
+ string(0) ""
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 6 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [2]=>
+ string(11) "hello world"
+ [1]=>
+ string(6) "string"
+ [0]=>
+ string(6) "string"
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 10 --
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt
new file mode 100644
index 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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of numeric data to test how natcasesort re-orders the array
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$inputs = array (
+
+ // negative/positive integers array
+ array(11, -11, 21, -21, 31, -31, 0, 41, -41),
+
+ // float value array
+ array(10.5, -10.5, 10.5e2, 10.6E-2, .5, .01, -.1),
+
+ // mixed value array
+ array(.0001, .0021, -.01, -1, 0, .09, 2, -.9, 10.6E-2, -10.6E-2, 33),
+
+ // array values contains minimum and maximum ranges
+ array(2147483647, 2147483648, -2147483647, -2147483648, -0, 0, -2147483649)
+);
+
+$iterator = 1;
+foreach ($inputs as $array_arg) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(natcasesort($array_arg));
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Iteration 1 --
+bool(true)
+array(9) {
+ [1]=>
+ int(-11)
+ [3]=>
+ int(-21)
+ [5]=>
+ int(-31)
+ [8]=>
+ int(-41)
+ [6]=>
+ int(0)
+ [0]=>
+ int(11)
+ [2]=>
+ int(21)
+ [4]=>
+ int(31)
+ [7]=>
+ int(41)
+}
+
+-- Iteration 1 --
+bool(true)
+array(7) {
+ [6]=>
+ float(-0.1)
+ [1]=>
+ float(-10.5)
+ [5]=>
+ float(0.01)
+ [4]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [0]=>
+ float(10.5)
+ [2]=>
+ float(1050)
+}
+
+-- Iteration 1 --
+bool(true)
+array(11) {
+ [2]=>
+ float(-0.01)
+ [7]=>
+ float(-0.9)
+ [9]=>
+ float(-0.106)
+ [3]=>
+ int(-1)
+ [4]=>
+ int(0)
+ [0]=>
+ float(0.0001)
+ [1]=>
+ float(0.0021)
+ [5]=>
+ float(0.09)
+ [8]=>
+ float(0.106)
+ [6]=>
+ int(2)
+ [10]=>
+ int(33)
+}
+
+-- Iteration 1 --
+bool(true)
+array(7) {
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+ [5]=>
+ int(0)
+ [4]=>
+ int(0)
+ [0]=>
+ int(2147483647)
+ [1]=>
+ float(2147483648)
+}
+Done \ 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of string data to see how natcasesort() re-orders the array
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$inputs = array (
+ // group of escape sequences
+ array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"),
+
+ // array contains combination of capital/small letters
+ array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
+);
+
+foreach ($inputs as $array_arg) {
+ var_dump( natcasesort($array_arg) );
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(11) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [6]=>
+ string(1) "
+"
+ [10]=>
+ string(1) " "
+ [7]=>
+ string(1) " "
+ [5]=>
+ string(1) " "
+ [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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of different hex values to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
+var_dump( natcasesort($unsorted_hex_array) );
+var_dump($unsorted_hex_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(11) {
+ [8]=>
+ int(-255)
+ [10]=>
+ int(-682)
+ [9]=>
+ int(0)
+ [2]=>
+ int(15)
+ [5]=>
+ int(187)
+ [3]=>
+ int(255)
+ [7]=>
+ int(255)
+ [0]=>
+ int(427)
+ [6]=>
+ int(427)
+ [4]=>
+ int(682)
+ [1]=>
+ int(4095)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation6.phpt b/ext/standard/tests/array/natcasesort_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of referenced varaibles to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+echo "\n-- Initial test --\n";
+$array = array( &$value1 , &$value2, &$value3);
+var_dump( natcasesort($array) );
+var_dump($array);
+
+echo "\n-- Change \$value1 --\n";
+$value1 = -29;
+var_dump( natcasesort($array) );
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Initial test --
+bool(true)
+array(3) {
+ [1]=>
+ &int(33)
+ [0]=>
+ &int(100)
+ [2]=>
+ &int(555)
+}
+
+-- Change $value1 --
+bool(true)
+array(3) {
+ [0]=>
+ &int(-29)
+ [1]=>
+ &int(33)
+ [2]=>
+ &int(555)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass natcasesort() an infinitely recursive array to test how it is re-ordered
+ */
+
+echo "*** Testing natcasesort() : usage variations ***\n";
+
+$array = array (1, 3.00, 'zero', '2');
+$array[] = &$array;
+var_dump($array);
+
+var_dump(@natcasesort($array));
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variations ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ float(3)
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "2"
+ [4]=>
+ &array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ float(3)
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "2"
+ [4]=>
+ *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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of octal values to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
+
+var_dump( natcasesort($unsorted_oct_array) );
+var_dump($unsorted_oct_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(9) {
+ [6]=>
+ int(-54)
+ [7]=>
+ int(-229)
+ [8]=>
+ int(0)
+ [3]=>
+ int(54)
+ [5]=>
+ int(63)
+ [1]=>
+ int(209)
+ [2]=>
+ int(229)
+ [4]=>
+ int(506)
+ [0]=>
+ int(669)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation9.phpt b/ext/standard/tests/array/natcasesort_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array containing sub-arrays, ints, floats, strings, boolean, null
+ * and escape characters to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$mixed_values = array (
+ array(),
+ array( array(33, -5, 6),
+ array(11),
+ array(22, -55),
+ array()
+ ),
+ -4, "4", 4.00, "b", "5", -2, -2.0, -2.98989, "-.9", "True", "",
+ NULL, "ab", "abcd", 0.0, -0, "abcd\x00abcd\x00abcd", '', true, false
+);
+// suppress errors as is generating a lot of "array to string" notices
+var_dump( @natcasesort($mixed_values) );
+
+var_dump($mixed_values);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(22) {
+ [13]=>
+ NULL
+ [19]=>
+ string(0) ""
+ [21]=>
+ bool(false)
+ [12]=>
+ string(0) ""
+ [10]=>
+ string(3) "-.9"
+ [7]=>
+ int(-2)
+ [8]=>
+ float(-2)
+ [9]=>
+ float(-2.98989)
+ [2]=>
+ int(-4)
+ [16]=>
+ float(0)
+ [17]=>
+ int(0)
+ [20]=>
+ bool(true)
+ [3]=>
+ string(1) "4"
+ [4]=>
+ float(4)
+ [6]=>
+ string(1) "5"
+ [14]=>
+ string(2) "ab"
+ [15]=>
+ string(4) "abcd"
+ [18]=>
+ string(14) "%s"
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [3]=>
+ array(0) {
+ }
+ }
+ [5]=>
+ string(1) "b"
+ [11]=>
+ string(4) "True"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/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--
+<?php
+/*
+* proto bool natsort ( array &$array )
+* Function is implemented in ext/standard/array.c
+*/
+$array1 = $array2 = array("img12.png", "img10.png", "img2.png", "img1.png");
+sort($array1);
+echo "Standard sorting\n";
+print_r($array1);
+natsort($array2);
+echo "\nNatural order sorting\n";
+print_r($array2);
+?>
+--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--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of next()
+ */
+
+echo "*** Testing next() : basic functionality ***\n";
+
+$array = array('zero', 'one', 'two');
+echo key($array) . " => " . current($array) . "\n";
+var_dump(next($array));
+
+echo key($array) . " => " . current($array) . "\n";
+var_dump(next($array));
+
+echo key($array) . " => " . current($array) . "\n";
+var_dump(next($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : basic functionality ***
+0 => zero
+string(3) "one"
+1 => one
+string(3) "two"
+2 => two
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/next_error.phpt b/ext/standard/tests/array/next_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to next() to test behaviour
+ */
+
+echo "*** Testing next() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing next() function with Zero arguments --\n";
+var_dump( next() );
+
+//Test next with one more than the expected number of arguments
+echo "\n-- Testing next() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( next($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : error conditions ***
+
+-- Testing next() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to next() to test behaviour
+ */
+
+echo "*** Testing next() : variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of next()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( next($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : variation ***
+
+-- Iteration 1 --
+
+Warning: next() 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--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test next() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ * as $array_arg argument.
+ */
+
+echo "*** Testing next() : usage variations ***\n";
+
+$array_arg = array ('a' => 'z', array(9, 8, 7));
+
+echo "\n-- Pass a two-dimensional array as \$array_arg --\n";
+var_dump(next($array_arg));
+var_dump(next($array_arg));
+
+echo "\n-- Pass a sub-array as \$array_arg --\n";
+var_dump(next($array_arg[0]));
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : usage variations ***
+
+-- Pass a two-dimensional array as $array_arg --
+array(3) {
+ [0]=>
+ int(9)
+ [1]=>
+ int(8)
+ [2]=>
+ int(7)
+}
+bool(false)
+
+-- Pass a sub-array as $array_arg --
+int(8)
+===DONE===
diff --git a/ext/standard/tests/array/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--
+<?php
+/* Prototype : mixed prev(array $array_arg)
+ * Description: Move array argument's internal pointer to the previous element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of prev()
+ */
+
+echo "*** Testing prev() : basic functionality ***\n";
+
+$array = array('zero', 'one', 'two');
+end($array);
+echo key($array) . " => " . 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--
+<?php
+/* Prototype : mixed prev(array $array_arg)
+ * Description: Move array argument's internal pointer to the previous element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to prev() to test behaviour
+ */
+
+echo "*** Testing prev() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing prev() function with Zero arguments --\n";
+var_dump( prev() );
+
+//Test prev with one more than the expected number of arguments
+echo "\n-- Testing prev() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( prev($array_arg, $extra_arg) );
+?>
+===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--
+<?php
+/* Prototype : mixed prev(array $array_arg)
+ * Description: Move array argument's internal pointer to the previous element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass temporary variables to prev() to test behaviour
+ */
+
+function f() {
+ $array = array(1,2);
+ end($array);
+ return $array;
+}
+
+echo "\n-- Passing an indirect temporary variable --\n";
+var_dump(prev(f()));
+
+?>
+--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--
+<?php
+/* Prototype : mixed prev(array $array_arg)
+ * Description: Move array argument's internal pointer to the previous element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass temporary variables to prev() to test behaviour
+ */
+
+
+var_dump(prev(array(1, 2)));
+?>
+--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--
+<?php
+/* Prototype : mixed prev(array $array_arg)
+ * Description: Move array argument's internal pointer to the previous element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to prev() to test behaviour
+ */
+
+echo "*** Testing prev() : variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of prev()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( prev($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===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--
+<?php
+/* Prototype : mixed prev(array $array_arg)
+ * Description: Move array argument's internal pointer to the previous element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test prev() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ * as $array_arg argument.
+ */
+
+echo "*** Testing prev() : usage variations ***\n";
+
+$subarray = array(9,8,7);
+end($subarray);
+
+$array_arg = array ($subarray, 'a' => '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--
+<?php
+
+echo "*** Testing range() function on basic operations ***\n";
+
+echo "\n-- Integers as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range(1, 10) );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range(10, 1) );
+
+echo "\n-- Numeric Strings as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("1", "10") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("10", "1") );
+
+echo "\n-- Chars as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("a", "z") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("z", "a") );
+
+echo "\n-- Low and High are equal --\n";
+var_dump( range(5, 5) );
+var_dump( range("q", "q") );
+
+echo "\n-- floats as Low and High --\n";
+var_dump( range(5.1, 10.1) );
+var_dump( range(10.1, 5.1) );
+
+var_dump( range("5.1", "10.1") );
+var_dump( range("10.1", "5.1") );
+
+echo "\n-- Passing step with Low and High --\n";
+var_dump( range(1, 2, 0.1) );
+var_dump( range(2, 1, 0.1) );
+
+var_dump( range(1, 2, "0.1") );
+var_dump( range("1", "2", 0.1) );
+
+echo "\n-- Testing basic string with step --\n";
+var_dump( range("abcd", "mnop", 2) );
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing ( (low < high) && (step = 0) ) --";
+var_dump( range(1, 2, 0) );
+var_dump( range("a", "b", 0) );
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
+var_dump( range(2, 1, 0) );
+var_dump( range("b", "a", 0) );
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
+var_dump( range(1.0, 7.0, 6.5) );
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
+var_dump( range(7.0, 1.0, 6.5) );
+
+echo "\n-- Testing Invalid number of arguments --";
+var_dump( range() ); // No.of args = 0
+var_dump( range(1) ); // No.of args < expected
+var_dump( range(1,2,3,4) ); // No.of args > expected
+var_dump( range(-1, -2, 2) );
+var_dump( range("a", "j", "z") );
+
+echo "\n-- Testing Invalid steps --";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
+
+foreach( $step_arr as $step ) {
+ var_dump( range( 1, 5, $step ) );
+}
+
+echo "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--
+<?php
+
+echo "\n*** Testing range() with various low and high values ***";
+$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+
+for( $i = 0; $i < count($low_arr); $i++) {
+ for( $j = 0; $j < count($high_arr); $j++) {
+ echo @"\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
+ var_dump( range( $low_arr[$i], $high_arr[$j] ) );
+ }
+}
+
+echo "\n*** Possible variatins with steps ***\n";
+var_dump( range( 1, 5, TRUE ) );
+var_dump( range( 1, 5, array(1, 2) ) );
+
+echo "Done\n";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\nDone";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\nDone";
+?>
+--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--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of reset()
+ */
+
+echo "*** Testing reset() : basic functionality ***\n";
+
+$array = array('zero', 'one', 200 => 'two');
+
+echo "\n-- Initial Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Call to next() --\n";
+var_dump(next($array));
+
+echo "\n-- Current Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Call to reset() --\n";
+var_dump(reset($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : basic functionality ***
+
+-- Initial Position: --
+0 => zero
+
+-- Call to next() --
+string(3) "one"
+
+-- Current Position: --
+1 => one
+
+-- Call to reset() --
+string(4) "zero"
+===DONE===
diff --git a/ext/standard/tests/array/reset_error.phpt b/ext/standard/tests/array/reset_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to reset() to test behaviour
+ */
+
+echo "*** Testing reset() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing reset() function with Zero arguments --\n";
+var_dump( reset() );
+
+//Test reset with one more than the expected number of arguments
+echo "\n-- Testing reset() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( reset($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : error conditions ***
+
+-- Testing reset() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to reset() to test behaviour
+ */
+
+echo "*** Testing reset() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of reset()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( reset($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: reset() 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--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Unset first element of an array and test behaviour of reset()
+ */
+
+echo "*** Testing reset() : usage variations ***\n";
+
+$array = array('a', 'b', 'c');
+
+echo "\n-- Initial Position: --\n";
+echo current($array) . " => " . key($array) . "\n";
+
+echo "\n-- Unset First element in array and check reset() --\n";
+unset($array[0]);
+var_dump(reset($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : usage variations ***
+
+-- Initial Position: --
+a => 0
+
+-- Unset First element in array and check reset() --
+string(1) "b"
+===DONE===
diff --git a/ext/standard/tests/array/reset_variation3.phpt b/ext/standard/tests/array/reset_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Reference two arrays to each other then call reset() to test position of
+ * internal pointer in both arrays
+ */
+
+echo "*** Testing reset() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(current($array1));
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+
+next($array1);
+
+echo "\n-- Position after calling next() --\n";
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+
+echo "\n-- Position after calling reset() --\n";
+var_dump(reset($array1));
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : usage variations ***
+
+-- Initial position of internal pointer --
+string(4) "zero"
+
+-- Position after calling next() --
+$array1: string(3) "one"
+$array2: string(3) "one"
+
+-- Position after calling reset() --
+string(4) "zero"
+$array1: string(4) "zero"
+$array2: string(4) "zero"
+===DONE===
diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt
new file mode 100644
index 0000000..34fcbb7
--- /dev/null
+++ b/ext/standard/tests/array/rsort_basic.phpt
@@ -0,0 +1,241 @@
+--TEST--
+Test rsort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of rsort()
+ */
+
+echo "*** Testing rsort() : basic functionality ***\n";
+
+// associative array containing unsorted string values
+$unsorted_strings = array(
+ "l" => "lemon", "o" => "orange",
+ "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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing rsort() function with Zero arguments --\n";
+var_dump( rsort() );
+
+//Test rsort() with more than the expected number of arguments
+echo "\n-- Testing rsort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$sort_flags = SORT_REGULAR;
+$extra_arg = 10;
+var_dump( rsort($array_arg, $sort_flags, $extra_arg) );
+
+// dump the input array to ensure that it wasn't changed
+var_dump($array_arg);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : error conditions ***
+
+-- Testing rsort() function with Zero arguments --
+
+Warning: rsort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing rsort() function with more than expected no. of arguments --
+
+Warning: rsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt
new file mode 100644
index 0000000..98f7cfe
--- /dev/null
+++ b/ext/standard/tests/array/rsort_object1.phpt
@@ -0,0 +1,243 @@
+--TEST--
+Test rsort() function : object functionality
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of rsort() with objects
+ */
+
+echo "*** Testing rsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_rsort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_rsort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array(
+ new for_integer_rsort(11), new for_integer_rsort(66),
+ new for_integer_rsort(23), new for_integer_rsort(-5),
+ new for_integer_rsort(0.001), new for_integer_rsort(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_rsort("axx"), new for_string_rsort("t"),
+ new for_string_rsort("w"), new for_string_rsort("py"),
+ new for_string_rsort("apple"), new for_string_rsort("Orange"),
+ new for_string_rsort("Lemon"), new for_string_rsort("aPPle")
+);
+
+
+echo "\n-- Sort flag = default --\n";
+
+// testing rsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_REGULAR --\n";
+// testing rsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : object functionality ***
+
+-- Sort flag = default --
+bool(true)
+array(6) {
+ [0]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [1]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [2]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [3]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [4]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [5]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+}
+bool(true)
+array(8) {
+ [0]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ [1]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [2]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [3]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [4]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [5]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [6]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [7]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(6) {
+ [0]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [1]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [2]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [3]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [4]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [5]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+}
+bool(true)
+array(8) {
+ [0]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ [1]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [2]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [3]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [4]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [5]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [6]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [7]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test functionality of rsort() with objects where properties have different visibilities
+ */
+
+echo "*** Testing rsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_rsort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_rsort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+
+$unsorted_int_obj = array(
+ new for_integer_rsort(11,33,30),
+ new for_integer_rsort(66,44,4),
+ new for_integer_rsort(-88,-5,5),
+ new for_integer_rsort(0.001,99.5,0.1)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_rsort("axx","AXX","ass"),
+ new for_string_rsort("t","eee","abb"),
+ new for_string_rsort("w","W", "c"),
+ new for_string_rsort("py","PY", "pt"),
+);
+
+
+echo "\n-- Sort flag = default --\n";
+
+// testing rsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_REGULAR --\n";
+// testing rsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : object functionality ***
+
+-- Sort flag = default --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(66)
+ ["private_class_value":"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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of rsort()
+$iterator = 1;
+foreach ($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ echo "Flag = default:\n";
+ var_dump( rsort($input) );
+ echo "Flag = SORT_REGULAR:\n";
+ var_dump( rsort($input, SORT_REGULAR) );
+ echo "Flag = SORT_NUMERIC:\n";
+ var_dump( rsort($input, SORT_NUMERIC) );
+ echo "Flag = SORT_STRING:\n";
+ var_dump( rsort($input, SORT_STRING) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+-- Iteration 1 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 21 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 22 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 23 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 24 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation10.phpt b/ext/standard/tests/array/rsort_variation10.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() an array containing octal values to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
+
+echo "\n-- Sort flag = default --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(rsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Sort flag = default --
+bool(true)
+array(9) {
+ [0]=>
+ int(669)
+ [1]=>
+ int(506)
+ [2]=>
+ int(229)
+ [3]=>
+ int(209)
+ [4]=>
+ int(63)
+ [5]=>
+ int(54)
+ [6]=>
+ int(0)
+ [7]=>
+ int(-54)
+ [8]=>
+ int(-229)
+}
+
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(9) {
+ [0]=>
+ int(669)
+ [1]=>
+ int(506)
+ [2]=>
+ int(229)
+ [3]=>
+ int(209)
+ [4]=>
+ int(63)
+ [5]=>
+ int(54)
+ [6]=>
+ int(0)
+ [7]=>
+ int(-54)
+ [8]=>
+ int(-229)
+}
+
+-- Sort flag = SORT_NUMERIC --
+bool(true)
+array(9) {
+ [0]=>
+ int(669)
+ [1]=>
+ int(506)
+ [2]=>
+ int(229)
+ [3]=>
+ int(209)
+ [4]=>
+ int(63)
+ [5]=>
+ int(54)
+ [6]=>
+ int(0)
+ [7]=>
+ int(-54)
+ [8]=>
+ int(-229)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation11.phpt b/ext/standard/tests/array/rsort_variation11.phpt
new file mode 100644
index 0000000..83bbf84
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/rsort_variation2.phpt b/ext/standard/tests/array/rsort_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $sort_flags argument to rsort() to test behaviour
+ * Where possible, 'SORT_NUMERIC' has been entered as a string value
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// Initialise function arguments not being substituted
+$array_arg = array (1, 5, 2, 3, 1);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "SORT_NUMERIC";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+SORT_NUMERIC
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $sort_flags argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "SORT_NUMERIC",
+ 'SORT_NUMERIC',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of rsort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+
+ //create temporary array in case rsort() works
+ $temp = $array_arg;
+
+ var_dump( rsort($temp, $input) );
+ var_dump($temp);
+ $iterator++;
+
+ $temp = null;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 2 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 3 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 4 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 5 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 6 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 7 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 8 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 9 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 10 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 11 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 12 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 13 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 14 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 15 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 16 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 17 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 18 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 19 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 20 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 21 --
+
+Warning: rsort() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 22 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 23 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 24 --
+
+Warning: rsort() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt
new file mode 100644
index 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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays containing different numeric data to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// group of various arrays
+
+$various_arrays = array (
+// negative/positive integers array
+array(11, -11, 21, -21, 31, -31, 0, 41, -41),
+
+// float value array
+array(10.5, -10.5, 10.5e2, 10.6E-2, .5, .01, -.1),
+
+// mixed value array
+array(.0001, .0021, -.01, -1, 0, .09, 2, -.9, 10.6E-2, -10.6E-2, 33),
+
+// array values contains minimum and maximum ranges
+array(2147483647, 2147483648, -2147483647, -2147483648, -0, 0, -2147483649)
+);
+
+// set of possible flag values
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+
+// loop through to test rsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flag_value array and setting all possible flag values
+ foreach($flag_value as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+- With Defualt sort flag -
+bool(true)
+array(9) {
+ [0]=>
+ int(41)
+ [1]=>
+ int(31)
+ [2]=>
+ int(21)
+ [3]=>
+ int(11)
+ [4]=>
+ int(0)
+ [5]=>
+ int(-11)
+ [6]=>
+ int(-21)
+ [7]=>
+ int(-31)
+ [8]=>
+ int(-41)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [0]=>
+ int(41)
+ [1]=>
+ int(31)
+ [2]=>
+ int(21)
+ [3]=>
+ int(11)
+ [4]=>
+ int(0)
+ [5]=>
+ int(-11)
+ [6]=>
+ int(-21)
+ [7]=>
+ int(-31)
+ [8]=>
+ int(-41)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [0]=>
+ int(41)
+ [1]=>
+ int(31)
+ [2]=>
+ int(21)
+ [3]=>
+ int(11)
+ [4]=>
+ int(0)
+ [5]=>
+ int(-11)
+ [6]=>
+ int(-21)
+ [7]=>
+ int(-31)
+ [8]=>
+ int(-41)
+}
+
+-- Iteration 2 --
+- With Defualt sort flag -
+bool(true)
+array(7) {
+ [0]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.01)
+ [5]=>
+ float(-0.1)
+ [6]=>
+ float(-10.5)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [0]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.01)
+ [5]=>
+ float(-0.1)
+ [6]=>
+ float(-10.5)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [0]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.01)
+ [5]=>
+ float(-0.1)
+ [6]=>
+ float(-10.5)
+}
+
+-- Iteration 3 --
+- With Defualt sort flag -
+bool(true)
+array(11) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.106)
+ [3]=>
+ float(0.09)
+ [4]=>
+ float(0.0021)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ int(0)
+ [7]=>
+ float(-0.01)
+ [8]=>
+ float(-0.106)
+ [9]=>
+ float(-0.9)
+ [10]=>
+ int(-1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.106)
+ [3]=>
+ float(0.09)
+ [4]=>
+ float(0.0021)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ int(0)
+ [7]=>
+ float(-0.01)
+ [8]=>
+ float(-0.106)
+ [9]=>
+ float(-0.9)
+ [10]=>
+ int(-1)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.106)
+ [3]=>
+ float(0.09)
+ [4]=>
+ float(0.0021)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ int(0)
+ [7]=>
+ float(-0.01)
+ [8]=>
+ float(-0.106)
+ [9]=>
+ float(-0.9)
+ [10]=>
+ int(-1)
+}
+
+-- Iteration 4 --
+- With Defualt sort flag -
+bool(true)
+array(7) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(-2147483647)
+ [5]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(-2147483647)
+ [5]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(-2147483647)
+ [5]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+}
+Done \ 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test behaviour of rsort() when:
+ * 1. passed an array of referenced variables
+ * 2. $array_arg is a reference to another array
+ * 3. $array_arg is passed by reference
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( &$value1 , &$value2, &$value3);
+
+echo "\n-- 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( rsort($temp_array) );
+var_dump( $temp_array);
+
+echo "\n-- 'flag' = SORT_REGULAR --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( rsort($temp_array, SORT_REGULAR) );
+var_dump( $temp_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 'flag' value is defualt --
+bool(true)
+array(3) {
+ [0]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays containing different string data to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+$various_arrays = array (
+// group of escape sequences
+array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"),
+
+// array contains combination of capital/small letters
+array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+// loop through to test rsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Default sort flag -\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flags array and setting all possible flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+
+ $temp_array = $array;
+ var_dump(rsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+- With Default sort flag -
+bool(true)
+array(11) {
+ [0]=>
+ string(4) "\xhh"
+ [1]=>
+ string(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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() an array of hexadecimal values to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// an array contains unsorted hexadecimal values
+$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
+
+echo "\n-- 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(rsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 'flag' value is defualt --
+bool(true)
+array(11) {
+ [0]=>
+ int(4095)
+ [1]=>
+ int(682)
+ [2]=>
+ int(427)
+ [3]=>
+ int(427)
+ [4]=>
+ int(255)
+ [5]=>
+ int(255)
+ [6]=>
+ int(187)
+ [7]=>
+ int(15)
+ [8]=>
+ int(0)
+ [9]=>
+ int(-255)
+ [10]=>
+ int(-682)
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(11) {
+ [0]=>
+ int(4095)
+ [1]=>
+ int(682)
+ [2]=>
+ int(427)
+ [3]=>
+ int(427)
+ [4]=>
+ int(255)
+ [5]=>
+ int(255)
+ [6]=>
+ int(187)
+ [7]=>
+ int(15)
+ [8]=>
+ int(0)
+ [9]=>
+ int(-255)
+ [10]=>
+ int(-682)
+}
+
+-- 'flag' value is SORT_NUMERIC --
+bool(true)
+array(11) {
+ [0]=>
+ int(4095)
+ [1]=>
+ int(682)
+ [2]=>
+ int(427)
+ [3]=>
+ int(427)
+ [4]=>
+ int(255)
+ [5]=>
+ int(255)
+ [6]=>
+ int(187)
+ [7]=>
+ int(15)
+ [8]=>
+ int(0)
+ [9]=>
+ int(-255)
+ [10]=>
+ int(-682)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation7.phpt b/ext/standard/tests/array/rsort_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() arrays of boolean values to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// bool value array
+$bool_values = array (true, false, TRUE, FALSE);
+
+echo "\n-- 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 'flag' value is defualt --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+-- 'flag' value is SORT_NUMERIC --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+-- 'flag' value is SORT_STRING --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation8.phpt b/ext/standard/tests/array/rsort_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() multi-dimensional arrays to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// array of arrays
+$various_arrays = array (
+ // null array
+ array(),
+
+ // array contains null sub array
+ array( array() ),
+
+ // array of arrays along with some values
+ array(44, 11, array(64, 61) ),
+
+ // array containing sub arrays
+ array(array(33, -5, 6), array(11), array(22, -55), array() )
+);
+
+
+$count = 1;
+
+// loop through to test rsort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+
+ echo "\n-- 'flag' value is default --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "\n-- 'flag' value is SORT_REGULAR --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+
+-- 'flag' value is default --
+bool(true)
+array(0) {
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+
+-- 'flag' value is default --
+bool(true)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+
+-- 'flag' value is default --
+bool(true)
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(44)
+ [2]=>
+ int(11)
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(44)
+ [2]=>
+ int(11)
+}
+
+-- Iteration 4 --
+
+-- 'flag' value is default --
+bool(true)
+array(4) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [3]=>
+ array(0) {
+ }
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [3]=>
+ array(0) {
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() associative arrays to test key re-assignment
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// Associative arrays
+$various_arrays = array(
+ // numeric assoc. only array
+ array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11),
+
+ // two-dimensional assoc. and default key array
+ array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
+ "numbers" => array(1, 2, 3, 4, 5, 6),
+ "holes" => array("first", 5 => "second", "third")),
+
+ // numeric assoc. and default key array
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+
+ // mixed assoc. array
+ array('bar' => 'baz', "foo" => 1),
+
+ // assoc. only multi-dimensional array
+ array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
+);
+
+$count = 1;
+
+// loop through to test rsort() with different arrays,
+// to test the new keys for the elements in the sorted array
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "-- Sort flag = default --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "-- Sort flag = SORT_REGULAR --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+-- Sort flag = default --
+bool(true)
+array(5) {
+ [0]=>
+ int(66)
+ [1]=>
+ int(55)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+ [4]=>
+ int(11)
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(5) {
+ [0]=>
+ int(66)
+ [1]=>
+ int(55)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+ [4]=>
+ int(11)
+}
+
+-- Iteration 2 --
+-- Sort flag = default --
+bool(true)
+array(3) {
+ [0]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+ }
+ [2]=>
+ array(3) {
+ ["a"]=>
+ string(6) "orange"
+ ["b"]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+ }
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+ }
+ [2]=>
+ array(3) {
+ ["a"]=>
+ string(6) "orange"
+ ["b"]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+ }
+}
+
+-- Iteration 3 --
+-- Sort flag = default --
+bool(true)
+array(6) {
+ [0]=>
+ int(19)
+ [1]=>
+ int(13)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(6) {
+ [0]=>
+ int(19)
+ [1]=>
+ int(13)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+}
+
+-- Iteration 4 --
+-- Sort flag = default --
+bool(true)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "baz"
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "baz"
+}
+
+-- Iteration 5 --
+-- Sort flag = default --
+bool(true)
+array(4) {
+ [0]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ [1]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ [2]=>
+ int(5)
+ [3]=>
+ int(1)
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ [1]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ [2]=>
+ int(5)
+ [3]=>
+ int(1)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle when an array with default keys
+* is passed to the 'array_arg' argument and check for the
+* changes in the input array by printing the input array
+* before and after shuffle() function is applied on it
+*/
+
+echo "*** Testing shuffle() : with arrays having default keys ***\n";
+
+// Initialise the array with integers
+$array_arg_int = array(0, 10, 20, 30, 40, 50, 60, 70, 80);
+
+// Initialise the array with strings
+$array_arg_strings = array("one", 'two', 'three', "four", "five", " ", 'six', ' ', "seven");
+
+/* Testing shuffle() function with array of integers */
+
+// printing the input array with integers before the shuffle operation
+echo "\n-- input array of integers before shuffle() function is applied --\n";
+var_dump( $array_arg_int );
+
+// applying shuffle() function on the input array of integers
+echo "\n-- return value from shuffle() function --\n";
+var_dump( shuffle($array_arg_int) ); // prints the return value from shuffle() function
+
+echo "\n-- resultant array after shuffle() function is applied --\n";
+var_dump( $array_arg_int );
+
+/* Testing shuffle() function with array of strings */
+
+// printing the input array with strings before the shuffle operation
+echo "\n-- input array of strings before shuffle() function is applied --\n";
+var_dump( $array_arg_strings );
+
+// applying shuffle() function on the input array of strings
+echo "\n-- return value from shuffle() function --\n";
+var_dump( shuffle($array_arg_strings) ); // prints the return value from shuffle() function
+
+echo "\n-- resultant array after shuffle() function is applied --\n";
+var_dump( $array_arg_strings );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle when an associative array is
+* passed to the 'array_arg' argument and check for the
+* changes in the input array by printing the input array
+* before and after shuffle() function is applied on it
+*/
+
+echo "*** Testing shuffle() : with associative array ***\n";
+
+// Initialise the associative array
+$array_arg = array(
+ 'one' => 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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/* Test shuffle() to see that warning messages are emitted
+ * when invalid number of arguments are passed to the function
+*/
+
+echo "*** Testing shuffle() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing shuffle() function with Zero arguments --\n";
+var_dump( shuffle() );
+
+// more than the expected number of arguments
+echo "\n-- Testing shuffle() function with more than expected no. of arguments --\n";
+$array_arg = array(1, "two" => 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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() when unexpected values are passed for 'array_arg'
+* argument and verify that function outputs required warning messages wherever applicable
+*/
+
+echo "*** Testing shuffle() : with unexpected values for 'array_arg' argument ***\n";
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new test(),
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+/*23*/ // resource data
+ $fp
+);
+
+// loop through the array to test shuffle() function
+// with each element of the array
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( shuffle($value) );
+ $count++;
+};
+
+// closing the resource
+fclose($fp);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() function when multi-dimensional array is
+* passed to 'array_arg' argument
+*/
+
+echo "*** Testing shuffle() : with multi-dimensional array ***\n";
+
+// initialise the multi-dimensional array
+$array_arg = array(
+ array(1, 2, 3),
+ array(4, 5, 6),
+ array(7, 8, 9),
+ array(10000, 20000000, 30000000),
+ array(0, 0, 0),
+ array(012, 023, 034),
+ array(0x1, 0x0, 0xa)
+
+);
+
+// calling shuffle() function with multi-dimensional array
+var_dump( shuffle($array_arg) );
+echo "\nThe output array is:\n";
+var_dump( $array_arg );
+
+
+// looping to test shuffle() with each sub-array in the multi-dimensional array
+echo "\n*** Testing shuffle() with arrays having different types of values ***\n";
+$counter = 1;
+for($i=0; $i<=6; $i++) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( shuffle($array_arg[$i]) );
+ echo "\nThe output array is:\n";
+ var_dump( $array_arg[$i] );
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() function when arrays having different
+* types of values, are passed to 'array_arg' argument
+*/
+
+echo "*** Testing shuffle() : arrays with diff types of values ***\n";
+
+// initialise different arrays
+$array_arg = array(
+ // array with positive int values
+/*1*/ array(0, 1, 2, 2147483647 ),
+
+ // array with negative int values
+ array(-1, -2, -2147483647 ),
+
+ // array with positive float values
+/*3*/ array(0.23, 1.34, 0e2, 200e-2, 30e2, 10e0, 2147473648.90),
+
+ // array with negative float values
+ array(-0.23, -1.34, -200e-2, -30e2, -10e0, -2147473649.80),
+
+ // array with single quoted and double quoted strings
+/*5*/ array('one', "123numbers", 'hello\tworld', "hello world\0", '12.34floatnum'),
+
+ // array with bool values
+ array(true, TRUE, FALSE, false),
+
+ // array with positive hexa values
+/*7*/ array(0x123, 0xabc, 0xABC, 0xac, 0xAb1, 0x9fa),
+
+ // array with negative hexa values
+ array(-0x123, -0xabc, -0xABC, -0xAb1, -0x9fa),
+
+ // array with positive octal values
+/*9*/ array(0123, 02348, 034, 00),
+
+ // array with negative octal values
+/*10*/ array(-0123, -02348, -034),
+
+);
+
+// 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() : 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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() function when associative arrays
+* having different types of values, are passed to 'array_arg' argument
+*/
+
+echo "*** Testing shuffle() : associative arrays with diff types of values ***\n";
+
+// initialise different arrays
+$array_arg = array(
+ // array with positive int values
+/*1*/ array("zero" => 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--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() when an array of heredoc strings is passed to
+* 'array_arg' argument of the function
+*/
+
+echo "*** Testing shuffle() : with array containing heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+// defining array with values as heredoc strings
+$heredoc_array = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls
+);
+
+// defining array with keys as heredoc strings
+$heredoc_asso_array = array(
+ $empty_heredoc => "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--
+<?php
+/* Prototype : int sizeof(mixed $var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP library is
+ * installed, it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+/* Testing the sizeof() for some of the scalar types(integer, float) values
+ * in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
+ */
+
+echo "*** Testing sizeof() : basic functionality ***\n";
+
+$intval = 10;
+$floatval = 10.5;
+$stringval = "String";
+
+echo "-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($intval) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($intval, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($intval, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($floatval) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($floatval, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($floatval, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : basic functionality ***
+-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
+default mode: int(1)
+
+COUNT_NORMAL mode: int(1)
+
+COUNT_RECURSIVE mode: int(1)
+
+-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
+default mode: int(1)
+
+COUNT_NORMAL mode: int(1)
+
+COUNT_RECURSIVE mode: int(1)
+Done
diff --git a/ext/standard/tests/array/sizeof_basic2.phpt b/ext/standard/tests/array/sizeof_basic2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof(mixed $var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP library is
+ * installed, it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+/* Testing the sizeof() for non-scalar type(array) value
+ * in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
+ * Sizeof() has been tested for simple integer, string,
+ * indexed and mixed arrays.
+ */
+
+echo "*** Testing sizeof() : basic functionality ***\n";
+
+$int_array = array(1, 2, 3, 4);
+$string_array = array("Saffron", "White", "Green");
+$indexed_array = array("Agression" => "Saffron", "Peace" => "White", "Growth" => "Green");
+$mixed_array = array(1, 2, "Aggression" => "Saffron", 10 => "Ten", "Ten" => 10);
+
+echo "-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($int_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($int_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($int_array, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($string_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($string_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($string_array, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($indexed_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($indexed_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($indexed_array, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($mixed_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($mixed_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($mixed_array, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : basic functionality ***
+-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(4)
+
+COUNT_NORMAL mode: int(4)
+
+COUNT_RECURSIVE mode: int(4)
+
+-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(3)
+
+COUNT_NORMAL mode: int(3)
+
+COUNT_RECURSIVE mode: int(3)
+
+-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(3)
+
+COUNT_NORMAL mode: int(3)
+
+COUNT_RECURSIVE mode: int(3)
+
+-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(5)
+
+COUNT_NORMAL mode: int(5)
+
+COUNT_RECURSIVE mode: int(5)
+Done
diff --git a/ext/standard/tests/array/sizeof_error.phpt b/ext/standard/tests/array/sizeof_error.phpt
new file mode 100644
index 0000000..79a75f3
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sizeof() function : error conditions
+--FILE--
+<?php
+/* Prototype : int sizeof(mixed $var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP Library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+// Calling sizeof() with zero and more than expected arguments .
+
+echo "*** Testing sizeof() : error conditions ***\n";
+
+echo "-- Testing sizeof() with zero arguments --\n";
+var_dump( sizeof() );
+echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n";
+$var = 100;
+$extra_arg = 10;;
+var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) );
+echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n";
+var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : error conditions ***
+-- Testing sizeof() with zero arguments --
+
+Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --
+
+Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --
+
+Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/sizeof_object1.phpt b/ext/standard/tests/array/sizeof_object1.phpt
new file mode 100644
index 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--
+<?php
+// Skip the test case if Standard PHP Library(spl) is not installed
+ if( !extension_loaded('spl'))
+ {
+ die('skip spl is not installed');
+ }
+?>
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : object functionality ***\n";
+
+echo "-- Testing sizeof() with an object which implements Countable interface --\n";
+class sizeof_class implements Countable
+{
+ public $member1;
+ private $member2;
+ protected $member3;
+
+ public function count()
+ {
+ return 3; // return the count of member variables in the object
+ }
+}
+
+$obj = new sizeof_class();
+
+echo "-- Testing sizeof() in default mode --\n";
+var_dump( sizeof($obj) );
+echo "-- Testing sizeof() in COUNT_NORMAL mode --\n";
+var_dump( sizeof($obj, COUNT_NORMAL) );
+echo "-- Testing sizeof() in COUNT_RECURSIVE mode --\n";
+var_dump( sizeof($obj, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : object functionality ***
+-- Testing sizeof() with an object which implements Countable interface --
+-- Testing sizeof() in default mode --
+int(3)
+-- Testing sizeof() in COUNT_NORMAL mode --
+int(3)
+-- Testing sizeof() in COUNT_RECURSIVE mode --
+int(3)
+Done
diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : object functionality ***\n";
+
+echo "--- Testing sizeof() with objects which doesn't implement Countable interface ---\n";
+
+// class without member
+class test
+{
+ // no members
+}
+
+// class with only members and with out member functions
+class test1
+{
+ public $member1;
+ var $var1;
+ private $member2;
+ protected $member3;
+
+ // no member functions
+}
+
+// class with only member functions
+class test2
+{
+ // no data members
+
+ public function display()
+ {
+ echo " Class Name : test2\n";
+ }
+}
+
+// child class which inherits parent test2
+class child_test2 extends test2
+{
+ public $child_member1;
+ private $child_member2;
+}
+
+// abstract class
+abstract class abstract_class
+{
+ public $member1;
+ private $member2;
+
+ abstract protected function display();
+}
+
+// implement abstract 'abstract_class' class
+class concrete_class extends abstract_class
+{
+ protected function display()
+ {
+ echo " class name is : concrete_class \n ";
+ }
+}
+
+$objects = array (
+ /* 1 */ new test(),
+ new test1(),
+ new test2(),
+ new child_test2(),
+ /* 5 */ new concrete_class()
+);
+
+$counter = 1;
+for($i = 0; $i < count($objects); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $var = $objects[$i];
+
+ echo "Default Mode: ";
+ var_dump( sizeof($var) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($var, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($var, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : object functionality ***
+--- Testing sizeof() with objects which doesn't implement Countable interface ---
+-- Iteration 1 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 2 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 3 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 4 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 5 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode ---\n";
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// array containing all scalar types
+$values = array (
+ // int values
+ /* 1 */ 0,
+ 1,
+
+ // float values
+ /* 3 */ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ /* 7 */ .5,
+
+ // NULL values
+ /* 8 */ NULL,
+ null,
+
+ // boolean values
+ /* 10 */ TRUE,
+ FALSE,
+ true,
+ /* 13 */ false,
+
+ // string data
+ /* 14 */ "",
+ '',
+ "string",
+ /* 17 */ 'string',
+
+ // undefined variable
+ @$undefined_var,
+
+ // resource variable
+ /* 19 */ $fp
+);
+
+// loop through the each value of the array for 'var' argument and check the behaviour of sizeof()
+$counter = 1;
+for($i = 0; $i < count($values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+
+ $var = $values[$i];
+
+ echo "Default Mode: ";
+ var_dump( sizeof($var) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($var, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($var, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode ---
+-- Iteration 1 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 2 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 3 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 4 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 5 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 6 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 7 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 8 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 9 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 10 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 11 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 12 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 13 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 14 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 15 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 16 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 17 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 18 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 19 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation2.phpt b/ext/standard/tests/array/sizeof_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+echo "--- Testing sizeof() with different array values for 'var' argument ---\n";
+
+// array containing different types of array values for 'var' argument
+$values = array (
+ /* 1 */ array($fp, "resource" => $fp),
+ array(1, array(3, 4, array(6, array(8)))),
+ array("a" => 1, 'b' => 2, array( "c" =>3, array( "d" => 5))),
+ array(),
+ /* 5 */ array(1, 2, 3, 4),
+ array("Saffron", "White", "Green"),
+ array('saffron', 'white', 'green'),
+ array(1 => "Hi", 2 => "Hello" ),
+ array("color" => "red", "item" => "pen"),
+ /* 10 */ array('color' => 'red', 'item' => 'pen'),
+ array(TRUE => "red", FALSE => "pen" ),
+ array(false => 'red', true => 'pen' ),
+ array('color' => "red", "item" => 'pen', 1 => "Hi", "" => "Hello" ),
+ /* 14 */ array($fp, "resource1" => $fp, 'resource2' => $fp, array( $fp, 'type' => $fp) )
+);
+
+// loop through each element of the values array for 'var' argument
+// check the working of sizeof()
+$counter = 1;
+for($i = 0; $i < count($values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $var = $values[$i];
+
+ echo "Default Mode: ";
+ var_dump( sizeof($var) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($var, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($var, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() with different array values for 'var' argument ---
+-- Iteration 1 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 2 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(8)
+
+-- Iteration 3 --
+Default Mode: int(3)
+
+COUNT_NORMAL Mode: int(3)
+
+COUNT_RECURSIVE Mode: int(6)
+
+-- Iteration 4 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 5 --
+Default Mode: int(4)
+
+COUNT_NORMAL Mode: int(4)
+
+COUNT_RECURSIVE Mode: int(4)
+
+-- Iteration 6 --
+Default Mode: int(3)
+
+COUNT_NORMAL Mode: int(3)
+
+COUNT_RECURSIVE Mode: int(3)
+
+-- Iteration 7 --
+Default Mode: int(3)
+
+COUNT_NORMAL Mode: int(3)
+
+COUNT_RECURSIVE Mode: int(3)
+
+-- Iteration 8 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 9 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 10 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 11 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 12 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 13 --
+Default Mode: int(4)
+
+COUNT_NORMAL Mode: int(4)
+
+COUNT_RECURSIVE Mode: int(4)
+
+-- Iteration 14 --
+Default Mode: int(4)
+
+COUNT_NORMAL Mode: int(4)
+
+COUNT_RECURSIVE Mode: int(6)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation3.phpt b/ext/standard/tests/array/sizeof_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode --\n";
+
+$array2 = array ( "Hi", "Hello",@$a);
+$array3 = array( 'hi', 'hello');
+$a = array ( 1, @$array1, $array2, $array3);
+$array1 = array( array(1, 2), $a);
+$array4 = array( 100, @$array4);
+
+var_dump( sizeof($array1, COUNT_RECURSIVE) );
+echo "\n";
+var_dump( sizeof($array4, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode --
+int(13)
+
+int(2)
+Done
diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes ---\n";
+
+// class declaration
+class test
+{
+ public $member1;
+}
+
+// get an resource variable
+$fp = fopen(__FILE__, "r");
+
+// array containing different types of variables
+$values = array (
+ // int values
+ /* 1 */ 0,
+ 1,
+ // float values
+ /* 3 */ 10.5,
+ -10.5,
+ 12.34e3,
+ /* 6 */ 12.34E-3,
+ // string values
+ /* 7 */ "string",
+ 'string',
+ "",
+ /* 10 */ '',
+ // NULL values
+ /* 11 */ NULL,
+ null,
+ // Boolean Values
+ /* 12 */ TRUE,
+ true,
+ false,
+ /* 16 */ FALSE,
+ // array values
+ /* 17 */ array(),
+ array(1, 2, 3,4 , array(5, 6)),
+ // object variable
+ /* 19 */ new test(),
+ // resource variable
+ /* 20 */ $fp
+);
+
+// loop through the each element of the $values array for 'var' arugment
+// and check the functionality of sizeof()
+$counter = 1;
+foreach($values as $value)
+{
+ echo "-- Iteration $counter --\n";
+
+ // unset the variable
+ unset($value);
+
+ // now check the size of unset variable when different modes are given
+ echo "Default Mode: ";
+ var_dump( sizeof($value) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($value, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($value, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes ---
+-- Iteration 1 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 2 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 3 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 4 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 5 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 6 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 7 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 8 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 9 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 10 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 11 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 12 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 13 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 14 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 15 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 16 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 17 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 18 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 19 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 20 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation5.phpt b/ext/standard/tests/array/sizeof_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "--- Testing sizeof() with different values for 'mode' argument ---\n";
+$array1 = array(1, 2, 3, 4, array(1.0, 2.0, array()), array() );
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//unset variable
+$unset_var = 10;
+unset($unset_var);
+
+//class declaration
+class test
+{
+ public $member1;
+}
+
+$mode_values = array (
+ /* 1 */ COUNT_NORMAL,
+ COUNT_RECURSIVE,
+ 0, // same as COUNT_NORMAL
+ 1, // same as COUNT_RECURSIVE
+
+ /* 5 */ TRUE, // same as COUNT_RECURSIVE
+ true, // same as COUNT_RECURSIVE
+ FALSE, // same as COUNT_NORMAL
+ false, // same as COUNT_NORMAL
+ NULL, // same as COUNT_NORMAL
+ /* 10 */ null, // same as COUNT_NORMAL
+ 100,
+ 10.5,
+ 12.34e3,
+ 12.34E-2,
+ /* 15 */ .5,
+ "",
+ '',
+ "string",
+ 'string',
+ /* 20 */ @$unset_var,
+ new test(),
+ /* 22 */ $fp
+);
+
+// loop through the each element of $modes_array for 'mode' argument
+// and check the working of sizeof()
+$counter = 1;
+for($i = 0; $i < count($mode_values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $mode = $mode_values[$i];
+
+ var_dump( sizeof($array1, $mode) );
+
+ $counter++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() with different values for 'mode' argument ---
+-- Iteration 1 --
+int(6)
+-- Iteration 2 --
+int(9)
+-- Iteration 3 --
+int(6)
+-- Iteration 4 --
+int(9)
+-- Iteration 5 --
+int(9)
+-- Iteration 6 --
+int(9)
+-- Iteration 7 --
+int(6)
+-- Iteration 8 --
+int(6)
+-- Iteration 9 --
+int(6)
+-- Iteration 10 --
+int(6)
+-- Iteration 11 --
+int(6)
+-- Iteration 12 --
+int(6)
+-- Iteration 13 --
+int(6)
+-- Iteration 14 --
+int(6)
+-- Iteration 15 --
+int(6)
+-- Iteration 16 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 20 --
+int(6)
+-- Iteration 21 --
+
+Warning: sizeof() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: sizeof() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing arrays with default keys and assoc arrays
+ * to check the basic functionality with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : basic functionality ***\n";
+
+// associative array containing unsorted string values
+$unsorted_strings = array(
+ "l" => "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--
+<?php
+/* Prototype : bool sort(array &array_arg [, int sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing sort() function with all possible error conditions
+*/
+
+echo "*** Testing sort() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing sort() function with Zero arguments --\n";
+var_dump( sort() );
+
+//Test sort with more than the expected number of arguments
+echo "\n-- Testing sort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 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 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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+/*
+ * testing sort() by providing integer/string object arrays with flag values are defualt, SORT_REGULAR
+*/
+
+echo "*** Testing sort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_sort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing integer/string object arrays with flag values are defualt, SORT_REGULAR
+*/
+
+echo "*** Testing sort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_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;
+ }
+}
+
+// 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--
+<?php
+/* Prototype : bool sort(array &array_arg [, int $sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different unexpected values for array argument
+ * with following flag values.
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of values to iterate over
+$unexpected_values = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e3,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new stdclass(),
+
+ // undefined data
+/*21*/ @undefined_var,
+
+ // unset data
+/*22*/ @unset_var,
+
+ // resource variable
+/*23*/ $fp
+);
+
+// loop though each element of the array and check the working of sort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing sort() 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( sort($value) ); // expecting : bool(false)
+ var_dump( sort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( sort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( sort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different octal array for $array argument
+ * with following flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
+
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(sort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation11.phpt
Binary files 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--
+<?php
+/* Prototype : bool sort(array &array_arg [, int $sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// temperory array for checking unexpected behavior
+$unsorted_values = array(10, 2, 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 sort()
+// when $flag arugment is supplied with different values
+echo "\n-- Testing sort() by supplying different unexpected values for 'flag' argument --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+
+ // sort the array, retain a temp. copy of input array for next iteration
+ $value = $unexpected_values [$index];
+ $temp_array = $unsorted_values;
+ var_dump( sort($temp_array, $value) );
+
+ //dump the sorted array
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing different integer/float value arrays for $array argument
+ * with following flag values
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// group of various arrays
+$various_arrays = array (
+ // negative/posative integers array
+ array(11, -11, 21, -21, 31, -31, 0, 41, -41),
+
+ // float value array
+ array(10.5, -10.5, 10.5e2, 10.6E-2, .5, .01, -.1),
+
+ // mixed value array
+ array(.0001, .0021, -.01, -1, 0, .09, 2, -.9, 10.6E-2, -10.6E-2, 33),
+
+ // array values contains minimum and maximum ranges
+ array(2147483647, 2147483648, -2147483647, -2147483648, -0, 0, -2147483649)
+);
+
+// set of possible flag values
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing reference variable array with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing sort() :usage variations ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( &$value1 , &$value2, &$value3);
+
+echo "\n-- Testing sort() by supplying reference variable 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 reference variable 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 reference variable 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() :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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
+}
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different string arrays for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+$various_arrays = array (
+ // group of escape sequences
+ array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\r", "\t", "\xhh", "\ddd", "\v"),
+
+ // array contains combination of capital/small letters
+ array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different hexa-decimal array for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// an array contains unsorted hexadecimal values
+$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
+
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(sort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing bool value array for $array argument with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (true, false, TRUE, FALSE);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing arrays contains sub arrays for $array argument with flowing flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// array of arrays
+$various_arrays = array (
+ // null array
+ array(),
+
+ // array contains null sub array
+ array( array() ),
+
+ // array of arrays along with some values
+ array(44, 11, array(64, 61) ),
+
+ // array containing sub arrays
+ array(array(33, -5, 6), array(11), array(22, -55), array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing sort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test sort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ // testing sort() function by supplying different arrays, flag value is defualt
+ echo "- With Defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array) );
+ var_dump($temp_array);
+
+ // testing sort() function by supplying different arrays, flag value = SORT_REGULAR
+ 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 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--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing arrays with key values for $array argument
+ * with following flag values.
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * To test the new keys for the elements in the sorted array.
+ */
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// list of arrays with key and values
+$various_arrays = array(
+ array(5 => 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing uasort() : basic functionality ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Int array with default keys
+$int_values = array(1, 8, 9, 3, 2, 6, 7);
+echo "-- Numeric array with default keys --\n";
+var_dump( uasort($int_values, 'cmp') );
+var_dump($int_values);
+
+// String array with default keys
+$string_values = array("This", "is", 'a', "test");
+echo "-- String array with default keys --\n";
+var_dump( uasort($string_values, 'cmp') );
+var_dump($string_values);
+
+// Associative array with numeric keys
+$numeric_key_arg = array(1=> 1, 2 => 2, 3 => 7, 5 => 4, 4 => 9);
+echo "-- Associative array with numeric keys --\n";
+var_dump( uasort($numeric_key_arg, 'cmp') );
+var_dump($numeric_key_arg);
+
+// Associative array with string keys
+$string_key_arg = array('one' => 4, 'two' => 2, 'three' => 1, 'four' => 10);
+echo "-- Associative array with string keys --\n";
+var_dump( uasort($string_key_arg, 'cmp') );
+var_dump($string_key_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : basic functionality ***
+-- Numeric array with default keys --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [4]=>
+ int(2)
+ [3]=>
+ int(3)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+}
+-- String array with default keys --
+bool(true)
+array(4) {
+ [0]=>
+ string(4) "This"
+ [2]=>
+ string(1) "a"
+ [1]=>
+ string(2) "is"
+ [3]=>
+ string(4) "test"
+}
+-- Associative array with numeric keys --
+bool(true)
+array(5) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [5]=>
+ int(4)
+ [3]=>
+ int(7)
+ [4]=>
+ int(9)
+}
+-- Associative array with string keys --
+bool(true)
+array(4) {
+ ["three"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(4)
+ ["four"]=>
+ int(10)
+}
+Done
diff --git a/ext/standard/tests/array/uasort_basic2.phpt b/ext/standard/tests/array/uasort_basic2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing uasort() : basic functionality with duplicate values ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// increasing values
+$int_values1 = array(1, 1, 2, 2, 3, 3);
+echo "-- Numeric array with increasing values --\n";
+var_dump( uasort($int_values1, 'cmp') );
+var_dump($int_values1);
+
+// decreasing values
+$int_values2 = array(3, 3, 2, 2, 1, 1);
+echo "-- Numeric array with decreasing values --\n";
+var_dump( uasort($int_values2, 'cmp') );
+var_dump($int_values2);
+
+// increasing and decreasing values
+$int_values3 = array(1, 2, 3, 3, 2, 1);
+echo "-- Numeric array with increasing and decreasing values --\n";
+var_dump( uasort($int_values3, 'cmp') );
+var_dump($int_values3);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : basic functionality with duplicate values ***
+-- Numeric array with increasing values --
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(2)
+ [2]=>
+ int(2)
+ [5]=>
+ int(3)
+ [4]=>
+ int(3)
+}
+-- Numeric array with decreasing values --
+bool(true)
+array(6) {
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [3]=>
+ int(2)
+ [2]=>
+ int(2)
+ [1]=>
+ int(3)
+ [0]=>
+ int(3)
+}
+-- Numeric array with increasing and decreasing values --
+bool(true)
+array(6) {
+ [5]=>
+ int(1)
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [4]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/uasort_error.phpt b/ext/standard/tests/array/uasort_error.phpt
new file mode 100644
index 0000000..820ab58
--- /dev/null
+++ b/ext/standard/tests/array/uasort_error.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test uasort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing uasort() : error conditions ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Initialize 'array_arg'
+$array_arg = array(0 => 1, 1 => 10, 2 => 'string', 3 => 3, 4 => 2, 5 => 100, 6 => 25);
+
+// With zero arguments
+echo "-- Testing uasort() function with Zero argument --\n";
+var_dump( uasort() );
+
+// With one more than the expected number of arguments
+echo "-- Testing uasort() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( uasort($array_arg, 'cmp', $extra_arg) );
+
+// With one less than the expected number of arguments
+echo "-- Testing uasort() function with less than expected no. of arguments --\n";
+var_dump( uasort($array_arg) );
+
+// With non existent comparison function
+echo "-- Testing uasort() function with non-existent compare function --\n";
+var_dump( uasort($array_arg, 'non_existent') );
+
+// With non existent comparison function and extra arguemnt
+echo "-- Testing uasort() function with non-existent compare function and extra argument --\n";
+var_dump( uasort($array_arg, 'non_existent', $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : error conditions ***
+-- Testing uasort() function with Zero argument --
+
+Warning: 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing uasort() function with the array of objects
+ * array of objects which has only one member variable & more than one member variables
+ */
+
+echo "*** Testing uasort() : object functionality ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value3
+ * Description : compares value1 and value2
+ */
+function simple_cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// comparison function for SimpleClass2 objects which has more than one members
+function multiple_cmp($value1, $value2)
+{
+ if($value1->getValue() == $value2->getValue())
+ return 0;
+ else if($value1->getValue() > $value2->getValue())
+ return 1;
+ else
+ return -1;
+}
+
+// Simple class with single member variable
+class SimpleClass1
+{
+ private $int_value;
+
+ public function __construct($value) {
+ $this->int_value = $value;
+ }
+}
+
+// Simple class with more than one member variables
+class SimpleClass2
+{
+ private $int_value;
+ protected $float_value;
+ public $string_value;
+ public function __construct($int, $float, $str) {
+ $this->int_value = $int;
+ $this->float_value = $float;
+ $this->string_value = $str;
+ }
+ public function getValue() {
+ return $this->int_value;
+ }
+}
+
+// array of SimpleClass objects with only one member
+$array_arg = array(
+ 0 => new SimpleClass1(10),
+ 1 => new SimpleClass1(1),
+ 2 => new SimpleClass1(100),
+ 3 => new SimpleClass1(50)
+);
+var_dump( uasort($array_arg, 'simple_cmp') );
+var_dump($array_arg);
+
+// array of SimpleClass objects having more than one members
+$array_arg = array(
+ 0 => new SimpleClass2(2, 3.4, "mango"),
+ 1 => new SimpleClass2(10, 1.2, "apple"),
+ 2 => new SimpleClass2(5, 2.5, "orange"),
+);
+var_dump( uasort($array_arg, 'multiple_cmp') );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : object functionality ***
+bool(true)
+array(4) {
+ [1]=>
+ object(SimpleClass1)#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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*
+
+/*
+ * This testcase tests uasort() functionality with differnt objects
+ * Objects of different classes:
+ * simple class,
+ * child class,
+ * empty class &
+ * static class
+ */
+
+echo "*** Testing uasort() : object functionality ***\n";
+
+// comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+
+// Simple class with single member variable
+class SimpleClass
+{
+ private $int_value;
+
+ public function __construct($value) {
+ $this->int_value = $value;
+ }
+
+}
+
+// Class without any member
+class EmptyClass
+{
+}
+
+// Class with static member
+class StaticClass
+{
+ public static $static_value;
+ public function __construct($value) {
+ StaticClass::$static_value = $value;
+ }
+}
+
+// Abstract class
+abstract class AbstractClass
+{
+ public $pub_value;
+ public abstract function abstractMethod();
+}
+
+// Child class extending abstract class
+class ChildClass extends AbstractClass
+{
+ public $child_value = 100;
+ public function abstractMethod() {
+ $pub_value = 5;
+ }
+ public function __construct($value) {
+ $this->child_value = $value;
+ }
+}
+
+// Testing uasort with StaticClass objects as elements of 'array_arg'
+echo "-- Testing uasort() with StaticClass objects --\n";
+$array_arg = array(
+ 0 => new StaticClass(20),
+ 1 => new StaticClass(50),
+ 2 => new StaticClass(15),
+ 3 => new StaticClass(70),
+);
+var_dump( uasort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+// Testing uasort with EmptyClass objects as elements of 'array_arg'
+echo "-- Testing uasort() with EmptyClass objects --\n";
+$array_arg = array(
+ 0 => new EmptyClass(),
+ 1 => new EmptyClass(),
+ 2 => new EmptyClass(),
+ 3 => new EmptyClass(),
+);
+var_dump( uasort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+// Testing uasort with ChildClass objects as elements of 'array_arg'
+echo "-- Testing uasort() with ChildClass objects --\n";
+$array_arg = array(
+ 0 => new ChildClass(20),
+ 1 => new ChildClass(500),
+ 2 => new ChildClass(15),
+ 3 => new ChildClass(700),
+);
+var_dump( uasort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : object functionality ***
+-- Testing uasort() with StaticClass objects --
+bool(true)
+array(4) {
+ [3]=>
+ object(StaticClass)#%d (0) {
+ }
+ [2]=>
+ object(StaticClass)#%d (0) {
+ }
+ [1]=>
+ object(StaticClass)#%d (0) {
+ }
+ [0]=>
+ object(StaticClass)#%d (0) {
+ }
+}
+-- Testing uasort() with EmptyClass objects --
+bool(true)
+array(4) {
+ [3]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [2]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [1]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [0]=>
+ object(EmptyClass)#%d (0) {
+ }
+}
+-- Testing uasort() with ChildClass objects --
+bool(true)
+array(4) {
+ [2]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(15)
+ ["pub_value"]=>
+ NULL
+ }
+ [0]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(20)
+ ["pub_value"]=>
+ NULL
+ }
+ [1]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(500)
+ ["pub_value"]=>
+ NULL
+ }
+ [3]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(700)
+ ["pub_value"]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation1.phpt b/ext/standard/tests/array/uasort_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() function by passing different scalar/nonscalar values as 'array_arg' argument
+*/
+
+echo "*** Testing uasort() : unexpected values for 'array_arg' ***\n";
+
+// Comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get resource variable
+$fp = fopen(__FILE__,'r');
+
+//array of values to iterate over
+$input_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // resource data
+/*20*/ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+);
+
+// loop through each value of input_values
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( uasort($input_values[$count], 'cmp_function') );
+};
+
+//closing resource
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : unexpected values for 'array_arg' ***
+-- Iteration 1 --
+
+Warning: uasort() 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() with 'array_arg' containing different reference variables
+*/
+
+// comparision function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+echo "*** Testing uasort() : 'array_arg' with elements as reference ***\n";
+
+// different variables which are used as elements of 'array_arg'
+$value1 = -5;
+$value2 = 100;
+$value3 = 0;
+$value4 = &$value1;
+
+// array_args an array containing elements with reference variables
+$array_arg = array(
+ 0 => 10,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => 200,
+ 4 => &$value3,
+);
+
+echo "-- Sorting 'array_arg' containing different references --\n";
+var_dump( uasort($array_arg, 'cmp_function') ); // expecting: bool(true)
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : 'array_arg' with elements as reference ***
+-- Sorting 'array_arg' containing different references --
+bool(true)
+array(5) {
+ [1]=>
+ &int(-5)
+ [4]=>
+ &int(0)
+ [0]=>
+ int(10)
+ [2]=>
+ &int(100)
+ [3]=>
+ int(200)
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation11.phpt b/ext/standard/tests/array/uasort_variation11.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/* Testing uasort() with different associative arrays having keys as
+ * string, integer, default & duplicate keys
+ */
+
+echo "*** Testing uasort() : sorting different associative arrays ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Array with duplicate string and integer keys
+$array_arg = array(0 => 2, "a" => 8, "d" => 9, 3 => 3, 5 => 2, "o" => 6, "z" => -99, 0 => 1, "z" => 3);
+echo "-- Array with duplicate keys --\n";
+var_dump( uasort($array_arg, 'cmp') );
+var_dump($array_arg);
+
+// Array with default and assigned keys
+$array_arg = array(0 => "Banana", 1 => "Mango", "Orange", 2 => "Apple", "Pineapple");
+echo "-- Array with default/assigned keys --\n";
+var_dump( uasort($array_arg, 'cmp') );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : sorting different associative arrays ***
+-- Array with duplicate keys --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [5]=>
+ int(2)
+ ["z"]=>
+ int(3)
+ [3]=>
+ int(3)
+ ["o"]=>
+ int(6)
+ ["a"]=>
+ int(8)
+ ["d"]=>
+ int(9)
+}
+-- Array with default/assigned keys --
+bool(true)
+array(4) {
+ [2]=>
+ string(5) "Apple"
+ [0]=>
+ string(6) "Banana"
+ [1]=>
+ string(5) "Mango"
+ [3]=>
+ string(9) "Pineapple"
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation2.phpt b/ext/standard/tests/array/uasort_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() function with different scalar and nonscalar values in place of 'cmp_function'
+*/
+
+echo "*** Testing uasort() : Unexpected values in place of comparison function ***\n";
+
+// Class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+$array_arg = array(0 => 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5);
+
+// Get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// Get resource variable
+$fp = fopen(__FILE__,'r');
+
+// different values for 'cmp_function'
+$cmp_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+/*25*/ new MyClass(),
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*28*/ @$unset_var,
+);
+
+// loop through each element of the cmp_values for 'cmp_function'
+for($count = 0; $count < count($cmp_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( uasort($array_arg, $cmp_values[$count]) );
+};
+
+//closing resource
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : Unexpected values in place of comparison function ***
+-- Iteration 1 --
+
+Warning: uasort() 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
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* sorting different types of numeric arrays containing data of following type:
+* integer, octal, hexadecimal & float
+*/
+
+// comparision function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+echo "*** Testing uasort() : different numeric arrays as 'array_arg' ***\n";
+
+// Int array
+$int_values = array(0 => 3, 1 => 2, 3 => 100, 4 => 150, 5 => 25, 6 => 350, 7 => 0, 8 => -3, 9 => -1200);
+echo "-- Sorting Integer array --\n";
+var_dump( uasort($int_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($int_values);
+
+// Octal array
+$octal_values = array(0 => 056, 1 => 023, 2 => 090, 3 => 015, 4 => -045, 5 => 01, 6 => -078);
+echo "-- Sorting Octal array --\n";
+var_dump( uasort($octal_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($octal_values);
+
+// Hexadecimal array
+$hex_values = array(0 => 0xAE, 1 => 0x2B, 2 => 0X10, 3 => -0xCF, 4 => 0X12, 5 => -0XF2);
+echo "-- Sorting Hex array --\n";
+var_dump( uasort($hex_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($hex_values);
+
+// Float array
+$float_values = array( 0 => 10.2, 1 => 2.4, 2 => -3.4, 3 => 0, 4 => 0.5, 5 => 7.3e3, 6 => -9.34E-2);
+echo "-- Sorting Float array --\n";
+var_dump( uasort($float_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($float_values);
+
+// empty array
+$empty_array = array();
+echo "-- Sorting empty array --\n";
+var_dump( uasort($empty_array, 'cmp_function') ); // expecting: bool(true)
+var_dump($empty_array);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : different numeric arrays as 'array_arg' ***
+-- Sorting Integer array --
+bool(true)
+array(9) {
+ [9]=>
+ int(-1200)
+ [8]=>
+ int(-3)
+ [7]=>
+ int(0)
+ [1]=>
+ int(2)
+ [0]=>
+ int(3)
+ [5]=>
+ int(25)
+ [3]=>
+ int(100)
+ [4]=>
+ int(150)
+ [6]=>
+ int(350)
+}
+-- Sorting Octal array --
+bool(true)
+array(7) {
+ [4]=>
+ int(-37)
+ [6]=>
+ int(-7)
+ [2]=>
+ int(0)
+ [5]=>
+ int(1)
+ [3]=>
+ int(13)
+ [1]=>
+ int(19)
+ [0]=>
+ int(46)
+}
+-- Sorting Hex array --
+bool(true)
+array(6) {
+ [5]=>
+ int(-242)
+ [3]=>
+ int(-207)
+ [2]=>
+ int(16)
+ [4]=>
+ int(18)
+ [1]=>
+ int(43)
+ [0]=>
+ int(174)
+}
+-- Sorting Float array --
+bool(true)
+array(7) {
+ [2]=>
+ float(-3.4)
+ [6]=>
+ float(-0.0934)
+ [3]=>
+ int(0)
+ [4]=>
+ float(0.5)
+ [1]=>
+ float(2.4)
+ [0]=>
+ float(10.2)
+ [5]=>
+ float(7300)
+}
+-- Sorting empty array --
+bool(true)
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation5.phpt b/ext/standard/tests/array/uasort_variation5.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* sorting different strings:
+* single quoted, double quoted and heredoc strings
+*/
+
+// comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Different heredoc strings to be sorted
+$empty_heredoc =<<<EOT
+EOT;
+
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+
+echo "*** Testing uasort() : different string arrays as 'array_arg' ***\n";
+
+// Single quoted strings
+$single_quoted_values = array(
+ 0 => ' ', 1 => 'test', 3 => 'Hello', 4 => 'HELLO',
+ 5 => '', 6 => '\t', 7 => '0', 8 => '123Hello', 9 => '\'', 10 => '@#$%'
+);
+echo "-- Sorting Single Quoted String values --\n";
+var_dump( uasort($single_quoted_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($single_quoted_values);
+
+// Double quoted strings
+$double_quoted_values = array(
+ 0 => " ", 1 => "test", 3 => "Hello", 4 => "HELLO",
+ 5 => "", 6 => "\t", 7 => "0", 8 => "123Hello", 9 => "\"", 10 => "@#$%"
+);
+echo "-- Sorting Double Quoted String values --\n";
+var_dump( uasort($double_quoted_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($double_quoted_values);
+
+// Heredoc strings
+$heredoc_values = array(0 => $empty_heredoc, 1 => $simple_heredoc1, 2 => $simple_heredoc2, 3 => $multiline_heredoc);
+echo "-- Sorting Heredoc String values --\n";
+var_dump( uasort($heredoc_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($heredoc_values);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : different string arrays as 'array_arg' ***
+-- Sorting Single Quoted String values --
+bool(true)
+array(10) {
+ [5]=>
+ string(0) ""
+ [0]=>
+ string(1) " "
+ [9]=>
+ string(1) "'"
+ [7]=>
+ string(1) "0"
+ [8]=>
+ string(8) "123Hello"
+ [10]=>
+ string(4) "@#$%"
+ [4]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "Hello"
+ [6]=>
+ string(2) "\t"
+ [1]=>
+ string(4) "test"
+}
+-- Sorting Double Quoted String values --
+bool(true)
+array(10) {
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) " "
+ [0]=>
+ string(1) " "
+ [9]=>
+ string(1) """
+ [7]=>
+ string(1) "0"
+ [8]=>
+ string(8) "123Hello"
+ [10]=>
+ string(4) "@#$%"
+ [4]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "Hello"
+ [1]=>
+ string(4) "test"
+}
+-- Sorting Heredoc String values --
+bool(true)
+array(4) {
+ [0]=>
+ string(0) ""
+ [2]=>
+ string(7) "HEREDOC"
+ [1]=>
+ string(7) "Heredoc"
+ [3]=>
+ string(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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() with 'array_arg' having different subarrays as array elements
+*/
+
+// comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+echo "*** Testing uasort() : sorting array having different subarrays ***\n";
+
+$array_args = array(
+ 0 => array(2, 10, -1),
+ 1 => array(100),
+ 2 => array(),
+ 3 => array(0),
+ 4 => array(-1),
+ 5 => array(-9, 34, 54, 0, 20),
+ 6 => array(''),
+ 7 => array("apple", "Apple", "APPLE", "aPPle", "aPpLe")
+);
+$temp_array = $array_args;
+// sorting array_arg as whole array
+var_dump( uasort($temp_array, 'cmp_function') ); // expecting: bool(true)
+var_dump($temp_array);
+
+?>
+--EXPECTF--
+*** Testing uasort() : sorting array having different subarrays ***
+bool(true)
+array(8) {
+ [2]=>
+ array(0) {
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [6]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(100)
+ }
+ [0]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(-1)
+ }
+ [5]=>
+ array(5) {
+ [0]=>
+ int(-9)
+ [1]=>
+ int(34)
+ [2]=>
+ int(54)
+ [3]=>
+ int(0)
+ [4]=>
+ int(20)
+ }
+ [7]=>
+ array(5) {
+ [0]=>
+ string(5) "apple"
+ [1]=>
+ string(5) "Apple"
+ [2]=>
+ string(5) "APPLE"
+ [3]=>
+ string(5) "aPPle"
+ [4]=>
+ string(5) "aPpLe"
+ }
+}
diff --git a/ext/standard/tests/array/uasort_variation7.phpt b/ext/standard/tests/array/uasort_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different anonymous functions as 'cmp_function'
+* arguments passed by value
+* arguments passed by reference
+*/
+
+echo "*** Testing uasort() : anonymous function as 'cmp_function' ***\n";
+
+$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}';
+
+$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90);
+echo "-- Anonymous 'cmp_function' with parameters passed by value --\n";
+var_dump( uasort($array_arg, create_function('$value1, $value2',$cmp_function) ) );
+var_dump($array_arg);
+
+$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple");
+echo "-- Anonymous 'cmp_function' with parameters passed by reference --\n";
+var_dump( uasort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : anonymous function as 'cmp_function' ***
+-- Anonymous 'cmp_function' with parameters passed by value --
+bool(true)
+array(5) {
+ [2]=>
+ int(-70)
+ [1]=>
+ int(3)
+ [3]=>
+ int(24)
+ [4]=>
+ int(90)
+ [0]=>
+ int(100)
+}
+-- Anonymous 'cmp_function' with parameters passed by reference --
+bool(true)
+array(4) {
+ ["a"]=>
+ string(5) "Apple"
+ ["b"]=>
+ string(6) "Banana"
+ ["m"]=>
+ string(5) "Mango"
+ ["p"]=>
+ string(9) "Pineapple"
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different built-in library functions in place of 'cmp_function'
+* valid comparison functions: strcmp() & strcasecmp()
+* language constructs: echo & exit
+*/
+
+echo "*** Testing uasort() : built in function as 'cmp_function' ***\n";
+// Initializing variables
+$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "apple", "p" => "Pineapple", "o" => "orange");
+$builtin_fun_arg = $array_arg;
+$languageConstruct_fun_arg = $array_arg;
+
+// Testing library functions as comparison function
+echo "-- Testing uasort() with built-in 'cmp_function': strcasecmp() --\n";
+var_dump( uasort($builtin_fun_arg, 'strcasecmp') ); // expecting: bool(true)
+var_dump($builtin_fun_arg);
+
+echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n";
+var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true)
+var_dump($array_arg);
+
+// Testing with language construct as comparison function
+echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
+var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false)
+
+echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
+var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false)
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : built in function as 'cmp_function' ***
+-- Testing uasort() with built-in 'cmp_function': strcasecmp() --
+bool(true)
+array(5) {
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(6) "Banana"
+ ["m"]=>
+ string(5) "Mango"
+ ["o"]=>
+ string(6) "orange"
+ ["p"]=>
+ string(9) "Pineapple"
+}
+-- Testing uasort() with built-in 'cmp_function': strcmp() --
+bool(true)
+array(5) {
+ ["b"]=>
+ string(6) "Banana"
+ ["m"]=>
+ string(5) "Mango"
+ ["p"]=>
+ string(9) "Pineapple"
+ ["a"]=>
+ string(5) "apple"
+ ["o"]=>
+ string(6) "orange"
+}
+-- Testing uasort() with language construct as 'cmp_function' --
+
+Warning: uasort() 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--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/* Testing uasort() functionality with comparison function having arguments as reference
+ */
+
+echo "*** Testing uasort() : 'cmp_function' with reference arguments ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed &$value1, mixed &$value2)
+ * Parameters : $value1 and $value2 - values recieved by reference
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp(&$value1, &$value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Int array with default keys
+$int_values = array(1, 8, 9, 3, 2, 6, 7);
+echo "-- Passing integer values to 'cmp_function' --\n";
+var_dump( uasort($int_values, 'cmp') );
+var_dump($int_values);
+
+// String array with default keys
+$string_values = array("Mango", "Apple", "Orange", "Banana");
+echo "-- Passing string values to 'cmp_function' --\n";
+var_dump( uasort($string_values, 'cmp') );
+var_dump($string_values);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : 'cmp_function' with reference arguments ***
+-- Passing integer values to 'cmp_function' --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [4]=>
+ int(2)
+ [3]=>
+ int(3)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+}
+-- Passing string values to 'cmp_function' --
+bool(true)
+array(4) {
+ [1]=>
+ string(5) "Apple"
+ [3]=>
+ string(6) "Banana"
+ [0]=>
+ string(5) "Mango"
+ [2]=>
+ string(6) "Orange"
+}
+Done
diff --git a/ext/standard/tests/array/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--
+<?php
+/*
+* proto bool uksort ( array &$array, callback $cmp_function )
+* Function is implemented in ext/standard/array.c
+*/
+function cmp($a, $b) {
+ if ($a == $b) {
+ return 0;
+ }
+ return ($a < $b) ? -1 : 1;
+}
+$a = array(3, 2, 5, 6, 1);
+uasort($a, "cmp");
+foreach($a as $key => $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--
+<?php
+/* Prototype : bool uksort(array array_arg, string cmp_function)
+ * Description: Sort an array by keys using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing uksort() : error conditions ***\n";
+
+echo "\n-- Testing uksort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$cmp_function = 'string_val';
+$extra_arg = 10;
+var_dump( uksort($array_arg, $cmp_function, $extra_arg) );
+
+echo "\n-- Testing uksort() function with less than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+var_dump( uksort($array_arg) );
+
+echo "\n-- Testing uksort() function with zero arguments --\n";
+var_dump( uksort() );
+
+?>
+===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--
+<?php
+/* Prototype : bool uksort(array array_arg, string cmp_function)
+ * Description: Sort an array by keys using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing uksort() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$cmp_function = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : bool uksort(array array_arg, string cmp_function)
+ * Description: Sort an array by keys using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing uksort() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array_arg = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+function usercompare($a,$b) {
+ unset($GLOBALS['my_var'][2]);
+ return 0;
+}
+$my_var = array(1 => "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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of usort() with indexed and associative arrays
+ */
+
+echo "*** Testing usort() : basic functionality ***\n";
+
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Int array with default keys
+$int_values = array(1, 8, 9, 3, 2, 6, 7);
+
+echo "\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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : error conditions ***\n";
+
+//Test usort with one more than the expected number of arguments
+echo "\n-- Testing usort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$cmp_function = 'string_val';
+$extra_arg = 10;
+var_dump( usort($array_arg, $cmp_function, $extra_arg) );
+
+// Testing usort with one less than the expected number of arguments
+echo "\n-- Testing usort() function with less than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+var_dump( usort($array_arg) );
+?>
+===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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an unknown comparison function to usort() to test behaviour.
+ * Pass incorrect number of arguments and an unknown function to test which error
+ * is generated.
+ */
+
+echo "*** Testing usort() : error conditions ***\n";
+
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Initialize 'array_arg'
+$array_arg = array(0 => 1, 1 => 10, 2 => 'string', 3 => 3, 4 => 2, 5 => 100, 6 => 25);
+$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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of objects which have a different number of properties
+ * to test behaviour of usort()
+ */
+
+echo "*** Testing usort() : object functionality ***\n";
+
+function simple_cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// comparison function for SimpleClass2 objects which has more than one 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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of objects which are either:
+ * 1. Empty
+ * 2. Static
+ * 2. Inherited
+ * to test behaviour of usort()
+ */
+
+echo "*** Testing usort() : object functionality ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of usort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( usort($input, 'cmp_function') );
+ $iterator++;
+};
+
+//closing resource
+fclose($fp);
+?>
+===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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array with duplicate keys and values to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Array with duplicate string and integer keys 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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $cmp_function argument to usort() to test behaviour
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+// Class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+$array_arg = array(0 => 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5);
+
+// Get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// Get resource variable
+$fp = fopen(__FILE__,'r');
+
+// different values for $cmp_function
+$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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array with different data types as keys to usort() to test how it is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return -1;
+ }
+ else {
+ return 1;
+ }
+}
+
+// different heredoc strings
+
+// single line heredoc string
+$simple_heredoc = <<<EOT2
+simple
+EOT2;
+
+// multiline heredoc string
+$multiline_heredoc = <<<EOT3
+multiline heredoc with 123
+and speci@! ch@r..\ncheck\talso
+EOT3;
+
+$array_arg = array(
+ // numeric keys
+ -2 => 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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of numeric data to usort() to test how it is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of string data to usort() to test how it is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Different heredoc strings to be sorted
+$empty_heredoc =<<<EOT
+EOT;
+
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+// Single quoted strings
+$single_quoted_values = array(
+ 0 => ' ', 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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass a multi-dimensional array as $array_arg argument to usort()
+ * to test how array is re-ordered
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an anonymous comparison function as $cmp_function argument to test behaviour()
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}';
+
+$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90);
+
+echo "\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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test usort() when comparison function is:
+ * 1. a built in comparison function
+ * 2. a language construct
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+// Initializing variables
+$array_arg = array("b" => "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--
+<?php
+/* Prototype : bool usort(array $array_arg, string $cmp_function)
+ * Description: Sort an array by values using a user-defined comparison function
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of referenced variables as $array_arg to test behaviour
+ */
+
+echo "*** Testing usort() : usage variation ***\n";
+
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $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--
+<?php
+$a = (object) array (1, 3, "foo" => "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--
+<?php
+$a = array ("\0" => '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--
+<?php
+class kake {
+ public $mann;
+ protected $kvinne;
+
+ function __construct()
+ {
+ $this->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--
+<?php
+function a($file,$line,$myev)
+{
+ echo "assertion failed $line,\"$myev\"\n";
+}
+
+class a
+{
+ function assert($file,$line,$myev)
+ {
+ echo "class assertion failed $line,\"$myev\"\n";
+ }
+}
+
+assert_options(ASSERT_ACTIVE,1);
+assert_options(ASSERT_QUIET_EVAL,1);
+assert_options(ASSERT_WARNING,0);
+
+$a = 0;
+
+assert_options(ASSERT_CALLBACK,"a");
+assert('$a != 0');
+
+assert_options(ASSERT_CALLBACK,array("a","assert"));
+assert('$a != 0');
+
+$obj = new a();
+assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
+assert('$a != 0');
+?>
+--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--
+<?php
+function handler($errno, $errstr) {
+ echo "in handler()\n";
+ assert(E_RECOVERABLE_ERROR === $errno);
+ var_dump($errstr);
+}
+
+set_error_handler('handler', E_RECOVERABLE_ERROR);
+
+assert(1);
+assert('1');
+assert('$a');
+
+assert('aa=sd+as+safsafasfasafsaf');
+
+assert('0');
+
+assert_options(ASSERT_BAIL, 1);
+assert('aa=sd+as+safsafasfasafsaf');
+
+echo "done\n";
+
+?>
+--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--
+<?php
+function a($file,$line,$myev)
+{
+ echo "assertion failed - a - $line,\"$myev\"\n";
+}
+
+function b($file,$line,$myev)
+{
+ echo "assertion failed - b - $line,\"$myev\"\n";
+}
+
+assert_options(ASSERT_ACTIVE,1);
+assert_options(ASSERT_QUIET_EVAL,1);
+assert_options(ASSERT_WARNING,0);
+
+$a = 0;
+
+assert_options(ASSERT_CALLBACK,"a");
+assert('$a != 0');
+
+ /* Modify call back using ini_set() */
+ini_set("assert.callback", "b");
+assert('$a != 0');
+
+?>
+==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--
+<?php
+/* Assert not active */
+assert_options(ASSERT_ACTIVE, 0);
+assert(1);
+
+
+/* Wrong parameter count in assert */
+assert_options(ASSERT_ACTIVE, 1);
+assert(2, "failure", 3);
+
+/* Wrong parameter count in assert_options */
+assert_options(ASSERT_ACTIVE, 0, 2);
+
+/* Wrong parameter name in assert_options */
+$test="ASSERT_FRED";
+assert_options($test, 1);
+
+/* Assert false */
+assert(0);
+
+
+/* Assert false and bail*/
+assert_options(ASSERT_BAIL, 1);
+assert(0);
+
+echo "not reached\n";
+
+?>
+--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--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+//String assert
+$sa = "0 != 0";
+var_dump($r2=assert($sa));
+$sa = "0 == 0";
+var_dump($r2=assert($sa));
+
+//Non string assert
+var_dump($r2=assert(0));
+var_dump($r2=assert(1));
+--EXPECTF--
+f1 called
+NULL
+bool(true)
+f1 called
+NULL
+bool(true)
diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt
new file mode 100644
index 0000000..8aed519
--- /dev/null
+++ b/ext/standard/tests/assert/assert_basic1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+assert() - basic - check that assert can be switched off
+--INI--
+assert.active = 0
+assert.warning = 0
+assert.callback = f1
+assert.bail = 0
+assert.quiet_eval = 0
+--FILE--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+
+//String assert
+$sa = "0 != 0";
+var_dump($r2=assert($sa));
+$sa = "0 == 0";
+var_dump($r2=assert($sa));
+
+//Non string assert
+var_dump($r2=assert(0));
+var_dump($r2=assert(1));
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt
new file mode 100644
index 0000000..277e5ca
--- /dev/null
+++ b/ext/standard/tests/assert/assert_basic2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+assert() - basic - correct call back values before and after assert.
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback=f1
+assert.bail = 0
+assert.quiet_eval = 0
+--FILE--
+<?php
+function f2()
+{
+ echo "f2 called\n";
+}
+
+function f1()
+{
+ echo "f1 called\n";
+}
+
+var_dump($o = assert_options(ASSERT_CALLBACK));
+assert(0);
+
+var_dump($o= assert_options(ASSERT_CALLBACK, "f2"));
+var_dump($n= assert_options(ASSERT_CALLBACK));
+assert(0);
+?>
+--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--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+
+//bail out on error
+var_dump($rao=assert_options(ASSERT_BAIL, 1));
+$sa = "0 != 0";
+var_dump($r2=assert($sa));
+echo "If this is printed BAIL hasn't worked";
+--EXPECTF--
+int(0)
+f1 called
+
+Warning: assert(): Assertion "0 != 0" failed in %s on line 10
diff --git a/ext/standard/tests/assert/assert_basic4.phpt b/ext/standard/tests/assert/assert_basic4.phpt
new file mode 100644
index 0000000..2f11234
--- /dev/null
+++ b/ext/standard/tests/assert/assert_basic4.phpt
@@ -0,0 +1,37 @@
+--TEST--
+assert() - basic - test initial values using ini.get and assert_options
+--INI--
+assert.active = 0
+assert.warning = 0
+assert.bail = 0
+assert.quiet_eval = 0
+assert.callback = f1
+--FILE--
+<?php
+// Check the initial settings for all assert_options
+
+//Using assert_options;
+echo "Initial values: assert_options(ASSERT_ACTIVE) => [".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--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+
+//switch warning on and test return value
+var_dump($rao=assert_options(ASSERT_WARNING, 1));
+$sa = "0 != 0";
+var_dump($r2=assert($sa));
+$sa = "0 == 0";
+var_dump($r2=assert($sa));
+
+//switch warning on and test return value
+var_dump($rao=assert_options(ASSERT_WARNING, 0));
+--EXPECTF--
+int(0)
+f1 called
+
+Warning: assert(): Assertion "0 != 0" failed in %s on line 10
+NULL
+bool(true)
+int(1)
diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt
new file mode 100644
index 0000000..2a73713
--- /dev/null
+++ b/ext/standard/tests/assert/assert_basic6.phpt
@@ -0,0 +1,26 @@
+--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--
+<?php
+function f1($message)
+{
+ echo "f1 called\n";
+}
+
+//bail out on error
+var_dump($rao = assert_options(ASSERT_BAIL, 1));
+$sa = "0 != 0";
+var_dump($r2 = assert($sa, "0 is 0"));
+echo "If this is printed BAIL hasn't worked";
+--EXPECTF--
+int(0)
+f1 called
+
+Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10
+
diff --git a/ext/standard/tests/assert/assert_closures.phpt b/ext/standard/tests/assert/assert_closures.phpt
new file mode 100644
index 0000000..e01c11a
--- /dev/null
+++ b/ext/standard/tests/assert/assert_closures.phpt
@@ -0,0 +1,16 @@
+--TEST--
+assert() - basic - accept closures as callback.
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.bail = 0
+assert.quiet_eval = 0
+--FILE--
+<?php
+assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; });
+assert(0);
+?>
+--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--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+
+$sa = "threemeninaboat";
+
+var_dump($r2=assert($sa));
+
+var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1));
+
+var_dump($r2=assert($sa));
+--EXPECTF--
+Notice: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' in %s(9) : assert code on line 1
+bool(true)
+int(0)
+bool(true)
diff --git a/ext/standard/tests/assert/assert_error1.phpt b/ext/standard/tests/assert/assert_error1.phpt
new file mode 100644
index 0000000..657b411
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error1.phpt
@@ -0,0 +1,45 @@
+--TEST--
+assert() - error - invalid params
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 1
+assert.bail = 0
+--FILE--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+function handler($errno, $errstr) {
+ echo "in handler()\n\n";
+ assert(E_RECOVERABLE_ERROR === $errno);
+ var_dump($errstr);
+}
+
+//Wrong number of parameters for assert_options()
+assert_options(ASSERT_WARNING, 1);
+var_dump($rao = assert_options(ASSERT_CALLBACK, "f1", 1));
+
+
+//Unknown option for assert_options()
+var_dump($rao=assert_options("F1", "f1"));
+
+//Wrong number of parameters for assert()
+$sa="0 != 0";
+var_dump($r2 = assert($sa, "message", 1));
+
+
+//Catch recoverable error with handler
+var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç'));
+--EXPECTF--
+Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: assert_options() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt
new file mode 100644
index 0000000..da7c3d9
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+assert() - basic - Test that bailout works
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 1
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+<?php
+function f1($script, $line, $message, $user_message)
+{
+ echo "f1 called\n";
+}
+
+//bail out on error
+var_dump($rao = assert_options(ASSERT_BAIL, 1));
+$sa = "0 != 0";
+var_dump($r2 = assert($sa));
+echo "If this is printed BAIL hasn't worked";
+--EXPECTF--
+int(0)
+
+Warning: Missing argument 4 for f1() in %s on line 2
+f1 called
+
+Warning: assert(): Assertion "0 != 0" failed in %s on line 10
+
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
new file mode 100644
index 0000000..54b91ed
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error3.phpt
@@ -0,0 +1,21 @@
+--TEST--
+assert() - basic - Test recoverable error
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 0
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+<?php
+$sa = "0 $ 0";
+var_dump($r2 = assert($sa));
+--EXPECTF--
+
+Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+
+Catchable fatal error: assert(): Failure evaluating code:
+0 $ 0 in %s on line 3
+
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
new file mode 100644
index 0000000..264cc8f
--- /dev/null
+++ b/ext/standard/tests/assert/assert_error4.phpt
@@ -0,0 +1,21 @@
+--TEST--
+assert() - basic - Test recoverable error
+--INI--
+assert.active = 1
+assert.warning = 1
+assert.callback = f1
+assert.quiet_eval = 0
+assert.bail = 0
+error_reporting = -1
+display_errors = 1
+--FILE--
+<?php
+$sa = "0 $ 0";
+var_dump($r2 = assert($sa, "Describing what was asserted"));
+--EXPECTF--
+
+Parse error: syntax error, unexpected '$' in %s(3) : assert code on line 1
+
+Catchable fatal error: assert(): Failure evaluating code:
+Describing what was asserted:"0 $ 0" in %s on line 3
+
diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt
new file mode 100644
index 0000000..c49feea
--- /dev/null
+++ b/ext/standard/tests/assert/assert_variation.phpt
@@ -0,0 +1,131 @@
+--TEST--
+assert() - variation - test callback options using ini_get/ini_set/assert_options
+--INI--
+assert.active = 1
+assert.warning = 0
+assert.callback = f1
+assert.bail = 0
+assert.quiet_eval = 0
+--FILE--
+<?php
+function f1()
+{
+ echo "f1 called\n";
+}
+function f2()
+{
+ echo "f2 called\n";
+}
+function f3()
+{
+ echo "f3 called\n";
+}
+class c1
+{
+ function assert($file, $line, $myev)
+ {
+ echo "Class assertion failed $line, \"$myev\"\n";
+ }
+}
+echo "Initial values: assert_options(ASSERT_CALLBACK) => [".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--
+<?php
+
+for ($i = 0; $i < 10; $i++) {
+ printf("{%f} %1\$f\n", pow(-1.0, 0.3));
+ printf(b"{%f} %1\$f\n", pow(-1.0, 0.3));
+}
+
+?>
+--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 @@
+<?php
+
+Interface AutoInterface {}
+
+?> \ 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 @@
+<?php
+
+class AutoLoaded {}
+
+?> \ 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 @@
+<?php
+
+class autoTest {
+ public static $bob = "bob";
+
+ public function __get($name) {
+ echo "attempt to access $name\n";
+ return "foo";
+ }
+
+}
+
+?> \ 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 @@
+<?php
+
+trait AutoTrait {}
+
+?> \ 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--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing class_exists() : basic functionality ***\n";
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
+var_dump( class_exists('C', true) );
+echo "\nCalling class_exists() on existing class with autoload explicitly enabled:\n";
+var_dump( class_exists('stdclass', true) );
+
+echo "\nCalling class_exists() on non-existent class with autoload explicitly enabled:\n";
+var_dump( class_exists('D', false) );
+echo "\nCalling class_exists() on existing class with autoload explicitly disabled:\n";
+var_dump( class_exists('stdclass', false) );
+
+echo "\nCalling class_exists() on non-existent class with autoload unspecified:\n";
+var_dump( class_exists('E') );
+echo "\nCalling class_exists() on existing class with autoload unspecified:\n";
+var_dump( class_exists('stdclass') );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : basic functionality ***
+Calling class_exists() on non-existent class with autoload explicitly enabled:
+In __autoload(C)
+bool(false)
+
+Calling class_exists() on existing class with autoload explicitly enabled:
+bool(true)
+
+Calling class_exists() on non-existent class with autoload explicitly enabled:
+bool(false)
+
+Calling class_exists() on existing class with autoload explicitly disabled:
+bool(true)
+
+Calling class_exists() on non-existent class with autoload unspecified:
+In __autoload(E)
+bool(false)
+
+Calling class_exists() on existing class with autoload unspecified:
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/class_exists_error_001.phpt b/ext/standard/tests/class_object/class_exists_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/**
+ * Test wrong number of arguments
+ */
+
+echo "*** Testing class_exists() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing class_exists() function with Zero arguments --\n";
+var_dump( class_exists() );
+
+//Test class_exists with one more than the expected number of arguments
+echo "\n-- Testing class_exists() function with more than expected no. of arguments --\n";
+$classname = 'string_val';
+$autoload = true;
+$extra_arg = 10;
+var_dump( class_exists($classname, $autoload, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : error conditions ***
+
+-- Testing class_exists() function with Zero arguments --
+
+Warning: class_exists() expects at least 1 parameter, 0 given in %s on line 16
+NULL
+
+-- Testing class_exists() function with more than expected no. of arguments --
+
+Warning: class_exists() expects at most 2 parameters, 3 given in %s on line 23
+NULL
+Done
diff --git a/ext/standard/tests/class_object/class_exists_variation_001.phpt b/ext/standard/tests/class_object/class_exists_variation_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing class_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$autoload = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for classname
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( class_exists($value, $autoload) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+In __autoload(0)
+bool(false)
+
+Arg value 1
+In __autoload(1)
+bool(false)
+
+Arg value 12345
+In __autoload(12345)
+bool(false)
+
+Arg value -2345
+In __autoload(-2345)
+bool(false)
+
+Arg value 10.5
+In __autoload(10.5)
+bool(false)
+
+Arg value -10.5
+In __autoload(-10.5)
+bool(false)
+
+Arg value 101234567000
+In __autoload(101234567000)
+bool(false)
+
+Arg value 1.07654321E-9
+In __autoload(1.07654321E-9)
+bool(false)
+
+Arg value 0.5
+In __autoload(0.5)
+bool(false)
+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--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing class_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$classname = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for autoload
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( class_exists($classname, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(71)
+Error: 8 - Undefined variable: unset_var, %s(74)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+In __autoload(string_val)
+bool(false)
+
+Arg value 12345
+In __autoload(string_val)
+bool(false)
+
+Arg value -2345
+In __autoload(string_val)
+bool(false)
+
+Arg value 10.5
+In __autoload(string_val)
+bool(false)
+
+Arg value -10.5
+In __autoload(string_val)
+bool(false)
+
+Arg value 101234567000
+In __autoload(string_val)
+bool(false)
+
+Arg value 1.07654321E-9
+In __autoload(string_val)
+bool(false)
+
+Arg value 0.5
+In __autoload(string_val)
+bool(false)
+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--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class caseSensitivityTest {}
+var_dump(class_exists('casesensitivitytest'));
+
+echo "Done"
+?>
+--EXPECTF--
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/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--
+<?php
+
+class A
+{
+ const NAME = 'A';
+ public static function test() {
+ echo static::NAME, "\n";
+ }
+}
+
+class B extends A
+{
+ const NAME = 'B';
+
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('parent', 'test'));
+ }
+
+ public static function test2() {
+ echo self::NAME, "\n";
+ forward_static_call(array('self', 'test'));
+ }
+
+ public static function test3() {
+ echo self::NAME, "\n";
+ forward_static_call(array('A', 'test'));
+ }
+}
+
+class C extends B
+{
+ const NAME = 'C';
+
+ public static function test()
+ {
+ echo self::NAME, "\n";
+ forward_static_call(array('A', 'test'));
+ }
+}
+
+A::test();
+echo "-\n";
+B::test();
+echo "-\n";
+B::test2();
+echo "-\n";
+B::test3();
+echo "-\n";
+C::test();
+echo "-\n";
+C::test2();
+echo "-\n";
+C::test3();
+
+?>
+===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--
+<?php
+
+class A
+{
+ public static function test() {
+ echo "A\n";
+ }
+}
+
+function test() {
+ forward_static_call(array('A', 'test'));
+}
+
+test();
+
+?>
+--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--
+<?php
+
+class A
+{
+ const NAME = 'A';
+ public static function test() {
+ echo static::NAME, "\n";
+ }
+}
+
+class B extends A
+{
+ const NAME = 'B';
+
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('parent', 'test'));
+ }
+}
+
+class C
+{
+ const NAME = 'C';
+
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('B', 'test'));
+ }
+}
+
+A::test();
+echo "-\n";
+B::test();
+echo "-\n";
+C::test();
+
+?>
+===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--
+<?php
+/* Prototype : proto string get_class([object object])
+ * Description: Retrieves the class name
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class() : error conditions ***\n";
+
+//Test get_class with one more than the expected number of arguments
+echo "\n-- Testing get_class() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$extra_arg = 10;
+var_dump( get_class($object, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class() : error conditions ***
+
+-- Testing get_class() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic behaviour with existing class and non-existent class.
+ */
+
+echo "*** Testing get_class_methods() : basic functionality ***\n";
+
+class C {
+ function f() {}
+ function g() {}
+ function h() {}
+}
+
+echo "Argument is class name:\n";
+var_dump( get_class_methods("C") );
+echo "Argument is class instance:\n";
+$c = new C;
+var_dump( get_class_methods($c) );
+
+class D {}
+echo "Argument is name of class which has no methods:\n";
+var_dump( get_class_methods("D") );
+
+echo "Argument is non existent class:\n";
+var_dump( get_class_methods("NonExistent") );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : basic functionality ***
+Argument is class name:
+array(3) {
+ [0]=>
+ string(1) "f"
+ [1]=>
+ string(1) "g"
+ [2]=>
+ string(1) "h"
+}
+Argument is class instance:
+array(3) {
+ [0]=>
+ string(1) "f"
+ [1]=>
+ string(1) "g"
+ [2]=>
+ string(1) "h"
+}
+Argument is name of class which has no methods:
+array(0) {
+}
+Argument is non existent class:
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test behaviour with various visibility levels.
+ */
+
+class C {
+ private function privC() {}
+ protected function protC() {}
+ public function pubC() {}
+
+ public static function testFromC() {
+ echo "Accessing C from C:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from C:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from C:\n";
+ var_dump(get_class_methods("X"));
+ }
+}
+
+class D extends C {
+ private function privD() {}
+ protected function protD() {}
+ public function pubD() {}
+
+ public static function testFromD() {
+ echo "Accessing C from D:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from D:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from D:\n";
+ var_dump(get_class_methods("X"));
+ }
+}
+
+class X {
+ private function privX() {}
+ protected function protX() {}
+ public function pubX() {}
+
+ public static function testFromX() {
+ echo "Accessing C from X:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from X:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from X:\n";
+ var_dump(get_class_methods("X"));
+ }
+}
+
+echo "Accessing D from global scope:\n";
+var_dump(get_class_methods("D"));
+
+C::testFromC();
+D::testFromD();
+X::testFromX();
+
+echo "Done";
+?>
+--EXPECTF--
+Accessing D from global scope:
+array(4) {
+ [0]=>
+ string(4) "pubD"
+ [1]=>
+ string(9) "testFromD"
+ [2]=>
+ string(4) "pubC"
+ [3]=>
+ string(9) "testFromC"
+}
+Accessing C from C:
+array(4) {
+ [0]=>
+ string(5) "privC"
+ [1]=>
+ string(5) "protC"
+ [2]=>
+ string(4) "pubC"
+ [3]=>
+ string(9) "testFromC"
+}
+Accessing D from C:
+array(7) {
+ [0]=>
+ string(5) "protD"
+ [1]=>
+ string(4) "pubD"
+ [2]=>
+ string(9) "testFromD"
+ [3]=>
+ string(5) "privC"
+ [4]=>
+ string(5) "protC"
+ [5]=>
+ string(4) "pubC"
+ [6]=>
+ string(9) "testFromC"
+}
+Accessing X from C:
+array(2) {
+ [0]=>
+ string(4) "pubX"
+ [1]=>
+ string(9) "testFromX"
+}
+Accessing C from D:
+array(3) {
+ [0]=>
+ string(5) "protC"
+ [1]=>
+ string(4) "pubC"
+ [2]=>
+ string(9) "testFromC"
+}
+Accessing D from D:
+array(7) {
+ [0]=>
+ string(5) "privD"
+ [1]=>
+ string(5) "protD"
+ [2]=>
+ string(4) "pubD"
+ [3]=>
+ string(9) "testFromD"
+ [4]=>
+ string(5) "protC"
+ [5]=>
+ string(4) "pubC"
+ [6]=>
+ string(9) "testFromC"
+}
+Accessing X from D:
+array(2) {
+ [0]=>
+ string(4) "pubX"
+ [1]=>
+ string(9) "testFromX"
+}
+Accessing C from X:
+array(2) {
+ [0]=>
+ string(4) "pubC"
+ [1]=>
+ string(9) "testFromC"
+}
+Accessing D from X:
+array(4) {
+ [0]=>
+ string(4) "pubD"
+ [1]=>
+ string(9) "testFromD"
+ [2]=>
+ string(4) "pubC"
+ [3]=>
+ string(9) "testFromC"
+}
+Accessing X from X:
+array(4) {
+ [0]=>
+ string(5) "privX"
+ [1]=>
+ string(5) "protX"
+ [2]=>
+ string(4) "pubX"
+ [3]=>
+ string(9) "testFromX"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test behaviour with interfaces.
+ */
+
+interface I {
+ public function pubI();
+
+}
+
+class C implements I {
+ public function pubI() {}
+
+ private function privC() {}
+ protected function protC() {}
+ public function pubC() {}
+
+ public static function testFromC() {
+ echo "Accessing I from C:\n";
+ var_dump(get_class_methods("I"));
+ echo "Accessing C from C:\n";
+ var_dump(get_class_methods("C"));
+ }
+}
+
+
+echo "Accessing I from global scope:\n";
+var_dump(get_class_methods("I"));
+echo "Accessing C from global scope:\n";
+var_dump(get_class_methods("C"));
+C::testFromC();
+echo "Done";
+?>
+--EXPECTF--
+Accessing I from global scope:
+array(1) {
+ [0]=>
+ string(4) "pubI"
+}
+Accessing C from global scope:
+array(3) {
+ [0]=>
+ string(4) "pubI"
+ [1]=>
+ string(4) "pubC"
+ [2]=>
+ string(9) "testFromC"
+}
+Accessing I from C:
+array(1) {
+ [0]=>
+ string(4) "pubI"
+}
+Accessing C from C:
+array(5) {
+ [0]=>
+ string(4) "pubI"
+ [1]=>
+ string(5) "privC"
+ [2]=>
+ string(5) "protC"
+ [3]=>
+ string(4) "pubC"
+ [4]=>
+ string(9) "testFromC"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_error_001.phpt b/ext/standard/tests/class_object/get_class_methods_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test wrong number of arguments.
+ */
+
+echo "*** Testing get_class_methods() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_class_methods() function with Zero arguments --\n";
+var_dump( get_class_methods() );
+
+//Test get_class_methods with one more than the expected number of arguments
+echo "\n-- Testing get_class_methods() function with more than expected no. of arguments --\n";
+$class = 1;
+$extra_arg = 10;
+var_dump( get_class_methods($class, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : error conditions ***
+
+-- Testing get_class_methods() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing get_class_methods() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for class
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( get_class_methods($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+NULL
+
+Arg value 1
+NULL
+
+Arg value 12345
+NULL
+
+Arg value -2345
+NULL
+
+Arg value 10.5
+NULL
+
+Arg value -10.5
+NULL
+
+Arg value 101234567000
+NULL
+
+Arg value 1.07654321E-9
+NULL
+
+Arg value 0.5
+NULL
+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--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class_methods() : usage variations ***\n";
+
+class caseSensitivityTest {
+ function MyMeThOd() {}
+}
+
+var_dump( get_class_methods('CasesensitivitytesT') );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : usage variations ***
+array(1) {
+ [0]=>
+ string(8) "MyMeThOd"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string get_class([object object])
+ * Description: Retrieves the class name
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class() : usage variations ***\n";
+
+// Note: basic use cases in Zend/tests/009.phpt
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
+ var_dump( get_class($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %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--
+<?php
+/* Prototype : proto string get_class([object object])
+ * Description: Retrieves the class name
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class caseSensitivityTest {}
+var_dump(get_class(new casesensitivitytest));
+
+echo "Done";
+?>
+--EXPECTF--
+string(19) "caseSensitivityTest"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_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--
+<?php
+/* Prototype : array get_class_vars(string class_name)
+ * Description: Returns an array of default properties of the class.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class_vars() : error conditions ***\n";
+
+
+//Test get_class_vars with one more than the expected number of arguments
+echo "\n-- Testing get_class_vars() function with more than expected no. of arguments --\n";
+$obj = new stdclass();
+$extra_arg = 10;
+var_dump(get_class_vars($obj,$extra_arg) );
+
+// Testing get_class_vars with one less than the expected number of arguments
+echo "\n-- Testing get_class_vars() function with less than expected no. of arguments --\n";
+var_dump(get_class_vars());
+
+?>
+===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--
+<?php
+/* Prototype : array get_class_vars(string class_name)
+ * Description: Returns an array of default properties of the class.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class_vars() : usage variation ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : array get_class_vars(string class_name)
+ * Description: Returns an array of default properties of the class.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class Ancestor {
+ function test() {
+ var_dump(get_class_vars("Tester"));
+ }
+
+ static function testStatic() {
+ var_dump(get_class_vars("Tester"));
+ }
+}
+
+class Tester extends Ancestor {
+ public $pub = "public var";
+ protected $prot = "protected var";
+ private $priv = "private var";
+
+ static public $pubs = "public static var";
+ static protected $prots = "protected static var";
+ static private $privs = "private static var";
+
+ function test() {
+ var_dump(get_class_vars("Tester"));
+ }
+
+ static function testStatic() {
+ var_dump(get_class_vars("Tester"));
+ }
+}
+
+class Child extends Tester {
+ function test() {
+ var_dump(get_class_vars("Tester"));
+ }
+
+ static function testStatic() {
+ var_dump(get_class_vars("Tester"));
+ }
+}
+
+echo "*** Testing get_class_vars() : testing visibility\n";
+
+echo "\n-- From global context --\n";
+var_dump(get_class_vars("Tester"));
+
+echo "\n-- From inside an object instance --\n";
+$instance = new Tester();
+$instance->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--
+<?php
+/* Prototype : proto array get_declared_classes()
+ * Description: Returns an array of all declared classes.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_classes() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_declared_classes() function with Zero arguments --\n";
+var_dump(get_declared_classes());
+
+foreach (get_declared_classes() as $class) {
+ if (!class_exists($class)) {
+ echo "Error: $class is not a valid class.\n";
+ }
+}
+
+echo "\n-- Ensure userspace classes are listed --\n";
+Class C {}
+var_dump(in_array('C', get_declared_classes()));
+
+echo "\n-- Ensure userspace interfaces are not listed --\n";
+Interface I {}
+var_dump(in_array( 'I', get_declared_classes()));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_classes() : basic functionality ***
+
+-- Testing get_declared_classes() function with Zero arguments --
+array(%d) {
+%a
+}
+
+-- Ensure userspace classes are listed --
+bool(true)
+
+-- Ensure userspace interfaces are not listed --
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_declared_classes_error_001.phpt b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_declared_classes()
+ * Description: Returns an array of all declared classes.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_declared_classes() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing get_declared_classes() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( get_declared_classes($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_classes() : error conditions ***
+
+-- Testing get_declared_classes() function with one argument --
+
+Warning: 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--
+<?php
+/* Prototype : proto array get_declared_classes()
+ * Description: Returns an array of all declared classes.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n";
+
+function __autoload($class_name) {
+ require_once $class_name . '.inc';
+}
+
+echo "\n-- before instance is declared --\n";
+var_dump(in_array('AutoLoaded', get_declared_classes()));
+
+echo "\n-- after instance is declared --\n";
+$class = new AutoLoaded();
+var_dump(in_array('AutoLoaded', get_declared_classes()));
+
+echo "\nDONE\n";
+
+?>
+--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--
+<?php
+/* Prototype : proto array get_declared_interfaces()
+ * Description: Returns an array of all declared interfaces.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_interfaces() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_declared_interfaces() function with Zero arguments --\n";
+var_dump(get_declared_interfaces());
+
+foreach (get_declared_interfaces() as $interface) {
+ if (!interface_exists($interface)) {
+ echo "Error: $interface is not a valid interface.\n";
+ }
+}
+
+echo "\n-- Ensure userspace classes are not listed --\n";
+Class C {}
+var_dump(in_array('C', get_declared_interfaces()));
+
+echo "\n-- Ensure userspace interfaces are listed --\n";
+Interface I {}
+var_dump(in_array('I', get_declared_interfaces()));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_interfaces() : basic functionality ***
+
+-- Testing get_declared_interfaces() function with Zero arguments --
+array(%d) {
+%a
+}
+
+-- Ensure userspace classes are not listed --
+bool(false)
+
+-- Ensure userspace interfaces are listed --
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_declared_interfaces()
+ * Description: Returns an array of all declared interfaces.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_declared_interfaces() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing get_declared_interfaces() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( get_declared_interfaces($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_interfaces() : error conditions ***
+
+-- Testing get_declared_interfaces() function with one argument --
+
+Warning: 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--
+<?php
+/* Prototype : proto array get_declared_interfaces()
+ * Description: Returns an array of all declared interfaces.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n";
+
+function __autoload($class_name) {
+ require_once $class_name . '.inc';
+}
+
+echo "\n-- before interface is used --\n";
+var_dump(in_array('AutoInterface', get_declared_interfaces()));
+
+
+echo "\n-- after interface is used --\n";
+class Implementor implements AutoInterface {}
+var_dump(in_array('AutoInterface', get_declared_interfaces()));
+
+echo "\nDONE\n";
+?>
+--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--
+<?php
+/* Prototype : proto array get_declared_traits()
+ * Description: Returns an array of all declared traits.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_traits() : basic functionality ***\n";
+
+trait MyTrait {}
+
+// Zero arguments
+echo "\n-- Testing get_declared_traits() function with Zero arguments --\n";
+var_dump(get_declared_traits());
+
+foreach (get_declared_traits() as $trait) {
+ if (!trait_exists($trait)) {
+ echo "Error: $trait is not a valid trait.\n";
+ }
+}
+
+echo "\n-- Ensure trait is listed --\n";
+var_dump(in_array('MyTrait', get_declared_traits()));
+
+echo "\n-- Ensure userspace interfaces are not listed --\n";
+interface I {}
+var_dump(in_array( 'I', get_declared_traits()));
+
+echo "\n-- Ensure userspace classes are not listed --\n";
+class MyClass {}
+var_dump(in_array( 'MyClass', get_declared_traits()));
+
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array get_declared_traits()
+ * Description: Returns an array of all declared traits.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_declared_traits() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing get_declared_traits() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( get_declared_traits($extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto array get_declared_traits()
+ * Description: Returns an array of all declared traits.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n";
+
+function __autoload($trait_name) {
+ require_once $trait_name . '.inc';
+}
+
+echo "\n-- before instance is declared --\n";
+var_dump(in_array('AutoTrait', get_declared_traits()));
+
+echo "\n-- after use is declared --\n";
+
+class MyClass {
+ use AutoTrait;
+}
+
+var_dump(in_array('AutoTrait', get_declared_traits()));
+
+echo "\nDONE\n";
+
+?>
+--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--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class A {
+ private $hiddenPriv = 'A::hiddenPriv';
+
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class B extends A {
+ private $hiddenPriv = 'B::hiddenPriv';
+ private $priv = 'B::priv';
+ protected $prot = 'B::prot';
+ public $pub = 'B::pub';
+
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class C extends B {
+ private $hiddenPriv = 'C::hiddenPriv';
+
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class X {
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+
+$b = new B;
+echo "\n---( Global scope: )---\n";
+var_dump(get_object_vars($b));
+echo "\n---( Declaring class: )---\n";
+B::test($b);
+echo "\n---( Subclass: )---\n";
+C::test($b);
+echo "\n---( Superclass: )---\n";
+A::test($b);
+echo "\n---( Unrelated class: )---\n";
+X::test($b);
+?>
+--EXPECTF--
+
+---( Global scope: )---
+array(1) {
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Declaring class: )---
+B::test
+array(4) {
+ ["hiddenPriv"]=>
+ string(13) "B::hiddenPriv"
+ ["priv"]=>
+ string(7) "B::priv"
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Subclass: )---
+C::test
+array(2) {
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Superclass: )---
+A::test
+array(3) {
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+ ["hiddenPriv"]=>
+ string(13) "A::hiddenPriv"
+}
+
+---( Unrelated class: )---
+X::test
+array(1) {
+ ["pub"]=>
+ string(6) "B::pub"
+} \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class A {
+ private $hiddenPriv = 'A::hiddenPriv';
+
+ public function testA($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class B extends A {
+ private $hiddenPriv = 'B::hiddenPriv';
+ private $priv = 'B::priv';
+ protected $prot = 'B::prot';
+ public $pub = 'B::pub';
+
+ public function testB($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+
+$b = new B;
+echo "\n---( Declaring class: )---\n";
+$b->testB($b);
+echo "\n---( Superclass: )---\n";
+$b->testA($b);
+
+?>
+--EXPECTF--
+
+---( Declaring class: )---
+B::testB
+array(4) {
+ ["hiddenPriv"]=>
+ string(13) "B::hiddenPriv"
+ ["priv"]=>
+ string(7) "B::priv"
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Superclass: )---
+A::testA
+array(3) {
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+ ["hiddenPriv"]=>
+ string(13) "A::hiddenPriv"
+} \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_error_001.phpt b/ext/standard/tests/class_object/get_object_vars_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_object_vars() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_object_vars() function with Zero arguments --\n";
+var_dump( get_object_vars() );
+
+//Test get_object_vars with one more than the expected number of arguments
+echo "\n-- Testing get_object_vars() function with more than expected no. of arguments --\n";
+$obj = new stdclass();
+$extra_arg = 10;
+var_dump( get_object_vars($obj, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_object_vars() : error conditions ***
+
+-- Testing get_object_vars() function with Zero arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class A {
+ public static $var = 'hello';
+}
+
+$a = new A;
+var_dump(get_object_vars($a));
+?>
+--EXPECTF--
+array(0) {
+} \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_002.phpt b/ext/standard/tests/class_object/get_object_vars_variation_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+$obj = new stdClass;
+var_dump(get_object_vars($obj));
+
+$a='original.a';
+$obj->ref = &$a;
+$obj->val = $a;
+
+$arr = get_object_vars($obj);
+var_dump($arr);
+
+$arr['ref'] = 'changed.ref';
+$arr['val'] = 'changed.val';
+
+var_dump($arr, $obj, $a);
+?>
+--EXPECTF--
+array(0) {
+}
+array(2) {
+ ["ref"]=>
+ &string(10) "original.a"
+ ["val"]=>
+ string(10) "original.a"
+}
+array(2) {
+ ["ref"]=>
+ &string(11) "changed.ref"
+ ["val"]=>
+ string(11) "changed.val"
+}
+object(stdClass)#1 (2) {
+ ["ref"]=>
+ &string(11) "changed.ref"
+ ["val"]=>
+ string(10) "original.a"
+}
+string(11) "changed.ref" \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_003.phpt b/ext/standard/tests/class_object/get_object_vars_variation_003.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_object_vars() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for obj
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( get_object_vars($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_object_vars() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 56
+
+Notice: Undefined variable: unset_var in %s on line 59
+
+Arg value 0
+
+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--
+<?php
+/* Prototype : proto string get_parent_class([mixed object])
+ * Description: Retrieves the parent class name for object or class or current scope.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_parent_class() : error conditions ***\n";
+
+
+//Test get_parent_class with one more than the expected number of arguments
+echo "\n-- Testing get_parent_class() function with more than expected no. of arguments --\n";
+$object = 1;
+$extra_arg = 10;
+var_dump( get_parent_class($object, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_parent_class() : error conditions ***
+
+-- Testing get_parent_class() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto string get_parent_class([mixed object])
+ * Description: Retrieves the parent class name for object or class or current scope.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+// Note: basic use cases in Zend/tests/010.phpt
+
+echo "*** Testing get_parent_class() : variation ***\n";
+
+class caseSensitivityTest {}
+class caseSensitivityTestChild extends caseSensitivityTest {}
+
+var_dump(get_parent_class('CasesensitivitytestCHILD'));
+var_dump(get_parent_class(new CasesensitivitytestCHILD));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_parent_class() : variation ***
+string(19) "caseSensitivityTest"
+string(19) "caseSensitivityTest"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string get_parent_class([mixed object])
+ * Description: Retrieves the parent class name for object or class or current scope.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing get_parent_class() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( get_parent_class($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_parent_class() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(68)
+Error: 8 - Undefined variable: unset_var, %s(71)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+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--
+<?php
+/* Prototype : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing interface_exists() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing interface_exists() function with Zero arguments --\n";
+var_dump( interface_exists() );
+
+//Test interface_exists with one more than the expected number of arguments
+echo "\n-- Testing interface_exists() function with more than expected no. of arguments --\n";
+$classname = 'string_val';
+$autoload = true;
+$extra_arg = 10;
+var_dump( interface_exists($classname, $autoload, $extra_arg) );
+
+?>
+===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--
+<?php
+/* Prototype : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing interface_exists() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$autoload = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing interface_exists() : usage variation ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$classname = 'aBogusInterfaceName';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing interface_exists() : autoloaded interface ***\n";
+
+function __autoload($class_name) {
+ require_once $class_name . '.inc';
+}
+
+echo "\n-- no autoloading --\n";
+var_dump(interface_exists("AutoInterface", false));
+
+echo "\n-- with autoloading --\n";
+var_dump(interface_exists("AutoInterface", true));
+
+echo "\nDONE\n";
+
+?>
+--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--
+<?php
+/* Prototype : bool interface_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing interface_exists() : test autoload default value ***\n";
+
+function __autoload($class_name) {
+ require_once $class_name . '.inc';
+}
+
+
+var_dump(interface_exists("AutoInterface"));
+
+echo "\nDONE\n";
+
+?>
+--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--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+
+interface if_a {
+ function f_a();
+}
+
+interface if_b extends if_a {
+ function f_b();
+}
+
+class base {
+ function _is_a($sub) {
+
+ echo "\n>>> 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--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name, bool allow_string)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_a() : error conditions ***\n";
+
+//Test is_a with one more than the expected number of arguments
+echo "\n-- Testing is_a() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$class_name = 'string_val';
+$allow_string = false;
+$extra_arg = 10;
+
+var_dump( is_a($object, $class_name, $allow_string, $object) );
+
+//Test is_a with one more than the expected number of arguments
+echo "\n-- Testing is_a() function with non-boolean in last position --\n";
+var_dump( is_a($object, $class_name, $object) );
+
+
+// Testing is_a with one less than the expected number of arguments
+echo "\n-- Testing is_a() function with less than expected no. of arguments --\n";
+$object = new stdclass();
+var_dump( is_a($object) );
+
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing is_a() : error conditions ***
+
+-- Testing is_a() function with more than expected no. of arguments --
+
+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--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+// Note: basic use cases in Zend/tests/is_a.phpt
+echo "*** Testing is_a() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$class_name = 'stdClass';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( is_a($value, $class_name) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 59
+
+Notice: Undefined variable: unset_var in %s on line 62
+
+Arg value 0
+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--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class C {
+ function __toString() {
+ return "C Instance";
+ }
+}
+
+echo "*** Testing is_a() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$object = new stdclass();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new C,
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for class_name
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( is_a($object, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 64
+
+Notice: Undefined variable: unset_var in %s on line 67
+
+Arg value 0
+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--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_a() : usage variations ***\n";
+
+class caseSensitivityTest {}
+class caseSensitivityTestChild extends caseSensitivityTest {}
+
+var_dump(is_a(new caseSensitivityTestChild, 'caseSensitivityTEST'));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : usage variations ***
+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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_subclass_of() : error conditions ***\n";
+
+
+//Test is_subclass_of with one more than the expected number of arguments
+echo "\n-- Testing is_subclass_of() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$class_name = 'string_val';
+$allow_string = false;
+$extra_arg = 10;
+var_dump( is_subclass_of($object, $class_name, $allow_string, $extra_arg) );
+
+//Test is_subclass_of with invalid last argument
+echo "\n-- Testing is_subclass_of() function with more than typo style invalid 3rd argument --\n";
+var_dump( is_subclass_of($object, $class_name, $class_name) );
+
+
+//Test is_subclass_of with invalid last argument
+echo "\n-- Testing is_subclass_of() function with more than invalid 3rd argument --\n";
+var_dump( is_subclass_of($object, $class_name, $object) );
+
+// Testing is_subclass_of with one less than the expected number of arguments
+echo "\n-- Testing is_subclass_of() function with less than expected no. of arguments --\n";
+$object = new stdclass();
+var_dump( is_subclass_of($object) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : error conditions ***
+
+-- Testing is_subclass_of() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+// Note: basic use cases in Zend/tests/is_a.phpt
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$class_name = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_subclass_of($value, $class_name) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(69)
+Error: 8 - Undefined variable: unset_var, %s(72)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$object = new stdclass();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for class_name
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_subclass_of($object, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+echo "*** Testing is_a() : usage variations ***\n";
+
+class caseSensitivityTest {}
+class caseSensitivityTestChild extends caseSensitivityTest {}
+
+var_dump(is_subclass_of('caseSensitivityTestCHILD', 'caseSensitivityTEST'));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+*** Testing is_a() : usage variations ***
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+// Note: basic use cases in Zend/tests/is_a.phpt
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$class_name = 'stdClass';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class B {
+ public function inherit_pub() {}
+ protected function inherit_prot() {}
+ private function inherit_priv() {}
+ static public function inherit_static_pub() {}
+ static protected function inherit_static_prot() {}
+ static private function inherit_static_priv() {}
+}
+
+Class C extends B {
+ public function pub() {}
+ protected function prot() {}
+ private function priv() {}
+ static public function static_pub() {}
+ static protected function static_prot() {}
+ static private function static_priv() {}
+}
+
+
+$methods = array(
+ 'inherit_pub', 'inherit_prot', 'inherit_priv',
+ 'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv',
+ 'pub', 'prot', 'priv',
+ 'static_pub', 'static_prot', 'static_priv',
+ 'non_existent');
+
+echo "\n ---(Using string class name)---\n";
+foreach ($methods as $method) {
+ echo "Does C::$method exist? ";
+ var_dump(method_exists("C", $method));
+}
+
+echo "\n ---(Using object)---\n";
+$myC = new C;
+foreach ($methods as $method) {
+ echo "Does C::$method exist? ";
+ var_dump(method_exists($myC, $method));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+
+ ---(Using string class name)---
+Does C::inherit_pub exist? bool(true)
+Does C::inherit_prot exist? bool(true)
+Does C::inherit_priv exist? bool(true)
+Does C::inherit_static_pub exist? bool(true)
+Does C::inherit_static_prot exist? bool(true)
+Does C::inherit_static_priv exist? bool(true)
+Does C::pub exist? bool(true)
+Does C::prot exist? bool(true)
+Does C::priv exist? bool(true)
+Does C::static_pub exist? bool(true)
+Does C::static_prot exist? bool(true)
+Does C::static_priv exist? bool(true)
+Does C::non_existent exist? bool(false)
+
+ ---(Using object)---
+Does C::inherit_pub exist? bool(true)
+Does C::inherit_prot exist? bool(true)
+Does C::inherit_priv exist? bool(true)
+Does C::inherit_static_pub exist? bool(true)
+Does C::inherit_static_prot exist? bool(true)
+Does C::inherit_static_priv exist? bool(true)
+Does C::pub exist? bool(true)
+Does C::prot exist? bool(true)
+Does C::priv exist? bool(true)
+Does C::static_pub exist? bool(true)
+Does C::static_prot exist? bool(true)
+Does C::static_priv exist? bool(true)
+Does C::non_existent exist? bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_basic_002.phpt b/ext/standard/tests/class_object/method_exists_basic_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo " ---(Internal classes, using string class name)---\n";
+echo "Does exception::getmessage exist? ";
+var_dump(method_exists("exception", "getmessage"));
+echo "Does stdclass::nonexistent exist? ";
+var_dump(method_exists("stdclass", "nonexistent"));
+
+echo "\n ---(Internal classes, using class instance)---\n";
+echo "Does exception::getmessage exist? ";
+var_dump(method_exists(new exception, "getmessage"));
+echo "Does stdclass::nonexistent exist? ";
+var_dump(method_exists(new stdclass, "nonexistent"));
+
+echo "Done";
+?>
+--EXPECTF--
+ ---(Internal classes, using string class name)---
+Does exception::getmessage exist? bool(true)
+Does stdclass::nonexistent exist? bool(false)
+
+ ---(Internal classes, using class instance)---
+Does exception::getmessage exist? bool(true)
+Does stdclass::nonexistent exist? bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($name) {
+ echo "In __autoload($name)\n";
+}
+
+var_dump(method_exists('UndefC', 'func'));
+
+echo "Done";
+?>
+--EXPECTF--
+In __autoload(UndefC)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_error_001.phpt b/ext/standard/tests/class_object/method_exists_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing method_exists() : error conditions ***\n";
+
+
+//Test method_exists with one more than the expected number of arguments
+echo "\n-- Testing method_exists() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$method = 'string_val';
+$extra_arg = 10;
+var_dump( method_exists($object, $method, $extra_arg) );
+
+// Testing method_exists with one less than the expected number of arguments
+echo "\n-- Testing method_exists() function with less than expected no. of arguments --\n";
+$object = new stdclass();
+var_dump( method_exists($object) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : error conditions ***
+
+-- Testing method_exists() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing method_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$method = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( method_exists($value, $method) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(68)
+Error: 8 - Undefined variable: unset_var, %s(71)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+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--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing method_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$object = new stdclass();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for method
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( method_exists($object, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+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--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing method_exists() : variation ***\n";
+
+Class caseSensitivityTest {
+ public function myMethod() {}
+}
+
+var_dump(method_exists(new casesensitivitytest, 'myMetHOD'));
+var_dump(method_exists('casesensiTivitytest', 'myMetHOD'));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : variation ***
+bool(true)
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/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--
+<?php
+/* Prototype : bool property_exists(mixed object_or_class, string property_name)
+ * Description: Checks if the object or class has a property
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing property_exists() : error conditions ***\n";
+
+$object_or_class = "obj";
+$property_name = 'string_val';
+$extra_arg = 10;
+
+
+echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n";
+var_dump( property_exists($object_or_class, $property_name, $extra_arg) );
+
+
+echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n";
+var_dump( property_exists($object_or_class) );
+
+echo "\n-- Testing property_exists() function with incorrect arguments --\n";
+var_dump( property_exists(10, $property_name) );
+
+?>
+===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--
+<?php
+/* Prototype : bool property_exists(mixed object_or_class, string property_name)
+ * Description: Checks if the object or class has a property
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing property_exists() : class auto loading ***\n";
+
+function __autoload($class_name) {
+ require_once $class_name . '.inc';
+}
+
+echo "\ntesting property in autoloaded class\n";
+var_dump(property_exists("AutoTest", "bob"));
+
+echo "\ntesting __get magic method\n";
+var_dump(property_exists("AutoTest", "foo"));
+
+?>
+===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--
+<?php
+/* Prototype : proto bool trait_exists(string traitname [, bool autoload])
+ * Description: Checks if the trait exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+trait caseSensitivityTest {}
+var_dump(trait_exists('casesensitivitytest'));
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto bool trait_exists(string traitname [, bool autoload])
+ * Description: Checks if the trait exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing trait_exists() : basic functionality ***\n";
+
+function __autoload($traitName) {
+ echo "In __autoload($traitName)\n";
+}
+
+trait MyTrait {}
+
+echo "Calling trait_exists() on non-existent trait with autoload explicitly enabled:\n";
+var_dump( trait_exists('C', true) );
+echo "\nCalling trait_exists() on existing trait with autoload explicitly enabled:\n";
+var_dump( trait_exists('MyTrait', true) );
+
+echo "\nCalling trait_exists() on non-existent trait with autoload explicitly enabled:\n";
+var_dump( trait_exists('D', false) );
+echo "\nCalling trait_exists() on existing trait with autoload explicitly disabled:\n";
+var_dump( trait_exists('MyTrait', false) );
+
+echo "\nCalling trait_exists() on non-existent trait with autoload unspecified:\n";
+var_dump( trait_exists('E') );
+echo "\nCalling trait_exists() on existing trait with autoload unspecified:\n";
+var_dump( trait_exists('MyTrait') );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto bool trait_exists(string traitname [, bool autoload])
+ * Description: Checks if the trait exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/**
+ * Test wrong number of arguments
+ */
+
+echo "*** Testing trait_exists() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing trait_exists() function with Zero arguments --\n";
+var_dump( trait_exists() );
+
+//Test trait_exists with one more than the expected number of arguments
+echo "\n-- Testing trait_exists() function with more than expected no. of arguments --\n";
+$traitname = 'string_val';
+$autoload = true;
+$extra_arg = 10;
+var_dump( trait_exists($traitname, $autoload, $extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : proto bool trait_exists(string traitname [, bool autoload])
+ * Description: Checks if the trait exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($traitName) {
+ echo "In __autoload($traitName)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing trait_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$autoload = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for 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--
+<?php
+/* Prototype : proto bool trait_exists(string traitname [, bool autoload])
+ * Description: Checks if the trait exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($traitName) {
+ echo "In __autoload($traitName)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing trait_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$traitname = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for autoload
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( 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--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of chdir() with absolute and relative paths
+ */
+
+echo "*** Testing chdir() : basic functionality ***\n";
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create directories
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- Testing chdir() with absolute path: --\n";
+chdir($base_dir_path);
+var_dump(chdir($level_one_dir_path));
+var_dump(getcwd());
+
+echo "\n-- Testing chdir() with relative paths: --\n";
+var_dump(chdir($level_two_dir_name));
+var_dump(getcwd());
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing chdir() : basic functionality ***
+
+-- Testing chdir() with absolute path: --
+bool(true)
+string(%d) "%slevel_one"
+
+-- Testing chdir() with relative paths: --
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_error1.phpt b/ext/standard/tests/dir/chdir_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to chdir() to test behaviour
+ */
+
+echo "*** Testing chdir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing chdir() function with Zero arguments --\n";
+var_dump( chdir() );
+
+//Test chdir with one more than the expected number of arguments
+echo "\n-- Testing chdir() function with more than expected no. of arguments --\n";
+$directory = __FILE__;
+$extra_arg = 10;
+var_dump( chdir($directory, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing chdir() : error conditions ***
+
+-- Testing chdir() function with Zero arguments --
+
+Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing chdir() function with more than expected no. of arguments --
+
+Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_error2.phpt b/ext/standard/tests/dir/chdir_error2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory that does not exist as $directory to chdir() to test behaviour
+ */
+
+echo "*** Testing chdir() : error conditions ***\n";
+
+$directory = __FILE__ . '/idonotexist';
+
+var_dump(chdir($directory));
+?>
+===DONE===
+--EXPECTF--
+*** Testing chdir() : error conditions ***
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_variation1.phpt b/ext/standard/tests/dir/chdir_variation1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $directory argument to test behaviour
+ */
+
+echo "*** Testing chdir() : usage variations ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/chdir_basic";
+@mkdir($dir_path);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA {
+ var $dir_path;
+
+ function __construct($dir) {
+ $this->dir_path = $dir;
+ }
+
+ public function __toString() {
+ return "$this->dir_path";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+$dir_path
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $directory argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "$dir_path",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA($dir_path),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of chdir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( chdir($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/chdir_basic";
+
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing chdir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: chdir() expects parameter 1 to be 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--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test chdir() with variations of relative paths
+ */
+
+echo "*** Testing chdir() : usage variations ***\n";
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create directories
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- \$directory = './level_one': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(chdir("./$level_one_dir_name"));
+var_dump(getcwd());
+
+echo "\n-- \$directory = 'level_one/level_two': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(chdir("$level_one_dir_name/$level_two_dir_name"));
+var_dump(getcwd());
+
+echo "\n-- \$directory = '..': --\n";
+var_dump(chdir('..'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = 'level_two', '.': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(chdir('.'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = '../': --\n";
+var_dump(chdir('../'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = './': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(chdir('./'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = '../../'level_one': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(chdir("../../$level_one_dir_name"));
+var_dump(getcwd());
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing chdir() : usage variations ***
+
+-- $directory = './level_one': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one"
+
+-- $directory = 'level_one/level_two': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+
+-- $directory = '..': --
+bool(true)
+string(%d) "%slevel_one"
+
+-- $directory = 'level_two', '.': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+
+-- $directory = '../': --
+bool(true)
+string(%d) "%slevel_one"
+
+-- $directory = './': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+
+-- $directory = '../../'level_one': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one"
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_basic.phpt b/ext/standard/tests/dir/closedir_basic.phpt
new file mode 100644
index 0000000..49080bb
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_basic.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test closedir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Test basic functionality of closedir()
+ */
+
+echo "*** Testing closedir() : basic functionality ***\n";
+
+$base_dir = dirname(__FILE__);
+$dir_path = $base_dir . '/closedir_basic';
+mkdir($dir_path);
+
+echo "\n-- Call closedir() with no arguments: --\n";
+$dh1 = opendir($dir_path);
+var_dump(closedir());
+echo "-- Check Directory Handle: --\n";
+var_dump($dh1);
+
+echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n";
+$dh2 = opendir($dir_path);
+
+if ((int)$dh1 === (int)$dh2) {
+ echo "\nNo new resource created\n";
+}
+var_dump(closedir($dh2));
+echo "-- Check Directory Handle: --\n";
+var_dump($dh2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$base_dir = dirname(__FILE__);
+$dir_path = $base_dir . '/closedir_basic';
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing closedir() : basic functionality ***
+
+-- Call closedir() with no arguments: --
+NULL
+-- Check Directory Handle: --
+resource(%d) of type (Unknown)
+
+-- Call closedir() with $dir_handle argument supplied: --
+NULL
+-- Check Directory Handle: --
+resource(%d) of type (Unknown)
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_error.phpt b/ext/standard/tests/dir/closedir_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Pass incorrect number of arguments to closedir() to test behaviour
+ */
+
+echo "*** Testing closedir() : error conditions ***\n";
+
+
+//Test closedir with one more than the expected number of arguments
+echo "\n-- Testing closedir() function with more than expected no. of arguments --\n";
+
+$dir_path = dirname(__FILE__) . '\closedir_error';
+mkdir($dir_path);
+$dir_handle = opendir($dir_path);
+
+$extra_arg = 10;
+var_dump( closedir($dir_handle, $extra_arg) );
+
+//successfully close the directory handle so can delete in CLEAN section
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$base_dir = dirname(__FILE__);
+$dir_path = $base_dir . '\closedir_error';
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing closedir() : error conditions ***
+
+-- Testing closedir() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Pass different data types as $dir_handle argument to closedir() to test behaviour
+ */
+
+echo "*** Testing closedir() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $dir_handle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of closedir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( closedir($input) );
+ $iterator++;
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing closedir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: closedir() 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--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * close the directory handle twice using closedir() to test behaviour
+ */
+
+echo "*** Testing closedir() : usage variations ***\n";
+
+//create temporary directory for test, removed in CLEAN section
+$directory = dirname(__FILE__) . "/closedir_variation2";
+mkdir($directory);
+
+$dh = opendir($directory);
+
+echo "\n-- Close directory handle first time: --\n";
+var_dump(closedir($dh));
+echo "Directory Handle: ";
+var_dump($dh);
+
+echo "\n-- Close directory handle second time: --\n";
+var_dump(closedir($dh));
+echo "Directory Handle: ";
+var_dump($dh);
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . "/closedir_variation2";
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing closedir() : usage variations ***
+
+-- Close directory handle first time: --
+NULL
+Directory Handle: resource(%d) of type (Unknown)
+
+-- Close directory handle second time: --
+
+Warning: closedir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+Directory Handle: resource(%d) of type (Unknown)
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Create a file pointer using fopen() then try to close it using closedir()
+ */
+
+echo "*** Testing closedir() : usage variations ***\n";
+
+echo "\n-- Open a file using fopen() --\n";
+var_dump($fp = fopen(__FILE__, 'r'));
+
+echo "\n-- Try to close the file pointer using closedir() --\n";
+var_dump(closedir($fp));
+
+echo "\n-- Check file pointer: --\n";
+var_dump($fp);
+
+if(is_resource($fp)) {
+ fclose($fp);
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing closedir() : usage variations ***
+
+-- Open a file using fopen() --
+resource(%d) of type (stream)
+
+-- Try to close the file pointer using closedir() --
+
+Warning: closedir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Check file pointer: --
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt
new file mode 100644
index 0000000..dba49db
--- /dev/null
+++ b/ext/standard/tests/dir/dir_basic.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test dir() function : basic functionality
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+echo "*** Testing dir() : basic functionality ***\n";
+
+// include the file.inc for Function: function create_files()
+include(dirname(__FILE__)."/../file/file.inc");
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_basic";
+@mkdir($dir_path);
+
+// create files within the temporary directory
+create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "dir_basic");
+
+echo "Get Directory instance:\n";
+$d = dir($dir_path);
+var_dump( $d );
+
+echo "\nRead and rewind:\n";
+var_dump( $d->read() );
+var_dump( $d->read() );
+var_dump( $d->rewind() );
+
+echo "\nTest using handle directly:\n";
+var_dump( readdir($d->handle) );
+var_dump( readdir($d->handle) );
+
+echo "\nClose directory:\n";
+var_dump( $d->close() );
+var_dump( $d );
+
+echo "\nTest read after closing the dir:";
+var_dump( $d->read() );
+
+// delete temp files
+delete_files($dir_path, 3, "dir_basic", 1, ".tmp");
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_basic";
+
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : basic functionality ***
+Get Directory instance:
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_basic"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+
+Read and rewind:
+string(%d) "%s"
+string(%d) "%s"
+NULL
+
+Test using handle directly:
+string(%d) "%s"
+string(%d) "%s"
+
+Close directory:
+NULL
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_basic"
+ ["handle"]=>
+ resource(%d) of type (Unknown)
+}
+
+Test read after closing the dir:
+Warning: Directory::read(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_error.phpt b/ext/standard/tests/dir/dir_error.phpt
new file mode 100644
index 0000000..f2ef25c
--- /dev/null
+++ b/ext/standard/tests/dir/dir_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test dir() function : error conditions
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+echo "*** Testing dir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing dir() function with zero arguments --";
+var_dump( dir() );
+
+// With one more than expected number of arguments
+echo "\n-- Testing dir() function with one more than expected number of arguments --";
+$extra_arg = 10;
+var_dump( dir(getcwd(), "stream", $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : error conditions ***
+
+-- Testing dir() function with zero arguments --
+Warning: dir() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing dir() function with one more than expected number of arguments --
+Warning: dir() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/dir/dir_variation1-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing non string values to 'directory' argument of dir() and see
+ * that the function outputs proper warning messages wherever expected.
+ */
+
+echo "*** Testing dir() : unexpected values for \$directory argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+ public $var;
+ public function init() {
+ $this->var = 10;
+ }
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r"); // get a file handle
+$dfp = opendir( dirname(__FILE__) ); // get a dir handle
+
+// unexpected values to be passed to $directory argument
+$unexpected_values = array (
+
+ // array data
+/*1*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*6*/ NULL,
+ null,
+
+ // boolean data
+/*8*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*12*/ "",
+ '',
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable(dir and file handle)
+/*16*/ $fp,
+ $dfp,
+
+ // object data
+/*18*/ new A()
+);
+
+// loop through various elements of $unexpected_values to check the behavior of dir()
+$iterator = 1;
+foreach( $unexpected_values as $unexpected_value ) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( dir($unexpected_value) );
+ $iterator++;
+}
+
+fclose($fp);
+closedir($dfp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : unexpected values for $directory argument ***
+
+-- Iteration 1 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+
+Warning: dir(1,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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing non string values to 'directory' argument of dir() and see
+ * that the function outputs proper warning messages wherever expected.
+ */
+
+echo "*** Testing dir() : unexpected values for \$directory argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+ public $var;
+ public function init() {
+ $this->var = 10;
+ }
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r"); // get a file handle
+$dfp = opendir( dirname(__FILE__) ); // get a dir handle
+
+// unexpected values to be passed to $directory argument
+$unexpected_values = array (
+
+ // array data
+/*1*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*6*/ NULL,
+ null,
+
+ // boolean data
+/*8*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*12*/ "",
+ '',
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable(dir and file handle)
+/*16*/ $fp,
+ $dfp,
+
+ // object data
+/*18*/ new A()
+);
+
+// loop through various elements of $unexpected_values to check the behavior of dir()
+$iterator = 1;
+foreach( $unexpected_values as $unexpected_value ) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( dir($unexpected_value) );
+ $iterator++;
+}
+
+fclose($fp);
+closedir($dfp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : unexpected values for $directory argument ***
+
+-- Iteration 1 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+
+Warning: dir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+
+Warning: dir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+
+Warning: dir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: dir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: dir() expects parameter 1 to be string, object given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_variation2.phpt b/ext/standard/tests/dir/dir_variation2.phpt
new file mode 100644
index 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--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing non resource values to 'context' argument of dir() and see
+ * that the function outputs proper warning messages wherever expected.
+ */
+
+echo "*** Testing dir() : unexpected values for \$context argument ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$directory = $file_path."/dir_variation2";
+@mkdir($directory);
+
+// get an unset variable
+$unset_var = stream_context_create();
+unset($unset_var);
+
+class classA
+{
+ public $var;
+ public function init() {
+ $this->var = 10;
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $directory argument
+$unexpected_values = array (
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*26*/ new classA(),
+
+ // undefined data
+/*27*/ @$undefined_var,
+
+ // unset data
+/*28*/ @$unset_var
+);
+
+// loop through various elements of $unexpected_values to check the behavior of dir()
+$iterator = 1;
+foreach( $unexpected_values as $unexpected_value ) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( dir($directory, $unexpected_value) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$directory = $file_path."/dir_variation2";
+
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing dir() : unexpected values for $context argument ***
+
+-- Iteration 1 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 25 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 26 --
+Warning: dir() expects parameter 2 to be resource, object given in %s on line %d
+NULL
+
+-- Iteration 27 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 28 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_variation3.phpt b/ext/standard/tests/dir/dir_variation3.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Providing various permissions to the directory to be opened and checking
+ * to see if dir() function opens the directory successfully.
+ */
+
+echo "*** Testing dir() : different directory permissions ***";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation3";
+@mkdir($dir_path);
+
+/* different values for directory permissions */
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+// Open directory with different permission values, read and close, expected: none of them to succeed.
+for($count = 0; $count < count($permission_values); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --\n";
+
+ // try to remove the dir if exists & create
+ $file_path = dirname(__FILE__);
+ $dir_path = $file_path."/dir_variation3";
+ @chmod ($dir_path, 0777); // change dir permission to allow all operation
+ @rmdir ($dir_path); // try n delete the dir
+
+ // create the dir now
+ @mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $permission_values[$count]) );
+
+ // try to get dir handle
+ $d = dir($dir_path);
+ var_dump($d); // dump the handle
+
+ // try read directory, expected : false
+ echo "-- reading contents --\n";
+ var_dump($d->read());
+
+ // close directory
+ $d->close();
+}
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+// deleting temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation3";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : different directory permissions ***
+-- Iteration 1 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 2 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 3 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 4 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 5 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 6 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 7 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 8 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 9 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 10 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/dir/dir_variation4.phpt b/ext/standard/tests/dir/dir_variation4.phpt
new file mode 100644
index 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--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Testing the behavior of dir() function by trying to open a
+ * directory which is already open.
+ */
+
+echo "*** Testing dir() : operate on previously opened directory ***\n";
+
+// include the file.inc for Function: function create_files()
+include( dirname(__FILE__)."/../file/file.inc");
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation4";
+@mkdir($dir_path);
+
+// create files within the temporary directory
+create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "dir_variation4");
+
+// open the directory
+$d = dir($dir_path);
+var_dump( $d );
+
+// open the same directory again without closing it
+$e = dir($dir_path);
+var_dump( $e );
+
+echo "-- reading directory contents with previous handle --\n";
+var_dump( $d->read() ); // with previous handle
+
+echo "-- reading directory contents with current handle --\n";
+var_dump( $e->read() ); // with current handle
+
+// delete temporary files
+delete_files($dir_path, 3, "dir_variation4");
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation4";
+
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : operate on previously opened directory ***
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation4"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation4"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading directory contents with previous handle --
+string(%d) "%s"
+-- reading directory contents with current handle --
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/dir/dir_variation5-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing a file as argument to dir() function instead of a directory
+ * and checking if proper warning message is generated.
+ */
+
+echo "*** Testing dir() : open a file instead of a directory ***\n";
+
+// open the file instead of directory
+$d = dir(__FILE__);
+var_dump( $d );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : open a file instead of a directory ***
+
+Warning: dir(%s): 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing a file as argument to dir() function instead of a directory
+ * and checking if proper warning message is generated.
+ */
+
+echo "*** Testing dir() : open a file instead of a directory ***\n";
+
+// open the file instead of directory
+$d = dir(__FILE__);
+var_dump( $d );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : open a file instead of a directory ***
+
+Warning: dir(%s): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/dir_variation6-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing a non-existent directory as argument to dir() function
+ * and checking to see if proper warning message is output.
+ */
+echo "*** Testing dir() : open a non-existent directory ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation6";
+@mkdir($dir_path);
+
+// open existent directory
+$d = dir($dir_path);
+$d->close(); //close the dir
+
+// remove directory and try to open the same(non-existent) directory again
+rmdir($dir_path);
+clearstatcache();
+
+echo "-- opening previously removed directory --\n";
+var_dump( dir($dir_path) );
+
+// point to a non-existent directory
+$non_existent_dir = $file_path."/non_existent_dir";
+echo "-- opening non-existent directory --\n";
+$d = dir($non_existent_dir);
+var_dump( $d );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : open a non-existent directory ***
+-- opening previously removed directory --
+
+Warning: dir(%s): 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing a non-existent directory as argument to dir() function
+ * and checking to see if proper warning message is output.
+ */
+echo "*** Testing dir() : open a non-existent directory ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation6";
+@mkdir($dir_path);
+
+// open existent directory
+$d = dir($dir_path);
+$d->close(); //close the dir
+
+// remove directory and try to open the same(non-existent) directory again
+rmdir($dir_path);
+clearstatcache();
+
+echo "-- opening previously removed directory --\n";
+var_dump( dir($dir_path) );
+
+// point to a non-existent directory
+$non_existent_dir = $file_path."/non_existent_dir";
+echo "-- opening non-existent directory --\n";
+$d = dir($non_existent_dir);
+var_dump( $d );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : open a non-existent directory ***
+-- opening previously removed directory --
+
+Warning: dir(%s): failed to open dir: %s in %s on line %d
+bool(false)
+-- opening non-existent directory --
+
+Warning: dir(%s): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/dir_variation7.phpt b/ext/standard/tests/dir/dir_variation7.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * remove the execute permission from the parent dir and test dir() on child dir
+ * 1) remove write & execute permission from the 1st parent and test dir()
+ * 2) remove execute permission from 2nd parent and test dir()
+ */
+
+echo "*** Testing dir() : remove execute permission from the parent dir ***\n";
+
+/* create the temporary directory :
+ dir_variation7 ( parent )
+ |-> sub_dir ( sub parent )
+ |-> child_dir ( child dir)
+*/
+$file_path = dirname(__FILE__);
+$parent_dir_path = $file_path."/dir_variation7";
+@mkdir($parent_dir_path);
+chmod($parent_dir_path, 0777);
+
+// create sub_dir
+$sub_dir_path = $parent_dir_path."/sub_dir";
+@mkdir($sub_dir_path);
+chmod($sub_dir_path, 0777);
+
+//create sub_sub_dir
+$child_dir_path = $sub_dir_path."/child_dir";
+@mkdir($child_dir_path);
+
+// remove the write and execute permisson from sub parent
+chmod($sub_dir_path, 0444);
+echo "-- After restricting 1st level parent directory --\n";
+$d = dir($child_dir_path); // try to open, expected failure
+var_dump( $d ); // dump it
+
+// remove the execute permisson from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permisson to sub dir
+chmod($parent_dir_path, 0666); // restricting parent directory
+echo "-- After restricting parent directory --\n";
+$d = dir($child_dir_path); // try to open, expected failure
+var_dump( $d ); // dump it
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$parent_dir_path = $file_path."/dir_variation7";
+$sub_dir_path = $parent_dir_path."/sub_dir";
+$child_dir_path = $sub_dir_path."/child_dir";
+
+// changing permissions for each temporary directory to delete them
+chmod($parent_dir_path, 0777);
+chmod($sub_dir_path, 0777);
+chmod($child_dir_path, 0777);
+
+rmdir($child_dir_path);
+rmdir($sub_dir_path);
+rmdir($parent_dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : remove execute permission from the parent dir ***
+-- After restricting 1st level parent directory --
+
+Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+-- After restricting parent directory --
+
+Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_variation8-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Create more than one temporary directory & subdirectory and check if dir() function can open
+ * those directories when wildcard characters are used to refer to them.
+ */
+
+echo "*** Testing dir() : checking with wildcard characters ***\n";
+
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation81";
+$sub_dir_path = $dir_path."/sub_dir1";
+
+@mkdir($dir_path1);
+@mkdir($sub_dir_path);
+
+/* with different wildcard characters */
+
+echo "-- wildcard = '*' --\n";
+var_dump( dir($file_path."/dir_var*") );
+var_dump( dir($file_path."/*") );
+
+echo "-- wildcard = '?' --\n";
+var_dump( dir($dir_path."/sub_dir?") );
+var_dump( dir($dir_path."/sub?dir1") );
+
+echo "Done";
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Create more than one temporary directory & subdirectory and check if dir() function can open
+ * those directories when wildcard characters are used to refer to them.
+ */
+
+echo "*** Testing dir() : checking with wildcard characters ***\n";
+
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation81";
+$sub_dir_path = $dir_path."/sub_dir1";
+
+@mkdir($dir_path1);
+@mkdir($sub_dir_path);
+
+/* with different wildcard characters */
+
+echo "-- wildcard = '*' --\n";
+var_dump( dir($file_path."/dir_var*") );
+var_dump( dir($file_path."/*") );
+
+echo "-- wildcard = '?' --\n";
+var_dump( dir($dir_path."/sub_dir?") );
+var_dump( dir($dir_path."/sub?dir1") );
+
+echo "Done";
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Checking the behavior of dir() function by passing directories which
+ * have valid and invalid relative path.
+ */
+
+echo "*** Testing dir() : checking with valid and invalid paths ***\n";
+
+/* create the temporary directories */
+
+$file_path = dirname(__FILE__);
+
+// directory dir_variation91 with one sub-directory sub_dir11 and sub-sub-directory sub_dir111
+$dir_path1 = $file_path."/dir_variation91";
+$sub_dir11 = $dir_path1."/sub_dir11";
+$sub_dir111 = $sub_dir11."/sub_dir111";
+
+// directory dir_variation92 with one sub-directory sub_dir21
+$dir_path2 = $file_path."/dir_variation92";
+$sub_dir21 = $dir_path2."/sub_dir21";
+
+@mkdir($dir_path1);
+@mkdir($dir_path2);
+@mkdir($sub_dir11);
+@mkdir($sub_dir111);
+@mkdir($sub_dir21);
+
+// open the directory with valid paths
+echo "\n-- With valid paths --\n";
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/..") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91/sub_dir11/..") );
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/..") );
+
+// open the directory with invalid path
+echo "\n-- With invalid paths --\n";
+var_dump( dir("$dir_path1/sub_dir12/sub_dir111/..") );
+var_dump( dir("$dir_path2/sub_dir21/../dir_variation91") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91/sub_dir12/..") );
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..") );
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+
+$dir_path1 = $file_path."/dir_variation91";
+$sub_dir11 = $dir_path1."/sub_dir11";
+$sub_dir111 = $sub_dir11."/sub_dir111";
+$dir_path2 = $file_path."/dir_variation92";
+$sub_dir21 = $dir_path2."/sub_dir21";
+
+rmdir($sub_dir21);
+rmdir($sub_dir111);
+rmdir($sub_dir11);
+rmdir($dir_path1);
+rmdir($dir_path2);
+?>
+--EXPECTF--
+*** Testing dir() : checking with valid and invalid paths ***
+
+-- With valid paths --
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir11/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+
+-- With invalid paths --
+
+Warning: dir(%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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Checking the behavior of dir() function by passing directories which
+ * have valid and invalid relative path.
+ */
+
+echo "*** Testing dir() : checking with valid and invalid paths ***\n";
+
+/* create the temporary directories */
+
+$file_path = dirname(__FILE__);
+
+// directory dir_variation91 with one sub-directory sub_dir11 and sub-sub-directory sub_dir111
+$dir_path1 = $file_path."/dir_variation91";
+$sub_dir11 = $dir_path1."/sub_dir11";
+$sub_dir111 = $sub_dir11."/sub_dir111";
+
+// directory dir_variation92 with one sub-directory sub_dir21
+$dir_path2 = $file_path."/dir_variation92";
+$sub_dir21 = $dir_path2."/sub_dir21";
+
+@mkdir($dir_path1);
+@mkdir($dir_path2);
+@mkdir($sub_dir11);
+@mkdir($sub_dir111);
+@mkdir($sub_dir21);
+
+// open the directory with valid paths
+echo "\n-- With valid paths --\n";
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/..") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91/sub_dir11/..") );
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/..") );
+
+// open the directory with invalid path
+echo "\n-- With invalid paths --\n";
+var_dump( dir("$dir_path1/sub_dir12/sub_dir111/..") );
+var_dump( dir("$dir_path2/sub_dir21/../dir_variation91") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91/sub_dir12/..") );
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..") );
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+
+$dir_path1 = $file_path."/dir_variation91";
+$sub_dir11 = $dir_path1."/sub_dir11";
+$sub_dir111 = $sub_dir11."/sub_dir111";
+$dir_path2 = $file_path."/dir_variation92";
+$sub_dir21 = $dir_path2."/sub_dir21";
+
+rmdir($sub_dir21);
+rmdir($sub_dir111);
+rmdir($sub_dir11);
+rmdir($dir_path1);
+rmdir($dir_path2);
+?>
+--EXPECTF--
+*** Testing dir() : checking with valid and invalid paths ***
+
+-- With valid paths --
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir11/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+
+-- With invalid paths --
+
+Warning: dir(%s/dir_variation91/sub_dir12/sub_dir111/..): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation92/sub_dir21/../dir_variation91): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/getcwd_basic.phpt b/ext/standard/tests/dir/getcwd_basic.phpt
new file mode 100644
index 0000000..ef720d0
--- /dev/null
+++ b/ext/standard/tests/dir/getcwd_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test getcwd() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed getcwd(void)
+ * Description: Gets the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of getcwd()
+ */
+
+echo "*** Testing getcwd() : basic functionality ***\n";
+
+//create temporary directory for test, removed in CLEAN section
+$directory = dirname(__FILE__) . "/getcwd_basic";
+mkdir($directory);
+
+var_dump(getcwd());
+chdir($directory);
+var_dump(getcwd());
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . "/getcwd_basic";
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing getcwd() : basic functionality ***
+string(%d) "%s"
+string(%d) "%s%egetcwd_basic"
+===DONE===
diff --git a/ext/standard/tests/dir/getcwd_error.phpt b/ext/standard/tests/dir/getcwd_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed getcwd(void)
+ * Description: Gets the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to getcwd() to test behaviour
+ */
+
+echo "*** Testing getcwd() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing getcwd() function with one argument --\n";
+$extra_arg = 10;
+var_dump( getcwd($extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing getcwd() : error conditions ***
+
+-- Testing getcwd() function with one argument --
+
+Warning: 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--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of opendir() with absolute and relative paths as $path argument
+ */
+
+echo "*** Testing opendir() : basic functionality ***\n";
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create temporary directories - will remove in CLEAN section
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- Testing opendir() with absolute path: --\n";
+var_dump($dh1 = opendir($level_one_dir_path));
+
+
+echo "\n-- Testing opendir() with relative paths: --\n";
+var_dump(chdir($level_one_dir_path));
+var_dump($dh2 = opendir($level_two_dir_name));
+
+echo "\n-- Close directory handles: --\n";
+closedir($dh1);
+var_dump($dh1);
+closedir($dh2);
+var_dump($dh2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing opendir() : basic functionality ***
+
+-- Testing opendir() with absolute path: --
+resource(%d) of type (stream)
+
+-- Testing opendir() with relative paths: --
+bool(true)
+resource(%d) of type (stream)
+
+-- Close directory handles: --
+resource(%d) of type (Unknown)
+resource(%d) of type (Unknown)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_error1.phpt b/ext/standard/tests/dir/opendir_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing opendir() function with Zero arguments --\n";
+var_dump( opendir() );
+
+//Test opendir with one more than the expected number of arguments
+echo "\n-- Testing opendir() function with more than expected no. of arguments --\n";
+$path = dirname(__FILE__) . "/opendir_error";
+mkdir($path);
+$context = stream_context_create();
+
+$extra_arg = 10;
+var_dump( opendir($path, $context, $extra_arg) );
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_error";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : error conditions ***
+
+-- Testing opendir() function with Zero arguments --
+
+Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing opendir() function with more than expected no. of arguments --
+
+Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_error2-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a non-existent directory as $path argument to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : error conditions ***\n";
+
+echo "\n-- Pass a non-existent absolute path: --\n";
+$path = dirname(__FILE__) . "/idonotexist";
+var_dump(opendir($path));
+
+echo "\n-- Pass a non-existent relative path: --\n";
+chdir(dirname(__FILE__));
+var_dump(opendir('idonotexist'));
+?>
+===DONE===
+--EXPECTF--
+*** Testing opendir() : error conditions ***
+
+-- Pass a non-existent absolute path: --
+
+Warning: opendir(%s/idonotexist,%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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a non-existent directory as $path argument to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : error conditions ***\n";
+
+echo "\n-- Pass a non-existent absolute path: --\n";
+$path = dirname(__FILE__) . "/idonotexist";
+var_dump(opendir($path));
+
+echo "\n-- Pass a non-existent relative path: --\n";
+chdir(dirname(__FILE__));
+var_dump(opendir('idonotexist'));
+?>
+===DONE===
+--EXPECTF--
+*** Testing opendir() : error conditions ***
+
+-- Pass a non-existent absolute path: --
+
+Warning: opendir(%s/idonotexist): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Pass a non-existent relative path: --
+
+Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation1-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $path argument to opendir() to test behaviour
+ * Where possible, an existing directory has been entered as a string value
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+// create directory to be passed as string value where possible
+$path = dirname(__FILE__) . "/opendir_variation1";
+mkdir($path);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA {
+
+ var $path;
+ function __construct($path) {
+ $this->path = $path;
+ }
+ public function __toString() {
+ return $this->path;
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+$path
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $path argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "$path",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA($path),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of opendir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( $dh = opendir($input) );
+ if ($dh) {
+ closedir($dh);
+ }
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation1";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: opendir(0,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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $path argument to opendir() to test behaviour
+ * Where possible, an existing directory has been entered as a string value
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+// create directory to be passed as string value where possible
+$path = dirname(__FILE__) . "/opendir_variation1";
+mkdir($path);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA {
+
+ var $path;
+ function __construct($path) {
+ $this->path = $path;
+ }
+ public function __toString() {
+ return $this->path;
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+$path
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $path argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "$path",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA($path),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of opendir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( $dh = opendir($input) );
+ if ($dh) {
+ closedir($dh);
+ }
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation1";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: opendir(0): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: opendir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: opendir(12345): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: opendir(-2345): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: opendir(10.5): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: opendir(-10.5): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: opendir(123456789000): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: opendir(1.23456789E-9): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: opendir(0.5): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+
+Warning: opendir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+
+Warning: opendir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+
+Warning: opendir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+resource(%d) of type (stream)
+
+-- Iteration 20 --
+
+Warning: opendir(string): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+resource(%d) of type (stream)
+
+-- Iteration 22 --
+resource(%d) of type (stream)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+
+Warning: opendir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation2.phpt b/ext/standard/tests/dir/opendir_variation2.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $context argument to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : usage variation ***\n";
+
+
+// Initialise function arguments not being substituted (if any)
+// create temporary directory for test, removed in CLEAN section
+$path = dirname(__FILE__) . "/opendir_variation2";
+mkdir($path);
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString()
+ {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $context argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of opendir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump($dh = opendir($path, $input) );#
+ if ($dh) {
+ closedir($dh);
+ }
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation2";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variation ***
+
+-- Iteration 1 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: opendir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: opendir() expects parameter 2 to be resource, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: opendir(): supplied resource is not a valid Stream-Context resource in %s on line %d
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation3.phpt b/ext/standard/tests/dir/opendir_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Call opendir() twice with the same directory as $path argument
+ */
+
+echo "*** Testing opendir() : usage variation ***\n";
+
+$path = dirname(__FILE__) . "/opendir_variation3";
+mkdir($path);
+
+echo "\n-- Open directory first time: --\n";
+var_dump($dh1 = opendir($path));
+
+echo "\n-- Open directory second time: --\n";
+var_dump($dh2 = opendir($path));
+
+if ($dh1 !== $dh2) {
+ echo "\nNew resource created\n";
+} else {
+ echo "\nNo new resource created\n";
+}
+
+closedir($dh1);
+closedir($dh2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation3";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variation ***
+
+-- Open directory first time: --
+resource(%d) of type (stream)
+
+-- Open directory second time: --
+resource(%d) of type (stream)
+
+New resource created
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation4.phpt b/ext/standard/tests/dir/opendir_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test opendir() with different relative paths as $path argument
+ */
+
+echo "*** Testing opendir() : usage variation ***\n";
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create directories
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- \$path = './level_one': --\n";
+var_dump(chdir($base_dir_path));
+var_dump($dh = opendir("./$level_one_dir_name"));
+clean_dh($dh);
+
+echo "\n-- \$path = 'level_one/level_two': --\n";
+var_dump(chdir($base_dir_path));
+var_dump($dh = opendir("$level_one_dir_name/$level_two_dir_name"));
+clean_dh($dh);
+
+echo "\n-- \$path = '..': --\n";
+var_dump($dh = opendir('..'));
+clean_dh($dh);
+
+echo "\n-- \$path = 'level_two', '.': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump($dh = opendir('.'));
+clean_dh($dh);
+
+echo "\n-- \$path = '../': --\n";
+var_dump($dh = opendir('../'));
+clean_dh($dh);
+
+echo "\n-- \$path = './': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump($dh = opendir('./'));
+clean_dh($dh);
+
+echo "\n-- \$path = '../../'level_one': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump($dh = opendir("../../$level_one_dir_name"));
+clean_dh($dh);
+
+/*
+ * function to remove directory handle before re-using variable name in test
+ * and to ensure directory is not in use at CLEAN section so can me removed
+ */
+function clean_dh($dh){
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ unset($dh);
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing opendir() : usage variation ***
+
+-- $path = './level_one': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = 'level_one/level_two': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = '..': --
+resource(%d) of type (stream)
+
+-- $path = 'level_two', '.': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = '../': --
+resource(%d) of type (stream)
+
+-- $path = './': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = '../../'level_one': --
+bool(true)
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation5.phpt b/ext/standard/tests/dir/opendir_variation5.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * remove the execute permission from the parent dir and test opendir() on child dir
+ * 1) remove write & execute permission from the 1st parent and test opendir()
+ * 2) remove execute permission from 2nd parent and test opendir()
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+/* create the temporary directory :
+ * opendir_variation5 ( parent )
+ * |-> sub_dir ( sub parent )
+ * |-> child_dir ( child dir)
+ */
+
+$parent_dir_path = dirname(__FILE__) . "/opendir_variation5";
+mkdir($parent_dir_path);
+chmod($parent_dir_path, 0777);
+
+// create sub_dir
+$sub_dir_path = $parent_dir_path . "/sub_dir";
+mkdir($sub_dir_path);
+chmod($sub_dir_path, 0777);
+
+//create sub_sub_dir
+$child_dir_path = $sub_dir_path."/child_dir";
+mkdir($child_dir_path);
+
+// remove the write and execute permisson from sub parent
+chmod($sub_dir_path, 0444);
+
+echo "\n-- After restricting 1st level parent directory --\n";
+$dir_handle1 = opendir($child_dir_path);
+var_dump( $dir_handle1 );
+
+// remove the execute permisson from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permisson to sub dir
+chmod($parent_dir_path, 0666); // restricting parent directory
+
+echo "\n-- After restricting parent directory --\n";
+$dir_handle2 = opendir($child_dir_path); // try to open, expected failure
+var_dump( $dir_handle2 ); // dump it
+
+if (is_resource($dir_handle1)) {
+ closedir($dir_handle1);
+}
+if (is_resource($dir_handle2)) {
+ closedir($dir_handle2);
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$parent_dir_path = dirname(__FILE__) . "/opendir_variation5";
+$sub_dir_path = $parent_dir_path."/sub_dir";
+$child_dir_path = $sub_dir_path."/child_dir";
+
+// changing permissions for each temporary directory to delete them
+chmod($parent_dir_path, 0777);
+chmod($sub_dir_path, 0777);
+chmod($child_dir_path, 0777);
+
+rmdir($child_dir_path);
+rmdir($sub_dir_path);
+rmdir($parent_dir_path);
+?>
+
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- After restricting 1st level parent directory --
+
+Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- After restricting parent directory --
+
+Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation6-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass paths containing wildcards to test if opendir() recognises them
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/opendir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+mkdir($dir_path);
+mkdir($sub_dir_path);
+
+// with different wildcard characters
+
+echo "\n-- Wildcard = '*' --\n";
+var_dump( opendir($file_path . "/opendir_var*") );
+var_dump( opendir($file_path . "/*") );
+
+echo "\n-- Wildcard = '?' --\n";
+var_dump( opendir($dir_path . "/sub_dir?") );
+var_dump( opendir($dir_path . "/sub?dir1") );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/opendir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+rmdir($sub_dir_path);
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Wildcard = '*' --
+
+Warning: opendir(%s/opendir_var*,%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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass paths containing wildcards to test if opendir() recognises them
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/opendir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+mkdir($dir_path);
+mkdir($sub_dir_path);
+
+// with different wildcard characters
+
+echo "\n-- Wildcard = '*' --\n";
+var_dump( opendir($file_path . "/opendir_var*") );
+var_dump( opendir($file_path . "/*") );
+
+echo "\n-- Wildcard = '?' --\n";
+var_dump( opendir($dir_path . "/sub_dir?") );
+var_dump( opendir($dir_path . "/sub?dir1") );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/opendir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+rmdir($sub_dir_path);
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Wildcard = '*' --
+
+Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: opendir(%s/*): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Wildcard = '?' --
+
+Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation7.phpt b/ext/standard/tests/dir/opendir_variation7.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__) . "/opendir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open a directory using opendir() with different directory permissions
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/opendir_variation7";
+mkdir($dir_path);
+
+/* different values for directory permissions */
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+// Open directory with different permission values, read and close, expected: none of them to succeed.
+
+$iterator = 1;
+foreach ($permission_values as $perm) {
+
+ echo "\n-- Iteration $iterator --\n";
+ // try to remove the dir if exists & create
+ if (is_dir($dir_path)){
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+
+ var_dump($dh = opendir($dir_path));
+
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ $iterator++;
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+// deleting temporary directory
+$dir_path = dirname(__FILE__) . "/opendir_variation7";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 2 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 3 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 4 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 5 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 6 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 7 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 8 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 9 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 10 --
+bool(true)
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_basic.phpt b/ext/standard/tests/dir/readdir_basic.phpt
new file mode 100644
index 0000000..572a9a0
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_basic.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test readdir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.C
+ */
+
+/*
+ * Test basic functionality of readdir()
+ */
+
+echo "*** Testing readdir() : basic functionality ***\n";
+
+// include the file.inc for Function: function create_files()
+chdir(dirname(__FILE__));
+include(dirname(__FILE__)."/../file/file.inc");
+
+$path = dirname(__FILE__) . '/readdir_basic';
+mkdir($path);
+create_files($path, 3);
+
+echo "\n-- Call readdir() with \$path argument --\n";
+var_dump($dh = opendir($path));
+$a = array();
+while( FALSE !== ($file = readdir($dh)) ) {
+ $a[] = $file;
+}
+sort($a);
+foreach($a as $file) {
+ var_dump($file);
+}
+
+echo "\n-- Call readdir() without \$path argument --\n";
+var_dump($dh = opendir($path));
+$a = array();
+while( FALSE !== ( $file = readdir() ) ) {
+ $a[] = $file;
+}
+sort($a);
+foreach($a as $file) {
+ var_dump($file);
+}
+
+delete_files($path, 3);
+closedir($dh);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . '/readdir_basic';
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing readdir() : basic functionality ***
+
+-- Call readdir() with $path argument --
+resource(%d) of type (stream)
+string(1) "."
+string(2) ".."
+string(9) "file1.tmp"
+string(9) "file2.tmp"
+string(9) "file3.tmp"
+
+-- Call readdir() without $path argument --
+resource(%d) of type (stream)
+string(1) "."
+string(2) ".."
+string(9) "file1.tmp"
+string(9) "file2.tmp"
+string(9) "file3.tmp"
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_error.phpt b/ext/standard/tests/dir/readdir_error.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : error conditions ***\n";
+
+
+//Test readdir with one more than the expected number of arguments
+echo "\n-- Testing readdir() function with more than expected no. of arguments --\n";
+
+$path = dirname(__FILE__) . "/readdir_error";
+mkdir($path);
+$dir_handle = opendir($path);
+$extra_arg = 10;
+
+var_dump( readdir($dir_handle, $extra_arg) );
+
+// close the handle so can remove dir in CLEAN section
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/readdir_error";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing readdir() : error conditions ***
+
+-- Testing readdir() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $dir_handle argument to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $dir_handle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of readdir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( readdir($input) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: readdir() 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass readdir() a directory handle pointing to an empty directory to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+$path = dirname(__FILE__) . '/readdir_variation2';
+mkdir($path);
+$dir_handle = opendir($path);
+
+echo "\n-- Pass an empty directory to readdir() --\n";
+function mysort($a,$b) {
+ return strlen($a) > 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--
+<?php
+$path = dirname(__FILE__) . '/readdir_variation2';
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Pass an empty directory to readdir() --
+string(1) "."
+string(2) ".."
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation3.phpt b/ext/standard/tests/dir/readdir_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory handle pointing to a directory that has a sub-directory
+ * to test behaviour of readdir()
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// include the file.inc for Function: function create_files()
+chdir(dirname(__FILE__));
+include(dirname(__FILE__)."/../file/file.inc");
+
+$path_top = dirname(__FILE__) . '/readdir_variation3';
+$path_sub = $path_top . '/sub_folder';
+mkdir($path_top);
+mkdir($path_sub);
+
+create_files($path_top, 2);
+create_files($path_sub, 2);
+
+$dir_handle = opendir($path_top);
+while(FALSE !== ($file = readdir($dir_handle))) {
+
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
+}
+
+// more important to check that all contents are present than order they are returned in
+sort($contents);
+var_dump($contents);
+
+delete_files($path_top, 2);
+delete_files($path_sub, 2);
+
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path_top = dirname(__FILE__) . '/readdir_variation3';
+$path_sub = $path_top . '/sub_folder';
+rmdir($path_sub);
+rmdir($path_top);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(9) "file2.tmp"
+ [4]=>
+ string(10) "sub_folder"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation4.phpt b/ext/standard/tests/dir/readdir_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory handle pointing to a directory that contains
+ * files with different file names to test how readdir() reads them
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+$dir_path = dirname(__FILE__) . "/readdir_variation4/";
+mkdir($dir_path);
+
+// heredoc string
+$heredoc = <<<EOT
+hd_file
+EOT;
+
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // empty data
+/*10*/ "",
+ array(),
+
+ // string data
+/*12*/ "double_file",
+ 'single_file',
+ $heredoc,
+);
+
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') );
+ var_dump( fwrite($$handle, $key));
+ fclose($$handle);
+ $iterator++;
+};
+
+echo "\n-- Call to readdir() --\n";
+$dir_handle = opendir($dir_path);
+while(FALSE !== ($file = readdir($dir_handle))){
+
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
+
+ // remove files while going through directory
+ @unlink($dir_path . $file);
+}
+
+// more important to check that all contents are present than order they are returned in
+sort($contents);
+var_dump($contents);
+
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/readdir_variation4/";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Iteration 1 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 2 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 3 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 4 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 5 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 6 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 7 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 8 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 9 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 10 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 11 --
+resource(%d) of type (stream)
+int(2)
+
+-- Iteration 12 --
+resource(%d) of type (stream)
+int(2)
+
+-- Iteration 13 --
+resource(%d) of type (stream)
+int(2)
+
+-- Iteration 14 --
+resource(%d) of type (stream)
+int(2)
+
+-- Call to readdir() --
+array(16) {
+ [0]=>
+ string(9) "-10.5.tmp"
+ [1]=>
+ string(9) "-2345.tmp"
+ [2]=>
+ string(1) "."
+ [3]=>
+ string(2) ".."
+ [4]=>
+ string(4) ".tmp"
+ [5]=>
+ string(7) "0.5.tmp"
+ [6]=>
+ string(5) "0.tmp"
+ [7]=>
+ string(17) "1.23456789E-9.tmp"
+ [8]=>
+ string(5) "1.tmp"
+ [9]=>
+ string(8) "10.5.tmp"
+ [10]=>
+ string(9) "12345.tmp"
+ [11]=>
+ string(16) "123456789000.tmp"
+ [12]=>
+ string(9) "Array.tmp"
+ [13]=>
+ string(15) "double_file.tmp"
+ [14]=>
+ string(11) "hd_file.tmp"
+ [15]=>
+ string(15) "single_file.tmp"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation5.phpt b/ext/standard/tests/dir/readdir_variation5.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/readdir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open a directory with different premissions then try to read it
+ * to test behaviour of readdir()
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// create the temporary directory
+$dir_path = dirname(__FILE__) . "/readdir_variation5";
+mkdir($dir_path);
+
+/* different values for directory permissions */
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+// Open directory with different permission values, read and close, expected: none of them to succeed.
+$iterator = 1;
+foreach($permission_values as $perm) {
+ echo "\n-- Iteration $iterator --\n";
+
+ if (is_dir($dir_path)) {
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+ var_dump($dh = opendir($dir_path));
+
+ echo "-- Calling readdir() --\n";
+ var_dump(readdir($dh));
+
+ closedir($dh);
+ $iterator++;
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/readdir_variation5";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 2 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 3 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 4 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 5 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 6 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 7 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 8 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 9 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 10 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation6.phpt b/ext/standard/tests/dir/readdir_variation6.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open two directory handles on the same directory and pass both
+ * to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// include the file.inc for Function: function create_files()
+include( dirname(__FILE__)."/../file/file.inc");
+
+// create the temporary directory
+$dir_path = dirname(__FILE__) . "/readdir_variation6";
+mkdir($dir_path);
+
+// create files within the temporary directory
+create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "readdir_variation6");
+
+// open the directory
+$dir_handle1 = opendir($dir_path);
+
+// open the same directory again without closing it
+opendir($dir_path);
+
+echo "\n-- Reading Directory Contents with Previous Handle --\n";
+$a = array();
+while (FALSE !== ($file = readdir($dir_handle1))) {
+ $a[] = $file;
+}
+sort($a);
+foreach ($a as $file) {
+ var_dump($file);
+}
+
+echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n";
+$a = array();
+while (FALSE !== ($file = readdir())) {
+ $a[] = $file;
+}
+sort($a);
+foreach ($a as $file) {
+ var_dump($file);
+}
+
+// delete temporary files
+delete_files($dir_path, 3, "readdir_variation6");
+closedir($dir_handle1);
+closedir();
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/readdir_variation6";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Reading Directory Contents with Previous Handle --
+string(1) "."
+string(2) ".."
+string(23) "readdir_variation61.tmp"
+string(23) "readdir_variation62.tmp"
+string(23) "readdir_variation63.tmp"
+
+-- Reading Directory Contents with Current Handle (no arguments supplied) --
+string(1) "."
+string(2) ".."
+string(23) "readdir_variation61.tmp"
+string(23) "readdir_variation62.tmp"
+string(23) "readdir_variation63.tmp"
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open a file pointer using fopen and pass to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// get a resource variable
+var_dump($fp = fopen(__FILE__, "r"));
+var_dump( readdir($fp) );
+
+?>
+===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--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Test basic functionality of rewinddir()
+ */
+
+echo "*** Testing rewinddir() : basic functionality ***\n";
+
+// include file.inc for create_files function
+include(dirname(__FILE__) . "/../file/file.inc");
+
+$dir_path1 = dirname(__FILE__) . "/rewinddir_basic_dir1";
+$dir_path2 = dirname(__FILE__) . "/rewinddir_basic_dir2";
+mkdir($dir_path1);
+mkdir($dir_path2);
+
+@create_files($dir_path1, 1);
+@create_files($dir_path2, 1, 'numeric', 0755, 1, 'w', 'file', 2);
+var_dump($dh1 = opendir($dir_path1));
+var_dump($dh2 = opendir($dir_path2));
+
+$data = array();
+echo "\n-- Read and rewind first directory (argument supplied) --\n";
+while(FALSE !== $file1 = readdir($dh1)) {
+ $data[] = $file1;
+}
+$first = $data[0];
+sort($data);
+var_dump($data);
+
+var_dump(rewinddir($dh1));
+var_dump(readdir($dh1) == $first);
+
+$data = array();
+echo "\n-- Read and rewind second directory (no argument supplied) --\n";
+while(FALSE !== $file2 = readdir()) {
+ $data[] = $file2;
+}
+$first = $data[0];
+sort($data);
+var_dump($data);
+
+var_dump(rewinddir());
+var_dump(readdir() == $first);
+
+closedir($dh1);
+closedir($dh2);
+
+delete_files($dir_path1, 1);
+delete_files($dir_path2, 1, 'file', 2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path1 = dirname(__FILE__) . "/rewinddir_basic_dir1";
+$dir_path2 = dirname(__FILE__) . "/rewinddir_basic_dir2";
+rmdir($dir_path1);
+rmdir($dir_path2);
+?>
+--EXPECTF--
+*** Testing rewinddir() : basic functionality ***
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+
+-- Read and rewind first directory (argument supplied) --
+array(3) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+}
+NULL
+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--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Pass incorrect number of arguments to rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : error conditions ***\n";
+
+
+//Test rewinddir with one more than the expected number of arguments
+echo "\n-- Testing rewinddir() function with more than expected no. of arguments --\n";
+
+$dir_path = dirname(__FILE__) . "/rewinddir_error";
+mkdir($dir_path);
+$dir_handle = opendir($dir_path);
+$extra_arg = 10;
+
+var_dump( rewinddir($dir_handle, $extra_arg) );
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/rewinddir_error";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing rewinddir() : error conditions ***
+
+-- Testing rewinddir() function with more than expected no. of arguments --
+
+Warning: 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--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Pass different data types as $dir_handle argument to rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $dir_handle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of rewinddir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( rewinddir($input) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing rewinddir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: rewinddir() 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--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Open and close a directory handle then call rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : usage variations ***\n";
+
+$dir_path = dirname(__FILE__) . '/rewinddir_variation2';
+mkdir($dir_path);
+
+echo "\n-- Create the directory handle, read and close the directory --\n";
+var_dump($dir_handle = opendir($dir_path));
+var_dump(readdir($dir_handle));
+closedir($dir_handle);
+
+echo "\n-- Call to rewinddir() --\n";
+var_dump(rewinddir($dir_handle));
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . '/rewinddir_variation2';
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing rewinddir() : usage variations ***
+
+-- Create the directory handle, read and close the directory --
+resource(%d) of type (stream)
+string(%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--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Pass a file pointer to rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : usage variations ***\n";
+
+echo "\n-- Open a file using fopen --\n";
+var_dump($fp = fopen(__FILE__, 'r'));
+
+$result1 = fread($fp, 5);
+var_dump(rewinddir($fp));
+$result2 = fread($fp, 5);
+
+echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
+if ($result1 === $result2) {
+ echo "rewinddir() works on file pointers\n";
+} else {
+ echo "rewinddir() does not work on file pointers\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing rewinddir() : usage variations ***
+
+-- Open a file using fopen --
+resource(%d) of type (stream)
+
+Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Check if rewinddir() has repositioned the file pointer --
+rewinddir() does not work on file pointers
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_basic.phpt b/ext/standard/tests/dir/scandir_basic.phpt
new file mode 100644
index 0000000..7a044da
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test scandir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of scandir()
+ */
+
+echo "*** Testing scandir() : basic functionality ***\n";
+
+// include file.inc for create_files function
+include (dirname(__FILE__) . '/../file/file.inc');
+
+// set up directory
+$directory = dirname(__FILE__) . '/scandir_basic';
+mkdir($directory);
+create_files($directory, 3);
+
+echo "\n-- scandir() with mandatory arguments --\n";
+var_dump(scandir($directory));
+
+echo "\n-- scandir() with all arguments --\n";
+$sorting_order = SCANDIR_SORT_DESCENDING;
+$context = stream_context_create();
+var_dump(scandir($directory, $sorting_order, $context));
+
+delete_files($directory, 3);
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . '/scandir_basic';
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing scandir() : basic functionality ***
+
+-- scandir() with mandatory arguments --
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(9) "file2.tmp"
+ [4]=>
+ string(9) "file3.tmp"
+}
+
+-- scandir() with all arguments --
+array(5) {
+ [0]=>
+ string(9) "file3.tmp"
+ [1]=>
+ string(9) "file2.tmp"
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(2) ".."
+ [4]=>
+ string(1) "."
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_error1.phpt b/ext/standard/tests/dir/scandir_error1.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to scandir() to test behaviour
+ */
+
+echo "*** Testing scandir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing scandir() function with Zero arguments --\n";
+var_dump( scandir() );
+
+//Test scandir with one more than the expected number of arguments
+echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
+$dir = dirname(__FILE__) . '/scandir_error';
+mkdir($dir);
+$sorting_order = 10;
+$context = stream_context_create();
+$extra_arg = 10;
+var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . '/scandir_error';
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing scandir() : error conditions ***
+
+-- Testing scandir() function with Zero arguments --
+
+Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing scandir() function with more than expected no. of arguments --
+
+Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_error2-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory that does not exist to scandir() to test error messages
+ */
+
+echo "*** Testing scandir() : error conditions ***\n";
+
+$directory = dirname(__FILE__) . '/idonotexist';
+
+echo "\n-- Pass scandir() an absolute path that does not exist --\n";
+var_dump(scandir($directory));
+
+echo "\n-- Pass scandir() a relative path that does not exist --\n";
+var_dump(scandir('/idonotexist'));
+?>
+===DONE===
+--EXPECTF--
+*** Testing scandir() : error conditions ***
+
+-- Pass scandir() an absolute path that does not exist --
+
+Warning: scandir(%s/idonotexist,%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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory that does not exist to scandir() to test error messages
+ */
+
+echo "*** Testing scandir() : error conditions ***\n";
+
+$directory = dirname(__FILE__) . '/idonotexist';
+
+echo "\n-- Pass scandir() an absolute path that does not exist --\n";
+var_dump(scandir($directory));
+
+echo "\n-- Pass scandir() a relative path that does not exist --\n";
+var_dump(scandir('/idonotexist'));
+?>
+===DONE===
+--EXPECTF--
+*** Testing scandir() : error conditions ***
+
+-- Pass scandir() an absolute path that does not exist --
+
+Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Pass scandir() a relative path that does not exist --
+
+Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation1-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $dir argument to test behaviour of scandir()
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $dir argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: scandir(0,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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $dir argument to test behaviour of scandir()
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $dir argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: scandir(0): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: scandir(1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: scandir(12345): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: scandir(-2345): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: scandir(10.5): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: scandir(-10.5): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: scandir(123456789000): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: scandir(1.23456789E-9): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: scandir(0.5): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: scandir(1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: scandir(1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: scandir() expects parameter 1 to be 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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+printf("SCANDIR_SORT_ASCENDING: %d\n", SCANDIR_SORT_ASCENDING);
+printf("SCANDIR_SORT_DESCENDING: %d\n", SCANDIR_SORT_DESCENDING);
+printf("SCANDIR_SORT_NONE: %d\n", SCANDIR_SORT_NONE);
+
+/*
+ * Pass different integers as $sorting_order argument to test how scandir()
+ * re-orders the array
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// include for create_files/delete_files functions
+include(dirname(__FILE__) . '/../file/file.inc');
+
+// create directory and files
+$dir = dirname(__FILE__) . '/scandir_variation10';
+mkdir($dir);
+@create_files($dir, 2);
+
+// Deterministic tests.
+var_dump(scandir($dir, SCANDIR_SORT_ASCENDING));
+var_dump(scandir($dir, SCANDIR_SORT_DESCENDING));
+
+// Non-deterministic tests.
+$files = scandir($dir, SCANDIR_SORT_NONE);
+var_dump(count($files));
+var_dump(in_array('.', $files));
+var_dump(in_array('..', $files));
+var_dump(in_array('file1.tmp', $files));
+var_dump(in_array('file2.tmp', $files));
+
+delete_files($dir, 2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation10';
+rmdir($dir);
+?>
+--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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $sorting_order argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$dir = dirname(__FILE__) . '/scandir_variation2';
+mkdir($dir);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $sorting_order argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($dir, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation2';
+rmdir($dir);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 10 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 12 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 16 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: scandir() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: scandir() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 24 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 25 --
+
+Warning: scandir() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation3.phpt b/ext/standard/tests/dir/scandir_variation3.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $context argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$dir = dirname(__FILE__) . '/scandir_variation3';
+mkdir($dir);
+$sorting_order = SCANDIR_SORT_ASCENDING;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $context argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($dir, $sorting_order, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation3';
+rmdir($dir);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation4.phpt b/ext/standard/tests/dir/scandir_variation4.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test scandir() with relative paths as $dir argument
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// include for create_files/delete_files functions
+include (dirname(__FILE__) . '/../file/file.inc');
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_path = "$base_dir_path/level_one";
+$level_two_dir_path = "$level_one_dir_path/level_two";
+
+// create directories and files
+mkdir($level_one_dir_path);
+create_files($level_one_dir_path, 2, 'numeric', 0755, 1, 'w', 'level_one', 1);
+mkdir($level_two_dir_path);
+create_files($level_two_dir_path, 2, 'numeric', 0755, 1, 'w', 'level_two', 1);
+
+echo "\n-- \$path = './level_one': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(scandir('./level_one'));
+
+echo "\n-- \$path = 'level_one/level_two': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(scandir('level_one/level_two'));
+
+echo "\n-- \$path = '..': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('..'));
+
+echo "\n-- \$path = 'level_two', '.': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('.'));
+
+echo "\n-- \$path = '../': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('../'));
+
+echo "\n-- \$path = './': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('./'));
+
+echo "\n-- \$path = '../../'level_one': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('../../level_one'));
+
+@delete_files($level_one_dir_path, 2, 'level_one');
+@delete_files($level_two_dir_path, 2, 'level_two');
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__);
+rmdir("$dir_path/level_one/level_two");
+rmdir("$dir_path/level_one");
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- $path = './level_one': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+
+-- $path = 'level_one/level_two': --
+bool(true)
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_two1.tmp"
+ [3]=>
+ string(14) "level_two2.tmp"
+}
+
+-- $path = '..': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+
+-- $path = 'level_two', '.': --
+bool(true)
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_two1.tmp"
+ [3]=>
+ string(14) "level_two2.tmp"
+}
+
+-- $path = '../': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+
+-- $path = './': --
+bool(true)
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_two1.tmp"
+ [3]=>
+ string(14) "level_two2.tmp"
+}
+
+-- $path = '../../'level_one': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation5.phpt b/ext/standard/tests/dir/scandir_variation5.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * remove the execute permission from the parent dir and test scandir() on child dir
+ * 1. remove write & execute permission from the 1st parent and test scandir()
+ * 2. remove execute permission from 2nd parent and test scandir()
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+/*
+ * create the temporary directory :
+ * scandir_variation5 ( parent )
+ * |-> sub_dir ( sub parent )
+ * |-> child_dir ( child dir)
+ */
+
+$parent_dir_path = dirname(__FILE__) . "/scandir_variation5";
+mkdir($parent_dir_path);
+chmod($parent_dir_path, 0777);
+
+// create sub_dir
+$sub_dir_path = $parent_dir_path . "/sub_dir";
+mkdir($sub_dir_path);
+chmod($sub_dir_path, 0777);
+
+//create sub_sub_dir
+$child_dir_path = $sub_dir_path."/child_dir";
+mkdir($child_dir_path);
+
+// remove the write and execute permisson from sub parent
+chmod($sub_dir_path, 0444);
+
+echo "\n-- After restricting 1st level parent directory --\n";
+var_dump(scandir($child_dir_path));
+
+// remove the execute permisson from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permisson to sub dir
+chmod($parent_dir_path, 0666); // restricting parent directory
+
+echo "\n-- After restricting parent directory --\n";
+var_dump(scandir($child_dir_path));
+?>
+===DONE===
+--CLEAN--
+<?php
+$parent_dir_path = dirname(__FILE__) . "/scandir_variation5";
+$sub_dir_path = $parent_dir_path."/sub_dir";
+$child_dir_path = $sub_dir_path."/child_dir";
+
+// changing permissions for each temporary directory to delete them
+chmod($parent_dir_path, 0777);
+chmod($sub_dir_path, 0777);
+chmod($child_dir_path, 0777);
+
+rmdir($child_dir_path);
+rmdir($sub_dir_path);
+rmdir($parent_dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- After restricting 1st level parent directory --
+
+Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- After restricting parent directory --
+
+Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation6-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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/scandir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+mkdir($dir_path);
+mkdir($sub_dir_path);
+
+// with different wildcard characters
+
+echo "\n-- Wildcard = '*' --\n";
+var_dump( scandir($file_path . "/scandir_var*") );
+var_dump( scandir($file_path . "/*") );
+
+echo "\n-- Wildcard = '?' --\n";
+var_dump( scandir($dir_path . "/sub_dir?") );
+var_dump( scandir($dir_path . "/sub?dir1") );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+rmdir($sub_dir_path);
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Wildcard = '*' --
+
+Warning: scandir(%s/scandir_var*,%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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/scandir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+mkdir($dir_path);
+mkdir($sub_dir_path);
+
+// with different wildcard characters
+
+echo "\n-- Wildcard = '*' --\n";
+var_dump( scandir($file_path . "/scandir_var*") );
+var_dump( scandir($file_path . "/*") );
+
+echo "\n-- Wildcard = '?' --\n";
+var_dump( scandir($dir_path . "/sub_dir?") );
+var_dump( scandir($dir_path . "/sub?dir1") );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+rmdir($sub_dir_path);
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Wildcard = '*' --
+
+Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+Warning: scandir(%s/*): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Wildcard = '?' --
+
+Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation7.phpt b/ext/standard/tests/dir/scandir_variation7.phpt
new file mode 100644
index 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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__) . "/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Create directories with different permissions to test whether scandir() can access them
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// create the temporary directory
+$dir_path = dirname(__FILE__) . "/scandir_variation7";
+mkdir($dir_path);
+
+// different values for directory permissions
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+$iterator = 1;
+foreach ($permission_values as $perm) {
+ echo "\n-- Iteration $iterator --\n";
+
+ // Remove the directory if already exists
+ if (is_dir($dir_path)){
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+
+ var_dump(scandir($dir_path));
+ $iterator++;
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation7";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 2 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 3 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 4 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 5 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 6 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 7 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 8 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 9 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 10 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation8.phpt b/ext/standard/tests/dir/scandir_variation8.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory containing files with different types of names to test how scandir()
+ * reads them
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+$dir_path = dirname(__FILE__) . "/scandir_variation8/";
+mkdir($dir_path);
+
+// heredoc string
+$heredoc = <<<EOT
+hd_file
+EOT;
+
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // empty data
+/*10*/ "",
+ array(),
+
+ // string data
+/*12*/ "double_file",
+ 'single_file',
+ $heredoc,
+);
+
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') );
+ fclose($$handle);
+ $iterator++;
+};
+
+echo "\n-- Call to scandir() --\n";
+var_dump($content = scandir($dir_path));
+
+// remove all files in directory so can remove directory in CLEAN section
+foreach ($content as $file_name) {
+ // suppress errors as won't be able to remove "." and ".." entries
+ @unlink($dir_path . $file_name);
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation8";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+resource(%d) of type (stream)
+
+-- Iteration 2 --
+resource(%d) of type (stream)
+
+-- Iteration 3 --
+resource(%d) of type (stream)
+
+-- Iteration 4 --
+resource(%d) of type (stream)
+
+-- Iteration 5 --
+resource(%d) of type (stream)
+
+-- Iteration 6 --
+resource(%d) of type (stream)
+
+-- Iteration 7 --
+resource(%d) of type (stream)
+
+-- Iteration 8 --
+resource(%d) of type (stream)
+
+-- Iteration 9 --
+resource(%d) of type (stream)
+
+-- Iteration 10 --
+resource(%d) of type (stream)
+
+-- Iteration 11 --
+resource(%d) of type (stream)
+
+-- Iteration 12 --
+resource(%d) of type (stream)
+
+-- Iteration 13 --
+resource(%d) of type (stream)
+
+-- Iteration 14 --
+resource(%d) of type (stream)
+
+-- Call to scandir() --
+array(16) {
+ [0]=>
+ string(9) "-10.5.tmp"
+ [1]=>
+ string(9) "-2345.tmp"
+ [2]=>
+ string(1) "."
+ [3]=>
+ string(2) ".."
+ [4]=>
+ string(4) ".tmp"
+ [5]=>
+ string(7) "0.5.tmp"
+ [6]=>
+ string(5) "0.tmp"
+ [7]=>
+ string(17) "1.23456789E-9.tmp"
+ [8]=>
+ string(5) "1.tmp"
+ [9]=>
+ string(8) "10.5.tmp"
+ [10]=>
+ string(9) "12345.tmp"
+ [11]=>
+ string(16) "123456789000.tmp"
+ [12]=>
+ string(9) "Array.tmp"
+ [13]=>
+ string(15) "double_file.tmp"
+ [14]=>
+ string(11) "hd_file.tmp"
+ [15]=>
+ string(15) "single_file.tmp"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation9.phpt b/ext/standard/tests/dir/scandir_variation9.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different integers as $sorting_order argument to test how scandir()
+ * re-orders the array
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// include for create_files/delete_files functions
+include(dirname(__FILE__) . '/../file/file.inc');
+
+// create directory and files
+$dir = dirname(__FILE__) . '/scandir_variation9';
+mkdir($dir);
+@create_files($dir, 2);
+
+// different ints to pass as $sorting_order argument
+$ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0);
+
+foreach($ints as $sorting_order) {
+ var_dump( scandir($dir, $sorting_order) );
+}
+
+delete_files($dir, 2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation9';
+rmdir($dir);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+array(4) {
+ [0]=>
+ string(9) "file2.tmp"
+ [1]=>
+ string(9) "file1.tmp"
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(1) "."
+}
+array(4) {
+ [0]=>
+ string(9) "file2.tmp"
+ [1]=>
+ string(9) "file1.tmp"
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(1) "."
+}
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(9) "file2.tmp"
+}
+===DONE===
diff --git a/ext/standard/tests/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--
+<?php
+/*
+ * Prototype: object dir(string directory[, resource context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Class is defined in ext/standard/dir.c
+ */
+
+echo "Structure of Directory class:\n";
+$rc = new ReflectionClass("Directory");
+echo $rc;
+
+echo "Cannot instantiate a valid Directory directly:\n";
+$d = new Directory(getcwd());
+var_dump($d);
+var_dump($d->read());
+
+?>
+--EXPECTF--
+Structure of Directory class:
+Class [ <internal%s> class Directory ] {
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [3] {
+ Method [ <internal:standard> public method close ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $dir_handle ]
+ }
+ }
+
+ Method [ <internal:standard> public method rewind ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $dir_handle ]
+ }
+ }
+
+ Method [ <internal:standard> public method read ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $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--
+<?php
+
+echo "\n--> 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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+echo DIRECTORY_SEPARATOR;
+
+echo "\n";
+
+echo PATH_SEPARATOR;
+
+echo "\n";
+
+echo "done";
+
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+
+echo DIRECTORY_SEPARATOR;
+
+echo "\n";
+
+echo PATH_SEPARATOR;
+
+echo "\n";
+
+echo "done";
+
+?>
+--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 <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+?>
+--FILE--
+<?php
+chdir(dirname(__FILE__));
+@unlink('test.file');
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+fclose (fopen('test.file', 'w'));
+chmod ('test.file', 0744);
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+if (is_link('test.file')) {
+ echo "test.file is a symlink\n";
+} else {
+ echo "test.file is not a symlink\n";
+}
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+$s = stat ('test.file');
+$ls = lstat ('test.file');
+for ($i = 0; $i <= 12; $i++) {
+ if ($ls[$i] != $s[$i]) {
+ echo "test.file lstat and stat differ at element $i\n";
+ }
+}
+echo "test.file is " . filetype('test.file') . "\n";
+printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
+echo "test.file size is " . filesize('test.file') . "\n";
+if (is_writeable('test.file')) {
+ echo "test.file is writeable\n";
+} else {
+ echo "test.file is not writeable\n";
+}
+if (is_readable('test.file')) {
+ echo "test.file is readable\n";
+} else {
+ echo "test.file is not readable\n";
+}
+if (is_file('test.file')) {
+ echo "test.file is a regular file\n";
+} else {
+ echo "test.file is not a regular file\n";
+}
+if (is_dir('../file')) {
+ echo "../file is a directory\n";
+} else {
+ echo "../file is not a directory\n";
+}
+if (is_dir('test.file')) {
+ echo "test.file is a directory\n";
+} else {
+ echo "test.file is not a directory\n";
+}
+unlink('test.file');
+if (file_exists('test.file')) {
+ echo "test.file exists (cached)\n";
+} else {
+ echo "test.file does not exist\n";
+}
+clearstatcache();
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--FILE--
+<?php
+chdir(dirname(__FILE__));
+@unlink('test.file');
+@unlink('test.link');
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+fclose (fopen('test.file', 'w'));
+chmod ('test.file', 0744);
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+sleep (2);
+symlink('test.file','test.link');
+if (file_exists('test.link')) {
+ echo "test.link exists\n";
+} else {
+ echo "test.link does not exist\n";
+}
+if (is_link('test.file')) {
+ echo "test.file is a symlink\n";
+} else {
+ echo "test.file is not a symlink\n";
+}
+if (is_link('test.link')) {
+ echo "test.link is a symlink\n";
+} else {
+ echo "test.link is not a symlink\n";
+}
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+$s = stat ('test.file');
+$ls = lstat ('test.file');
+for ($i = 0; $i <= 12; $i++) {
+ if ($ls[$i] != $s[$i]) {
+ echo "test.file lstat and stat differ at element $i\n";
+ }
+}
+$s = stat ('test.link');
+$ls = lstat ('test.link');
+for ($i = 0; $i <= 11; $i++) {
+ if ($ls[$i] != $s[$i]) {
+ if ($i != 6 && $i != 10 && $i != 11) echo "test.link lstat and stat differ at element $i\n";
+ }
+}
+echo "test.file is " . filetype('test.file') . "\n";
+echo "test.link is " . filetype('test.link') . "\n";
+printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
+echo "test.file size is " . filesize('test.file') . "\n";
+if (is_writeable('test.file')) {
+ echo "test.file is writeable\n";
+} else {
+ echo "test.file is not writeable\n";
+}
+if (is_readable('test.file')) {
+ echo "test.file is readable\n";
+} else {
+ echo "test.file is not readable\n";
+}
+if (is_executable('test.file')) {
+ echo "test.file is executable\n";
+} else {
+ echo "test.file is not executable\n";
+}
+if (is_file('test.file')) {
+ echo "test.file is a regular file\n";
+} else {
+ echo "test.file is not a regular file\n";
+}
+if (is_file('test.link')) {
+ echo "test.link is a regular file\n";
+} else {
+ echo "test.link is not a regular file\n";
+}
+if (is_dir('test.link')) {
+ echo "test.link is a directory\n";
+} else {
+ echo "test.link is not a directory\n";
+}
+if (is_dir('../file')) {
+ echo "../file is a directory\n";
+} else {
+ echo "../file is not a directory\n";
+}
+if (is_dir('test.file')) {
+ echo "test.file is a directory\n";
+} else {
+ echo "test.file is not a directory\n";
+}
+unlink('test.file');
+unlink('test.link');
+if (file_exists('test.file')) {
+ echo "test.file exists (cached)\n";
+} else {
+ echo "test.file does not exist\n";
+}
+clearstatcache();
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+?>
+--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--
+<?php
+
+$data = <<<EOD
+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
+EOD;
+
+$name = tempnam("./ext/standard/tests/file/", "php");
+$fp = fopen($name, "w");
+fwrite($fp, $data);
+fclose($fp);
+
+//readfile($name);
+echo file_get_contents($name);
+
+unlink($name);
+
+?>
+--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--
+<?php
+
+$funcs = array(
+ 'is_writable',
+ 'is_readable',
+ 'is_executable',
+ 'is_file',
+ 'file_exists',
+);
+
+$filename="";
+
+foreach ($funcs as $test) {
+ $bb = $test($filename);
+ echo gettype($bb)."\n";
+ clearstatcache();
+}
+
+$filename="run-tests.php";
+
+foreach ($funcs as $test) {
+ $bb = $test($filename);
+ echo gettype($bb)."\n";
+ clearstatcache();
+}
+
+?>
+--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--
+<?php
+ chdir(dirname(__FILE__));
+ for ($i = 1; $i < 6; $i++) {
+ @unlink("./TEST{$i}");
+ }
+
+ echo "String Test: ";
+ echo file_put_contents("TEST1", file_get_contents(__FILE__)) !== FALSE ? 'OK' : 'FAIL';
+ echo "\n";
+
+ $old_int = $int = rand();
+ $ret = file_put_contents("TEST2", $int);
+ echo "Integer Test: ";
+ if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST2")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
+
+ $old_int = $int = time() / 1000;
+ $ret = file_put_contents("TEST3", $int);
+ echo "Float Test: ";
+ if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST3")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
+
+ $ret = file_put_contents("TEST4", __FILE__);
+ echo "Bool Test: ";
+ if ($ret !== FALSE && md5(__FILE__) == md5_file("TEST4")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
+
+ $ret = @file_put_contents("TEST5", $_SERVER);
+ echo "Array Test: ";
+ if ($ret !== FALSE && @md5(implode('', $_SERVER)) == md5_file("TEST5")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
+
+ for ($i = 1; $i < 6; $i++) {
+ @unlink("./TEST{$i}");
+ }
+?>
+--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--
+<?php
+/*
+ Prototype: int fileatime ( string $filename );
+ Description: Returns the time the file was last accessed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: int filemtime ( string $filename );
+ Description: Returns the time the file was last modified, or FALSE
+ in case of an error.
+
+ Prototype: int filectime ( string $filename );
+ Description: Returns the time the file was last changed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
+ Description: Attempts to set the access and modification times of the file
+ named in the filename parameter to the value given in time.
+*/
+
+echo "*** Testing the basic functionality with file ***\n";
+print( @date('Y:M:D:H:i:s', fileatime(__FILE__)) )."\n";
+print( @date('Y:M:D:H:i:s', filemtime(__FILE__)) )."\n";
+print( @date('Y:M:D:H:i:s', filectime(__FILE__)) )."\n";
+print( @date('Y:M:D:H:i:s', touch(dirname(__FILE__)."/005_basic.tmp")) )."\n";
+
+echo "*** Testing the basic functionality with dir ***\n";
+print( @date('Y:M:D:H:i:s', fileatime(".")) )."\n";
+print( @date('Y:M:D:H:i:s', filemtime(".")) )."\n";
+print( @date('Y:M:D:H:i:s', filectime(".")) )."\n";
+print( @date('Y:M:D:H:i:s', touch(dirname(__FILE__)."/005_basic")) )."\n";
+
+echo "\n*** Done ***\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/005_basic.tmp");
+unlink(dirname(__FILE__)."/005_basic");
+?>
+--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--
+<?php
+/*
+ Prototype: int fileatime ( string $filename );
+ Description: Returns the time the file was last accessed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: int filemtime ( string $filename );
+ Description: Returns the time the file was last modified, or FALSE
+ in case of an error.
+
+ Prototype: int filectime ( string $filename );
+ Description: Returns the time the file was last changed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
+ Description: Attempts to set the access and modification times of the file
+ named in the filename parameter to the value given in time.
+*/
+
+echo "*** Testing error conditions ***\n";
+
+echo "\n-- Testing with Non-existing files --";
+/* Both invalid argumetns */
+var_dump( fileatime("/no/such/file/or/dir") );
+var_dump( filemtime("/no/such/file/or/dir") );
+var_dump( filectime("/no/such/file/or/dir") );
+var_dump( touch("/no/such/file/or/dir", 10) );
+
+/* Only one invalid argument */
+var_dump( fileatime(__FILE__, "string") );
+var_dump( filemtime(__FILE__, 100) );
+var_dump( filectime(__FILE__, TRUE) );
+var_dump( touch(__FILE__, 10, 100, 123) );
+
+echo "\n-- Testing No.of arguments less than expected --";
+var_dump( fileatime() );
+var_dump( filemtime() );
+var_dump( filectime() );
+var_dump( touch() );
+
+echo "\n-- Testing No.of arguments greater than expected --";
+/* Both invalid arguments */
+var_dump( fileatime("/no/such/file/or/dir", "string") );
+var_dump( filemtime("/no/such/file/or/dir", 100) );
+var_dump( filectime("/no/such/file/or/dir", TRUE) );
+var_dump( touch("/no/such/file/or/dir", 10, 100, 123) );
+
+/* Only one invalid argument */
+var_dump( fileatime(__FILE__, "string") );
+var_dump( filemtime(__FILE__, 100) );
+var_dump( filectime(__FILE__, TRUE) );
+var_dump( touch(__FILE__, 10, 100, 123) );
+
+echo "\nDone";
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows-only test');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileatime ( string $filename );
+ Description: Returns the time the file was last accessed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: int filemtime ( string $filename );
+ Description: Returns the time the file was last modified, or FALSE
+ in case of an error.
+
+ Prototype: int filectime ( string $filename );
+ Description: Returns the time the file was last changed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
+ Description: Attempts to set the access and modification times of the file
+ named in the filename parameter to the value given in time.
+*/
+
+/*
+ Prototype: void stat_fn(string $filename);
+ Description: Prints access, modification and change times of a file
+*/
+function stat_fn( $filename ) {
+ echo "-- File access time is => ";
+ 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--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/005_variation_softlink.tmp");
+unlink($file_path."/005_variation_hardlink.tmp");
+unlink($file_path."/005_variation1.tmp");
+unlink($file_path."/005_variation_copy.tmp");
+unlink($file_path."/005_variation_touch.tmp");
+unlink($file_path."/005_variation_touch_fly.tmp");
+unlink($file_path."/005_variation_touch_new.tmp");
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+if (getenv("SKIP_SLOW_TESTS")) {
+ die("skip slow test");
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileatime ( string $filename );
+ Description: Returns the time the file was last accessed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: int filemtime ( string $filename );
+ Description: Returns the time the file was last modified, or FALSE
+ in case of an error.
+
+ Prototype: int filectime ( string $filename );
+ Description: Returns the time the file was last changed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
+ Description: Attempts to set the access and modification times of the file
+ named in the filename parameter to the value given in time.
+*/
+
+/*
+ Prototype: void stat_fn(string $filename);
+ Description: Prints access, modification and change times of a file
+*/
+function stat_fn( $filename ) {
+ echo "-- File access time is => ";
+ 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--
+<?php
+$file_path = dirname(__FILE__);
+if(file_exists($file_path."/005_variation_softlink.tmp")) {
+ unlink($file_path."/005_variation_softlink.tmp");
+}
+if(file_exists($file_path."/005_variation_hardlink.tmp")) {
+ unlink($file_path."/005_variation_hardlink.tmp");
+}
+if(file_exists($file_path."/005_variation1.tmp")) {
+ unlink($file_path."/005_variation1.tmp");
+}
+if(file_exists($file_path."/005_variation_copy.tmp")) {
+ unlink($file_path."/005_variation_copy.tmp");
+}
+if(file_exists($file_path."/005_variation_touch.tmp")) {
+ unlink($file_path."/005_variation_touch.tmp");
+}
+if(file_exists($file_path."/005_variation_touch_fly.tmp")) {
+ unlink($file_path."/005_variation_touch_fly.tmp");
+}
+if(file_exists($file_path."/005_variation_touch_new.tmp")) {
+ unlink($file_path."/005_variation_touch_new.tmp");
+}
+?>
+--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 <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileatime ( string $filename );
+ Description: Returns the time the file was last accessed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: int filemtime ( string $filename );
+ Description: Returns the time the file was last modified, or FALSE
+ in case of an error.
+
+ Prototype: int filectime ( string $filename );
+ Description: Returns the time the file was last changed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
+ Description: Attempts to set the access and modification times of the file
+ named in the filename parameter to the value given in time.
+*/
+
+/*
+ Prototype: void stat_fn(string $filename);
+ Description: Prints access, modification and change times of a file
+*/
+function stat_fn( $filename ) {
+ echo "\n-- File '$filename' --\n";
+ echo "-- File access time is => ";
+ 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 <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Non Windows Systems');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileatime ( string $filename );
+ Description: Returns the time the file was last accessed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: int filemtime ( string $filename );
+ Description: Returns the time the file was last modified, or FALSE
+ in case of an error.
+
+ Prototype: int filectime ( string $filename );
+ Description: Returns the time the file was last changed, or FALSE
+ in case of an error. The time is returned as a Unix timestamp.
+
+ Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
+ Description: Attempts to set the access and modification times of the file
+ named in the filename parameter to the value given in time.
+*/
+
+/*
+ Prototype: void stat_fn(string $filename);
+ Description: Prints access, modification and change times of a file
+*/
+function stat_fn( $filename ) {
+ echo "\n-- File '$filename' --\n";
+ echo "-- File access time is => ";
+ 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not on Windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/006_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileperms ( string $filename );
+ Description: Returns the permissions on the file, or FALSE in case of an error
+
+ Prototype: bool chmod ( string $filename, int $mode );
+ Description: Attempts to change the mode of the file specified by
+ filename to that given in mode
+*/
+$path = dirname(__FILE__);
+
+echo "*** Testing fileperms(), chmod() with files and dirs ***\n";
+fopen($path."/perm.tmp", "w");
+var_dump( chmod($path."/perm.tmp", 0755 ) );
+printf("%o", fileperms($path."/perm.tmp") );
+echo "\n";
+clearstatcache();
+
+mkdir($path."/perm");
+var_dump( chmod( $path."/perm", 0777 ) );
+printf("%o", fileperms($path."/perm") );
+echo "\n";
+clearstatcache();
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/perm.tmp");
+rmdir(dirname(__FILE__)."/perm");
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not on Windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/006_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileperms ( string $filename )
+ Description: Returns the permissions on the file, or FALSE in case of an error
+
+ Prototype: bool chmod ( string $filename, int $mode )
+ Description: Attempts to change the mode of the file specified by
+ filename to that given in mode
+*/
+
+echo "*** Testing error conditions for fileperms(), chmod() ***\n";
+
+/* With standard files and dirs */
+var_dump( chmod("/etc/passwd", 0777) );
+printf("%o", fileperms("/etc/passwd") );
+echo "\n";
+clearstatcache();
+
+var_dump( chmod("/etc", 0777) );
+printf("%o", fileperms("/etc") );
+echo "\n";
+clearstatcache();
+
+/* With non-existing file or dir */
+var_dump( chmod("/no/such/file/dir", 0777) );
+var_dump( fileperms("/no/such/file/dir") );
+echo "\n";
+
+/* With args less than expected */
+$fp = fopen(dirname(__FILE__)."/006_error.tmp", "w");
+fclose($fp);
+var_dump( chmod(dirname(__FILE__)."/006_error.tmp") );
+var_dump( chmod("nofile") );
+var_dump( chmod() );
+var_dump( fileperms() );
+
+/* With args greater than expected */
+var_dump( chmod(dirname(__FILE__)."/006_error.tmp", 0755, TRUE) );
+var_dump( fileperms(dirname(__FILE__)."/006_error.tmp", 0777) );
+var_dump( fileperms("nofile", 0777) );
+
+echo "\n*** Done ***\n";
+?>
+--CLEAN--
+<?php
+unlink( dirname(__FILE__)."/006_error.tmp");
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not on Windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/006_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileperms ( string $filename );
+ Description: Returns the permissions on the file, or FALSE in case of an error
+
+ Prototype: bool chmod ( string $filename, int $mode );
+ Description: Attempts to change the mode of the file specified by
+ filename to that given in mode
+*/
+
+echo "*** Testing fileperms() & chmod() : usage variations ***\n";
+
+$file_name = dirname(__FILE__)."/006_variation1.tmp";
+$file_handle = fopen($file_name, "w");
+fclose($file_handle);
+$dir_name = dirname(__FILE__)."/006_variation1";
+mkdir($dir_name);
+
+$count = 1;
+echo "-- Testing all permission from octal 0000 to octal 0777 on file and dir --\n";
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chmod($file_name, $mode) );
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+ clearstatcache();
+
+ var_dump( chmod($dir_name, $mode) );
+ printf("%o", fileperms($dir_name) );
+ echo "\n";
+ clearstatcache();
+ $count++;
+}
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+chmod(dirname(__FILE__)."/006_variation1.tmp", 0777);
+chmod(dirname(__FILE__)."/006_variation1", 0777);
+unlink(dirname(__FILE__)."/006_variation1.tmp");
+rmdir(dirname(__FILE__)."/006_variation1");
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not on Windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/006_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fileperms ( string $filename );
+ Description: Returns the permissions on the file, or FALSE in case of an error
+
+ Prototype: bool chmod ( string $filename, int $mode );
+ Description: Attempts to change the mode of the file specified by
+ filename to that given in mode
+*/
+
+/* Testing with miscellaneous Permission */
+
+echo "*** Testing fileperms() & chmod() : usage variations ***\n";
+
+$file_name = dirname(__FILE__)."/006_variation2.tmp";
+$file_handle = fopen($file_name, "w");
+fclose($file_handle);
+$dir_name = dirname(__FILE__)."/006_variation2";
+mkdir($dir_name);
+
+echo "\n*** Testing fileperms(), chmod() with miscellaneous permissions ***\n";
+$perms_array = array(
+ /* testing sticky bit */
+ 07777,
+ 00000,
+ 01000,
+ 011111,
+ /* negative values as permission */
+ -0777, // permissions will be given as 2's complement form of -0777
+ -07777, // permissions will be given as 2's complement form of -07777
+
+ /* decimal values as permission */
+ 777, // permissions will be given as octal equivalent value of 777
+ 7777, // permissions will be given as octal equivalent value of 7777
+ -7777, // permissions are given as 2's complement of octal equivalent of 7777
+
+ /* hex value as permission */
+ 0x777, // permissions will be given as ocatal equivalent value of 0x777
+ 0x7777,
+
+ /* strings notation of permission, wont work properly */
+ "r+w",
+ "r+w+x",
+ "u+rwx",
+ "u+rwx, g+rw, o+wx"
+);
+
+$count = 1;
+foreach($perms_array as $permission) {
+ echo "-- Iteration $count --\n";
+ var_dump( chmod($file_name, $permission) );
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+ clearstatcache();
+
+ var_dump( chmod($dir_name, $permission) );
+ printf("%o", fileperms($dir_name) );
+ echo "\n";
+ clearstatcache();
+ $count++;
+}
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+chmod(dirname(__FILE__)."/006_variation2.tmp", 0777);
+chmod(dirname(__FILE__)."/006_variation2", 0777);
+unlink(dirname(__FILE__)."/006_variation2.tmp");
+rmdir(dirname(__FILE__)."/006_variation2");
+?>
+--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--
+<?php
+/*
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+
+ Prototype: bool feof ( resource $handle );
+ Description: Tests for end-of-file on a file pointer
+*/
+
+echo "*** Testing basic operations of fopen() and fclose() functions ***\n";
+$modes = array(
+ "w",
+ "wb",
+ "wt",
+ "w+",
+ "w+b",
+ "w+t",
+
+ "r",
+ "rb",
+ "rt",
+ "r+",
+ "r+b",
+ "r+t",
+
+ "a",
+ "ab",
+ "at",
+ "a+",
+ "a+t",
+ "a+b"
+);
+
+for( $i=0; $i<count($modes); $i++ ) {
+ echo "\n-- Iteration with mode '$modes[$i]' --\n";
+
+ $filename = dirname(__FILE__)."/007_basic.tmp";
+ // check fopen()
+ $handle = fopen($filename, $modes[$i]);
+ var_dump($handle );
+ var_dump( ftell($handle) );
+ var_dump( feof($handle) );
+
+ // check fclose()
+ var_dump( fclose($handle) );
+ var_dump( $handle );
+ // confirm the closure, using ftell() and feof(), expect, false
+ var_dump( ftell($handle) );
+ var_dump( feof($handle) );
+}
+
+// remove the temp file
+unlink($filename);
+
+$x_modes = array(
+ "x",
+ "xb",
+ "xt",
+ "x+",
+ "x+b",
+ "x+t"
+);
+
+for( $i=0; $i<count($x_modes); $i++ ) {
+ echo "\n-- Iteration with mode '$x_modes[$i]' --\n";
+ $handle = fopen($filename, $x_modes[$i]);
+ var_dump($handle );
+ var_dump( ftell($handle) );
+ var_dump( feof($handle) );
+
+ // check fclose()
+ var_dump( fclose($handle) );
+ var_dump( $handle );
+ // confirm the closure, using ftell() and feof(), expect, false
+ var_dump( ftell($handle) );
+ var_dump( feof($handle) );
+ var_dump( $handle );
+
+ // remove the file
+ unlink( $filename );
+}
+
+echo "\n*** Done ***\n";
+--EXPECTF--
+*** Testing basic operations of fopen() and fclose() functions ***
+
+-- Iteration with mode 'w' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'wb' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'wt' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'w+' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'w+b' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'w+t' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'r' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'rb' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'rt' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'r+' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'r+b' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'r+t' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'a' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'ab' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'at' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'a+' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'a+t' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'a+b' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+-- Iteration with mode 'x' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+resource(%d) of type (Unknown)
+
+-- Iteration with mode 'xb' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+resource(%d) of type (Unknown)
+
+-- Iteration with mode 'xt' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+resource(%d) of type (Unknown)
+
+-- Iteration with mode 'x+' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+resource(%d) of type (Unknown)
+
+-- Iteration with mode 'x+b' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+resource(%d) of type (Unknown)
+
+-- Iteration with mode 'x+t' --
+resource(%d) of type (stream)
+int(0)
+bool(false)
+bool(true)
+resource(%d) of type (Unknown)
+
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: feof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+resource(%d) of type (Unknown)
+
+*** Done ***
diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt
new file mode 100644
index 0000000..a369c9d
--- /dev/null
+++ b/ext/standard/tests/file/007_error.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test fopen, fclose() & feof() functions: error conditions
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/*
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+
+ Prototype: bool feof ( resource $handle )
+ Description: Returns TRUE if the file pointer is at EOF or an error occurs
+ (including socket timeout); otherwise returns FALSE.
+*/
+
+echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n";
+/* Arguments less than minimum no.of args */
+
+// fopen ()
+var_dump(fopen(__FILE__)); // one valid argument
+var_dump(fopen()); // zero argument
+
+// fclose()
+$fp = fopen(__FILE__, "r");
+fclose($fp);
+var_dump( fclose($fp) ); // closed handle
+var_dump( fclose(__FILE__) ); // invalid handle
+var_dump( fclose() ); // zero argument
+
+//feof()
+var_dump( feof($fp) ); // closed handle
+var_dump( feof(__FILE__) ); // invalid handle
+var_dump( feof() ); //zero argument
+
+/* Arguments greater than maximum no.of ags */
+var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100));
+
+$fp = fopen(__FILE__, "r");
+var_dump( fclose($fp, "handle") );
+
+var_dump( feof($fp, "handle"));
+fclose($fp);
+
+/* test invalid arguments : non-resources */
+echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+ NULL,
+ ""
+);
+
+/* loop to test fclose with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fopen($invalid_args[$loop_counter - 1], "r") );
+ var_dump( fclose($invalid_args[$loop_counter - 1]) );
+ var_dump( feof($invalid_args[$loop_counter - 1]) );
+}
+
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "r" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 1, "bytes");
+$file = $file_path."/007_variation1.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'r' mode ***\n";
+$file_handle = fopen($file, "r"); //opening the file in "r" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial position of file pointer
+var_dump( fread($file_handle, 100) ); //Check for read operation
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; fails; expected: 0 bytes
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation1.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "r+t" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 10, "bytes");
+$file = $file_path."/007_variation10.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'r+t' mode ***\n";
+$file_handle = fopen($file, "r+t"); //opening the file in "r+t" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fread($file_handle, 100) ); //Check for read operation
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation10.tmp");
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die('skip Run only on Windows');
+?>
+--FILE--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "wt" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "wt" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "wt", "007_variation", 11, "bytes");
+$file = $file_path."/007_variation11.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'wt' mode ***\n";
+$file_handle = fopen($file, "wt"); //opening the file "wt" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "wt" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "wt") ); //Opening the existing data file again in "wt" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "wt" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "wt") ); //Opening the non-existing file in "wt" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation11.tmp");
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die('skip Do not run on Windows');
+?>
+--FILE--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "wt" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "wt" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "wt", "007_variation", 11, "bytes");
+$file = $file_path."/007_variation11.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'wt' mode ***\n";
+$file_handle = fopen($file, "wt"); //opening the file "wt" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "wt" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "wt") ); //Opening the existing data file again in "wt" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "wt" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "wt") ); //Opening the non-existing file in "wt" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation11.tmp");
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die('skip Run only on Windows');
+?>
+--FILE--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "w+t" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "w+t" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 12, "bytes");
+$file = $file_path."/007_variation12.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'w+t' mode ***\n";
+$file_handle = fopen($file, "w+t"); //opening the file "w+t" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "w+t" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "w+t") ); //Opening the existing data file again in "w+t" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "w+t" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "w+t") ); //Opening the non-existing file in "w+t" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation12.tmp");
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die('skip Do not run on Windows');
+?>
+--FILE--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "w+t" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "w+t" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 12, "bytes");
+$file = $file_path."/007_variation12.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'w+t' mode ***\n";
+$file_handle = fopen($file, "w+t"); //opening the file "w+t" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "w+t" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "w+t") ); //Opening the existing data file again in "w+t" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "w+t" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "w+t") ); //Opening the non-existing file in "w+t" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation12.tmp");
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die('skip Run only on Windows');
+?>
+--FILE--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "at" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 13, "bytes");
+$file = $file_path."/007_variation13.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'at' mode ***\n";
+$file_handle = fopen($file, "at"); //opening the file "at" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+var_dump( filesize($file) ); //Check that data hasn't over written; Expected: Size of (initial data + newly added data)
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "at") ); //Opening the non-existing file in "at" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation13.tmp");
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die('skip Do not run on Windows');
+?>
+--FILE--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "at" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 13, "bytes");
+$file = $file_path."/007_variation13.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'at' mode ***\n";
+$file_handle = fopen($file, "at"); //opening the file "at" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+var_dump( filesize($file) ); //Check that data hasn't over written; Expected: Size of (initial data + newly added data)
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "at") ); //Opening the non-existing file in "at" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation13.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "a+t" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 14, "bytes");
+$file = $file_path."/007_variation14.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'a+t' mode ***\n";
+$file_handle = fopen($file, "a+t"); //opening the file "a+t" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "a+t") ); //Opening the non-existing file in "a+t" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation14.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "xt" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the warning msg when trying to open an existing file in "xt" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$file = $file_path."/007_variation15.tmp";
+
+echo "*** Test fopen() & fclose() functions: with 'xt' mode ***\n";
+$file_handle = fopen($file, "xt"); //opening the non-existing file in "xt" mode, file will be created
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+$file_handle = fopen($file, "xt"); //Opening the existing data file in 'xt' mode to check for the warning message
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation15.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "x+t" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the warning msg when trying to open an existing file in "x+t" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$file = $file_path."/007_variation16.tmp";
+
+echo "*** Test fopen() & fclose() functions: with 'x+t' mode ***\n";
+$file_handle = fopen($file, "x+t"); //opening the non-existing file in "x+t" mode, file will be created
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of the file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+$file_handle = fopen($file, "x+t"); //Opening the existing data file in "x+t" mode to check for the warning message
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation16.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "rb" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 17, "bytes");
+$file = $file_path."/007_variation17.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'rb' mode ***\n";
+$file_handle = fopen($file, "rb"); //opening the file in "rb" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial position of file pointer
+var_dump( fread($file_handle, 100) ); //Check for read operation
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; fails; expected: 0 bytes
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation17.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "r+b" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 18, "bytes");
+$file = $file_path."/007_variation18.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'r+b' mode ***\n";
+$file_handle = fopen($file, "r+b"); //opening the file in "r+b" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fread($file_handle, 100) ); //Check for read operation
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation18.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "wb" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "wb" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "wb", "007_variation", 19, "bytes");
+$file = $file_path."/007_variation19.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'wb' mode ***\n";
+$file_handle = fopen($file, "wb"); //opening the file "wb" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "wb" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "wb") ); //Opening the existing data file again in "wb" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "wb" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "wb") ); //Opening the non-existing file in "wb" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation19.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "r+" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 2, "bytes");
+$file = $file_path."/007_variation2.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'r+' mode ***\n";
+$file_handle = fopen($file, "r+"); //opening the file in "r+" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fread($file_handle, 100) ); //Check for read operation
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation2.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "w+b" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "w+b" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 20, "bytes");
+$file = $file_path."/007_variation20.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'w+b' mode ***\n";
+$file_handle = fopen($file, "w+b"); //opening the file "w+b" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "w+b" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "w+b") ); //Opening the existing data file again in "w+b" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "w+b" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "w+b") ); //Opening the non-existing file in "w+b" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation20.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "ab" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 21, "bytes");
+$file = $file_path."/007_variation21.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'ab' mode ***\n";
+$file_handle = fopen($file, "ab"); //opening the file "ab" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+var_dump( filesize($file) ); //Check that data hasn't over written; Expected: Size of (initial data + newly added data)
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "ab") ); //Opening the non-existing file in "ab" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation21.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "a+b" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 22, "bytes");
+$file = $file_path."/007_variation22.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'a+b' mode ***\n";
+$file_handle = fopen($file, "a+b"); //opening the file "a+b" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "a+b") ); //Opening the non-existing file in "a+b" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation22.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "xb" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the warning msg when trying to open an existing file in "xb" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$file = $file_path."/007_variation23.tmp";
+
+echo "*** Test fopen() & fclose() functions: with 'xb' mode ***\n";
+$file_handle = fopen($file, "xb"); //opening the non-existing file in "xb" mode, file will be created
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+$file_handle = fopen($file, "xb"); //Opening the existing data file in 'xb' mode to check for the warning message
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation23.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "x+b" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the warning msg when trying to open an existing file in "x+b" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$file = $file_path."/007_variation24.tmp";
+
+echo "*** Test fopen() & fclose() functions: with 'x+b' mode ***\n";
+$file_handle = fopen($file, "x+b"); //opening the non-existing file in "x+b" mode, file will be created
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of the file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+$file_handle = fopen($file, "x+b"); //Opening the existing data file in "x+b" mode to check for the warning message
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation24.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "w" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "w" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 3, "bytes");
+$file = $file_path."/007_variation3.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'w' mode ***\n";
+$file_handle = fopen($file, "w"); //opening the file "w" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "w" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "w") ); //Opening the existing data file again in "w" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "w" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "w") ); //Opening the non-existing file in "w" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation3.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "w+" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the file truncation when trying to open an existing file in "w+" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 4, "bytes");
+$file = $file_path."/007_variation4.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'w+' mode ***\n";
+$file_handle = fopen($file, "w+"); //opening the file "w+" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "w+" mode again, expected: size of content
+clearstatcache();
+fclose( fopen($file, "w+") ); //Opening the existing data file again in "w+" mode
+var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "w+" mode again, expected: 0 bytes
+clearstatcache();
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "w+") ); //Opening the non-existing file in "w+" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation4.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "a" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 5, "bytes");
+$file = $file_path."/007_variation5.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'a' mode ***\n";
+$file_handle = fopen($file, "a"); //opening the file "a" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+var_dump( filesize($file) ); //Check that data hasn't over written; Expected: Size of (initial data + newly added data)
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "a") ); //Opening the non-existing file in "a" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation5.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "a+" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 6, "bytes");
+$file = $file_path."/007_variation6.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'a+' mode ***\n";
+$file_handle = fopen($file, "a+"); //opening the file "a+" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+
+unlink($file); //Deleting the file
+fclose( fopen($file, "a+") ); //Opening the non-existing file in "a+" mode, which will be created
+var_dump( file_exists($file) ); //Check for the existance of file
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation6.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "x" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the warning msg when trying to open an existing file in "x" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$file = $file_path."/007_variation7.tmp";
+
+echo "*** Test fopen() & fclose() functions: with 'x' mode ***\n";
+$file_handle = fopen($file, "x"); //opening the non-existing file in "x" mode, file will be created
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+$file_handle = fopen($file, "x"); //Opening the existing data file in 'x' mode to check for the warning message
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation7.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "x+" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ checking for the warning msg when trying to open an existing file in "x+" mode,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+$file = $file_path."/007_variation8.tmp";
+
+echo "*** Test fopen() & fclose() functions: with 'x+' mode ***\n";
+$file_handle = fopen($file, "x+"); //opening the non-existing file in "x+" mode, file will be created
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the begining of the file
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
+var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
+rewind($file_handle);
+var_dump( fread($file_handle, 100) ); //Check for read operation; passes; expected: content of the file
+var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the end of the file
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+$file_handle = fopen($file, "x+"); //Opening the existing data file in "x+" mode to check for the warning message
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation8.tmp");
+?>
+--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--
+<?php
+/*
+ fopen() function:
+ Prototype: resource fopen(string $filename, string $mode
+ [, bool $use_include_path [, resource $context]] );
+ Description: Opens file or URL.
+*/
+/*
+ fclose() function:
+ Prototype: bool fclose ( resource $handle );
+ Description: Closes an open file pointer
+*/
+
+/* Test fopen() and fclose(): Opening the file in "rt" mode,
+ checking for the file creation, write & read operations,
+ checking for the file pointer position,
+ and fclose function
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 9, "bytes");
+$file = $file_path."/007_variation9.tmp";
+$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
+
+echo "*** Test fopen() & fclose() functions: with 'rt' mode ***\n";
+$file_handle = fopen($file, "rt"); //opening the file in "rt" mode
+var_dump($file_handle); //Check for the content of handle
+var_dump( get_resource_type($file_handle) ); //Check for the type of resource
+var_dump( ftell($file_handle) ); //Initial position of file pointer
+var_dump( fread($file_handle, 100) ); //Check for read operation
+var_dump( fwrite($file_handle, $string) ); //Check for write operation; fails; expected: 0 bytes
+var_dump( fclose($file_handle) ); //Check for close operation on the file handle
+var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
+echo "*** Done ***\n";
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/007_variation9.tmp");
+?>
+--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 <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only basename tests');
+}
+?>
+--FILE--
+<?php
+/*
+ * proto string basename(string path [, string suffix])
+ * Function is implemented in ext/standard/string.c
+ */
+$file_paths = array (
+ /* simple paths */
+ array("bar"),
+ array("\\foo\\bar"),
+ array("foo\\bar"),
+ array("\\bar"),
+
+ /* simple paths with trailing slashes */
+ array("bar\\"),
+ array("\\bar\\"),
+ array("\\foo\\bar\\"),
+ array("foo\\bar\\"),
+ array("\\bar\\"),
+
+ /* paths with suffix removal */
+ array("bar.zip", ".zip"),
+ array("bar.zip", "bar.zip"),
+ array("\\foo\\bar.zip", ".zip"),
+ array("foo\\bar.zip", ".zip"),
+ array("\\bar.zip", ".zip"),
+
+ /* paths with suffix and trailing slashes with suffix removal*/
+ array("bar.zip\\", ".zip"),
+ array("\\bar.zip\\", ".zip"),
+ array("\\foo\\bar.zip\\", ".zip"),
+ array("foo\\bar.zip\\", ".zip"),
+ array("\\bar.zip\\", ".zip"),
+
+ /* paths with basename only suffix, with suffix removal*/
+ array("\\.zip", ".zip"),
+ array(".zip", ".zip"),
+ array("\\foo\\.zip", ".zip"),
+
+ /* paths with basename only suffix & trailing slashes, with suffix removal*/
+ array(".zip\\", ".zip"),
+ array("\\foo\\.zip\\", ".zip"),
+ array("foo\\.zip\\", ".zip"),
+);
+
+$file_path_variations = array (
+ /* paths with shortcut home dir char, with suffix variation */
+ array("C:\\temp\\bar"),
+ array("C:\\temp\\bar", ""),
+ array("C:\\temp\\bar", NULL),
+ array("C:\\temp\\bar", ' '),
+ array("C:\\temp\\bar.tar", ".tar"),
+ array("C:\\temp\\bar.tar", "~"),
+ array("C:\\temp\\bar.tar\\", "~"),
+ array("C:\\temp\\bar.tar\\", ""),
+ array("C:\\temp\\bar.tar", NULL),
+ array("C:\\temp\\bar.tar", ''),
+ array("C:\\temp\\bar.tar", " "),
+
+ /* paths with numeric strings */
+ array("10.5"),
+ array("10.5", ".5"),
+ array("10.5", "10.5"),
+ array("10"),
+ array("105", "5"),
+ array("/10.5"),
+ array("10.5\\"),
+ array("10/10.zip"),
+ array("0"),
+ array('0'),
+
+ /* paths and suffix given as same */
+ array("bar.zip", "bar.zip"),
+ array("\\bar.zip", "\\bar.zip"),
+ array("\\bar.zip\\", "\\bar.zip\\"),
+ array(" ", " "),
+ array(' ', ' '),
+ array(NULL, NULL),
+
+ /* path with spaces */
+ array(" "),
+ array(' '),
+
+ /* empty paths */
+ array(""),
+ array(''),
+ array(NULL)
+);
+
+function check_basename( $path_arrays ) {
+ $loop_counter = 1;
+ foreach ($path_arrays as $path) {
+ echo "\n--Iteration $loop_counter--\n"; $loop_counter++;
+ if( 1 == count($path) ) { // no suffix provided
+ var_dump( basename($path[0]) );
+ } else { // path as well as suffix provided,
+ var_dump( basename($path[0], $path[1]) );
+ }
+ }
+}
+
+echo "*** Testing basic operations ***\n";
+check_basename( $file_paths );
+
+echo "\n*** Testing possible variations in path and suffix ***\n";
+check_basename( $file_path_variations );
+
+echo "\n*** Testing error conditions ***\n";
+// zero arguments
+var_dump( basename() );
+
+// more than expected no. of arguments
+var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") );
+
+// passing invalid type arguments
+$object = new stdclass;
+var_dump( basename( array("string\\bar") ) );
+var_dump( basename( array("string\\bar"), "bar" ) );
+var_dump( basename( "bar", array("string\\bar") ) );
+var_dump( basename( $object, "bar" ) );
+var_dump( basename( $object ) );
+var_dump( basename( $object, $object ) );
+var_dump( basename( "bar", $object ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing 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
--- /dev/null
+++ b/ext/standard/tests/file/basename.phpt
Binary files 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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only basename tests');
+}
+?>
+--FILE--
+<?php
+
+$file_paths = array (
+ /* simple paths (forward slashes) */
+ "bar",
+ "/foo/bar",
+ "foo/bar",
+ "/bar",
+
+ /* simple paths with trailing slashes (forward slashes) */
+ "bar/",
+ "/bar/",
+ "/foo/bar/",
+ "foo/bar/",
+ "/bar/",
+
+ /* simple paths (backslashes) */
+ "bar",
+ "\\foo\\bar",
+ "foo\\bar",
+ "\\bar",
+
+ /* simple paths with trailing slashes (backslashes) */
+ "bar\\",
+ "\\bar\\",
+ "\\foo\\bar\\",
+ "foo\\bar\\",
+ "\\bar\\",
+
+ /* paths with numeric strings */
+ "10.5\\10.5",
+ "10.5/10.5",
+ "10.5",
+ "105",
+ "/10.5",
+ "\\10.5",
+ "10.5/",
+ "10.5\\",
+ "10/10.zip",
+ "0",
+ '0',
+
+ /* path with spaces */
+ " ",
+ ' ',
+
+ /* empty paths */
+ "",
+ '',
+ NULL,
+);
+
+foreach ($file_paths as $file_path) {
+ var_dump(basename($file_path));
+}
+
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+$file_paths = array (
+ /* simple paths (forward slashes) */
+ "bar",
+ "/foo/bar",
+ "foo/bar",
+ "/bar",
+
+ /* simple paths with trailing slashes (forward slashes) */
+ "bar/",
+ "/bar/",
+ "/foo/bar/",
+ "foo/bar/",
+ "/bar/",
+
+ /* simple paths (backslashes) */
+ "bar",
+ "\\foo\\bar",
+ "foo\\bar",
+ "\\bar",
+
+ /* simple paths with trailing slashes (backslashes) */
+ "bar\\",
+ "\\bar\\",
+ "\\foo\\bar\\",
+ "foo\\bar\\",
+ "\\bar\\",
+
+ /* paths with numeric strings */
+ "10.5\\10.5",
+ "10.5/10.5",
+ "10.5",
+ "105",
+ "/10.5",
+ "\\10.5",
+ "10.5/",
+ "10.5\\",
+ "10/10.zip",
+ "0",
+ '0',
+
+ /* path with spaces */
+ " ",
+ ' ',
+
+ /* empty paths */
+ "",
+ '',
+ NULL,
+);
+
+foreach ($file_paths as $file_path) {
+ var_dump(basename($file_path));
+}
+
+?>
+--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--
+<?php
+/* Prototype : string basename(string path [, string suffix])
+ * Description: Returns the filename component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing basename() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing basename() function with Zero arguments --\n";
+var_dump( basename() );
+
+//Test basename with one more than the expected number of arguments
+echo "\n-- Testing basename() function with more than expected no. of arguments --\n";
+$path = 'string_val';
+$suffix = 'string_val';
+$extra_arg = 10;
+var_dump( basename($path, $suffix, $extra_arg) );
+
+?>
+===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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only basename tests');
+}
+?>
+--FILE--
+<?php
+
+$prefixes = array (
+
+ // drive letters
+ "A:/",
+ "Z:/",
+ "A:\\",
+
+ // other prefixes
+ "http://",
+ "blah://",
+ "blah:\\",
+ "hostname:",
+
+ // home directory ~
+ "~/",
+ "~\\",
+);
+
+$paths = array (
+
+ "foo",
+ "foo/",
+ "foo\\",
+ "foo.bar",
+ "foo.bar/",
+ "foo.bar\\",
+ "dir/foo.bar",
+ "dir\\foo.bar",
+ "dir with spaces/foo.bar",
+ "dir with spaces\\foo.bar",
+
+);
+
+foreach ($prefixes as $prefix) {
+ foreach ($paths as $path) {
+ $input = $prefix . $path;
+ echo "basename for path $input is:\n";
+ var_dump(basename($input));
+ }
+}
+
+echo "\ndone\n";
+
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+$prefixes = array (
+
+ // drive letters
+ "A:/",
+ "Z:/",
+ "A:\\",
+
+ // other prefixes
+ "http://",
+ "blah://",
+ "blah:\\",
+ "hostname:",
+
+ // home directory ~
+ "~/",
+ "~\\",
+);
+
+$paths = array (
+
+ "foo",
+ "foo/",
+ "foo\\",
+ "foo.bar",
+ "foo.bar/",
+ "foo.bar\\",
+ "dir/foo.bar",
+ "dir\\foo.bar",
+ "dir with spaces/foo.bar",
+ "dir with spaces\\foo.bar",
+
+);
+
+foreach ($prefixes as $prefix) {
+ foreach ($paths as $path) {
+ $input = $prefix . $path;
+ echo "basename for path $input is:\n";
+ var_dump(basename($input));
+ }
+}
+
+echo "\ndone\n";
+
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only basename tests');
+}
+?>
+--FILE--
+<?php
+
+$paths = array (
+
+ "foo",
+ "foo/",
+ "foo\\",
+ "foo.bar",
+ "foo.bar/",
+ "foo.bar\\",
+ "dir/foo.bar",
+ "dir\\foo.bar",
+ "dir with spaces/foo.bar",
+ "dir with spaces\\foo.bar",
+
+);
+
+$suffixes = array (
+
+ ".bar",
+ ".b",
+ ".",
+ " ",
+ "foo",
+ "foo.bar",
+ "foo/bar",
+ "foo\\bar",
+ "/",
+ "\\",
+);
+
+foreach ($paths as $path) {
+ foreach ($suffixes as $suffix) {
+ echo "basename for path $path, supplying suffix $suffix is:\n";
+ var_dump(basename($path, $suffix));
+ }
+}
+
+echo "\ndone\n";
+
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+$paths = array (
+
+ "foo",
+ "foo/",
+ "foo\\",
+ "foo.bar",
+ "foo.bar/",
+ "foo.bar\\",
+ "dir/foo.bar",
+ "dir\\foo.bar",
+ "dir with spaces/foo.bar",
+ "dir with spaces\\foo.bar",
+
+);
+
+$suffixes = array (
+
+ ".bar",
+ ".b",
+ ".",
+ " ",
+ "foo",
+ "foo.bar",
+ "foo/bar",
+ "foo\\bar",
+ "/",
+ "\\",
+);
+
+foreach ($paths as $path) {
+ foreach ($suffixes as $suffix) {
+ echo "basename for path $path, supplying suffix $suffix is:\n";
+ var_dump(basename($path, $suffix));
+ }
+}
+
+echo "\ndone\n";
+
+?>
+--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--
+<?php
+/* Prototype : string basename(string path [, string suffix])
+ * Description: Returns the filename component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing basename() : usage variation ***\n";
+
+// 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');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : string basename(string path [, string suffix])
+ * Description: Returns the filename component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing basename() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted
+$path = 'path';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+$fp = fopen(dirname(__FILE__)."/test.csv", "r");
+while($line = fgetcsv($fp, 24)) {
+ $line = str_replace("\x0d\x0a", "\x0a", $line);
+ var_dump($line);
+}
+fclose($fp);
+?>
+--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--
+<?php
+$f = fopen(__FILE__, "r");
+$dummy = var_export(stream_get_meta_data($f), TRUE);
+echo "I'm alive!\n";
+?>
+--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--
+<?php
+$fp = fopen(dirname(__FILE__)."/test2.csv", "r");
+while(($line = fgetcsv($fp, 1024))) {
+ var_dump($line);
+}
+fclose($fp);
+?>
+--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--
+<?php
+
+ $php = getenv('TEST_PHP_EXECUTABLE');
+ $tmpfile = tempnam(__DIR__, 'phpt');
+ $args = ' -n ';
+
+ /* Regular Data Test */
+ passthru($php . $args . ' -r " echo \"HELLO\"; "');
+
+ echo "\n";
+
+ /* Binary Data Test */
+
+ if (substr(PHP_OS, 0, 3) != 'WIN') {
+ $cmd = $php . $args . ' -r \"readfile(@getenv(\'TEST_PHP_EXECUTABLE\')); \"';
+ $cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip "/dev" is not available');
+}
+?>
+--INI--
+open_basedir=/dev
+--FILE--
+<?php
+ var_dump(file_exists("/dev/bogus_file_no_such_thing"));
+?>
+--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--
+<?php
+if (!function_exists("glob")) {
+ die('skip glob() not available');
+}
+?>
+--FILE--
+<?php
+$globdirs = glob("*", GLOB_ONLYDIR);
+
+$dirs = array();
+$dh = opendir(".");
+while (is_string($file = readdir($dh))) {
+ if ($file[0] === ".") continue;
+ if (!is_dir($file)) continue;
+ $dirs[] = $file;
+}
+closedir($dh);
+
+if (count($dirs) != count($globdirs)) {
+ echo "Directory count mismatch\n";
+
+ echo "glob found:\n";
+ sort($globdirs);
+ var_dump($globdirs);
+
+ echo "opendir/readdir/isdir found:\n";
+ sort($dirs);
+ var_dump($dirs);
+} else {
+ echo "OK\n";
+}
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/file/bug26003.phpt
Binary files 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--
+<?php
+$out = array();
+$status = -1;
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
+} else {
+ exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status);
+}
+print_r($out);
+?>
+--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--
+<?php
+$out = array();
+$status = -1;
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ exec($php . ' -n -r \''
+ . '$lengths = array(10,20000,10000,5,10000,3);'
+ . 'foreach($lengths as $length) {'
+ . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
+ . ' print "\n";'
+ . '}\'', $out, $status);
+} else {
+ exec($php . ' -n -r "'
+ . '$lengths = array(10,20000,10000,5,10000,3);'
+ . 'foreach($lengths as $length) {'
+ . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
+ . ' print \\"\\n\\";'
+ . '}"', $out, $status);
+}
+for ($i=0;$i<6;$i++)
+ print "md5(line $i)= " . md5($out[$i]) . " (length " .
+strlen($out[$i]) . ")\n";
+?>
+--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--
+<?php # vim:ft=php
+class FileStream {
+ public $fp;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = urldecode(substr($path, 9));
+ $this->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--
+<?php
+ $fp = tmpfile();
+ fwrite($fp, "this is a lowercase string.\n");
+ rewind($fp);
+
+ /* Echo out the first four bytes 'this' without applying filter
+ Remainder will get sucked into the read buffer though. */
+ echo fread($fp, 4);
+
+ stream_filter_append($fp, "string.toupper");
+
+ fpassthru($fp);
+?>
+--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--
+<?php
+
+$resource = fopen(dirname(__FILE__).'/bug30362.txt', 'rb');
+
+for ($i = 0; ($i < 10) && !feof($resource); ++$i ) {
+ $a = "Y";
+ $line = stream_get_line($resource, 50, $a);
+ echo $line . "\n";
+}
+fclose($resource);
+
+?>
+--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--
+<?php
+$path = dirname(__FILE__) . "/bug32160.txt";
+var_dump(copy($path, $path));
+chdir(dirname(__FILE__));
+var_dump(copy($path, "bug32160.txt"));
+var_dump(copy("bug32160.txt", "bug32160.txt"));
+?>
+--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--
+<?php
+
+include (dirname(__FILE__));
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+$filename = dirname(__FILE__)."/bug35781.txt";
+
+$fp = fopen($filename, "w");
+stream_filter_append($fp, "string.rot13", -49);
+fwrite($fp, "This is a test\n");
+rewind($fp);
+fpassthru($fp);
+fclose($fp);
+
+var_dump(file_get_contents($filename));
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+class VariableStream {
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ return true;
+ }
+}
+
+stream_wrapper_register("var", "VariableStream");
+
+error_reporting(E_ALL | E_STRICT);
+$file = dirname(__FILE__) . '/footest.txt';
+$x = str_repeat(1, 8192);
+$fp = fopen($file, 'w');
+for ($i = 0; $i < 5; $i++) {
+ fwrite($fp, $x);
+}
+fclose($fp);
+
+$fp = fopen($file, 'r');
+$outsidecontents = fread($fp, 20000);
+fclose($fp);
+var_dump('size of contents 1 = ' . strlen($outsidecontents));
+$outsidecontents = file_get_contents($file);
+var_dump('size of contents 2 = ' . strlen($outsidecontents));
+
+unlink($file);
+
+echo "Done\n";
+?>
+--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--
+<?php
+ $tmpfname = tempnam(sys_get_temp_dir(), "emptyfile");
+ var_dump(file_get_contents($tmpfname));
+ echo "done.\n";
+ unlink($tmpfname);
+?>
+--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--
+<?php
+define('WIN', substr(PHP_OS, 0, 3) == 'WIN');
+
+$initial_file = dirname(__FILE__).'/bug38086.txt';
+$new_file = dirname(__FILE__).'/bug38086_1.txt';
+
+$src = fopen($initial_file, 'r');
+stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+$src = fopen($initial_file, 'r');
+stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest, 10000));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+class VariableStream {
+ var $position;
+ var $varname;
+
+ function VariableStream($var) {
+ var_dump("constructor!");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->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--
+<?php
+
+class VariableStream {
+ var $position;
+ var $varname;
+
+ function __construct($var) {
+ var_dump("constructor!");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->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--
+<?php
+
+class VariableStream {
+ var $position;
+ var $varname;
+
+ function __construct($var) {
+ throw new Exception("constructor");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->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--
+<?php
+
+class VariableStream {
+ var $position;
+ var $varname;
+
+ function __construct(array $var) {
+ var_dump("constructor!");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+function test() {
+ unlink('/tmp/1link');
+ unlink('/tmp/1tmp');
+ unlink('/tmp/testfile1');
+
+ file_put_contents('/tmp/testfile1', 'ok');
+ symlink('/tmp/testfile1', '/tmp/1tmp');
+ rename('/tmp/1tmp', '/tmp/1link');
+ echo file_get_contents('/tmp/1link')."\n";
+
+ unlink('/tmp/1link');
+ clearstatcache(true);
+
+ echo file_get_contents('/tmp/1link')."\n";
+
+ unlink('/tmp/1link');
+ unlink('/tmp/1tmp');
+ unlink('/tmp/testfile1');
+}
+@test();
+?>
+--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--
+<?php
+$content = array("\"\nthis is an test\", \"next data\", \"p\narsed\"","\"\r\nthis is an test\", \"next data\", \"p\r\narsed\"","\"\n\rthis is an test\", \"next data\", \"p\n\rarsed\"");
+
+$file = dirname(__FILE__) . "/bug39538.csv";
+@unlink($file);
+foreach ($content as $v) {
+ file_put_contents($file, $v);
+ print_r (fgetcsv(fopen($file, "r"), filesize($file)));
+}
+@unlink($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--
+<?php
+
+$bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
+
+class bucketFilter {
+ public function filter($in, $out, &$consumed, $closing ){
+
+ $bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
+ stream_bucket_append($out, $bucket);
+ return PSFS_PASS_ON;
+ }
+}
+
+stream_filter_register('bucketfault', 'bucketFilter');
+stream_filter_append($s = fopen('php://temp', 'r+'), 'bucketfault');
+stream_get_contents($s);
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+$str = str_repeat("test", 3456);
+
+$filename = dirname(__FILE__).'/bug39673.txt';
+file_put_contents($filename, $str);
+
+$offsets = array(
+ -1,
+ 0,
+ 3456*4,
+ 3456*4 - 1,
+ 3456*4 + 1,
+ 2000,
+ 5000,
+ 100000,
+);
+
+
+foreach ($offsets as $offset) {
+ $r = file_get_contents($filename, false, null, $offset);
+ var_dump(strlen($r));
+}
+
+@unlink($filename);
+echo "Done\n";
+?>
+--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--
+<?php
+
+$filename = __FILE__ . chr(0). ".ridiculous";
+
+if (file_exists($filename)) {
+ echo "FAIL\n";
+}
+else {
+ echo "PASS\n";
+}
+?>
+===DONE===
+<?php exit(0); ?>
+--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--
+<?php
+
+$file = tempnam(sys_get_temp_dir(), "test_");
+var_dump($file);
+$fp = fopen($file, "wt");
+fwrite($fp, "test");
+fclose($fp);
+unlink($file);
+
+echo "Done\n";
+?>
+--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--
+<?php
+$file = dirname(__FILE__).'/bug40501.csv';
+
+$h = fopen($file, 'r');
+$data = fgetcsv($h, NULL, ',', '"', '"');
+fclose($h);
+
+var_dump($data);
+?>
+--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 <d_kelsey@uk.ibm.com>
+--INI--
+open_basedir=/tmp
+--FILE--
+<?php
+$a=glob("./*.jpeg");
+var_dump($a);
+echo "Done\n";
+?>
+--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--
+<?php
+ $dir = dirname(__FILE__);
+ $a=glob($dir . "/test.*");
+ print_r($a);
+?>
+--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--
+<?php
+
+var_dump(scandir(''));
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+$filename = dirname(__FILE__)."/concur_rw.txt";
+
+@unlink($filename);
+$writer = fopen($filename, "wt");
+$reader = fopen($filename, "r");
+fread($reader, 1);
+fwrite($writer, "foo");
+
+if (strlen(fread($reader, 10)) > 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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test');
+?>
+--FILE--
+<?php
+$result = exec('cd 1:\non_existant; dir nonexistant');
+echo "$result";
+system('cd 1:\non_existant; dir nonexistant');
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+popen("1:\\non_existent", "r");
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+$result = exec('cd 1:\\non_existant; dir nonexistant');
+echo "$result";
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+system('cd 1:\\non_existant; dir nonexistant');
+?>
+--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--
+<?php
+if (!extension_loaded("iconv")) die("skip iconv extension not available");
+?>
+--FILE--
+<?php
+$url = b""
+ . b"php://filter/read="
+ . urlencode(b"convert.iconv.ISO-8859-15/UTF-8")
+ . b'|' . urlencode(b"string.rot13")
+ . b'|' . urlencode(b"string.rot13")
+ . b'|' . urlencode(b"convert.iconv.UTF-8/ISO-8859-15")
+ . b"/resource=data://text/plain,foob%E2r";
+var_dump(urlencode(file_get_contents($url)));
+?>
+--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--
+<?php
+ $toname = "TO_" . md5(microtime());
+ $dirname = "FROM_" . md5(microtime());
+
+ mkdir($dirname);
+ var_dump(is_dir($dirname)); // Expected: true
+ rename($dirname, $toname);
+ var_dump(is_dir($dirname)); // Expected: false
+ var_dump(is_dir($toname)); // Expected: true
+ rmdir($toname);
+ var_dump(is_dir($toname)); // Expected: false
+?>
+--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--
+<?php
+var_dump(stream_is_local("file://"));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/file/bug43248.phpt b/ext/standard/tests/file/bug43248.phpt
new file mode 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--
+<?php
+echo realpath(dirname(__FILE__) . '/../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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+var_dump(is_dir('file:///datafoo:test'));
+var_dump(is_dir('datafoo:test'));
+var_dump(file_get_contents('data:text/plain,foo'));
+var_dump(file_get_contents('datafoo:text/plain,foo'));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+string(3) "foo"
+
+Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: 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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip on Windows");
+?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+var_dump(is_dir('file:///datafoo:test'));
+var_dump(is_dir('datafoo:test'));
+var_dump(file_get_contents('data:text/plain,foo'));
+var_dump(file_get_contents('datafoo:text/plain,foo'));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+string(3) "foo"
+
+Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
+bool(false)
diff --git a/ext/standard/tests/file/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--
+<?php // 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
+
+$fp = fopen(__FILE__, 'r'); // Open self
+
+DoTest($fp, 'ZZZ'); // test multi-char delimiter
+DoTest($fp, "Z"); // test single-char delimiter
+
+function DoTest($fp, $delim) {
+ echo "Delimiter: " . $delim . "\n";
+ rewind($fp);
+ echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
+ echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
+}
+
+?>
+--EXPECT--
+Delimiter: ZZZ
+ <?php // 1
+ 234567890A
+Delimiter: Z
+ <?php // 1
+ 234567890A
diff --git a/ext/standard/tests/file/bug44034.phpt b/ext/standard/tests/file/bug44034.phpt
new file mode 100644
index 0000000..36d88a9
--- /dev/null
+++ b/ext/standard/tests/file/bug44034.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Bug #44034
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$urls = array();
+$urls[] = "data://text/plain,foo\r\nbar\r\n";
+$urls[] = "data://text/plain,\r\nfoo\r\nbar\r\n";
+$urls[] = "data://text/plain,foo\r\nbar";
+
+foreach($urls as $url) {
+ echo strtr($url, array("\r" => "\\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--
+<?php
+$eol = '<EOL>';
+$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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+$dirname = dirname(__FILE__);
+$file1 = $dirname . DIRECTORY_SEPARATOR . "file1.txt";
+$file2 = $dirname . DIRECTORY_SEPARATOR . "file2.txt";
+
+file_put_contents($file1, "this is file 1");
+file_put_contents($file2, "this is file 2");
+
+rename($file1, $file2);
+
+echo "reading file 2: ";
+readfile($file2);
+if (file_exists($file1)) {
+ unlink($file1);
+}
+if (file_exists($file1)) {
+ unlink($file2);
+}
+?>
+--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--
+<?php
+mkdir("bug45181_x");
+var_dump(is_dir("bug45181_x"));
+chdir("bug45181_x");
+var_dump(is_dir("bug45181_x"));
+?>
+--CLEAN--
+<?php
+rmdir("bug45181_x");
+?>
+--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--
+<?php
+$fd = fopen("php://stdout","a");
+var_dump($fd);
+var_dump(fseek($fd, 1024*1024, SEEK_SET));
+?>
+--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--
+<?php
+$file = __DIR__ . '/' . '__tmp_35740.dat';
+file_put_contents($file, 'test');
+$f = fopen($file, 'r');
+touch($file);
+fclose($f);
+@unlink($file);
+echo "ok";
+?>
+--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--
+<?php
+
+$str = <<< EOF
+[section]
+part1.*.part2 = 1
+EOF;
+
+$file = __DIR__ . '/parse.ini';
+file_put_contents($file, $str);
+
+var_dump(parse_ini_file($file));
+?>
+--CLEAN--
+<?php
+unlink(__DIR__.'/parse.ini');
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+if(PHP_WINDOWS_VERSION_MAJOR < 6) {
+ die('skip windows version 6.0+ only test');
+}
+
+$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out);
+if (strpos($ret, 'privilege')) {
+ die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
+}
+?>
+--FILE--
+<?php
+echo "Testing include_once using file symbolic link\n";
+$filename = __DIR__ . '\\a.php';
+$content = '<?php echo "I am included\n" ?>';
+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--
+<?php
+// fopen with interesting windows paths.
+$testdir = __DIR__ . '/bug47177.tmpdir';
+mkdir($testdir);
+$t = time() - 3600;
+touch($testdir, $t);
+clearstatcache();
+$t2 = filemtime($testdir);
+if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
+rmdir($testdir);
+echo "Ok.";
+?>
+--EXPECTF--
+Ok.
diff --git a/ext/standard/tests/file/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--
+<?php
+
+$ini = parse_ini_string('ini="ini;raw"', null, INI_SCANNER_RAW);
+var_dump($ini['ini']);
+$ini = parse_ini_string('ini="ini;raw', null, INI_SCANNER_RAW);
+var_dump($ini['ini']);
+$ini = parse_ini_string('ini=ini;raw', null, INI_SCANNER_RAW);
+var_dump($ini['ini']);
+$ini = parse_ini_string('ini=ini"raw', null, INI_SCANNER_RAW);
+var_dump($ini['ini']);
+$ini = parse_ini_string("ini=\r\niniraw", null, INI_SCANNER_RAW);
+var_dump($ini['ini']);
+--EXPECTF--
+string(7) "ini;raw"
+string(4) ""ini"
+string(3) "ini"
+string(7) "ini"raw"
+string(0) ""
+
diff --git a/ext/standard/tests/file/bug52624.phpt b/ext/standard/tests/file/bug52624.phpt
new file mode 100644
index 0000000..ee61eb9
--- /dev/null
+++ b/ext/standard/tests/file/bug52624.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #52624 (tempnam() by-pass open_basedir with inexistent directory)
+--INI--
+open_basedir=.
+--FILE--
+<?php
+
+echo tempnam("directory_that_not_exists", "prefix_");
+
+?>
+--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--
+<?php
+if (!function_exists('leak_variable'))
+ die("skip only for debug builds");
+/* unfortunately no standard function does a cast to FILE*, so we need
+ * curl to test this */
+if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+$handle=curl_init('http://127.0.0.1:37349/');
+curl_setopt($handle, CURLOPT_VERBOSE, true);
+curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
+if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
+ die("skip fopencookie not supported on this platform");
+--FILE--
+<?php
+function do_stuff($url) {
+ $handle=curl_init('http://127.0.0.1:37349/');
+ curl_setopt($handle, CURLOPT_VERBOSE, true);
+ curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($handle, CURLOPT_STDERR, $o = fopen($url, "w+"));
+ curl_exec($handle);
+ echo "About to rewind!\n";
+ rewind($o);
+ echo stream_get_contents($o);
+ return $o;
+}
+
+echo "temp stream (close after):\n";
+fclose(do_stuff("php://temp"));
+
+echo "\nmemory stream (close after):\n";
+fclose(do_stuff("php://memory"));
+
+echo "\ntemp stream (leak):\n";
+leak_variable(do_stuff("php://temp"), true);
+
+echo "\nmemory stream (leak):\n";
+leak_variable(do_stuff("php://memory"), true);
+
+echo "\nDone.\n";
+--EXPECTF--
+temp stream (close after):
+About to rewind!
+* About to connect() to 127.0.0.1 port 37349%r.*%r
+* Trying 127.0.0.1...%A* Connection refused
+* couldn't connect to host%S
+* Closing connection #0
+
+memory stream (close after):
+About to rewind!
+* About to connect() to 127.0.0.1 port 37349%r.*%r
+* Trying 127.0.0.1...%A* Connection refused
+* couldn't connect to host%S
+* Closing connection #0
+
+temp stream (leak):
+About to rewind!
+* About to connect() to 127.0.0.1 port 37349%r.*%r
+* Trying 127.0.0.1...%A* Connection refused
+* couldn't connect to host%S
+* Closing connection #0
+
+memory stream (leak):
+About to rewind!
+* About to connect() to 127.0.0.1 port 37349%r.*%r
+* Trying 127.0.0.1...%A* Connection refused
+* couldn't connect to host%S
+* Closing connection #0
+
+Done.
diff --git a/ext/standard/tests/file/bug53241.phpt b/ext/standard/tests/file/bug53241.phpt
new file mode 100644
index 0000000..685bf14
--- /dev/null
+++ b/ext/standard/tests/file/bug53241.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #53241 (stream casting that relies on fdopen/fopencookie fails with 'xb' mode)
+--SKIPIF--
+<?php
+/* unfortunately no standard function does a cast to FILE*, so we need
+ * curl to test this */
+if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+--FILE--
+<?php
+$fn = __DIR__ . "/test.tmp";
+@unlink($fn);
+$fh = fopen($fn, 'xb');
+$ch = curl_init('http://www.yahoo.com/');
+var_dump(curl_setopt($ch, CURLOPT_FILE, $fh));
+echo "Done.\n";
+--CLEAN--
+<?php
+$fn = __DIR__ . "/test.tmp";
+@unlink($fn);
+?>
+--EXPECT--
+bool(true)
+Done.
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--
+<?php
+$file = dirname(__FILE__) . "/bug39538.csv";
+@unlink($file);
+file_put_contents($file, "a,b\n c, d");
+$fp = fopen($file, "r");
+while ($l = fgetcsv($fp)) var_dump($l);
+fclose($fp);
+@unlink($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--
+<?php
+$old_dir_path = getcwd();
+chdir(__DIR__);
+mkdir('a/./b', 0755, true);
+if (is_dir('a/b')) {
+ rmdir('a/b');
+}
+if (is_dir('./a')) {
+ rmdir('a');
+}
+chdir($old_dir_path);
+echo "OK";
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt
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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 1024 * 16) . '!';
+$stdin = str_repeat('*', 2049 );
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+echo "OK.";
+?>
+--EXPECT--
+OK.
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--
+<?php
+$tmp_empty_file = __FILE__ . ".tmp";
+file_put_contents($tmp_empty_file, "");
+
+var_dump(file_get_contents($tmp_empty_file, NULL, NULL, NULL, 10));
+unlink($tmp_empty_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--
+<?php
+
+$array = parse_ini_string('
+ int = 123
+ constant = INSTALL_ROOT
+ quotedString = "string"
+ a = INSTALL_ROOT "waa"
+ b = "INSTALL_ROOT"
+ c = "waa" INSTALL_ROOT
+ d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW);
+
+var_dump($array);
+--EXPECTF--
+array(7) {
+ ["int"]=>
+ 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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip, not supported on Windows");
+?>
+--FILE--
+<?php
+chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL);
+echo "ALIVE\n";
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only chmod test');
+}
+?>
+--FILE--
+<?php
+
+define("PERMISSIONS_MASK", 0777);
+
+$filename = __FILE__ . ".tmp";
+
+$fd = fopen($filename, "w+");
+fclose($fd);
+
+for ($perms_to_set = 0777; $perms_to_set >= 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+define("MODE_MASK", 07777);
+
+$filename = __FILE__ . ".tmp";
+
+$fd = fopen($filename, "w+");
+fclose($fd);
+
+for ($perms_to_set = 07777; $perms_to_set >= 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--
+<?php
+/* Prototype : bool chmod(string filename, int mode)
+ * Description: Change file mode
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing chmod() : error conditions ***\n";
+
+
+//Test chmod with one more than the expected number of arguments
+echo "\n-- Testing chmod() function with more than expected no. of arguments --\n";
+$filename = 'string_val';
+$mode = 10;
+$extra_arg = 10;
+var_dump( chmod($filename, $mode, $extra_arg) );
+
+// Testing chmod with one less than the expected number of arguments
+echo "\n-- Testing chmod() function with less than expected no. of arguments --\n";
+$filename = 'string_val';
+var_dump( chmod($filename) );
+
+// testing chmod with a non-existing file
+$filename = "___nonExisitingFile___";
+var_dump(chmod($filename, 0777));
+
+?>
+===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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+define("PERMISSIONS_MASK", 0777);
+
+$dirname = dirname(__FILE__) . "/" . basename(__FILE__, ".php") . "testdir";
+mkdir($dirname);
+
+for ($perms_to_set = 0777; $perms_to_set >= 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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only chmod test');
+}
+?>
+--FILE--
+<?php
+
+define("PERMISSIONS_MASK", 0777);
+
+$script_directory = dirname(__FILE__);
+chdir($script_directory);
+$test_dirname = basename(__FILE__, ".php") . "testdir";
+mkdir($test_dirname);
+
+$filepath = __FILE__ . ".tmp";
+$filename = basename($filepath);
+$fd = fopen($filepath, "w+");
+fclose($fd);
+
+echo "chmod() on a path containing .. and .\n";
+var_dump(chmod("./$test_dirname/../$filename", 0777));
+var_dump(chmod("./$test_dirname/../$filename", 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+
+echo "\nchmod() on a path containing .. with invalid directories\n";
+var_dump(chmod($filepath, 0777));
+var_dump(chmod("./$test_dirname/bad_dir/../../$filename", 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+
+echo "\nchmod() on a relative path from a different working directory\n";
+chdir($test_dirname);
+var_dump(chmod("../$filename", 0777));
+var_dump(chmod("../$filename", 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+chdir($script_directory);
+
+echo "\nchmod() on a directory with a trailing /\n";
+var_dump(chmod($test_dirname, 0777));
+var_dump(chmod("$test_dirname/", 0775));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+
+chdir($script_directory);
+rmdir($test_dirname);
+unlink($filepath);
+
+?>
+--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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+define("PERMISSIONS_MASK", 0777);
+
+$script_directory = dirname(__FILE__);
+chdir($script_directory);
+$test_dirname = basename(__FILE__, ".php") . "testdir";
+mkdir($test_dirname);
+
+$filepath = __FILE__ . ".tmp";
+$filename = basename($filepath);
+$fd = fopen($filepath, "w+");
+fclose($fd);
+
+echo "chmod() on a path containing .. and .\n";
+var_dump(chmod("./$test_dirname/../$filename", 0777));
+var_dump(chmod("./$test_dirname/../$filename", 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+
+echo "\nchmod() on a path containing .. with invalid directories\n";
+var_dump(chmod($filepath, 0777));
+var_dump(chmod("./$test_dirname/bad_dir/../../$filename", 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+
+echo "\nchmod() on a linked file\n";
+$linkname = "somelink";
+var_dump(symlink($filepath, $linkname));
+var_dump(chmod($filepath, 0777));
+var_dump(chmod($linkname, 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+var_dump(unlink($linkname));
+
+echo "\nchmod() on a relative path from a different working directory\n";
+chdir($test_dirname);
+var_dump(chmod("../$filename", 0777));
+var_dump(chmod("../$filename", 0755));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+chdir($script_directory);
+
+echo "\nchmod() on a directory with a trailing /\n";
+var_dump(chmod($test_dirname, 0777));
+var_dump(chmod("$test_dirname/", 0775));
+clearstatcache();
+printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK);
+
+chdir($script_directory);
+rmdir($test_dirname);
+unlink($filepath);
+
+?>
+--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--
+<?php
+/* Prototype : bool chmod(string filename, int mode)
+ * Description: Change file mode
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing chmod() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$mode = 0777;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+/* Prototype : bool chmod(string filename, int mode)
+ * Description: Change file mode
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing chmod() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted
+$filename = __FILE__ . ".tmp";
+$fd = fopen($filename, "w+");
+fclose($fd);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip, not supported on Windows");
+?>
+--FILE--
+<?php
+chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL);
+echo "ALIVE\n";
+?>
+--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--
+<?php
+chdir("/");
+if (!@mkdir("testtmpskipifdir")) {
+ die("skip for root only");
+}
+rmdir("testtmpskipifdir");
+if (!function_exists("chroot")) {
+ die("skip chroot() not available");
+}
+?>
+--FILE--
+<?php
+mkdir("chroot_001_x");
+var_dump(is_dir("chroot_001_x"));
+var_dump(chroot("chroot_001_x"));
+var_dump(is_dir("chroot_001_x"));
+var_dump(realpath("."));
+?>
+--CLEAN--
+<?php
+rmdir("chroot_001_x");
+?>
+--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--
+<?php
+if (strncmp(PHP_OS, "WIN", 3) === 0) {
+ die('skip not for Windows');
+}
+?>
+--FILE--
+<?php
+
+@rmdir(__FILE__ . "_dir1");
+@rmdir(__FILE__ . "_dir2");
+@unlink(__FILE__ . "_link1");
+@unlink(__FILE__ . "_link2");
+
+mkdir(__FILE__ . "_dir1");
+mkdir(__FILE__ . "_dir2");
+symlink(__FILE__ . "_link1", __FILE__ . "_link2");
+symlink(__FILE__ . "_dir1", __FILE__ . "_link1");
+
+var_dump(realpath(__FILE__ . "_link2"));
+passthru("rm -f " . escapeshellarg(__FILE__ . "_link1"));
+var_dump(realpath(__FILE__ . "_link2"));
+clearstatcache(false);
+var_dump(realpath(__FILE__ . "_link2"));
+clearstatcache(true, "/foo/bar");
+var_dump(realpath(__FILE__ . "_link2"));
+clearstatcache(true, __FILE__ . "_link2");
+clearstatcache(true, __FILE__ . "_link1");
+var_dump(realpath(__FILE__ . "_link2"));
+
+@rmdir(__FILE__ . "_dir1");
+@rmdir(__FILE__ . "_dir2");
+@unlink(__FILE__ . "_link1");
+@unlink(__FILE__ . "_link2");
+?>
+--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--
+<?php
+/*
+ Prototype: void clearstatcache ([bool clear_realpath_cache[, filename]]);
+ Description: clears files status cache
+*/
+
+echo "*** Testing clearstatcache() function: error conditions ***\n";
+var_dump( clearstatcache(0, "/foo/bar", 1) ); //No.of args more than expected
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ * Description: Makes a copy of the file source to dest.
+ * Returns TRUE on success or FALSE on failure.
+ */
+
+echo "*** Testing copy() function: to copy file from source to destination --\n";
+
+var_dump( file_exists(__FILE__) );
+
+/* copying the file */
+$file_path = dirname(__FILE__);
+$file_name1 = $file_path."/copy_basic1.tmp";
+$file_name2 = $file_path."/copy_basic2.tmp";
+var_dump( copy(__FILE__, $file_name1) );
+var_dump( copy($file_name1, $file_name2) );
+
+echo "-- Checking whether the copy of file exists --\n";
+var_dump( file_exists($file_name1) );
+var_dump( file_exists($file_name2) );
+
+echo "-- Checking filepermissions of file and its copies --\n";
+printf( "%o", fileperms(__FILE__) );
+echo "\n";
+printf( "%o", fileperms($file_name1) );
+echo "\n";
+printf( "%o", fileperms($file_name2) );
+echo "\n";
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$file_name1 = $file_path."/copy_basic1.tmp";
+$file_name2 = $file_path."/copy_basic2.tmp";
+unlink($file_name1);
+unlink($file_name2);
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ * Description: Makes a copy of the file source to dest.
+ * Returns TRUE on success or FALSE on failure.
+ */
+
+echo "*** Testing copy() function: error conditions --\n";
+/* Invalid args */
+var_dump( copy("/no/file", "file") );
+
+/* No.of args less than expected */
+var_dump( copy() );
+var_dump( copy(__FILE__) );
+
+/* No.of args less than expected */
+var_dump( copy(__FILE__, "file1", "file1") );
+
+echo "*** Done ***\n";
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: In creation of destination file names containing numerics/strings
+ and checking the existence and size of destination files
+*/
+
+echo "*** Test copy() function: destination file names containing numerics/strings ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation1.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* File names containing numerics, strings */
+ "copy.tmp", //regular file name
+ "copy_copy_variation1.tmp",
+ ".tmp", //file name only with extension
+ "123.tmp", //file name starts with numeric and with regular extension
+ "copy_variation1.123", //file name with numeric extension
+ "123", //numeric
+ "123copy_variation1.tmp", //file name containing numeric & string
+ "copy_variation.tmp123", //file name containing string & numeric
+ chr(99).chr(111).chr(112).chr(121).chr(49).".tmp" //file name containing ASCII values
+);
+
+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--
+<?php
+unlink(dirname(__FILE__)."/copy_variation1.tmp");
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Try copying source file to desntination file, where destination file name is identical to source name */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy(): Trying to create a copy of file with the same source name ***\n";
+$file = $file_path."/copy_variation10.tmp";
+$file_handle = fopen($file, "w");
+fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fclose($file_handle);
+
+var_dump( copy($file, $file) );
+var_dump( file_exists($file) );
+var_dump( filesize($file) );
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation10.tmp");
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to copy the file to a destination, where destination is an existing dir */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: Trying to create a copy of source file as a dir ***\n";
+$file = $file_path."/copy_variation11.tmp";
+$file_handle = fopen($file, "w");
+fwrite($file_handle, str_repeat(b"Hello, world...", 20));
+fclose($file_handle);
+
+$dir = $file_path."/copy_variation11";
+mkdir($dir);
+
+echo "Size of source before copy operation => ";
+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--
+<?php
+unlink(dirname(__FILE__)."/copy_variation11.tmp");
+rmdir(dirname(__FILE__)."/copy_variation11");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to create a copy of an existing dir */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: Trying to create a copy of an existing dir ***\n";
+$src_dir = $file_path."/copy_variation12";
+mkdir($src_dir);
+
+$dest = $file_path."/copy_copy_variation12";
+
+var_dump( copy($src_dir, $dest) );
+
+var_dump( file_exists($dest) );
+
+var_dump( filesize($src_dir) );
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_copy_variation12");
+rmdir(dirname(__FILE__)."/copy_variation12");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to create a copy of an existing dir */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: Trying to create a copy of an existing dir ***\n";
+$src_dir = $file_path."/copy_variation12";
+mkdir($src_dir);
+
+$dest = $file_path."/copy_copy_variation12";
+
+var_dump( copy($src_dir, $dest) );
+
+var_dump( file_exists($dest) );
+
+var_dump( filesize($src_dir) );
+var_dump( filesize($dest) );
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/copy_variation12");
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to copy dir to an existing file */
+
+echo "*** Test copy() function: Trying to copy dir to file ***\n";
+$file_path = dirname(__FILE__);
+$file = $file_path."/copy_variation13_dir.tmp";
+fclose(fopen($file, "w"));
+$dir = $file_path."/copy_variation13";
+mkdir($dir);
+
+echo "*** Testing copy() in copying dir to file ***\n";
+var_dump( copy($dir, $file) );
+
+var_dump( file_exists($file) );
+var_dump( file_exists($dir) );
+
+var_dump( is_file($dir) );
+var_dump( is_dir($dir) );
+
+var_dump( is_file($file) );
+var_dump( is_dir($file) );
+
+var_dump( filesize($file) );
+var_dump( filesize($dir) );
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation13_dir.tmp");
+rmdir(dirname(__FILE__)."/copy_variation13");
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to create a copy of non-existing source in an existing destination
+ and an existing source in non-existing destiantion */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: Trying to create a copy of non-existing source in existing destination ***";
+$file = $file_path."/copy_variation14.tmp";
+$file_handle = fopen($file, "w");
+fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fclose($file_handle);
+
+var_dump( copy($file_path."/nosuchfile.tmp", $file_path."/copy_nosuchfile.tmp") ); //With non-existing source
+var_dump( file_exists($file_path."/copy_nosuchfile.tmp") );
+
+echo "\n*** Test copy() function: Trying to create copy of an existing source in non-existing destination ***";
+var_dump( copy($file, $file_path."/nodir/copy_nosuchfile.tmp") ); //With non-existing dir path
+var_dump( file_exists($file_path."/nodir/copy_nosuchfile.tmp") );
+var_dump( filesize($file) ); //size of the source
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation14.tmp");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN')
+ die("skip do not run on Windows");
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/copy_variation15_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to create a copy of file in a dir which doesn't have write permissions */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: Trying to create a copy of file in a dir which doesn't have write permissions ***";
+$file = $file_path."/copy_variation15.tmp";
+$file_handle = fopen($file, "w");
+fwrite($file_handle, str_repeat(b"Hello, world...", 20));
+fclose($file_handle);
+
+$dir = $file_path."/copy_variation15";
+mkdir($dir);
+
+$old_perms = fileperms($dir);
+
+chmod($dir, 0555); //dir without write permissions
+
+$dest = $dir."/copy_copy_variation15.tmp";
+
+var_dump( copy($file, $dir."/copy_copy_variation15.tmp") );
+var_dump( file_exists($dir."/copy_copy_variation15_dir.tmp") );
+var_dump( filesize($file) ); //size of source
+
+chmod($dir, $old_perms);
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation15.tmp");
+rmdir(dirname(__FILE__)."/copy_variation15");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Trying to create copy of source file
+ into different destination dir paths given in various notations */
+
+echo "*** Testing copy() function: copying data file across directories ***\n";
+$base_dir = dirname(__FILE__)."/copy_variation16";
+mkdir($base_dir);
+
+$sub_dir = $base_dir."/copy_variation16_sub";
+mkdir($sub_dir);
+
+$dirname_with_blank = $sub_dir."/copy variation6";
+mkdir($dirname_with_blank);
+
+$src_file_name = dirname(__FILE__)."/copy_variation16.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite($file_handle, str_repeat(b"Hello world, this is 2007 year ...\n", 100));
+fclose($file_handle);
+
+echo "- Size of source 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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Trying to create copy of source file
+ into different destination dir paths given in various notations */
+
+echo "*** Testing copy() function: copying data file across directories ***\n";
+$base_dir = dirname(__FILE__)."/copy_variation16";
+mkdir($base_dir);
+
+$sub_dir = $base_dir."/copy_variation16_sub";
+mkdir($sub_dir);
+
+$dirname_with_blank = $sub_dir."/copy variation6";
+mkdir($dirname_with_blank);
+
+$src_file_name = dirname(__FILE__)."/copy_variation16.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite($file_handle, str_repeat("Hello world, this is 2007 year ...\n", 100));
+fclose($file_handle);
+
+echo "- Size of source 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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to copy the source file which is given with the combination of wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: With source file names containing wild-card chars ***\n";
+$src_file = $file_path."/copy_variation17.tmp";
+$file_handle = fopen($src_file, "w");
+fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fclose($file_handle);
+
+$dir = $file_path."/copy_variation17";
+mkdir($dir);
+
+$src_file_names = array(
+ $file_path."/copy_variation17.tmp", //without wild-card char
+ $file_path."/copy*17.tmp",
+ $file_path."/*_variation17.tmp",
+ $file_path."/copy_variation*.tmp",
+ $file_path."/*.tmp"
+);
+
+$dest_file_name = $dir."/copy_copy_variation17.tmp";
+
+$count = 1;
+foreach($src_file_names as $src_file_name) {
+ var_dump( copy($src_file_name, $dest_file_name) );
+ var_dump( file_exists($dest_file_name) );
+
+ if( file_exists($dest_file_name) ) {
+ var_dump( filesize($dest_file_name) ); //size of destination
+ unlink($dest_file_name);
+ }
+
+ $count++;
+}
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation17.tmp");
+rmdir(dirname(__FILE__)."/copy_variation17");
+?>
+
+--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--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): checking stat of file before and after after copy operation */
+
+$file_path = dirname(__FILE__);
+
+require($file_path."/file.inc");
+
+echo "*** Test copy() function: stat of file before and after copy ***\n";
+$src_file_name = $file_path."/copy_variation18.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite($file_handle, str_repeat("Hello2world...\n", 100));
+fclose($file_handle);
+
+$dest_file_name = $file_path."/copy_copy_variation18.tmp";
+
+clearstatcache();
+
+$stat_before_copy = stat($src_file_name);
+clearstatcache();
+
+echo "Copy operation => ";
+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--
+<?php
+unlink(dirname(__FILE__)."/copy_copy_variation18.tmp");
+unlink(dirname(__FILE__)."/copy_variation18.tmp");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: In creation of destination file names containing special characters
+ and checking the existence and size of destination files
+*/
+
+echo "*** Test copy() function: destination file names containing special characters ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation2.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* File names containing special(non-alpha numeric) characters */
+ "_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",
+ ";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--
+<?php
+unlink(dirname(__FILE__)."/copy_variation2.tmp");
+?>
+
+--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/&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 =>
+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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: In creation of destination file names containing special characters
+ and checking the existence and size of destination files
+*/
+
+echo "*** Test copy() function: destination file names containing special characters ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation2.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* File names containing special(non-alpha numeric) characters */
+ "_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",
+ "(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--
+<?php
+unlink(dirname(__FILE__)."/copy_variation2.tmp");
+?>
+
+--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/<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/>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/&copy_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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: In creation of destination file names containing white spaces
+ and checking the existence and size of destination files
+*/
+
+echo "*** Test copy() function: destination file names containing whitespaces ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation3.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* File names containing whitespaces */
+ "copy variation3.tmp", //file name containing blank space
+ " copy_variation3.tmp", //file name starts with blank space
+ "copy\tvariation3.tmp",
+ " ", //blank space as file name
+);
+
+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 = $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--
+<?php
+unlink(dirname(__FILE__)."/copy_variation3.tmp");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: In creation of destination file names containing white spaces
+ and checking the existence and size of destination files
+*/
+
+echo "*** Test copy() function: destination file names containing whitespaces ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation3.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* File names containing whitespaces */
+ "copy variation3.tmp", //file name containing blank space
+ " copy_variation3.tmp", //file name starts with blank space
+ "copy\tvariation3.tmp",
+ " ", //blank space as file name
+);
+
+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 = $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--
+<?php
+unlink(dirname(__FILE__)."/copy_variation3.tmp");
+?>
+
+--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
--- /dev/null
+++ b/ext/standard/tests/file/copy_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/file/copy_variation5-win32.phpt b/ext/standard/tests/file/copy_variation5-win32.phpt
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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Checking case sensitivity in creation of destination file names
+ and the existence and size of destination files
+*/
+
+echo "*** Test copy() function: checking case sensitivity in creation of destination file names ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation5.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* Checking case sensitiveness */
+ "COPY.tmp",
+ "COPY.TMP",
+ "CopY.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();
+
+ $count++;
+}
+
+
+$count = 1;
+foreach($dest_files as $dest_file) {
+ unlink($file_path."/".$dest_file);
+ $count++;
+}
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation5.tmp");
+?>
+
+--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--
+<?php
+if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) )
+ die("skip do not run on MacOS/Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Checking case sensitivity in creation of destination file names
+ and the existence and size of destination files
+*/
+
+echo "*** Test copy() function: checking case sensitivity in creation of destination file names ***\n";
+$file_path = dirname(__FILE__);
+$src_file_name = $file_path."/copy_variation5.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
+fclose($file_handle);
+
+/* array of destination file names */
+$dest_files = array(
+
+ /* Checking case sensitiveness */
+ "COPY.tmp",
+ "COPY.TMP",
+ "CopY.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();
+
+ $count++;
+}
+
+$count = 1;
+foreach($dest_files as $dest_file) {
+ unlink($file_path."/".$dest_file);
+ $count++;
+}
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_variation5.tmp");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Trying to create copy of source file
+ into different destination dir paths given in various notations */
+
+echo "*** Test copy() function: copying file across directories ***\n";
+$base_dir = dirname(__FILE__)."/copy_variation6";
+mkdir($base_dir);
+
+$sub_dir = $base_dir."/copy_variation6_sub";
+mkdir($sub_dir);
+
+$dirname_with_blank = $sub_dir."/copy variation6";
+mkdir($dirname_with_blank);
+
+$src_file_name = dirname(__FILE__)."/copy_variation6.tmp";
+fclose( fopen($src_file_name, "w") );
+
+echo "Size of source 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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Trying to create copy of source file
+ into different destination dir paths given in various notations */
+
+echo "*** Test copy() function: copying file across directories ***\n";
+$base_dir = dirname(__FILE__)."/copy_variation6";
+mkdir($base_dir);
+
+$sub_dir = $base_dir."/copy_variation6_sub";
+mkdir($sub_dir);
+
+$dirname_with_blank = $sub_dir."/copy variation6";
+mkdir($dirname_with_blank);
+
+$src_file_name = dirname(__FILE__)."/copy_variation6.tmp";
+fclose( fopen($src_file_name, "w") );
+
+echo "Size of source 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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Invalid for Windows");
+?>
+
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy() function: Trying to create copy of links */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing copy() with symlink and hardlink ***\n";
+$file = $file_path."/copy_variation7.tmp";
+$file_handle = fopen($file, "w");
+fwrite( $file_handle, str_repeat(b"Hello World, this is 2007 year ....\n", 100) );
+fclose($file_handle);
+
+$symlink = $file_path."/copy_variation7_symlink.tmp";
+$hardlink = $file_path."/copy_variation7_hardlink.tmp";
+
+symlink($file, $symlink); //creating symlink
+link($file, $hardlink); //creating hardlink
+
+echo "Size of source files => \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--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/copy_copy_variation7_symlink.tmp");
+unlink($file_path."/copy_copy_variation7_hardlink.tmp");
+unlink($file_path."/copy_variation7_symlink.tmp");
+unlink($file_path."/copy_variation7_hardlink.tmp");
+unlink($file_path."/copy_variation7.tmp");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Invalid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Trying to copy the links across dir paths given in various notations
+ and dirs having limited access */
+
+echo "*** Testing copy() function: copying links across different directories ***\n";
+
+$file_path = dirname(__FILE__);
+
+$base_dir = $file_path."/copy_variation8";
+mkdir($base_dir);
+$sub_dir = $base_dir."/copy_variation8_sub";
+mkdir($sub_dir);
+$dirname_with_blank = $sub_dir."/copy variation6";
+mkdir($dirname_with_blank);
+
+$file = $file_path."/copy_variation8.tmp";
+fclose( fopen($file, "w") );
+
+$symlink = $file_path."/copy_variation8_symlink.tmp";
+$hardlink = $file_path."/copy_variation8_hardlink.tmp";
+
+symlink($file, $symlink); //creating symlink
+link($file, $hardlink); //creating hardlink
+
+$dests = array(
+ $base_dir."/copy_copy_variation8.tmp",
+ $base_dir."/copy_variation8_sub/copy_copy_variation8.tmp",
+ "$sub_dir/copy_copy_variation8.tmp",
+ "$sub_dir/../copy_copy_variation8.tmp",
+ "$sub_dir/../copy_variation8_sub/copy_copy_variation8.tmp",
+ "$sub_dir/..///../copy_copy_variation8.tmp",
+ "$sub_dir/..///../*",
+ "$dirname_with_blank/copy_copy_variation8.tmp"
+);
+
+$count = 1;
+foreach($dests as $dest) {
+ echo "\n-- Iteration $count --\n";
+ echo "- With symlink -\n";
+ var_dump( copy($symlink, $dest) );
+ var_dump( file_exists($dest) );
+ var_dump( is_link($dest) ); //expected: bool(false)
+ var_dump( is_file($dest) ); //expected: bool(true)
+ clearstatcache();
+ unlink("$dest");
+ echo "- With hardlink -\n";
+ var_dump( copy($hardlink, $dest) );
+ var_dump( file_exists($dest) );
+ var_dump( is_link($dest) ); //expected: bool(flase)
+ var_dump( is_file($dest) ); //expected: bool(true)
+ clearstatcache();
+ unlink("$dest");
+ $count++;
+}
+
+unlink($symlink);
+unlink($hardlink);
+unlink($file);
+rmdir($dirname_with_blank);
+rmdir($sub_dir);
+rmdir($base_dir);
+
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN')
+ die("skip do not run on Windows");
+
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/copy_variation9_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool copy ( string $source, string $dest );
+ Description: Makes a copy of the file source to dest.
+ Returns TRUE on success or FALSE on failure.
+*/
+
+/* Test copy(): Trying to copy source file to destination file with and without write permissions */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test copy() function: destination with/without write permissions ***\n";
+$src_file_name = $file_path."/copy_variation9.tmp";
+$file_handle = fopen($src_file_name, "w");
+fwrite($file_handle, str_repeat(b"Hello2world...\n", 100));
+fclose($file_handle);
+
+$dest_file_name = $file_path."/copy_copy_variation9.tmp";
+
+
+echo "\n-- With write permissions --\n";
+var_dump( file_exists($src_file_name) );
+var_dump( copy($src_file_name, $dest_file_name) );
+var_dump( file_exists($dest_file_name) );
+var_dump( filesize($dest_file_name) );
+
+echo "\n-- Without write permissions --\n";
+chmod($file_path."/copy_copy_variation9.tmp", 0555); //No write permissions
+var_dump( file_exists($src_file_name) );
+var_dump( copy($src_file_name, $dest_file_name) );
+var_dump( file_exists($dest_file_name) );
+var_dump( filesize($dest_file_name) );
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/copy_copy_variation9.tmp");
+unlink(dirname(__FILE__)."/copy_variation9.tmp");
+?>
+--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--
+<?php
+$d = dirname(__FILE__);
+$h = opendir($d);
+var_dump(fstat($h));
+closedir($h);
+?>
+===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 <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string dirname(string path)
+ * Description: Returns the directory name component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing dirname() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$paths = array(
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ '/usr/lib/locale/en_US',
+ '//usr/lib//locale/en_US',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/lib/locale/en_US/',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\lib/locale\en_US',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/lib/locale/en_US',
+ '/usr/lib/locale/en_US ',
+ ' /usr/lib/locale/en_US ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/',
+ );
+
+foreach ($paths as $path) {
+ var_dump( dirname($path) );
+}
+
+?>
+===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 <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string dirname(string path)
+ * Description: Returns the directory name component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing dirname() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$paths = array(
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ '/usr/lib/locale/en_US',
+ '//usr/lib//locale/en_US',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/lib/locale/en_US/',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\lib/locale\en_US',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/lib/locale/en_US',
+ '/usr/lib/locale/en_US ',
+ ' /usr/lib/locale/en_US ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/'
+ );
+
+foreach ($paths as $path) {
+ var_dump( dirname($path) );
+}
+
+?>
+===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 <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string dirname(string path)
+ * Description: Returns the directory name component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing dirname() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing dirname() function with Zero arguments --\n";
+var_dump( dirname() );
+
+//Test dirname with one more than the expected number of arguments
+echo "\n-- Testing dirname() function with more than expected no. of arguments --\n";
+$path = 'string_val';
+$extra_arg = 10;
+var_dump( dirname($path, $extra_arg) );
+
+?>
+===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 <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string dirname(string path)
+ * Description: Returns the directory name component of the path
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing dirname() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for Windows');
+}
+?>
+--FILE--
+<?php
+
+var_dump(disk_free_space());
+var_dump(disk_total_space());
+
+var_dump(disk_free_space(-1));
+var_dump(disk_total_space(-1));
+
+var_dump(disk_free_space("/"));
+var_dump(disk_total_space("/"));
+
+var_dump(disk_free_space("/some/path/here"));
+var_dump(disk_total_space("/some/path/here"));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ * Prototype: float disk_free_space( string directory )
+ * Description: Given a string containing a directory, this function
+ * will return the number of bytes available on the corresponding
+ * filesystem or disk partition
+ */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing with existing directory ***\n";
+var_dump( disk_free_space($file_path) );
+var_dump( diskfreespace($file_path) );
+
+echo "*** Testing with newly created directory ***\n";
+$dir = "/disk_free_space";
+mkdir($file_path.$dir);
+echo" \n Free Space before writing to a file\n";
+$space1 = disk_free_space($file_path.$dir);
+var_dump( $space1 );
+
+$fh = fopen($file_path.$dir."/disk_free_space.tmp", "a");
+$data = str_repeat("x", 4096);
+fwrite($fh, (binary)$data);
+fclose($fh);
+
+echo "\n Free Space after writing to a file\n";
+$space2 = disk_free_space($file_path.$dir);
+var_dump( $space2 );
+
+if( $space1 > $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--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/disk_free_space/disk_free_space.tmp");
+rmdir($file_path."/disk_free_space");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' )
+ die("skip Valid only for Windows");
+?>
+--FILE--
+<?php
+/*
+ * Prototype: float disk_free_space( string directory )
+ * Description: Given a string containing a directory, this function will
+ * return the number of bytes available on the corresponding
+ * filesystem or disk partition
+ */
+
+echo "*** Testing error conditions ***\n";
+$file_path = dirname(__FILE__);
+var_dump( disk_free_space() ); // Zero Arguments
+var_dump( diskfreespace() );
+
+var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
+var_dump( diskfreespace( $file_path, "extra argument") );
+
+
+var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
+var_dump( diskfreespace( $file_path."/dir1" ));
+
+$fh = fopen( $file_path."/disk_free_space.tmp", "w" );
+fwrite( $fh, " Garbage data for the temporary file" );
+var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory
+var_dump( diskfreespace( $file_path."/disk_free_space.tmp" ));
+fclose($fh);
+
+echo"\n-- Done --";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/disk_free_space.tmp");
+
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN')
+ die("skip Not valid on Windows");
+?>
+--FILE--
+<?php
+/*
+ * Prototype: float disk_free_space( string directory )
+ * Description: Given a string containing a directory, this function will
+ * return the number of bytes available on the corresponding
+ * filesystem or disk partition
+ */
+
+echo "*** Testing error conditions ***\n";
+$file_path = dirname(__FILE__);
+var_dump( disk_free_space() ); // Zero Arguments
+var_dump( diskfreespace() );
+
+var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
+var_dump( diskfreespace( $file_path, "extra argument") );
+
+
+var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
+var_dump( diskfreespace( $file_path."/dir1" ));
+
+$fh = fopen( $file_path."/disk_free_space.tmp", "w" );
+fwrite( $fh, (binary)" Garbage data for the temporary file" );
+var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory
+var_dump( diskfreespace( $file_path."/disk_free_space.tmp" ));
+fclose($fh);
+
+echo"\n-- Done --";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/disk_free_space.tmp");
+
+?>
+--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--
+<?php
+/*
+ * Prototype: float disk_free_space( string directory )
+ * Description: Given a string containing a directory, this function
+ * will return the number of bytes available on the corresponding
+ * filesystem or disk partition
+ */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing with a directory ***\n";
+var_dump( disk_free_space($file_path."/..") );
+var_dump( diskfreespace($file_path."/..") );
+
+echo "\nTesting for the return type ***\n";
+$return_value = disk_free_space($file_path);
+var_dump( is_float($return_value) );
+
+echo "\n*** Testing with different directory combinations ***";
+$dir = "/disk_free_space";
+mkdir($file_path.$dir);
+
+$dirs_arr = array(
+ ".",
+ $file_path.$dir,
+ $file_path."/.".$dir,
+
+ /* Testing a file trailing slash */
+ $file_path."".$dir."/",
+ $file_path."/.".$dir."/",
+
+ /* Testing file with double trailing slashes */
+ $file_path.$dir."//",
+ $file_path."/.".$dir."//",
+ $file_path."/./".$dir."//",
+
+ /* Testing Binary safe */
+ $file_path.$dir.chr(0),
+ $file_path."/.".$dir.chr(0),
+ ".".chr(0).$file_path.$dir,
+ ".".chr(0).$file_path.$dir.chr(0)
+);
+
+$count = 1;
+/* loop through to test each element the above array */
+foreach($dirs_arr as $dir1) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( disk_free_space( $dir1 ) );
+ var_dump( diskfreespace( $dir1 ) );
+ $count++;
+}
+
+echo"\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir($file_path."/disk_free_space");
+?>
+
+
+--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--
+<?php
+/*
+ * Prototype: float disk_total_space( string $directory );
+ * Description: given a string containing a directory, this function will
+ * return the total number of bytes on the corresponding filesyatem
+ * or disk partition.
+ */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing with normal directory ***\n";
+var_dump( disk_total_space($file_path) );
+
+echo "*** Testing with newly created directory ***\n";
+$dir = "/disk_total_space";
+
+mkdir($file_path.$dir);
+var_dump( disk_total_space($file_path.$dir) );
+$fh = fopen($file_path.$dir."/disk_total_space.tmp", "w");
+fwrite($fh, (binary)"Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data");
+
+fclose($fh);
+
+echo"\nTotal Space after writing to a file\n";
+var_dump( disk_total_space($file_path.$dir) );
+
+echo"\n-- Done --";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/disk_total_space/disk_total_space.tmp");
+rmdir($file_path."/disk_total_space");
+?>
+
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' )
+ die("skip Valid only for Windows");
+?>
+--FILE--
+<?php
+/*
+ * Prototype: float disk_total_space( string $directory );
+ * Description: given a string containing a directory, this function
+ * will return the total number of bytes on the corresponding
+ * filesystem or disk partition
+ */
+
+echo "*** Testing error conditions ***\n";
+$file_path = dirname(__FILE__);
+var_dump( disk_total_space() ); // Zero Arguments
+
+var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
+
+
+var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
+
+$fh = fopen( $file_path."/disk_total_space.tmp", "w" );
+fwrite( $fh, " Garbage data for the temporary file" );
+var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
+fclose($fh);
+
+echo"\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/disk_total_space.tmp");
+?>
+--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--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN')
+ die("skip Not valid on Windows");
+?>
+--FILE--
+<?php
+/*
+ * Prototype: float disk_total_space( string $directory );
+ * Description: given a string containing a directory, this function
+ * will return the total number of bytes on the corresponding
+ * filesystem or disk partition
+ */
+
+echo "*** Testing error conditions ***\n";
+$file_path = dirname(__FILE__);
+var_dump( disk_total_space() ); // Zero Arguments
+
+var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
+
+
+var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
+
+$fh = fopen( $file_path."/disk_total_space.tmp", "w" );
+fwrite( $fh, (binary)" Garbage data for the temporary file" );
+var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
+fclose($fh);
+
+echo"\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/disk_total_space.tmp");
+?>
+--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--
+<?php
+/*
+ * Prototype: float disk_total_space( string directory )
+ * Description: given a string containing a directory, this function
+ * will return the total number of bytes on the corresponding
+ * filesystem or disk partition.
+ */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing with a directory ***\n";
+var_dump( disk_total_space($file_path."/..") );
+
+echo "\nTesting for the return type ***\n";
+$return_value = disk_total_space($file_path);
+var_dump( is_float($return_value) );
+
+echo "\n*** Testing with different directory combinations ***";
+$dir = "/disk_total_space";
+
+mkdir($file_path.$dir);
+
+$dirs_arr = array(
+ ".",
+ $file_path.$dir,
+ $file_path."/.".$dir,
+
+ /* Testing a file trailing slash */
+ $file_path."".$dir."/",
+ $file_path."/.".$dir."/",
+
+ /* Testing file with double trailing slashes */
+ $file_path.$dir."//",
+ $file_path."/.".$dir."//",
+ $file_path."/./".$dir."//",
+
+ /* Testing Binary safe */
+ $file_path.$dir.chr(0),
+ $file_path."/.".$dir.chr(0),
+ ".".chr(0).$file_path.$dir,
+ ".".chr(0).$file_path.$dir.chr(0)
+);
+
+
+$count = 1;
+/* loop through to test each element the above array */
+foreach($dirs_arr as $dir1) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( disk_total_space( $dir1 ) );
+ $count++;
+}
+
+echo "*** Testing with Binary Input ***\n";
+var_dump( disk_total_space(b"$file_path") );
+
+echo"\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir($file_path."/disk_total_space");
+?>
+
+
+--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--
+<?php
+$s = fopen(__FILE__, "rb");
+function separate_zval(&$var) { }
+$s2 = $s;
+separate_zval($s2);
+fclose($s);
+echo fread($s2, strlen("<?php"));
+echo "\nDone.\n";
+--EXPECTF--
+Warning: fread(): %d is not a valid stream resource in %s on line %d
+
+Done.
diff --git a/ext/standard/tests/file/feof_basic.phpt b/ext/standard/tests/file/feof_basic.phpt
new file mode 100644
index 0000000..ff1d179
--- /dev/null
+++ b/ext/standard/tests/file/feof_basic.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Test feof() function : basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto bool feof(resource fp)
+ * Description: Test for end-of-file on a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions: gzeof
+ */
+
+echo "*** Testing feof() : basic functionality ***\n";
+$tmpFile1 = __FILE__.".tmp1";
+$h = fopen($tmpFile1, 'wb');
+$count = 10;
+for ($i = 1; $i <= $count; $i++) {
+ fwrite($h, "some data $i\n");
+}
+fclose($h);
+
+echo "\n*** testing reading complete file using feof to stop ***\n";
+$h = fopen($tmpFile1, 'rb');
+
+//feof is not set to true until you try to read past the end of file.
+//so fgets will be called even if we are at the end of the file on
+//last time to set the eof flag but it will fail to read.
+$lastline = "";
+while (!feof($h)) {
+ $previousLine = $lastline;
+ $lastline = fgets($h);
+}
+echo $previousLine;
+var_dump($lastline); // this should be false
+fclose($h);
+
+$tmpFile2 = __FILE__.".tmp2";
+$h = fopen($tmpFile2, 'wb+');
+$count = 10;
+echo "*** writing $count lines, testing feof ***\n";
+for ($i = 1; $i <=$count; $i++) {
+ fwrite($h, "some data $i\n");
+ var_dump(feof($h));
+}
+
+echo "*** testing feof on unclosed file after a read ***\n";
+
+fread($h, 100);
+var_dump(feof($h));
+
+$eofPointer = ftell($h);
+
+echo "*** testing feof after a seek to near the beginning ***\n";
+fseek($h, 20, SEEK_SET);
+var_dump(feof($h));
+
+echo "*** testing feof after a seek to end ***\n";
+fseek($h, $eofPointer, SEEK_SET);
+var_dump(feof($h));
+
+echo "*** testing feof after a seek passed the end ***\n";
+fseek($h, $eofPointer + 1000, SEEK_SET);
+var_dump(feof($h));
+
+echo "*** closing file, testing eof ***\n";
+fclose($h);
+feof($h);
+unlink($tmpFile1);
+unlink($tmpFile2);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+echo "*** Testing fflush(): writing to a file and reading the contents ***\n";
+$data = <<<EOD
+first line of string
+second line of string
+third line of string
+EOD;
+
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fflush_basic.tmp";
+
+// opening a file
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $data = str_replace("\r",'', $data);
+}
+
+// writing data to the file
+var_dump( fwrite($file_handle, $data) );
+var_dump( fflush($file_handle) );
+var_dump( readfile($filename) );
+
+echo "\n*** Testing fflush(): for return type ***\n";
+$return_value = fflush($file_handle);
+var_dump( is_bool($return_value) );
+fclose($file_handle);
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fflush_basic.tmp";
+unlink($filename);
+?>
+
+--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--
+<?php
+/*
+ Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+echo "*** Testing error conditions ***\n";
+$file_path = dirname(__FILE__);
+
+// zero argument
+echo "-- Testing fflush(): with zero argument --\n";
+var_dump( fflush() );
+
+// more than expected no. of args
+echo "-- Testing fflush(): with more than expected number of arguments --\n";
+
+$filename = "$file_path/fflush_error.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+var_dump( fflush($file_handle, $file_handle) );
+fclose($file_handle);
+
+// test invalid arguments : non-resources
+echo "-- Testing fflush(): with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass
+);
+
+/* loop to test fflush() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fflush($invalid_args[$loop_counter - 1]) );
+}
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/fflush_error.tmp");
+?>
+
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only for Windows");
+?>
+
+--FILE--
+<?php
+/* Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+/* test fflush() with handle to the files opened in different modes */
+
+$file_path = dirname(__FILE__);
+require $file_path.'/file.inc';
+
+echo "*** Testing fflush(): with various types of files ***\n";
+$file_types = array("empty", "numeric", "text", "text_with_new_line", "alphanumeric");
+$file_modes = array("w", "wb", "wt", "w+", "w+b", "w+t",
+ "a", "ab", "at", "a+","a+b", "a+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t");
+
+$file_name = "$file_path/fflush_variation1.tmp";
+
+$count = 1;
+
+foreach( $file_types as $type ) {
+ echo "-- Iteration $count with file containing $type Data--\n";
+ foreach( $file_modes as $mode ) {
+ echo "-- File opened in $mode mode --\n";
+
+ // creating the file except for x mode
+ if( substr($mode, 0, 1) != "x" ) {
+ $file_handle = fopen($file_name, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+
+ // filling the file some data if mode is append mode
+ if( substr($mode, 0, 1) == "a")
+ fill_file($file_handle, $type, 10);
+ fclose($file_handle);
+ }
+
+ // opening the file in different modes
+ $file_handle = fopen($file_name, $mode);
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+
+ // writing data to the file
+ var_dump( fill_file($file_handle, $type, 50) );
+ var_dump( fflush($file_handle) );
+ fclose($file_handle);
+
+ // reading the contents of the file after flushing
+ var_dump( readfile($file_name) );
+ unlink($file_name);
+ }
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. only for linux");
+?>
+
+--FILE--
+<?php
+/* Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+/* test fflush() with handle of files opened in different modes */
+
+$file_path = dirname(__FILE__);
+require $file_path.'/file.inc';
+
+echo "*** Testing fflush(): with various types of files ***\n";
+$file_types = array("empty", "numeric", "text", "text_with_new_line", "alphanumeric");
+$file_modes = array("w", "wb", "wt", "w+", "w+b", "w+t",
+ "a", "ab", "at", "a+","a+b", "a+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t");
+
+$file_name = "$file_path/fflush_variation1.tmp";
+
+$count = 1;
+
+foreach( $file_types as $type ) {
+ echo "-- Iteration $count with file containing $type Data--\n";
+ foreach( $file_modes as $mode ) {
+ echo "-- File opened in $mode mode --\n";
+
+ // creating the file except for x mode
+ if( substr($mode, 0, 1) != "x" ) {
+ $file_handle = fopen($file_name, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+
+ // filling the file with some data if mode is append mode
+ if( substr($mode, 0, 1) == "a")
+ fill_file($file_handle, $type, 10);
+ fclose($file_handle);
+
+ }
+
+ // opening the file in different modes
+ $file_handle = fopen($file_name, $mode);
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+
+ // writing data to the file
+ var_dump( fill_file($file_handle, $type, 50) );
+ var_dump( fflush($file_handle) );
+ fclose($file_handle);
+
+ // reading the contents of the file after flushing
+ var_dump( readfile($file_name) );
+ unlink($file_name);
+ }
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN')
+ die("skip Links not valid on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+/* test fflush() with handle to symbollic link */
+
+$file_path = dirname(__FILE__);
+require $file_path.'/file.inc';
+
+echo "*** Testing fflush(): with soft links to files opened in diff modes ***\n";
+$file_types = array("empty", "numeric", "text", "text_with_new_line", "alphanumeric");
+$file_modes = array("w", "wb", "wt", "w+", "w+b", "w+t",
+ "a", "ab", "at", "a+","a+b", "a+t");
+
+$file_name = "$file_path/fflush_variation2.tmp";
+$symlink_name = "$file_path/symlnk_fflush_variation2.tmp";
+
+$count = 1;
+
+foreach( $file_types as $type ) {
+ echo "-- Iteration $count with file containing $type data --\n";
+ foreach( $file_modes as $mode ) {
+ echo "-- link opened in $mode mode --\n";
+
+ //creating the file
+ $file_handle = fopen($file_name, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+
+ //fill the file with some data if mode is append mode
+ if( substr($mode, 0, 1) == "a" )
+ fill_file($file_handle, $type, 10);
+
+ //close the file
+ fclose($file_handle);
+
+ // creating the sym link
+ var_dump( symlink($file_name, $symlink_name) );
+ $file_handle = fopen($symlink_name, $mode);
+ if($file_handle == false)
+ exit("Error:failed to open link $symlink_name");
+
+ // filling data into the file
+ var_dump( fill_file($file_handle, $type, 50) );
+ var_dump( fflush($file_handle) );
+ fclose($file_handle);
+
+ // reading the data from the file
+ var_dump( readfile($symlink_name) );
+
+ unlink($symlink_name);
+ unlink($file_name);
+ }
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--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--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN')
+ die("skip Links not valid on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+/* test fflush() with handle to hard links as resource */
+
+$file_path = dirname(__FILE__);
+require $file_path.'/file.inc';
+
+echo "*** Testing fflush(): with hard links to files opened in diff modes ***\n";
+$file_types = array("empty", "numeric", "text", "text_with_new_line", "alphanumeric");
+$file_modes = array("w", "wb", "wt", "w+", "w+b","w+t",
+ "a", "ab", "at", "a+","a+b", "a+t");
+
+$file_name = "$file_path/fflush_variation3.tmp";
+$link_name = "$file_path/lnk_fflush_variation3.tmp";
+
+$count = 1;
+
+foreach( $file_types as $type ) {
+ echo "-- Iteration $count with file containing $type data --\n";
+ foreach( $file_modes as $mode ) {
+
+ // creating the file
+ $file_handle = fopen($file_name, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+
+ // fill the fill with some data if mode is append mode
+ if( substr($mode, 0, 1) == "a" )
+ fill_file($file_handle, $type, 10);
+
+ // fclose($file_handle);
+
+ // creating hard link to the file
+ var_dump( link($file_name, $link_name) );
+
+ // opening the file in different modes
+ $file_handle = fopen($link_name, $mode);
+ if($file_handle == false)
+ exit("Error:failed to open link $link_name");
+
+ // writing data to the file
+ var_dump( fill_file($file_handle, $type, 50) );
+ var_dump( fflush($file_handle) );
+ fclose($file_handle);
+
+ // reading data from the file after flushing
+ var_dump( readfile($link_name) );
+
+ unlink($link_name);
+ unlink($file_name);
+ }
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--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--
+<?php
+/* Prototype: bool fflush ( resource $handle );
+ Description: Flushes the output to a file
+*/
+
+/* test fflush() with handle to a file opened in read-only mode as resource */
+
+$file_path = dirname(__FILE__);
+require $file_path.'/file.inc';
+
+echo "*** Testing fflush(): with file handles of files opened in various read modes ***\n";
+$file_modes = array("r", "rb", "rt");
+
+$file_name = "$file_path/fflush_variation4.tmp";
+
+$count = 1;
+
+foreach( $file_modes as $mode ) {
+ echo "-- Iteration $count with file opened in $mode mode --\n";
+
+ // creating a file
+ $file_handle = fopen($file_name, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+ fclose($file_handle);
+
+ // opening the file in different read modes
+ $file_handle = fopen($file_name, $mode);
+ if($file_handle == false)
+ exit("Error:failed to open file $file_name");
+ var_dump( fflush($file_handle) );
+ fclose($file_handle);
+
+ unlink($file_name);
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--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--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgetc() : basic operations ***\n";
+/* read charecter from different files which are opened in different modes */
+$file_modes = array( "r", "rb", "rt", "r+", "r+b", "r+t");
+
+/* create file with following type of contents */
+$file_content_types = array("numeric", "text", "text_with_new_line");
+
+for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $outerloop_counter++) {
+ echo "--- Outerloop iteration ";
+ echo $outerloop_counter + 1;
+ echo " ---\n";
+ // create file file
+ create_files(dirname(__FILE__), 1, $file_content_types[$outerloop_counter], 0755, 1, "w", "fgetc_basic", 1);
+
+ //open the file in different modes and check the working of fgetc
+ for($innerloop_counter = 0; $innerloop_counter < count($file_modes); $innerloop_counter++) {
+ echo "-- Innerloop iteration ";
+ echo $innerloop_counter + 1;
+ echo " of Outerloop Iteration ";
+ echo $outerloop_counter + 1;
+ echo " --\n";
+
+ // open the file using the $file_modes
+ $filename = dirname(__FILE__)."/fgetc_basic1.tmp"; // file name that is created by create_files
+ echo "-- Testing fgetc() : file opened using $file_modes[$innerloop_counter] mode --\n";
+ $file_handle = fopen($filename, $file_modes[$innerloop_counter]);
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ // perform the read file at least 6 char and check
+ for( $counter = 1; $counter <= 6; $counter++ ) {
+ // read data from the file and check, file pointer position, feof etc
+ var_dump( fgetc($file_handle) ); // read a char
+ var_dump( ftell($file_handle) ); // file pointer position
+ var_dump( feof($file_handle) ); // is it eof()
+ var_dump($file_handle); // dump the $file_handle to see if any thing got modifed
+ } // end of for
+
+ // close the file
+ fclose ( $file_handle);
+
+ } // end of innerloop for
+
+ // delete the file
+ delete_files(dirname(__FILE__), 1, "fgetc_basic", 1, ".tmp");
+
+} // end of outerloop for
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetc() : basic operations ***
+--- Outerloop iteration 1 ---
+-- Innerloop iteration 1 of Outerloop Iteration 1 --
+-- Testing fgetc() : file opened using r mode --
+string(1) "2"
+int(1)
+bool(false)
+resource(%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--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+
+echo "*** Testing error conditions ***\n";
+// zero argument
+echo "-- Testing fgetc() with zero argument --\n";
+var_dump( fgetc() );
+
+// more than expected no. of args
+echo "-- Testing fgetc() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( fgetc($fp, $fp) );
+fclose($fp);
+
+// test invalid arguments : non-resources
+echo "-- Testing fgetc() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fgetc() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fgetc($invalid_args[$loop_counter - 1]) );
+}
+
+echo "Done\n";
+--EXPECTF--
+*** Testing error conditions ***
+-- Testing fgetc() with zero argument --
+
+Warning: fgetc() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+-- Testing fgetc() with more than expected number of arguments --
+
+Warning: fgetc() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+-- Testing fgetc() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fgetc() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: fgetc() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: fgetc() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: fgetc() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: fgetc() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: fgetc() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetc_variation1.phpt b/ext/standard/tests/file/fgetc_variation1.phpt
new file mode 100644
index 0000000..007b2e0
--- /dev/null
+++ b/ext/standard/tests/file/fgetc_variation1.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test fgetc() function : usage variations - read when file pointer at EOF
+--FILE--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgetc() : usage variations ***\n";
+echo "-- Testing fgetc() with file whose file pointer is pointing to EOF --\n";
+// create a file
+create_files(dirname(__FILE__), 1, "text_with_new_line", 0755, 1, "w", "fgetc_variation");
+
+$filename = dirname(__FILE__)."/fgetc_variation1.tmp";
+
+// loop to check the file opened in different read modes
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t");
+$loop_counter =0;
+for(; $loop_counter < count($file_modes); $loop_counter++) {
+ // print the hearder
+ echo "-- File opened in mode : $file_modes[$loop_counter] --\n";
+ // open the file
+ $file_handle = fopen ($filename, $file_modes[$loop_counter]);
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename! \n";
+ exit();
+ }
+
+ // seek to end of the file and try fgetc()
+ var_dump( fseek($file_handle, 0, SEEK_END) ); // set file pointer to eof
+ var_dump( feof($file_handle) ); // expected false
+ var_dump( ftell($file_handle) ); // ensure that file pointer is at eof
+ var_dump( fgetc($file_handle) ); // try n read a char, none expected
+ var_dump( feof($file_handle) ); // ensure thta file pointer is at eof
+ var_dump( ftell($file_handle) ); // file pointer position
+
+ // close the file handle
+ fclose($file_handle);
+}
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink( dirname(__FILE__)."/fgetc_variation1.tmp");
+?>
+--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--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+
+/* try reading a char using fgetc() using invalid handles
+ - closed file handle
+ - unset file handle
+*/
+
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgetc() : usage variations ***\n";
+
+echo "-- Testing fgetc() with closed handle --\n";
+// open the file for reading
+$file_handle = fopen(__FILE__, "r");
+// close the file
+fclose($file_handle);
+
+// read from closed file
+var_dump( fgetc($file_handle) );
+
+echo "-- Testing fgetc() with unset handle --\n";
+// open the file for reading
+$file_handle = fopen(__FILE__, "r");
+// unset the file handle
+unset($file_handle);
+
+//fgetc using unset handle
+var_dump( fgetc($file_handle) );
+
+echo "Done";
+?>
+--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--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+
+/* try fgetc on files which are opened in non readable modes
+ w, wb, wt,
+ a, ab, at,
+ x, xb, xt
+*/
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgetc() with file opened in write only mode ***\n";
+
+$file_modes = array("w", "wb", "wt", "a", "ab", "at", "x", "xb", "xt");
+$filename = dirname(__FILE__)."/fgetc_variation3.tmp";
+foreach ($file_modes as $file_mode ) {
+ echo "-- File opened in mode : $file_mode --\n";
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+ $data = "fgetc_variation test";
+ fwrite($file_handle, $data);
+
+ // rewind the file pointer to begining of the file
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read from file
+ var_dump( fgetc($file_handle) ); // expected : no chars should be read
+ var_dump( ftell($file_handle) ); // ensure that file pointer position is not changed
+ var_dump( feof($file_handle) ); // check if end of file pointer is set
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+
+/* read from fie using fgetc, file opened using different
+ read read modes */
+
+echo "*** Testing fgetc() : usage variations ***\n";
+echo "-- Testing fgetc() with files opened with different read modes --\n";
+
+$file_modes = array( "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t",
+ "w+", "w+b", "w+t" );
+
+$filename = dirname(__FILE__)."/fgetc_variation4.tmp";
+foreach ($file_modes as $file_mode ) {
+ echo "-- File opened in mode : $file_mode --\n";
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+ $data = "fgetc\n test";
+ fwrite($file_handle, $data);
+
+ // rewind the file pointer to begining of the file
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read from file, at least 7 chars
+ for($counter =0; $counter < 7; $counter ++) {
+ var_dump( fgetc($file_handle) ); // expected : 1 char
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); // check if end of file pointer is set
+ }
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+ $list = array(
+ 'aaa,bbb',
+ 'aaa,"bbb"',
+ '"aaa","bbb"',
+ 'aaa,bbb',
+ '"aaa",bbb',
+ '"aaa", "bbb"',
+ ',',
+ 'aaa,',
+ ',"aaa"',
+ '"",""',
+ '"\\"","aaa"',
+ '"""""",',
+ '""""",aaa',
+ '"\\""",aaa',
+ 'aaa,"\\"bbb,ccc',
+ 'aaa,bbb ',
+ 'aaa,"bbb "',
+ 'aaa"aaa","bbb"bbb',
+ 'aaa"aaa""",bbb',
+ 'aaa"\\"a","bbb"'
+ );
+
+ $file = dirname(__FILE__) . 'fgetcsv.csv';
+ @unlink($file);
+ foreach ($list as $v) {
+ $fp = fopen($file, "w");
+ fwrite($fp, $v . "\n");
+ fclose($fp);
+
+ var_dump(fgetcsv(fopen($file, "r"), 1024));
+ }
+ @unlink($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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure [, string $escape]]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+echo "*** Testing error conditions ***\n";
+// zero argument
+echo "-- Testing fgetcsv() with zero argument --\n";
+var_dump( fgetcsv() );
+
+// more than expected no. of args
+echo "-- Testing fgetcsv() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+$len = 1024;
+$delim = ";";
+$enclosure ="\"";
+$escape = '"';
+var_dump( fgetcsv($fp, $len, $delim, $enclosure, $escape, $fp) );
+fclose($fp);
+
+// test invalid arguments : non-resources
+echo "-- Testing fgetcsv() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fgetcsv() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fgetcsv($invalid_args[$loop_counter - 1]) ); // with default args
+ var_dump( fgetcsv($invalid_args[$loop_counter - 1], $len, $delim, $enclosure, $escape) ); // all args specified
+}
+
+echo "Done\n";
+--EXPECTF--
+*** Testing error conditions ***
+-- Testing fgetcsv() with zero argument --
+
+Warning: fgetcsv() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing fgetcsv() with more than expected number of arguments --
+
+Warning: fgetcsv() expects at most 5 parameters, 6 given in %s on line %d
+NULL
+-- Testing fgetcsv() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fgetcsv() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+Warning: fgetcsv() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: fgetcsv() expects parameter 1 to be resource, integer given in %s on line %d
+NULL
+
+Warning: fgetcsv() expects parameter 1 to be resource, integer given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: fgetcsv() expects parameter 1 to be resource, double given in %s on line %d
+NULL
+
+Warning: fgetcsv() expects parameter 1 to be resource, double given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: fgetcsv() expects parameter 1 to be resource, boolean given in %s on line %d
+NULL
+
+Warning: fgetcsv() expects parameter 1 to be resource, boolean given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: fgetcsv() expects parameter 1 to be resource, array given in %s on line %d
+NULL
+
+Warning: fgetcsv() expects parameter 1 to be resource, array given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: fgetcsv() expects parameter 1 to be resource, object given in %s on line %d
+NULL
+
+Warning: fgetcsv() expects parameter 1 to be resource, object given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/file/fgetcsv_variation1.phpt b/ext/standard/tests/file/fgetcsv_variation1.phpt
new file mode 100644
index 0000000..8a698e4
--- /dev/null
+++ b/ext/standard/tests/file/fgetcsv_variation1.phpt
@@ -0,0 +1,1412 @@
+--TEST--
+Test fgetcsv() : usage variations - with all parameters specified
+--FILE--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read a file when all its parameters are provided */
+
+echo "*** Testing fgetcsv() : with all parameters specified ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation1.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use the right delimiter and enclosure with max length
+ var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() by reading from a file when the file pointer is pointing to end of file */
+
+echo "*** Testing fgetcsv() : with file pointer pointing to EOF ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation10.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // set the file pointer to EOF
+ var_dump( fseek($file_handle, 0, SEEK_END) );
+
+ // call fgetcsv() to parse csv fields
+
+ // now file pointer should point to end of the file, try reading again
+ var_dump( feof($file_handle) );
+ var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ var_dump( fgetcsv($file_handle) ); // with default args
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() by reading from a file when different enclosure that is not
+ present in the data being read and delimiter which is present in the data */
+
+echo "*** Testing fgetcsv() : with different enclosure but same delimiter char ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation11.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+
+ // use different delimiter but same enclosure char
+ fseek($file_handle, 0, SEEK_SET);
+ $enc = "+";
+ var_dump( fgetcsv($file_handle, 1024, $delimiter, $enc) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() by providing two characters for enclosure and delimiter parameters */
+
+echo "*** Testing fgetcsv() : with two chars as enclosure & delimiter ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation12.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use delimiter & enclosure char of two chars
+ fseek($file_handle, 0, SEEK_SET);
+ $del = "++";
+ $enc = "%%";
+ var_dump( fgetcsv($file_handle, 1024, $del, $enc) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read a line from a file which doesn't have any CSV field */
+
+echo "*** Testing fgetcsv() : reading the line which is without csv fields ***\n";
+
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation13.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ // write line of text
+ fwrite($file_handle, "This is line of text without csv fields\n");
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+
+ // read the line which is without csv fields, provide delimiter and see the working of fgetcsv
+ $fp_pos = ftell($file_handle);
+ var_dump( fgetcsv($file_handle) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() by reading a file containing a blank line */
+
+echo "*** Testing fgetcsv() : reading the blank line ***\n";
+
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation14.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ // write a blank line
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // read the next line which is a blank line to see the working of fgetcsv
+ $fp_pos = ftell($file_handle);
+ var_dump( fgetcsv($file_handle, 1024) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ // read again to struck EOF
+ var_dump( fgetcsv($file_handle, 1024) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read a file when provided with default enclosure character */
+
+echo "*** Testing fgetcsv() : with default enclosure ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation15.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ var_dump( fgetcsv($file_handle, 1024, $delimiter) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read a file when provided with default enclosure character
+ and length value equal to zero
+*/
+
+echo "*** Testing fgetcsv() : with default enclosure & length as 0 ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation16.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use length as 0
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 0, $delimiter) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read a file when provided with default enclosure character
+ and length value less than the size of line being read
+ */
+
+echo "*** Testing fgetcsv() : with default enclosure & length less than line size ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation17.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use length as less than the actual size of the line
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 9, $delimiter) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read rest of the line
+ var_dump( fgetcsv($file_handle, 1024, $delimiter) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read a file when provided with default enclosure character
+ and with delimiter character which is not in the line being read by fgetcsv()
+*/
+
+echo "*** Testing fgetcsv() : with default enclosure and different delimiter ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation18.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use different delimiter than existing in file
+ fseek($file_handle, 0, SEEK_SET);
+ $del = "+";
+ var_dump( fgetcsv($file_handle, 1024, $del) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a file when provided with default enclosure character
+ and with delimiter of two characters
+*/
+
+echo "*** Testing fgetcsv() : with default enclosure & delimiter of two chars ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation19.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use delimiter & enclosure char of two chars
+ fseek($file_handle, 0, SEEK_SET);
+ $del = "++";
+ var_dump( fgetcsv($file_handle, 1024, $del) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to rwad from a file with length argument equal to zero */
+
+echo "*** Testing fgetcsv() : with length as 0 ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation2.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use length as 0
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 0, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a line without any csv fields from a file
+ when provided with default enclosure value
+*/
+
+echo "*** Testing fgetcsv() : with default enclosure, line without any csv fields ***\n";
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation20.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ // write line of text
+ fwrite($file_handle, "This is line of text without csv fields\n");
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // read the line which is without csv fields, provide delimiter and see the working of fgetcsv
+ $fp_pos = ftell($file_handle);
+ var_dump( fgetcsv($file_handle, 1024) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a file containing blank line when provided with
+ default enclosure argument
+*/
+
+echo "*** Testing fgetcsv() : with default enclosure, blank line ***\n";
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation21.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ // write a blank line
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // read the line which is a blank line to see the working of fgetcsv
+ $fp_pos = ftell($file_handle);
+ var_dump( fgetcsv($file_handle, 1024, '+') );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a file whose file pointer is pointing to end of file
+ and fgetcsv() provided with default enclosure argument
+*/
+
+echo "*** Testing fgetcsv() : with default enclosure, file pointer pointing at end of file ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation22.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // set the file pointer to EOF
+ var_dump( fseek($file_handle, 0, SEEK_END) );
+
+ // call fgetcsv() to parse csv fields
+
+ // now file pointer should point to end of the file, try reading again
+ var_dump( feof($file_handle) );
+ var_dump( fgetcsv($file_handle, 1024, $delimiter) ); // with length, delimiter
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read from an empty file */
+
+echo "*** Testing fgetcsv() : reading from file which is having zero content ***\n";
+
+// try reading from file which is having zero content
+// create the file and then open in read mode and try reading
+$filename = dirname(__FILE__) . '/fgetcsv_variation23.tmp';
+$fp = fopen ($filename, "w");
+fclose($fp);
+$fp = fopen ($filename, "r");
+if (!$fp) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+}
+var_dump( fgetcsv($fp) );
+var_dump( ftell($fp) );
+var_dump( fgetcsv($fp, 1024) );
+var_dump( ftell($fp) );
+var_dump( fgetcsv($fp, 1024, "+" ) );
+var_dump( ftell($fp) );
+var_dump( fgetcsv($fp, 1024, "+", "%") );
+var_dump( ftell($fp) );
+
+// close and delete the file
+fclose($fp);
+unlink($filename);
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file opened in various write modes and
+ enclosure argument with two characters
+*/
+
+echo "*** Testing fgetcsv() : with two chars as enclosure & delimiter ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation24.tmp';
+@unlink($filename);
+
+$file_modes = array ("w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use delimiter & enclosure char of two chars
+ fseek($file_handle, 0, SEEK_SET);
+ $del = "++";
+ $enc = "%%";
+ var_dump( fgetcsv($file_handle, 1024, $del, $enc) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when provided with negative length argument
+ along with delimiter and enclosure arguments
+*/
+
+echo "*** Testing fgetcsv() : with negative length value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation25.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use the right delimiter and enclosure with negative length
+ var_dump( fgetcsv($file_handle, -10, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read from files opened in write only mode */
+
+echo "*** Testing fgetcsv() : reading the files opened in write only mode ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation26.tmp';
+@unlink($filename);
+
+$file_modes = array ("w", "wb", "wt",
+ "a", "ab", "at",
+ "x", "xb", "xt");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // rewind the file pointer to bof
+ rewind($file_handle);
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use the right delimiter and enclosure with max length
+ var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when provided with negative length argument
+ along with delimiter and no enclosure arguments
+*/
+
+echo "*** Testing fgetcsv() : with negative length value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation27.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use the right delimiter and enclosure with negative length
+ var_dump( fgetcsv($file_handle, -10, $delimiter) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when provided with negative length argument
+ along with neither delimiter nor enclosure argument
+*/
+
+echo "*** Testing fgetcsv() : with negative length value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation28.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use the right delimiter and enclosure with negative length
+ var_dump( fgetcsv($file_handle, -10) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a file whose file pointer is pointing to end of file
+ and fgetcsv() provided with only file handle in its argument
+*/
+
+echo "*** Testing fgetcsv() : with file handle as only argument and file pointer pointing at end of file ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation29.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // set the file pointer to EOF
+ var_dump( fseek($file_handle, 0, SEEK_END) );
+
+ // call fgetcsv() to parse csv fields
+
+ // now file pointer should point to end of the file, try reading again
+ var_dump( feof($file_handle) );
+ var_dump( fgetcsv($file_handle) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read from a file when provided with delimiter value as NULL */
+
+echo "*** Testing fgetcsv() : with delimiter as NULL ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation3.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use length as 0
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 1024, NULL, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a file whose file pointer is pointing to end of file
+ and fgetcsv() provided with file handle and length arguments
+*/
+
+echo "*** Testing fgetcsv() : with file handle and length arguments, file pointer pointing at end of file ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation30.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // set the file pointer to EOF
+ var_dump( fseek($file_handle, 0, SEEK_END) );
+
+ // call fgetcsv() to parse csv fields
+
+ // now file pointer should point to end of the file, try reading again
+ var_dump( feof($file_handle) );
+ var_dump( fgetcsv($file_handle, 1024) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read a file whose file pointer is pointing to end of file
+ and fgetcsv() provided with enclosure argument
+*/
+
+echo "*** Testing fgetcsv() : with enclosure argument, file pointer pointing at end of file ***\n";
+
+/* the array is with two elements in it. Each element should be read as
+ 1st element is delimiter & 2nd element is csv fields
+*/
+$csv_lists = array (
+ array(',', 'water,fruit'),
+ array(' ', 'water fruit'),
+ array(' ', '"water" "fruit"'),
+ array('\\', 'water\\"fruit"\\"air"'),
+ array('\\', '"water"\\"fruit"\\"""'),
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation31.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $csv_field = $csv_list[1];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // set the file pointer to EOF
+ var_dump( fseek($file_handle, 0, SEEK_END) );
+
+ // call fgetcsv() to parse csv fields
+
+ // now file pointer should point to end of the file, try reading again
+ var_dump( feof($file_handle) );
+ $enc = 'z';
+ var_dump( fgetcsv($file_handle, 1024, $delimiter, $enc ) ); // with length, delimiter
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read from a file when provided with enclosure value as NULL */
+
+echo "*** Testing fgetcsv() : with enclosure as NULL ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation4.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use length as 0
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 0, $delimiter, NULL) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when provided with delimiter and
+ enclosure values both as NULL
+ */
+
+echo "*** Testing fgetcsv() : with delimiter & enclosure as NULL ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation5.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 1024, NULL, NULL) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when provided with the length argument
+ value less than the line size
+*/
+
+echo "*** Testing fgetcsv() : with length less than line size ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation6.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use length as less than the actual size of the line
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle, 9, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ // read rest of the line
+ var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/* Testing fgetcsv() to read from a file when provided with default value of arguments */
+
+echo "*** Testing fgetcsv() : with default arguments value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation7.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use only default arguments
+ fseek($file_handle, 0, SEEK_SET);
+ var_dump( fgetcsv($file_handle) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when provided with values of delimiter and
+ enclosure that are not present in the line read by fgetcsv()
+*/
+
+echo "*** Testing fgetcsv() : with different delimiter and enclosure ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation8.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blank line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use different delimiter and enclosure than existing in file
+ fseek($file_handle, 0, SEEK_SET);
+ $del = "+";
+ $enc = "%";
+ var_dump( fgetcsv($file_handle, 1024, $del, $enc) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
+ Description: Gets line from file pointer and parse for CSV fields
+*/
+
+/*
+ Testing fgetcsv() to read from a file when the delimiter argument value is not
+ present in the line being read by the fgetcsv()
+*/
+
+echo "*** Testing fgetcsv() : with different delimiter but same enclosure ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', '"water",fruit'),
+ array(',', '"', '"water","fruit"'),
+ array(' ', '^', '^water^ ^fruit^'),
+ array(':', '&', '&water&:&fruit&'),
+ array('=', '=', '=water===fruit='),
+ array('-', '-', '-water--fruit-air'),
+ array('-', '-', '-water---fruit---air-'),
+ array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
+);
+
+$filename = dirname(__FILE__) . '/fgetcsv_variation9.tmp';
+@unlink($filename);
+
+$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+ fwrite($file_handle, $csv_field . "\n");
+ // write another line of text and a blank line
+ // this will be used to test, if the fgetcsv() read more than a line and its
+ // working when only a blan line is read
+ fwrite($file_handle, "This is line of text without csv fields\n");
+ fwrite($file_handle, "\n"); // blank line
+
+ // close the file if the mode to be used is read mode and re-open using read mode
+ // else rewind the file pointer to begining of the file
+ if ( strstr($file_modes[$mode_counter], "r" ) ) {
+ fclose($file_handle);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ } else {
+ // rewind the file pointer to bof
+ rewind($file_handle);
+ }
+
+ echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ // call fgetcsv() to parse csv fields
+
+ // use different delimiter but same enclosure char
+ fseek($file_handle, 0, SEEK_SET);
+ $del = "+";
+ var_dump( fgetcsv($file_handle, 1024, $del, $enclosure) );
+ // check the file pointer position and if eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // close the file
+ fclose($file_handle);
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : basic functionality ***\n";
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 50, "w", "fgets_basic", 1, "bytes"); //create a file
+ $filename = dirname(__FILE__)."/fgets_basic1.tmp"; // this is name of the file created by create_files()
+ $file_handle = fopen($filename, $file_mode);
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ echo "-- fgets() with default length, file pointer at 0 --\n";
+ var_dump( fgets($file_handle) ); // with default length
+ var_dump( ftell($file_handle) ); // ensure the file pointer position
+ var_dump( feof($file_handle) ); // enusre if eof set
+
+ echo "-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 --\n";
+ var_dump( rewind($file_handle) );
+ var_dump( fgets($file_handle, 23) ); // expected: 22 chars
+ 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() : 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--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets line from file pointer
+*/
+
+echo "*** Testing error conditions ***\n";
+// zero argument
+echo "-- Testing fgets() with zero argument --\n";
+var_dump( fgets() );
+
+// more than expected no. of args
+echo "-- Testing fgets() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( fgets($fp, 10, $fp) );
+
+// invalid length argument
+echo "-- Testing fgets() with invalid length arguments --\n";
+$len = 0;
+var_dump( fgets($fp, $len) );
+$len = -10;
+var_dump( fgets($fp, $len) );
+$len = 1;
+var_dump( fgets($fp, $len) ); // return length - 1 always, expect false
+
+
+// test invalid arguments : non-resources
+echo "-- Testing fgets() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fgets() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fgets($invalid_args[$loop_counter - 1], 10) );
+}
+
+// fgets() on a file handle which is already closed
+echo "-- Testing fgets() with closed/unset file handle --";
+fclose($fp);
+var_dump(fgets($fp,10));
+
+// fgets() on a file handle which is unset
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle); //unset file handle
+var_dump( fgets(@$file_handle,10));
+
+echo "Done\n";
+?>
+--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 <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+if (!$client) {
+ die("Unable to create socket");
+}
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+echo "Write some data:\n";
+fwrite($socket, "line1\nline2\nline3\n");
+
+
+echo "\n\nRead a line from the client:\n";
+var_dump(fgets($client));
+
+echo "\n\nRead another line from the client:\n";
+var_dump(fgets($client));
+
+echo "\n\nClose the server side socket and read the remaining data from the client\n";
+fclose($socket);
+fclose($server);
+while(!feof($client)) {
+ fread($client, 1);
+}
+
+echo "done\n";
+
+?>
+--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 <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+// create a file
+$filename = __FILE__ . ".tmp";
+$fd = fopen($filename, "w+");
+
+// populate the file with lines of data
+define("LINE_OF_DATA", "12345678\n");
+for ($i = 0; $i < 1000; $i++) {
+ fwrite($fd, LINE_OF_DATA);
+}
+fclose($fd);
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+if (!$client) {
+ die("Unable to create socket");
+}
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+echo "Write data from the file:\n";
+$data = file_get_contents($filename);
+unlink($filename);
+
+var_dump(fwrite($socket, $data));
+fclose($socket);
+
+echo "\nRead lines from the client\n";
+while ($line = fgets($client,256)) {
+ if (strcmp($line, LINE_OF_DATA) != 0) {
+ echo "Error - $line does not match " . LINE_OF_DATA;
+ break;
+ }
+}
+
+echo "\nClose the server side socket and read the remaining data from the client\n";
+fclose($server);
+while(!feof($client)) {
+ fread($client, 1);
+}
+
+echo "done\n";
+
+?>
+--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--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+/* try fgets on files which are opened in non readable modes
+ w, wb, wt,
+ a, ab, at,
+ x, xb, xt
+*/
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgets() with file opened in write only mode ***\n";
+
+$file_modes = array("w", "wb", "wt", "a", "ab", "at", "x", "xb", "xt");
+$filename = dirname(__FILE__)."/fgets_variation1.tmp";
+foreach ($file_modes as $file_mode ) {
+ echo "-- File opened in mode : $file_mode --\n";
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+ $data = "fgets_variation test";
+ fwrite($file_handle, $data);
+
+ // rewind the file pointer to begining of the file
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read from file
+ var_dump( fgets($file_handle) ); // expected : no chars should be read
+ var_dump( ftell($file_handle) ); // ensure that file pointer position is not changed
+ var_dump( feof($file_handle) ); // check if end of file pointer is set
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+/* try reading a line using fgets() using invalid handles
+ - closed file handle
+ - unset file handle
+*/
+
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+echo "-- Testing fgets() with closed handle --\n";
+// open the file for reading
+$file_handle = fopen(__FILE__, "r");
+// close the file
+fclose($file_handle);
+
+// read from closed file
+var_dump( fgets($file_handle) ); // default length
+var_dump( fgets($file_handle, 10) ); // with specific length
+
+echo "-- Testing fgets() with unset handle --\n";
+// open the file for reading
+$file_handle = fopen(__FILE__, "r");
+// unset the file handle
+unset($file_handle);
+
+//fgets using unset handle
+var_dump( fgets($file_handle) ); // default length
+var_dump( fgets($file_handle, 10) ); // with specific length
+
+echo "Done";
+?>
+--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--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("w+", "w+b", "w+t",
+ "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+$filename = dirname(__FILE__)."/fgets_variation3.tmp";
+
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+
+ /* create files with $file_content_type */
+ $file_handle = fopen($filename, $file_mode);
+ $data = fill_file($file_handle, $file_content_type, 50);
+
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ echo "-- fgets() with default length, file pointer at 0 --\n";
+ // get the file pointer to begining of the file
+ rewind($file_handle);
+
+ var_dump( ftell($file_handle) );
+ var_dump( fgets($file_handle) ); // with default length
+ var_dump( ftell($file_handle) ); // ensure the file pointer position
+ var_dump( feof($file_handle) ); // enusre if eof set
+
+ echo "-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 --\n";
+ // get the file pointer to begining of the file
+ rewind($file_handle);
+
+ var_dump( ftell($file_handle) );
+ var_dump( fgets($file_handle, 23) ); // expected: 22 chars
+ 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 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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("w+", "w+b", "w+t",
+ "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+$filename = dirname(__FILE__)."/fgets_variation4.tmp";
+
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+
+ /* create files with $file_content_type */
+ $file_handle = fopen($filename, $file_mode);
+ $data = fill_file($file_handle, $file_content_type, 50);
+
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ echo "-- fgets() with location set by fseek() with default length --\n";
+ var_dump( fseek($file_handle, 5, SEEK_SET) );
+ var_dump( ftell($file_handle) );
+ var_dump( fgets($file_handle ) );
+ var_dump( ftell($file_handle) ); // ensure the file pointer position
+ var_dump( feof($file_handle) ); // enusre if eof set
+
+ echo "-- fgets() with location set by fseek() with length = 20 --\n";
+ var_dump( fseek($file_handle, 25, SEEK_SET) );
+ var_dump( ftell($file_handle) );
+ var_dump( fgets($file_handle, 20 ) ); // expected 19 chars
+ 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 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("w+", "w+b", "w+t",
+ "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+$filename = dirname(__FILE__)."/fgets_variation4.tmp";
+
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+
+ /* create files with $file_content_type */
+ $file_handle = fopen($filename, $file_mode);
+ $data = fill_file($file_handle, $file_content_type, 50);
+
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ echo "-- fgets() with location set by fseek() with default length --\n";
+ var_dump( fseek($file_handle, 5, SEEK_SET) );
+ var_dump( ftell($file_handle) );
+ var_dump( fgets($file_handle ) );
+ var_dump( ftell($file_handle) ); // ensure the file pointer position
+ var_dump( feof($file_handle) ); // enusre if eof set
+
+ echo "-- fgets() with location set by fseek() with length = 20 --\n";
+ var_dump( fseek($file_handle, 25, SEEK_SET) );
+ var_dump( ftell($file_handle) );
+ var_dump( fgets($file_handle, 20 ) ); // expected 19 chars
+ 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 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--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("w+", "w+b", "w+t",
+ "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+$filename = dirname(__FILE__)."/fgets_variation5.tmp";
+
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+
+ /* create files with $file_content_type */
+ $file_handle = fopen($filename, $file_mode);
+ $data = fill_file($file_handle, $file_content_type, 50);
+
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ /* read with length beyong file size */
+ echo "-- fgets() with length > 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--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("w+", "w+b", "w+t",
+ "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+$filename = dirname(__FILE__)."/fgets_variation4.tmp";
+
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+
+ /* create files with $file_content_type */
+ $file_handle = fopen($filename, $file_mode);
+ $data = fill_file($file_handle, $file_content_type, 50);
+
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ echo "-- fgets() with file pointer pointing at EOF --\n";
+ // seek to end of the file and try fgets()
+ var_dump( fseek($file_handle, 0, SEEK_END) ); // set file pointer to eof
+ var_dump( ftell($file_handle) ); // ensure that file pointer is at eof
+ var_dump( feof($file_handle) ); // expected false
+
+ var_dump( fgets($file_handle) ); // try n read a line, none expected
+ var_dump( ftell($file_handle) ); // file pointer position
+ var_dump( feof($file_handle) ); // ensure thta file pointer is at eof
+
+ //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 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--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgets ( resource $handle [, int $length] );
+ Description: Gets a line from file pointer
+*/
+
+// include the file.inc for common test funcitons
+include ("file.inc");
+
+$file_modes = array("w+", "w+b", "w+t",
+ "a+", "a+b", "a+t",
+ "x+", "x+b", "x+t");
+
+$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric");
+
+echo "*** Testing fgets() : usage variations ***\n";
+
+$filename = dirname(__FILE__)."/fgets_variation4.tmp";
+
+foreach($file_modes as $file_mode) {
+ echo "\n-- Testing fgets() with file opened using mode $file_mode --\n";
+
+ foreach($file_content_types as $file_content_type) {
+ echo "-- File content type : $file_content_type --\n";
+
+ /* create files with $file_content_type */
+ $file_handle = fopen($filename, $file_mode);
+ $data = fill_file($file_handle, $file_content_type, 50);
+
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ echo "-- fgets() with file pointer pointing at EOF --\n";
+ // seek to end of the file and try fgets()
+ var_dump( fseek($file_handle, 0, SEEK_END) ); // set file pointer to eof
+ var_dump( ftell($file_handle) ); // ensure that file pointer is at eof
+ var_dump( feof($file_handle) ); // expected false
+
+ var_dump( fgets($file_handle) ); // try n read a line, none expected
+ var_dump( ftell($file_handle) ); // file pointer position
+ var_dump( feof($file_handle) ); // ensure thta file pointer is at eof
+
+ //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 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--
+<?php
+
+$filename = dirname(__FILE__)."/fgetss.html";
+
+$array = array(
+ "askasdfasdf<b>aaaaaa\n</b>dddddd",
+ "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
+ "aaa<script>function foo() {}</script>qqq",
+ "asdasd<a\n asdjeje",
+ "",
+ "some text \n<b>blah</i>",
+ "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--
+<?php
+
+$filename = dirname(__FILE__)."/fgetss1.html";
+
+$array = array(
+ "askasdfasdf<b>aaaaaa\n</b>dddddd",
+ "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
+ "aaa<script>function foo() {}</script>qqq",
+ "asdasd<a\n asdjeje",
+ "",
+ "some text \n<b>blah</i>",
+ "some another text <> hoho </>"
+ );
+
+foreach ($array as $str) {
+ file_put_contents($filename, $str);
+ $fp = fopen($filename, "r");
+ var_dump(fgetss($fp, 1000, "<i>,<b>,<a>"));
+ 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, "<script>,<a>"));
+}
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(21) "askasdfasdf<b>aaaaaa
+"
+string(6) "dddddd"
+string(28) "asdqw<i onClick="hello();">
+"
+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(9) "t>functio"
+string(6) "asdasd"
+string(0) ""
+bool(false)
+bool(false)
+string(9) "some text"
+string(2) "
+"
+string(9) "some anot"
+string(9) "her text "
+Done
diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt
new file mode 100644
index 0000000..4c5881d
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_basic1.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test fgetss() function : Basic functionality - read modes only
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* test fgetss with all read modes */
+
+// include the common file related test functions
+include ("file.inc");
+
+echo "*** Testing fgetss() : Basic operations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+EOT;
+
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $string_with_tags = str_replace("\r",'', $string_with_tags);
+}
+/* try reading the file opened in different modes of reading */
+$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $filename = dirname(__FILE__)."/fgetss_basic1.tmp";
+ create_file ($filename); //create an empty file
+ file_put_contents($filename, $string_with_tags);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle);
+ /* read entire file and strip tags */
+ echo "-- fgetss() with default length, file pointer at 0 --\n";
+ var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ rewind($file_handle);
+ /* read entire file and strip tags tags */
+ echo "-- fgets() with length = 30, file pointer at 0 --\n";
+ var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
+ var_dump( ftell($file_handle) ); // checking file pointer position initially
+ var_dump( feof($file_handle) ); // confirm file pointer is not at eof
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ delete_file($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing fgetss() : Basic operations ***
+
+-- Testing fgetss() with file opened using r mode --
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using rb mode --
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using rt mode --
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using r+ mode --
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using r+b mode --
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using r+t mode --
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt
new file mode 100644
index 0000000..9187fe5
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_basic2-win32.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test fgetss() function : Basic functionality - read/write modes
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only on Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgetss on files which are opened in read/write modes
+ w+, w+b, w+t,
+ a+, a+b, a+t,
+ x+, x+b, x+t
+*/
+
+
+echo "*** Testing fgetss() : basic operations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+EOT;
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $string_with_tags = str_replace("\r",'', $string_with_tags);
+}
+$filename = dirname(__FILE__)."/fgetss_basic2.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags); //writing data to the file
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ /* read entire file and strip tags */
+ echo "-- fgetss() with default length, file pointer at 0 --\n";
+ var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ rewind($file_handle);
+ /* read entire file and strip tags tags */
+ echo "-- fgets() with length = 30, file pointer at 0 --\n";
+ var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
+ var_dump( ftell($file_handle) ); // checking file pointer position initially
+ var_dump( feof($file_handle) ); // confirm file pointer is not at eof
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : basic operations ***
+
+-- Testing fgetss() with file opened using w+ mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using w+b mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using w+t mode --
+int(195)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using a+ mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using a+b mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using a+t mode --
+int(195)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using x+ mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using x+b mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using x+t mode --
+int(195)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt
new file mode 100644
index 0000000..63fdde8
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_basic2.phpt
@@ -0,0 +1,214 @@
+--TEST--
+Test fgetss() function : Basic functionality - read/write modes
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgetss on files which are opened in read/write modes
+ w+, w+b, w+t,
+ a+, a+b, a+t,
+ x+, x+b, x+t
+*/
+
+
+echo "*** Testing fgetss() : basic operations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+EOT;
+
+$filename = dirname(__FILE__)."/fgetss_basic2.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags); //writing data to the file
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ /* read entire file and strip tags */
+ echo "-- fgetss() with default length, file pointer at 0 --\n";
+ var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ rewind($file_handle);
+ /* read entire file and strip tags tags */
+ echo "-- fgets() with length = 30, file pointer at 0 --\n";
+ var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
+ var_dump( ftell($file_handle) ); // checking file pointer position initially
+ var_dump( feof($file_handle) ); // confirm file pointer is not at eof
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : basic operations ***
+
+-- Testing fgetss() with file opened using w+ mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using w+b mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using w+t mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using a+ mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using a+b mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using a+t mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using x+ mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using x+b mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+
+-- Testing fgetss() with file opened using x+t mode --
+int(192)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 --
+string(27) "Testing fgetss() functions
+"
+int(40)
+bool(false)
+-- fgets() with length = 30, file pointer at 0 --
+string(23) "Testing fgetss() functi"
+int(29)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt
new file mode 100644
index 0000000..3691e96
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_error.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Test fgetss() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+echo "*** Testing error conditions ***\n";
+// zero argument
+echo "-- Testing fgetss() with zero argument --\n";
+var_dump( fgetss() );
+
+// more than expected no. of args
+echo "-- Testing fgetss() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( fgetss($fp, 100, '<p><a>', $fp) );
+
+// invalid length argument
+echo "-- Testing fgetss() with invalid length arguments --\n";
+$len = 0;
+$allowable_tags = '<p><a>';
+var_dump( fgetss($fp, $len, $allowable_tags) );
+$len = -10;
+var_dump( fgetss($fp, $len, $allowable_tags) );
+$len = 1;
+var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false
+
+// test invalid arguments : non-resources
+echo "-- Testing fgetss() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fgetss() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) );
+}
+// fgetss() on a file handle which is already closed
+echo "-- Testing fgetss() with closed/unset file handle --";
+fclose($fp);
+var_dump(fgetss($fp,10,$allowable_tags));
+
+// fgetss() on a file handle which is unset
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle); //unset file handle
+var_dump( fgetss(@$file_handle,10));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+-- Testing fgetss() with zero argument --
+
+Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+-- Testing fgetss() with more than expected number of arguments --
+
+Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+-- Testing fgetss() with invalid length arguments --
+
+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)
+bool(false)
+-- Testing fgetss() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: fgetss() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: fgetss() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: fgetss() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing fgetss() with closed/unset file handle --
+Warning: fgetss(): 5 is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt
new file mode 100644
index 0000000..0aca5d3
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation1-win32.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test fgetss() function : usage variations - write only modes
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only on Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgets on files which are opened in non readable modes
+ w, wb, wt,
+ a, ab, at,
+ x, xb, xt
+*/
+
+// include the common file related test functions
+include ("file.inc");
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $string_with_tags = str_replace("\r",'', $string_with_tags);
+}
+
+$filename = dirname(__FILE__)."/fgetss_variation1.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ /* read entire file and strip tags */
+ echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n";
+ var_dump( fgetss($file_handle) ); // expected : no character should be read
+ var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed
+ var_dump( feof($file_handle) ); // check if end of file pointer is set
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ delete_file($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using w mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using wb mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using wt mode --
+int(453)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using a mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using ab mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using at mode --
+int(453)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using x mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using xb mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using xt mode --
+int(453)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt
new file mode 100644
index 0000000..d85b095
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation1.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test fgetss() function : usage variations - write only modes
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgets on files which are opened in non readable modes
+ w, wb, wt,
+ a, ab, at,
+ x, xb, xt
+*/
+
+// include the common file related test functions
+include ("file.inc");
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+$filename = dirname(__FILE__)."/fgetss_variation1.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ /* read entire file and strip tags */
+ echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n";
+ var_dump( fgetss($file_handle) ); // expected : no character should be read
+ var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed
+ var_dump( feof($file_handle) ); // check if end of file pointer is set
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ delete_file($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using w mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using wb mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using wt mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using a mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using ab mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using at mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using x mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using xb mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+
+-- Testing fgetss() with file opened using xt mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- fgetss() with default length, file pointer at 0 , expected : no character should be read --
+bool(false)
+int(0)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt
new file mode 100644
index 0000000..d155f08
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation2.phpt
@@ -0,0 +1,434 @@
+--TEST--
+Test fgetss() function : usage variations - read modes
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+// include the common file related test functions
+include ("file.inc");
+
+/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this is the text containing \r character
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+$filename = dirname(__FILE__)."/fgetss_variation2.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ create_file ($filename); //create an empty file
+ file_put_contents($filename, $string_with_tags);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ /* rewind the file and read the file line by line with allowable tags */
+ echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
+ rewind($file_handle);
+ $line = 1;
+ while( !feof($file_handle) ) {
+ echo "-- Line $line --\n"; $line++;
+ var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
+ var_dump( ftell($file_handle) ); // check the file pointer position
+ var_dump( feof($file_handle) ); // check if eof reached
+ }
+
+ // close the file
+ fclose($file_handle);
+ // delete the file
+ delete_file($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using r mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(41) "this is the text containing character
+"
+int(383)
+bool(false)
+-- Line 9 --
+string(46) "this text contains some html tags body br
+"
+int(451)
+bool(false)
+-- Line 10 --
+string(23) "this is the line with
+"
+int(474)
+bool(false)
+-- Line 11 --
+string(12) " character. "
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using rb mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(41) "this is the text containing character
+"
+int(383)
+bool(false)
+-- Line 9 --
+string(46) "this text contains some html tags body br
+"
+int(451)
+bool(false)
+-- Line 10 --
+string(23) "this is the line with
+"
+int(474)
+bool(false)
+-- Line 11 --
+string(12) " character. "
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using rt mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(41) "this is the text containing character
+"
+int(383)
+bool(false)
+-- Line 9 --
+string(46) "this text contains some html tags body br
+"
+int(451)
+bool(false)
+-- Line 10 --
+string(23) "this is the line with
+"
+int(474)
+bool(false)
+-- Line 11 --
+string(12) " character. "
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using r+ mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(41) "this is the text containing character
+"
+int(383)
+bool(false)
+-- Line 9 --
+string(46) "this text contains some html tags body br
+"
+int(451)
+bool(false)
+-- Line 10 --
+string(23) "this is the line with
+"
+int(474)
+bool(false)
+-- Line 11 --
+string(12) " character. "
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using r+b mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(41) "this is the text containing character
+"
+int(383)
+bool(false)
+-- Line 9 --
+string(46) "this text contains some html tags body br
+"
+int(451)
+bool(false)
+-- Line 10 --
+string(23) "this is the line with
+"
+int(474)
+bool(false)
+-- Line 11 --
+string(12) " character. "
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using r+t mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(41) "this is the text containing character
+"
+int(383)
+bool(false)
+-- Line 9 --
+string(46) "this text contains some html tags body br
+"
+int(451)
+bool(false)
+-- Line 10 --
+string(23) "this is the line with
+"
+int(474)
+bool(false)
+-- Line 11 --
+string(12) " character. "
+int(486)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt
new file mode 100644
index 0000000..7539b36
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation3-win32.phpt
@@ -0,0 +1,571 @@
+--TEST--
+Test fgetss() function : usage variations - read/write modes
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgetss on files which are opened in read/write modes
+ w+, w+b, w+t,
+ a+, a+b, a+t,
+ x+, x+b, x+t
+ reading line by line with allowable tags: <test>, <html>, <?>
+*/
+
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $string_with_tags = str_replace("\r",'', $string_with_tags);
+}
+
+$filename = dirname(__FILE__)."/fgetss_variation3.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags); //writing data to the file
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ rewind($file_handle);
+ var_dump( ftell($file_handle) );
+ var_dump( filesize($filename) );
+ var_dump( feof($file_handle) );
+
+ /* rewind the file and read the file line by line with allowable tags */
+ echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
+ $line = 1;
+ while( !feof($file_handle) ) {
+ echo "-- Line $line --\n"; $line++;
+ var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
+ var_dump( ftell($file_handle) ); // check the file pointer position
+ var_dump( feof($file_handle) ); // check if eof reached
+ }
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using w+ mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+b mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+t mode --
+int(0)
+int(453)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+ mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+b mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+t mode --
+int(0)
+int(453)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+ mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+b mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+t mode --
+int(0)
+int(453)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt
new file mode 100644
index 0000000..5b339a1
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation3.phpt
@@ -0,0 +1,567 @@
+--TEST--
+Test fgetss() function : usage variations - read/write modes
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgetss on files which are opened in read/write modes
+ w+, w+b, w+t,
+ a+, a+b, a+t,
+ x+, x+b, x+t
+ reading line by line with allowable tags: <test>, <html>, <?>
+*/
+
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+$filename = dirname(__FILE__)."/fgetss_variation3.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags); //writing data to the file
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ rewind($file_handle);
+ var_dump( ftell($file_handle) );
+ var_dump( filesize($filename) );
+ var_dump( feof($file_handle) );
+
+ /* rewind the file and read the file line by line with allowable tags */
+ echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
+ $line = 1;
+ while( !feof($file_handle) ) {
+ echo "-- Line $line --\n"; $line++;
+ var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
+ var_dump( ftell($file_handle) ); // check the file pointer position
+ var_dump( feof($file_handle) ); // check if eof reached
+ }
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using w+ mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+b mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+t mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+ mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+b mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+t mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+ mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+b mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+t mode --
+int(0)
+int(445)
+bool(false)
+-- Reading line by line with allowable tags: <test>, <html>, <?> --
+-- Line 1 --
+string(40) "<test>Testing fgetss() functions</test>
+"
+int(40)
+bool(false)
+-- Line 2 --
+string(10) " {;} this
+"
+int(99)
+bool(false)
+-- Line 3 --
+string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
+"
+int(152)
+bool(false)
+-- Line 4 --
+string(21) "<html> html </html>
+"
+int(193)
+bool(false)
+-- Line 5 --
+string(43) "this line is without any html and php tags
+"
+int(236)
+bool(false)
+-- Line 6 --
+string(79) "this is a line with more than eighty character,want to check line splitting cor"
+int(315)
+bool(false)
+-- Line 7 --
+string(27) "rectly after 80 characters
+"
+int(342)
+bool(false)
+-- Line 8 --
+string(46) "this text contains some html tags body br
+"
+int(410)
+bool(false)
+-- Line 9 --
+string(23) "this is the line with
+"
+int(433)
+bool(false)
+-- Line 10 --
+string(12) " character. "
+int(445)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt
new file mode 100644
index 0000000..6c201d1
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation4.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test fgetss() function : usage variations - read modes, file pointer at EOF
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip not for Windows");
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+// include the common file related test functions
+include ("file.inc");
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this is the text containing \r character
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+$filename = dirname(__FILE__)."/fgetss_variation4.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ create_file ($filename); //create an empty file
+ file_put_contents($filename, $string_with_tags);
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ echo "-- Reading when file pointer points to EOF --\n";
+ var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
+ var_dump( ftell($file_handle) ); //ensure file pointer at end
+ var_dump( fgetss($file_handle) ); // try to read
+ var_dump( ftell($file_handle) ); // find out file position
+ var_dump( feof($file_handle) ); // ensure that file pointer is at eof
+
+ // now file is at the end try reading with length and allowable tags,expecting false
+ var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
+ var_dump( ftell($file_handle) ); // find out file position
+ var_dump( feof($file_handle) ); // ensure that file pointer is at eof
+
+ // close the file
+ fclose($file_handle);
+ // delete the file
+ delete_file($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using r mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(486)
+bool(false)
+int(486)
+bool(true)
+bool(false)
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using rb mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(486)
+bool(false)
+int(486)
+bool(true)
+bool(false)
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using rt mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(486)
+bool(false)
+int(486)
+bool(true)
+bool(false)
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using r+ mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(486)
+bool(false)
+int(486)
+bool(true)
+bool(false)
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using r+b mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(486)
+bool(false)
+int(486)
+bool(true)
+bool(false)
+int(486)
+bool(true)
+
+-- Testing fgetss() with file opened using r+t mode --
+int(486)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(486)
+bool(false)
+int(486)
+bool(true)
+bool(false)
+int(486)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt
new file mode 100644
index 0000000..cedc7b9
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation5-win32.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test fgetss() function : usage variations - read/write modes, file pointer at EOF
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgetss on files which are opened in read/write modes
+ w+, w+b, w+t,
+ a+, a+b, a+t,
+ x+, x+b, x+t
+*/
+
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $string_with_tags = str_replace("\r",'', $string_with_tags);
+}
+
+$filename = dirname(__FILE__)."/fgetss_variation5.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags); //writing data to the file
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ echo "-- Reading when file pointer points to EOF --\n";
+ var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
+ var_dump( ftell($file_handle) ); //ensure file pointer at end
+ var_dump( fgetss($file_handle) ); // try to read
+ var_dump( ftell($file_handle) ); // find out file position
+ var_dump( feof($file_handle) ); // ensure that file pointer is at eof
+
+ // now file is at the end try reading with length and allowable tags,expecting false
+ var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
+ var_dump( ftell($file_handle) ); // find out file position
+ var_dump( feof($file_handle) ); // ensure that file pointer is at eof
+
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using w+ mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+b mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+t mode --
+int(453)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(453)
+bool(false)
+int(453)
+bool(true)
+bool(false)
+int(453)
+bool(true)
+
+-- Testing fgetss() with file opened using a+ mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+b mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+t mode --
+int(453)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(453)
+bool(false)
+int(453)
+bool(true)
+bool(false)
+int(453)
+bool(true)
+
+-- Testing fgetss() with file opened using x+ mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+b mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+t mode --
+int(453)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(453)
+bool(false)
+int(453)
+bool(true)
+bool(false)
+int(453)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt
new file mode 100644
index 0000000..ea53382
--- /dev/null
+++ b/ext/standard/tests/file/fgetss_variation5.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test fgetss() function : usage variations - read/write modes, file pointer at EOF
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
+ Description: Gets line from file pointer and strip HTML tags
+*/
+
+/* try fgetss on files which are opened in read/write modes
+ w+, w+b, w+t,
+ a+, a+b, a+t,
+ x+, x+b, x+t
+*/
+
+
+echo "*** Testing fgetss() : usage variations ***\n";
+
+/* string with html and php tags */
+$string_with_tags = <<<EOT
+<test>Testing fgetss() functions</test>
+<?php echo "this string is within php tag"; ?> {;}<{> this
+is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
+<html> html </html> <?php echo "php"; ?>
+this line is without any html and php tags
+this is a line with more than eighty character,want to check line splitting correctly after 80 characters
+this text contains some html tags <body> body </body> <br> br </br>
+this is the line with \n character.
+EOT;
+
+$filename = dirname(__FILE__)."/fgetss_variation5.tmp";
+
+/* try reading the file opened in different modes of reading */
+$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
+
+for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
+
+ /* create an empty file and write the strings with tags */
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fwrite($file_handle,$string_with_tags); //writing data to the file
+ if(!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+ // rewind the file pointer to begining of the file
+ var_dump( filesize($filename) );
+ var_dump( rewind($file_handle) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ echo "-- Reading when file pointer points to EOF --\n";
+ var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
+ var_dump( ftell($file_handle) ); //ensure file pointer at end
+ var_dump( fgetss($file_handle) ); // try to read
+ var_dump( ftell($file_handle) ); // find out file position
+ var_dump( feof($file_handle) ); // ensure that file pointer is at eof
+
+ // now file is at the end try reading with length and allowable tags,expecting false
+ var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
+ var_dump( ftell($file_handle) ); // find out file position
+ var_dump( feof($file_handle) ); // ensure that file pointer is at eof
+
+
+ // close the file
+ fclose($file_handle);
+
+ // delete the file
+ unlink($filename);
+} // end of for - mode_counter
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetss() : usage variations ***
+
+-- Testing fgetss() with file opened using w+ mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+b mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using w+t mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+ mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+b mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using a+t mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+ mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+b mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+
+-- Testing fgetss() with file opened using x+t mode --
+int(445)
+bool(true)
+int(0)
+bool(false)
+-- Reading when file pointer points to EOF --
+int(0)
+int(445)
+bool(false)
+int(445)
+bool(true)
+bool(false)
+int(445)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc
new file mode 100644
index 0000000..c0f86e7
--- /dev/null
+++ b/ext/standard/tests/file/file.inc
@@ -0,0 +1,650 @@
+<?php
+/* Header file for common file test functions
+ Following functions are provided :
+ create_files() : create files with specified contents
+ delete_files() : delete files
+ create_links() : crate links of different types
+ delete_links() : delete links
+ fill_files() : fill file with specified contents
+ change_file_perms() : Change permission of files
+ fill_buffer() : fills buffer with specified contents
+ compare_self_stat() : compares the first 13 elements of the
+ stat with the corresponding named key values of
+ the same stat.
+ compare_stats() : Compares two stat values
+
+*/
+
+define('file_not_found', 2, 1);
+
+/*
+ Function: bool create_file(string $filename, string $mode = "w");
+ Description: creates a new file using fopen() call
+ $filename = Name of the file
+ $mode = Mode as specified in fopen call, read documentation of fopen() call for more info
+
+ Returns:
+ true on success, false otherwise
+*/
+function create_file($filename, $mode = "w") {
+ $file_handle = fopen ($filename, $mode);
+ if ( $file_handle == false )
+ return false;
+ fclose($file_handle);
+ return true;
+}
+
+/*
+ Function : bool fill_buffer(string &$buffer, string $fill_type, int $fill_size);
+ Description: Fills the $buffer with data as specified with requested size.
+ $buffer = buffer to be filled
+ $fill_type:
+ "text" = fills with string of size $file_size
+ "numeric" = fills with numeric value of size $file_size
+ "text_with_new_line" = similar to "text" fill type but writes with new line
+ "alphanumeric" = fills with alphnumeric values
+ Returns: true on success, false on invalid fill type
+*/
+function fill_buffer(&$buffer, $fill_type, $fill_size) {
+
+ if ( $fill_type == "text" ) {
+ $data = "text ";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "text_with_new_line" ) {
+ $data = "line\nline of text\n";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "alphanumeric" ) {
+ $data = "ab12 ";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "numeric" ) {
+ $data = 2;
+ $size_divider = 1;
+ $add_value = 0;
+ } else {
+ // invalid fill type;
+ return false;
+ }
+
+ $tmp_buff = str_repeat($data, ($fill_size/$size_divider) + $add_value );
+
+ if ( strlen($tmp_buff) > $fill_size ) {
+ $buffer = substr($tmp_buff, 0, $fill_size);
+ } else {
+ $buffer = $tmp_buff;
+ }
+
+ return true;
+}
+
+/*
+ Function : bool fill_file(resource $file_handle, string $fill_type, string $file_size);
+ Description: Fills the file with data as specified with requested size.
+ $file_handle = file handle, opened with write options,
+ $fill_type:
+ "text" = fills with string of size $file_size
+ "numeric" = fills with numeric value of size $file_size
+ "empty" = no fill operation performed, returns true
+ "text_with_new_line" = similar to "text" fill type but writes with new line
+ "alphanumeric" = fills with alphnumeric values
+ Returns: true on success, false on failure & invalid fill type
+*/
+
+function fill_file($file_handle, $fill_type, $file_size) {
+
+ if ( $fill_type == "empty" ) {
+ // no fill required, return true
+ return true;
+ } if ( $fill_type == "text" ) {
+ $data = "text ";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "text_with_new_line" ) {
+ $data = "line\nline of text\n";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "alphanumeric" ) {
+ $data = "ab12 ";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "numeric" ) {
+ $data = 2;
+ $size_divider = 1;
+ $add_value = 0;
+ } else {
+ // invalid fill type;
+ return false;
+ }
+
+ // write in terms of a chunk of 1 K to avoid memory size overflow
+ $size = $file_size;
+ $chunk_size = 1024;
+ if ( $size > $chunk_size ) {
+ $loop_count = 1;
+ do {
+ $loop_count ++;
+ if ( $size <= $chunk_size ) {
+ $chunk_size = $size;
+ }
+ $num_values = str_repeat($data, ($chunk_size/$size_divider) + $add_value );
+ $bytes_written = fwrite($file_handle, $num_values, $chunk_size);
+ if ( $bytes_written != $chunk_size ) {
+ return false;
+ }
+ $size -= $chunk_size;
+ } while ( $size > 0 );
+ } else {
+ $num_values = str_repeat($data, ($chunk_size/$size_divider) + $add_value );
+ $bytes_written = fwrite($file_handle, $num_values, $file_size);
+ if ( $bytes_written != $file_size ) {
+ return false;
+ }
+ }
+
+ // successful, return true
+ return true;
+}
+
+/*
+ Function: int change_file_perms(string $file_path, int $count = 1, int $perms = 0755,
+ string $name_prefix = "file",
+ string $name_suffix = 1, $file_extension = ".tmp");
+ Description: changes file permission for given file(s).
+ $file_path = dir path where file exists
+ $count = no. of files, default is 1
+ $perms = new permission of the file, similar to $mode args of chmod() call
+ $name_prefix = common name prefix, default is "file"
+ $name_suffix = suffix to end the common name given in name_prefix to create
+ a unique name. default is 1.
+ $file_extension = default is .tmp
+ Returns:
+ Integer, Count of total files permission changed.
+*/
+function change_file_perms($file_path,
+ $count = 1,
+ $perms = 0755,
+ $name_prefix = "file",
+ $name_suffix = 1,
+ $file_extension = ".tmp" )
+{
+ $changed = 0;
+
+ if( $count <= 0 )
+ return $changed;
+
+ if ( $name_suffix <= 0)
+ $name_suffix = 1;
+
+ for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) {
+ $filename = $file_path."/".$name_prefix.$name_suffix.$file_extension;
+ if( chmod($filename, $perms) )
+ $changed++;
+ $name_suffix++;
+ }
+ return $changed;
+}
+
+/*
+ Function: array create_files( string $file_path,
+ int $count = 1,
+ string $content_type = "numeric",
+ int $permission = 0755,
+ int $size = 1,
+ string $mode = "w",
+ string $name_prefix = "file",
+ int $name_suffix = 1,
+ string $flag = "kilobytes"
+ string $file_extension = ".tmp"
+ );
+ Description: Creates given number of files with specified mode and
+ permissions. File is filled with content of size specified.
+ $file_path = dir where files will be created
+ $name_prefix = prefix to be used for names, name is suffix with a
+ unqiue numeric value to make the file name unique, default = file
+ $name_suffix = suffix to be used for the name, default = 1
+ $count = total no. of files to be created, default = 1
+ $mode = file open mode as specified in fopen() call. Do not use
+ modes used for only reading the file. Default = "w"
+ $permission = An octal number, This should be similar to $mode
+ specified in chmod() call.
+ $content_type = Specify type of the content to fill in the file.
+ "numeric" = fill file with numeric vlaues
+ "text" = fill file with regular text
+ "empty" = empty file
+ "text_with_new_line" = similar to text fill type, but writes with new line char
+ "alphanumeric" = fill file with alpha numeric text
+ If imporper $content type is specified, file is created as empty
+ $size = size of the fill in terms of kilobyte, i.e size of the file.
+ if $flag is specified as "byte", then then given size is taken in bytes
+ $flag = specifiy if size has to be treated as no of total bytes or
+ multiple of KB.
+ "kilobytes" = take size in terms of multiple of KB
+ "byte" = take size in terms of bytes
+ $file_extension = default is .tmp
+
+ Returns:
+ An array with following key value pair:
+ created => total file created
+ filled => total files filled
+ perms_changed => total files permission changed
+*/
+function create_files( $file_path,
+ $count = 1,
+ $content_type = "numeric",
+ $permission = 0755,
+ $size = 1,
+ $mode = "w",
+ $name_prefix = "file",
+ $name_suffix = 1,
+ $flag = "kilobytes",
+ $file_extension = ".tmp"
+ )
+{
+ $return_value = array('created' => 0, 'filled' => 0, 'perms_changed' => 0);
+
+ //ensure that suffix is a +ve integer
+ if ($name_suffix <= 0) {
+ $name_suffix = 1;
+ }
+
+ // check for proper size
+ if ( $size == 0 )
+ return $return_value;
+
+ // prepare the size based on flag
+ $file_size = $size;
+ if ( $flag == "kilobytes" ) {
+ $file_size = $file_size * 1024;
+ }
+
+ $tmp_name_suffix = $name_suffix;
+ // create the files with specified mode and permission
+ for($file_created_count = 1; $file_created_count <= $count; $file_created_count ++) {
+ $filename = $file_path."/".$name_prefix.$tmp_name_suffix.$file_extension;
+
+ $status = create_file($filename, $mode);
+
+ $tmp_name_suffix++;
+
+ if ($status == true) {
+ $return_value['created']++;
+ }
+ else {
+ return $return_value;
+ }
+ }
+
+ if ( $content_type == "empty" ) {
+ $return_value['filled'] = $count;
+ } else {
+ // fill the file with specifiec type of data and size
+ $tmp_name_suffix = $name_suffix;
+ for($loop_counter = 1; $loop_counter <= $count; $loop_counter ++) {
+ $filename = $file_path."/".$name_prefix.$tmp_name_suffix.$file_extension;
+ $file_handle = fopen($filename, $mode);
+ if($file_handle == false) {
+ fclose($file_handle);
+ return $return_value;
+ } // end of if
+
+ // call fill_file() to fill the file
+ if( fill_file($file_handle, $content_type, $file_size) )
+ $return_value['filled']++;
+
+ fclose($file_handle);
+
+ $tmp_name_suffix++;
+ } // end of for
+ }
+
+ // change all file's permissions
+ $return_value['perms_changed'] = change_file_perms($file_path, $count, $permission, $name_prefix,
+ $name_suffix, $file_extension);
+
+ return $return_value;
+}
+
+
+/*
+ Function: function create_links( $file_path,
+ $filename,
+ $link_count = 1,
+ $link_type = "soft",
+ $link_size = 1024,
+ $link_name_prefix = "link",
+ $link_name_suffix = 1,
+ $link_file_content = "text",
+ $link_perms = 0755,
+ $link_file_extension = ".tmp"
+ );
+
+ Description: Creates given number of links with specified mode and
+ permissions.Link is filled with content of size specified.
+ $file_path = location of the file and where links need to be created
+ $link_name_prefix = prefix to be used for names, name is suffix with a
+ unique numeric value to make the file name unique, default = link
+ $link_name_suffix = suffix to be used for the name, default = 1
+ $link_count = total no. of links to be created to given file, default = 1
+ $link_perms = An octal number, This should be similar to $mode
+ specified in chmod() call.
+ $link_file_content = Type of the content to fill in the file.
+ numeric = fill file with numeric vlaues
+ text = fill file with regular text
+ text_with_new_line = same as text but new lines are written
+ alphanumeric = fill with alphanumeric text
+ If imporper $content type is specified, file is created as empty
+ $size = size of the fill in terms of kilobyte, i.e size of the file.
+ $link_type = type of the link to be created
+ "soft" = soft link
+ "hard" = hard link
+ $filename = file used to create a link on
+
+ Returns:
+ An array with following key value pair:
+ created => total file created
+ filled => total files filled, always returned as 1
+ perms_changed => total files permission changed
+*/
+function create_links($file_path,
+ $filename,
+ $link_count = 1,
+ $link_type = "soft",
+ $link_size = 1024,
+ $link_name_prefix = "link",
+ $link_name_suffix = 1,
+ $link_file_content = "text",
+ $link_perms = 0755,
+ $link_file_extension = ".tmp"
+ )
+{
+ $return_value = array('created' => 0, 'filled' => 0, 'perms_changed' => 0);
+ $tmp_name_suffix = $link_name_suffix;
+ $src_filename = $file_path."/".$filename;
+ switch( $link_type ) {
+ default :
+ case "soft" : // create a soft link
+ for($link_created_count = 1; $link_created_count <= $link_count; $link_created_count++) {
+ $linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
+ $status = symlink( $src_filename, $linkname);
+ $tmp_name_suffix++;
+ if ($status) {
+ $return_value['created']++;
+ }
+ else {
+ $return_value;
+ }
+ }
+ break;
+
+ case "hard" : // create a hard link
+ for($link_created_count = 1; $link_created_count <= $link_count; $link_created_count++) {
+ $linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
+ $status = link($src_filename, $linkname);
+ $tmp_name_suffix++;
+ if ($status) {
+ $return_value['created']++;
+ }
+ else {
+ $return_value;
+ }
+ }
+ break;
+ }
+
+ if ( $link_file_content == "empty" ) {
+ $return_value['filled'] = 1;
+ return $return_value;
+ }
+
+ // fill the file with specific type of data and size
+ $tmp_name_suffix = $link_name_suffix;
+ $linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
+ $file_handle = fopen($linkname, "w");
+ if($file_handle == false) {
+ return $return_value;
+ } // end of if
+
+ // call fill_file() to fill the file
+ if( fill_file($file_handle, $link_file_content, $link_size) )
+ $return_value['filled']++;
+
+ // close the link
+ fclose($file_handle);
+
+ // change the permission of the link file, only if hard link.
+ // this is not applicable to soft links
+ if( $link_type == "hard" ) {
+ $return_value['perms_changed'] = change_file_perms($file_path,
+ $link_count,
+ $link_perms,
+ $link_name_prefix,
+ $link_name_suffix,
+ $link_file_extension );
+ }
+
+ return $return_value;
+}
+
+/*
+ Function: bool delete_file(string $filename);
+ Description: delete a given file if exists
+ Returns: true on success
+ false on failure
+ file_not_found if file doesn't exist
+*/
+function delete_file($filename) {
+ // check if file exists
+ if ( file_exists($filename) ) {
+ if ( unlink($filename) )
+ return true;
+ else
+ return false;
+ }
+ return file_not_found;
+}
+
+/*
+ Function: array delete_files(string $file_path, int $count = 1, string $name_prefix = "file",
+ int name_suffix = 1, $file_extension = ".tmp" );
+ Description: Deletes given number of files if exists.
+ $file_path = location of the files
+ $name_prefix = prefix for the filename, rest of the name is incremental(increment by 1 only)
+ numeric starting from suffix upto count
+ $count = number of files to be deleted
+ $name_suffix = first numeric suffix in the name
+ Returns: An array with following key/value pair
+ deleted = Number of files deleted.
+ notfound = Count of non existing file
+ failed = Count of failed to delete
+*/
+function delete_files($file_path,
+ $count = 1,
+ $name_prefix = "file",
+ $name_suffix = 1,
+ $file_extension = ".tmp")
+{
+ $return_value = array ('deleted' => 0, 'notfound' => 0, 'failed' => 0);
+
+ if ( $name_suffix < 1 )
+ $name_suffix = 1;
+ for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) {
+ $filename = $file_path."/".$name_prefix.$name_suffix.$file_extension;
+ $name_suffix++;
+ $status = delete_file($filename);
+ if($status == true) {
+ $return_value['deleted']++;
+ } else if($status == file_not_found) {
+ $return_value['notfound']++;
+ } else {
+ $return_value['failed']++;
+ }
+
+ } // end of for
+ return $return_value;
+}
+
+/*
+ Function: array delete_links( $file_path,
+ $link_file_count,
+ $link_name_prefix,
+ $link_name_suffix,
+ $link_file_extension );
+ Description: Deletes given number of links if exists. Uses delete_files() function
+ $file_path = location of link files
+ $link_file_count = Number of link files
+ $link_name_prefix = prefix for the linkname, rest of the name is incremental(increment by 1 only)
+ numeric starting from $link_name_suffix upto count
+ $link_name_suffix = first numeric suffix in the name
+
+ Returns: An array with following key/value pair
+ deleted = Number of links deleted.
+ notfound = Count of non existing link
+ failed = Count of failed to delete
+*/
+function delete_links($file_path,
+ $link_file_count = 1,
+ $link_name_prefix = "link",
+ $link_name_suffix = 1,
+ $link_file_extension = ".tmp")
+{
+ // call the delete files to delete links
+ $return_value = delete_files( $file_path,
+ $link_file_count,
+ $link_name_prefix,
+ $link_name_suffix,
+ $link_file_extension );
+ return $return_value;
+}
+
+
+
+/*
+ Prototype:
+ function compare_self_stat( array $stat );
+ Description:
+ Compares the each of the first 13 values of the stat array with the
+ corresponding next 13 values of the same stat for equality
+ $stat = stat array
+
+ Retuns: true when all of them match, false otherwise
+*/
+function compare_self_stat( array $stat )
+{
+ //return value
+ $return_value = true;
+
+ // named keys present in a stat
+ $string_keys = array("dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "ctime",
+ "blksize", "blocks");
+
+ // first numeric key
+ $key = 0;
+
+ // compare the values in the stat, which are accessed using numeric key with
+ // values accessed using string keys
+ foreach($string_keys as $str_key)
+ {
+ if($stat[$key] != $stat[$str_key]) {
+ echo "Error: stat[$key] doesn't match with stat[$str_key]\n";
+ $flag = false;
+ $key++;
+ }
+ else {
+ $key++;
+ }
+ } // end of foreach
+
+ // if the $return_value is false, i.e all the element do not match then
+ // dump the stat array so that its easy to figure out the error
+ if ($return_value == false ) {
+ echo "\n Dumping stat array ...\n";
+ var_dump($stat);
+ }
+
+ return $return_value;
+}// end of compare_self_stat
+
+/*
+Prototype:
+ function compare_stats( array $stat1, array $stat2, array $fields,
+ [string $op = "==", [ bool $flag = false] ]);
+Description:
+ Compares two stat values, stat value should be obtained by stat/lstat
+ $stat1 = first stat array
+ $stat2 = second stat array
+ $op = type of the comparision to be perform between elements of stat1 and stat2
+ "!=" compare for not equal
+ "==" compare for equality
+ ">" if each element of stat1 is > than stat2
+ "<" if each element of stat1 is < than stat2
+ $fields = contains the key of the elements that needs to be compared.
+ type of the comparision is based on $op argument value
+ $flag = specify true to dump the stat1 and stat2
+*/
+
+$all_stat_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ "dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "ctime",
+ "blksize", "blocks");
+
+function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
+ // dump the stat if requested
+ if ( $flag == true ) {
+ var_dump($stat1);
+ var_dump($stat2);
+ }
+
+ $result = true;
+
+ // compare values of given key from each stat array
+ for($index = 0; $index < count($fields); $index++)
+ {
+ switch( $op )
+ {
+ case "==":
+ if ( $stat1[ $fields[$index] ] != $stat2[ $fields[$index] ] ) {
+ $result = false;
+ echo "Error: stat1 do not match with stat2 at key value: $fields[$index]\n";
+ }
+ break;
+
+ case "!=":
+ if ( $stat1[ $fields[$index] ] != $stat2[ $fields[$index] ] ) {
+ // do nothing as its not equal, else will take care of if equal
+ } else {
+ $result = false;
+ echo "Error: stat1 equals stat2 at key value: $fields[$index]\n";
+ }
+ break;
+
+ case ">":
+ if ( $stat1[ $fields[$index] ] <= $stat2[ $fields[$index] ] ) {
+ $result = false;
+ echo "Error: stat1 is not greater than stat2 at key value: $fields[$index]\n";
+ }
+ break;
+
+ case "<":
+ if ( $stat1[ $fields[$index] ] >= $stat2[ $fields[$index] ] ) {
+ $result = false;
+ echo "Error: stat1 is not lesser than stat2 at key value: $fields[$index]\n";
+ }
+ break;
+ }
+ }
+ // if the result is false(i.e values are not as expected),
+ // dump the stat array so that easy to figure out the error
+ if ( $result == false ) {
+ echo "\n Dumping stat array 1...\n";
+ var_dump($stat1);
+ echo "\n Dumping stat array 2...\n";
+ var_dump($stat2);
+ }
+
+ return $result;
+}
+
+?>
diff --git a/ext/standard/tests/file/file_basic.phpt b/ext/standard/tests/file/file_basic.phpt
new file mode 100644
index 0000000..97a592f
--- /dev/null
+++ b/ext/standard/tests/file/file_basic.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test file() function : basic functionality
+--FILE--
+<?php
+/*
+ * Prototype: array file ( string filename [,int use-include_path [,resource context]] );
+ * Description: Reads entire file into an array
+ * Returns the file in an array
+ */
+require(dirname(__FILE__) . '/file.inc');
+$file_path = dirname(__FILE__);
+echo "*** Testing file() with basic types of files ***\n";
+$filetypes = array("numeric", "text", "empty", "text_with_new_line");
+
+foreach( $filetypes as $type ) {
+ create_files($file_path, 1, $type, 0755, 100, "w", "file_basic", 1, "byte");
+ print_r( file($file_path."/file_basic1.tmp") );
+ delete_files($file_path, 1, "file_basic");
+}
+
+echo "*** Testing for return type of file() function ***\n";
+foreach( $filetypes as $type ) {
+ create_files($file_path, 1, $type, 0755, 1, "w", "file_basic");
+ $ret_arr = file($file_path."/file_basic1.tmp");
+ var_dump( is_array($ret_arr) );
+ delete_files($file_path, 1, "file_basic");
+}
+
+echo "\n--- Done ---";
+?>
+--EXPECTF--
+*** Testing file() with basic types of files ***
+Array
+(
+ [0] => 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+)
+Array
+(
+ [0] => text text text text text text text text text text text text text text text text text text text text
+)
+Array
+(
+)
+Array
+(
+ [0] => line
+
+ [1] => line of text
+
+ [2] => line
+
+ [3] => line of text
+
+ [4] => line
+
+ [5] => line of text
+
+ [6] => line
+
+ [7] => line of text
+
+ [8] => line
+
+ [9] => line of text
+
+ [10] => line
+
+ [11] => line
+)
+*** Testing for return type of file() function ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
+
diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt
new file mode 100644
index 0000000..c3130c3
--- /dev/null
+++ b/ext/standard/tests/file/file_error.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test file() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: array file ( string filename [,int use-include_path [,resource context]] );
+ Description: Reads entire file into an array
+ Returns the file in an array
+*/
+$file_path = dirname(__FILE__);
+echo "\n*** Testing error conditions ***";
+$file_handle = fopen($file_path."/file.tmp", "w");
+var_dump( file() ); // Zero No. of args
+
+$filename = $file_path."/file.tmp";
+var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments
+
+var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag
+var_dump( file($filename, 10, NULL) ); // Incorrect flag
+
+var_dump( file("temp.tmp") ); // non existing filename
+fclose($file_handle);
+
+echo "\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/file.tmp");
+?>
+--EXPECTF--
+*** Testing error conditions ***
+Warning: file() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: file() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+Warning: file() expects parameter 2 to be long, string given in %s on line %d
+NULL
+array(0) {
+}
+
+Warning: file(temp.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+--- Done ---
+
diff --git a/ext/standard/tests/file/file_exists_error.phpt b/ext/standard/tests/file/file_exists_error.phpt
new file mode 100644
index 0000000..b20b2fe
--- /dev/null
+++ b/ext/standard/tests/file/file_exists_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test file_exists() function : error conditions
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto bool file_exists(string filename)
+ * Description: Returns true if filename exists
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_exists() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing file_exists() function with Zero arguments --\n";
+var_dump( file_exists() );
+
+//Test file_exists with one more than the expected number of arguments
+echo "\n-- Testing file_exists() function with more than expected no. of arguments --\n";
+$filename = 'string_val';
+$extra_arg = 10;
+var_dump( file_exists($filename, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing file_exists() : error conditions ***
+
+-- Testing file_exists() function with Zero arguments --
+
+Warning: file_exists() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing file_exists() function with more than expected no. of arguments --
+
+Warning: file_exists() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
+
diff --git a/ext/standard/tests/file/file_exists_variation1.phpt b/ext/standard/tests/file/file_exists_variation1.phpt
new file mode 100644
index 0000000..35c86a2
--- /dev/null
+++ b/ext/standard/tests/file/file_exists_variation1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test file_exists() function : usage variations
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto bool file_exists(string filename)
+ * Description: Returns true if filename exists
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_exists() : usage variations ***\n";
+
+var_dump(file_exists(NULL));
+var_dump(file_exists(false));
+var_dump(file_exists(''));
+var_dump(file_exists(' '));
+var_dump(file_exists('|'));
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing file_exists() : usage variations ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/file_get_contents_basic.phpt b/ext/standard/tests/file/file_get_contents_basic.phpt
new file mode 100644
index 0000000..413909b
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+file_get_contents() function : basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
+ * resource $context[, int $offset[, int $maxlen]]]] )
+ * Description: Reads entire file into a string
+ */
+
+$file_path = dirname(__FILE__);
+include($file_path."/file.inc");
+
+echo "*** Testing the basic functionality of the file_get_contents() function ***\n";
+
+echo "-- Testing with simple valid data file --\n";
+
+
+create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte");
+var_dump( file_get_contents($file_path."/file1.tmp") );
+delete_files($file_path, 1);
+
+echo "\n-- Testing with empty file --\n";
+
+create_files($file_path, 1, "empty", 0755, 100, "w", "file", 1, "byte");
+var_dump( file_get_contents($file_path."/file1.tmp") );
+delete_files($file_path, 1);
+
+echo "\n*** Done ***";
+?>
+--EXPECTF--
+*** Testing the basic functionality of the file_get_contents() function ***
+-- Testing with simple valid data file --
+string(100) "text text text text text text text text text text text text text text text text text text text text "
+
+-- Testing with empty file --
+string(0) ""
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_basic001.phpt b/ext/standard/tests/file/file_get_contents_basic001.phpt
new file mode 100644
index 0000000..71b6963
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_basic001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+file_get_contents() test using basic syntax
+--CREDITS--
+"Blanche V.N." <valerie_nare@yahoo.fr>
+--FILE--
+<?php
+ $file_content = "Bienvenue au CodeFest a Montreal";
+ $temp_filename = dirname(__FILE__)."/fichier_a_lire.txt";
+ $handle = fopen($temp_filename,"w");
+ fwrite($handle,$file_content);
+ fclose($handle);
+ $var = file_get_contents($temp_filename);
+ echo $var;
+?>
+--CLEAN--
+<?php
+ $temp_filename = dirname(__FILE__)."/fichier_a_lire.txt";
+ unlink($temp_filename);
+?>
+--EXPECT--
+Bienvenue au CodeFest a Montreal
diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt
new file mode 100644
index 0000000..631a138
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_error.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test file_get_contents() function : error conditions
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: string file_get_contents( string $filename{, bool $use_include_path[,
+ * resource $context[, int $offset[, int $maxlen]]]] )
+ * Description: Reads entire file into a string
+ */
+
+echo "*** Testing error conditions ***\n";
+
+$file_path = dirname(__FILE__);
+include($file_path."/file.inc");
+
+echo "\n-- Testing with Non-existing file --\n";
+print( file_get_contents("/no/such/file/or/dir") );
+
+echo "\n-- Testing No.of arguments less than expected --\n";
+print( file_get_contents() );
+
+echo "\n-- Testing No.of arguments greater than expected --\n";
+
+create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte");
+$file_handle = fopen($file_path."/file_put_contents_error.tmp", "w");
+print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") );
+
+echo "\n-- Testing for invalid negative maxlen values --";
+var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) );
+
+delete_files($file_path, 1);
+fclose($file_handle);
+unlink($file_path."/file_put_contents_error.tmp");
+
+echo "\n*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+if(file_exists($file_path."/file_put_contents_error.tmp")) {
+ unlink($file_path."/file_put_contents_error.tmp");
+}
+if(file_exists($file_path."/file_put_contents1.tmp")) {
+ unlink($file_path."/file_put_contents1.tmp");
+}
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+-- Testing with Non-existing file --
+
+Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
+
+-- Testing No.of arguments less than expected --
+
+Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d
+
+-- Testing No.of arguments greater than expected --
+
+Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d
+
+-- Testing for invalid negative maxlen values --
+Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt
new file mode 100644
index 0000000..127901a
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_error001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+file_get_contents() test using offset parameter out of range
+--CREDITS--
+"Blanche V.N." <valerie_nare@yahoo.fr>
+"Sylvain R." <sracine@phpquebec.org>
+--INI--
+display_errors=false
+--SKIPIF--
+<?php
+ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+ if (!function_exists("file_get_contents"))
+ die ("skip file_get_contents function is not found");
+?>
+--FILE--
+<?php
+ var_dump(file_get_contents("http://checkip.dyndns.com",null,null,8000,1));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/file/file_get_contents_error002.phpt b/ext/standard/tests/file/file_get_contents_error002.phpt
new file mode 100644
index 0000000..47c7b9c
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_error002.phpt
@@ -0,0 +1,18 @@
+--TEST--
+file_get_contents() test using negative parameter for length (last parameter)
+--CREDITS--
+"Blanche V.N." <valerie_nare@yahoo.fr>
+"Sylvain R." <sracine@phpquebec.org>
+--INI--
+display_errors=false
+--SKIPIF--
+<?php
+ if (!function_exists("file_get_contents"))
+ die ("skip file_get_contents function is not found");
+?>
+--FILE--
+<?php
+ var_dump(file_get_contents("http://checkip.dyndns.com",null,null,0,-1));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt
new file mode 100644
index 0000000..edfad0d
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test file_put_contents() and file_get_contents() functions : basic functionality
+--FILE--
+<?php
+
+/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
+ * resource $context[, int $offset[, int $maxlen]]]] )
+ * Description: Reads entire file into a string
+ */
+
+/* Prototype: int file_put_contents( string $filename, mixed $data[, int $flags[, resource $context]] )
+ * Description: Write a string to a file
+ */
+
+$file_path = dirname(__FILE__);
+include($file_path."/file.inc");
+
+echo "*** Testing the basic functionality of file_put_contents() and file_get_contents() functions ***\n";
+
+echo "-- Testing with simple valid data file --\n";
+
+$file_name = "/file_put_contents.tmp";
+fill_buffer($text_buffer, "text", 100);
+file_put_contents( $file_path.$file_name, $text_buffer );
+
+var_dump( file_get_contents($file_path.$file_name) );
+
+echo "\n-- Testing with empty file --\n";
+
+$file_name = "/file_put_contents1.tmp";
+file_put_contents( $file_path.$file_name, "");
+var_dump( file_get_contents( $file_path.$file_name ) );
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/file_put_contents.tmp");
+unlink($file_path."/file_put_contents1.tmp");
+?>
+--EXPECTF--
+*** Testing the basic functionality of file_put_contents() and file_get_contents() functions ***
+-- Testing with simple valid data file --
+string(100) "text text text text text text text text text text text text text text text text text text text text "
+
+-- Testing with empty file --
+string(0) ""
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
new file mode 100644
index 0000000..72fe121
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test file-get_contents() and file_put_contents() functions : error conditions
+--FILE--
+<?php
+/* Prototype: string file_get_contents( string $filename{, bool $use_include_path[,
+ * resource $context[, int $offset[, int $maxlen]]]] )
+ * Description: Reads entire file into a string
+ */
+
+/* Prototype: int file_put_contents( string $filename, mixed $data[, int $flags[, resource $context]] )
+ * Description: Write a string to a file
+ */
+
+echo "*** Testing error conditions ***\n";
+
+$file_path = dirname(__FILE__);
+
+echo "\n-- Testing with Non-existing file --\n";
+print( file_get_contents("/no/such/file/or/dir") );
+
+echo "\n-- Testing No.of arguments less than expected --\n";
+print( file_get_contents() );
+print( file_put_contents() );
+print( file_put_contents($file_path."/".__FILE__) );
+
+$file_handle = fopen($file_path."/file_put_contents.tmp", "w");
+echo "\n-- Testing No.of arguments greater than expected --\n";
+print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") );
+print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") );
+
+echo "\n-- Testing for invalid negative maxlen values --";
+file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file");
+var_dump( file_get_contents($file_path."/file_put_contents1.tmp", FALSE, NULL, 0, -5) );
+
+fclose($file_handle);
+
+echo "\n*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/file_put_contents.tmp");
+unlink($file_path."/file_put_contents1.tmp");
+
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+-- Testing with Non-existing file --
+
+Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
+
+-- Testing No.of arguments less than expected --
+
+Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d
+
+Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d
+
+Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d
+
+-- Testing No.of arguments greater than expected --
+
+Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d
+
+Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d
+
+-- Testing for invalid negative maxlen values --
+Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_variation1.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_variation1.phpt
new file mode 100644
index 0000000..1bac1c9
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_file_put_contents_variation1.phpt
@@ -0,0 +1,116 @@
+--TEST--
+Test file_get_contents() and file_put_contents() functions : usage variations - all arguments
+
+--FILE--
+<?php
+/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
+ * resource $context[, int $offset[, int $maxlen]]]] )
+ * Description: Reads entire file into a string
+ */
+
+/* Prototype: int file_put_contents( string $filename, mixed $data[,int $flags[, resource $context]] )
+ * Description: Write a string to a file
+ */
+
+/* Testing variation in all argument values */
+$file_path = dirname(__FILE__);
+include($file_path."/file.inc");
+
+echo "*** Testing with variations in the arguments values ***\n";
+
+$buffer_types = array("text", "numeric", "text_with_new_line", "alphanumeric");
+
+foreach( $buffer_types as $type) {
+ fill_buffer($buffer, $type, 100);
+ file_put_contents( $file_path."/file_put_contents_variation1.tmp", $buffer);
+ var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0) );
+ var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1) );
+ var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0, NULL, 5) );
+ var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1, NULL, 5) );
+ var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0, NULL, 5, 20) );
+ var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1, NULL, 5, 20) );
+
+}
+
+echo "--- Done ---";
+?>
+--CLEAN--
+<?php
+//Deleting the temporary file
+
+$file_path = dirname(__FILE__);
+unlink($file_path."/file_put_contents_variation1.tmp");
+?>
+--EXPECTF--
+*** Testing with variations in the arguments values ***
+string(100) "text text text text text text text text text text text text text text text text text text text text "
+string(100) "text text text text text text text text text text text text text text text text text text text text "
+string(95) "text text text text text text text text text text text text text text text text text text text "
+string(95) "text text text text text text text text text text text text text text text text text text text "
+string(20) "text text text text "
+string(20) "text text text text "
+string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
+string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
+string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
+string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
+string(20) "22222222222222222222"
+string(20) "22222222222222222222"
+string(100) "line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line "
+string(100) "line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line "
+string(95) "line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line "
+string(95) "line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line "
+string(20) "line of text
+line
+li"
+string(20) "line of text
+line
+li"
+string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
+string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
+string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
+string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
+string(20) "ab12 ab12 ab12 ab12 "
+string(20) "ab12 ab12 ab12 ab12 "
+--- Done ---
diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt
new file mode 100644
index 0000000..fc2281d
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test file_get_contents() and file_put_contents() functions : usage variations - use_include_path
+
+--FILE--
+<?php
+/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
+ * resource $context[, int $offset[, int $maxlen]]]] )
+ * Description: Reads entire file into a string
+ */
+
+/* Prototype: int file_put_contents( string $filename, mixed $data[,int $flags[, resource $context]] )
+ * Description: Write a string to a file
+ */
+
+/* Testing variation using use_include_path argument */
+$file_path = dirname(__FILE__);
+include($file_path."/file.inc");
+
+echo "*** Testing with variation in use_include_path argument ***\n";
+$dir = "file_get_contents_variation2";
+mkdir($file_path."/".$dir);
+$filename = $file_path."/".$dir."/"."file_get_contents_variation2.tmp";
+
+ini_set( 'include_path',$file_path."/".$dir );
+
+$data_array = array( 1, " Data1 in an array", 2, " Data2 in an array" );
+fill_buffer( $buffer, "text", 100);
+file_put_contents( $filename, $buffer );
+fill_buffer( $buffer, "numeric", 100);
+file_put_contents( $filename, $buffer, FILE_APPEND, NULL );
+file_put_contents( $filename, $data_array, FILE_APPEND, NULL );
+var_dump( file_get_contents($filename, 0) );
+var_dump( file_get_contents($filename, 1) );
+var_dump( file_get_contents($filename, 0, NULL, 5) );
+var_dump( file_get_contents($filename, 1, NULL, 5) );
+var_dump( file_get_contents($filename, 0, NULL, 5, 20) );
+var_dump( file_get_contents($filename, 1, NULL, 5, 20) );
+
+echo "--- Done ---";
+?>
+--CLEAN--
+<?php
+//Deleting the temporary files and directory used in the testcase
+
+$file_path = dirname(__FILE__);
+unlink($file_path."/file_get_contents_variation2/file_get_contents_variation2.tmp");
+rmdir($file_path."/file_get_contents_variation2");
+?>
+--EXPECTF--
+*** Testing with variation in use_include_path argument ***
+string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
+string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
+string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
+string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
+string(20) "text text text text "
+string(20) "text text text text "
+--- Done ---
diff --git a/ext/standard/tests/file/file_get_contents_variation1.phpt b/ext/standard/tests/file/file_get_contents_variation1.phpt
new file mode 100644
index 0000000..ddc9261
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation1.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test file_get_contents() function : variation - include path testing
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+
+require_once('fopen_include_path.inc');
+
+// this doesn't create the include dirs in this directory
+// we change to this to ensure we are not part of the
+// include paths.
+$thisTestDir = "fileGetContentsVar1.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = "afile.txt";
+$secondFile = $dir2."/".$filename;
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $secondFile, $filename;
+ $h = fopen($secondFile, "w");
+ fwrite($h, "File in include path");
+ fclose($h);
+ $line = file_get_contents($filename, true);
+ echo "$line\n";
+ unlink($secondFile);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing file_get_contents() : variation ***
+File in include path
+===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation2.phpt b/ext/standard/tests/file/file_get_contents_variation2.phpt
new file mode 100644
index 0000000..510ec12
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test file_get_contents() function : variation - include path testing
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+
+
+require_once('fopen_include_path.inc');
+
+// this doesn't create the include dirs in this directory
+// we change to this to ensure we are not part of the
+// include paths.
+$thisTestDir = "FileGetContentsVar2.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = 'FileGetContentsVar2.tmp';
+$scriptLocFile = dirname(__FILE__)."/".$filename;
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $scriptLocFile, $filename;
+ $h = fopen($scriptLocFile, "w");
+ fwrite($h, "File in script location");
+ fclose($h);
+ $line = file_get_contents($filename, true);
+ echo "$line\n";
+ unlink($scriptLocFile);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing file_get_contents() : variation ***
+File in script location
+===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation3.phpt b/ext/standard/tests/file/file_get_contents_variation3.phpt
new file mode 100644
index 0000000..f485b0e
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation3.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test file_get_contents() function : usage variation - different type for use_include_path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'FileGetContentsVar3.tmp';
+$absFile = dirname(__FILE__).'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 use_include_path
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file_get_contents($absFile, $value) );
+};
+
+unlink($absFile);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_get_contents() : usage variation ***
+
+--int 0--
+string(13) "contents read"
+
+--int 1--
+string(13) "contents read"
+
+--int 12345--
+string(%d) "contents read"
+
+--int -12345--
+string(%d) "contents read"
+
+--float 10.5--
+string(%d) "contents read"
+
+--float -10.5--
+string(%d) "contents read"
+
+--float 12.3456789000e10--
+string(%d) "contents read"
+
+--float -12.3456789000e10--
+string(%d) "contents read"
+
+--float .5--
+string(%d) "contents read"
+
+--empty array--
+Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(%d) "contents read"
+
+--lowercase null--
+string(%d) "contents read"
+
+--lowercase true--
+string(%d) "contents read"
+
+--lowercase false--
+string(%d) "contents read"
+
+--uppercase TRUE--
+string(%d) "contents read"
+
+--uppercase FALSE--
+string(%d) "contents read"
+
+--empty string DQ--
+string(%d) "contents read"
+
+--empty string SQ--
+string(%d) "contents read"
+
+--string DQ--
+string(%d) "contents read"
+
+--string SQ--
+string(%d) "contents read"
+
+--mixed case string--
+string(%d) "contents read"
+
+--heredoc--
+string(%d) "contents read"
+
+--instance of classWithToString--
+Error: 2 - file_get_contents() expects parameter 2 to be boolean, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file_get_contents() expects parameter 2 to be boolean, object given, %s(%d)
+NULL
+
+--undefined var--
+string(%d) "contents read"
+
+--unset var--
+string(%d) "contents read"
+===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation4.phpt b/ext/standard/tests/file/file_get_contents_variation4.phpt
new file mode 100644
index 0000000..3b494b4
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation4.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test file_get_contents() function : usage variation - different types for context.
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'FileGetContentsVar4.tmp';
+$absFile = dirname(__FILE__).'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+$fileRes = fopen(__FILE__,'r');
+$strContext = stream_context_create();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ //non context resource
+ 'file resource' => $fileRes,
+
+ //valid stream context
+ 'stream context' => $strContext,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file_get_contents($absFile, false, $value) );
+};
+
+unlink($absFile);
+fclose($fileRes);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_get_contents() : usage variation ***
+
+--int 0--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--empty array--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(%d) "contents read"
+
+--lowercase null--
+string(%d) "contents read"
+
+--lowercase true--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file_get_contents() expects parameter 3 to be resource, object given, %s(%d)
+NULL
+
+--undefined var--
+string(%d) "contents read"
+
+--unset var--
+string(%d) "contents read"
+
+--file resource--
+Error: 2 - file_get_contents(): supplied resource is not a valid Stream-Context resource, %s(%d)
+string(%d) "contents read"
+
+--stream context--
+string(%d) "contents read"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/file_get_contents_variation5.phpt b/ext/standard/tests/file/file_get_contents_variation5.phpt
new file mode 100644
index 0000000..ce88d3c
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation5.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test file_get_contents() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'FileGetContentsVar5.tmp';
+$absFile = dirname(__FILE__).'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, b"contents read");
+fclose($h);
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 offset
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file_get_contents($absFile, false, null, $value) );
+};
+
+unlink($absFile);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_get_contents() : usage variation ***
+
+--int 0--
+string(%d) "contents read"
+
+--int 1--
+string(%d) "ontents read"
+
+--int 12345--
+string(%d) ""
+
+--int -12345--
+string(%d) "contents read"
+
+--float 10.5--
+string(3) "ead"
+
+--float -10.5--
+string(%d) "contents read"
+
+--float 12.3456789000e10--
+string(%d) %s
+
+--float -12.3456789000e10--
+string(%d) %s
+
+--float .5--
+string(%d) "contents read"
+
+--empty array--
+Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(%d) "contents read"
+
+--lowercase null--
+string(%d) "contents read"
+
+--lowercase true--
+string(12) "ontents read"
+
+--lowercase false--
+string(%d) "contents read"
+
+--uppercase TRUE--
+string(12) "ontents read"
+
+--uppercase FALSE--
+string(%d) "contents read"
+
+--empty string DQ--
+Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - file_get_contents() expects parameter 4 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file_get_contents() expects parameter 4 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+string(%d) "contents read"
+
+--unset var--
+string(%d) "contents read"
+===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation6.phpt b/ext/standard/tests/file/file_get_contents_variation6.phpt
new file mode 100644
index 0000000..6795e01
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation6.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test file_get_contents() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'FileGetContentsVar5.tmp';
+$absFile = dirname(__FILE__).'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ '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 maxlen
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file_get_contents($absFile, false, null, 0, $value) );
+};
+
+unlink($absFile);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_get_contents() : usage variation ***
+
+--int 0--
+string(%d) ""
+
+--int 1--
+string(%d) "c"
+
+--int 12345--
+string(%d) "contents read"
+
+--int -12345--
+Error: 2 - file_get_contents(): length must be greater than or equal to zero, %s(%d)
+bool(false)
+
+--float 10.5--
+string(%d) "contents r"
+
+--float -10.5--
+Error: 2 - file_get_contents(): length must be greater than or equal to zero, %s(%d)
+bool(false)
+
+--float .5--
+string(%d) ""
+
+--empty array--
+Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(%d) ""
+
+--lowercase null--
+string(%d) ""
+
+--lowercase true--
+string(%d) "c"
+
+--lowercase false--
+string(%d) ""
+
+--uppercase TRUE--
+string(%d) "c"
+
+--uppercase FALSE--
+string(%d) ""
+
+--empty string DQ--
+Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - file_get_contents() expects parameter 5 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file_get_contents() expects parameter 5 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+string(%d) ""
+
+--unset var--
+string(%d) ""
+===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation7-win32.phpt b/ext/standard/tests/file/file_get_contents_variation7-win32.phpt
new file mode 100644
index 0000000..d350b4b
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation7-win32.phpt
@@ -0,0 +1,115 @@
+--TEST--
+Test file_get_contents() function : variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+$mainDir = "fileGetContentsVar7.dir";
+$subDir = "fileGetContentsVar7Sub";
+$absMainDir = dirname(__FILE__)."\\".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."\\".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3);
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir\\",
+ "$absSubDir\\..\\".$subDir,
+ "$absSubDir\\\\..\\.\\".$subDir,
+ "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir,
+ "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir,
+ "$absSubDir\\BADDIR",
+
+ // relative paths
+ $mainDir."\\".$subDir,
+ $mainDir."\\\\".$subDir,
+ $mainDir."\\\\\\".$subDir,
+ ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir,
+ "BADDIR",
+
+ // unixifed path
+ $unixifiedDir,
+);
+
+$filename = 'FileGetContentsVar7.tmp';
+$absFile = $absSubDir.'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ var_dump(file_get_contents($dir."\\".$filename));
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file_get_contents() : variation ***
+
+-- Iteration 1 --
+string(%d) "contents read"
+
+-- Iteration 2 --
+string(%d) "contents read"
+
+-- Iteration 3 --
+string(%d) "contents read"
+
+-- Iteration 4 --
+string(%d) "contents read"
+
+-- Iteration 5 --
+
+Warning: file_get_contents(%sfileGetContentsVar7.dir\fileGetContentsVar7Sub\..\\\fileGetContentsVar7Sub\\..\\..\fileGetContentsVar7Sub\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: file_get_contents(%sfileGetContentsVar7.dir\fileGetContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+string(%d) "contents read"
+
+-- Iteration 8 --
+string(%d) "contents read"
+
+-- Iteration 9 --
+string(%d) "contents read"
+
+-- Iteration 10 --
+string(%d) "contents read"
+
+-- Iteration 11 --
+
+Warning: file_get_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+string(%d) "contents read"
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/file_get_contents_variation7.phpt b/ext/standard/tests/file/file_get_contents_variation7.phpt
new file mode 100644
index 0000000..17c55b6
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation7.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test file_get_contents() function : variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+$mainDir = "fileGetContentsVar7.dir";
+$subDir = "fileGetContentsVar7Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+
+);
+
+$filename = 'FileGetContentsVar7.tmp';
+$absFile = $absSubDir.'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ var_dump(file_get_contents($dir."/".$filename));
+}
+
+chdir($old_dir_path);
+unlink($absFile);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file_get_contents() : variation ***
+
+-- Iteration 1 --
+string(%d) "contents read"
+
+-- Iteration 2 --
+string(%d) "contents read"
+
+-- Iteration 3 --
+string(%d) "contents read"
+
+-- Iteration 4 --
+string(%d) "contents read"
+
+-- Iteration 5 --
+
+Warning: file_get_contents(%sfileGetContentsVar7.dir/fileGetContentsVar7Sub/..///fileGetContentsVar7Sub//..//../fileGetContentsVar7Sub/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: file_get_contents(%sfileGetContentsVar7.dir/fileGetContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+string(%d) "contents read"
+
+-- Iteration 8 --
+string(%d) "contents read"
+
+-- Iteration 9 --
+string(%d) "contents read"
+
+-- Iteration 10 --
+string(%d) "contents read"
+
+-- Iteration 11 --
+
+Warning: file_get_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
new file mode 100644
index 0000000..bb62eb4
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test file_get_contents() function : variation - obscure filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die("skip Valid only on Windows");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+
+/* An array of filenames */
+$names_arr = array(
+ /* Invalid args */
+ "-1" => -1,
+ "TRUE" => TRUE,
+ "FALSE" => FALSE,
+ "NULL" => NULL,
+ "\"\"" => "",
+ "\" \"" => " ",
+ "\\0" => "\0",
+ "array()" => array(),
+
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir" => "/no/such/file/dir",
+ "php/php"=> "php/php"
+
+);
+
+foreach($names_arr as $key =>$value) {
+ echo "\n-- Filename: $key --\n";
+ var_dump(file_get_contents($value));
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing file_get_contents() : variation ***
+
+-- Filename: -1 --
+
+Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Filename: TRUE --
+
+Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Filename: FALSE --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
+bool(false)
+
+-- Filename: NULL --
+
+Warning: file_get_contents(): Filename cannot be empty in %sfile_get_contents_variation8-win32.php on line %d
+bool(false)
+
+-- Filename: "" --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
+bool(false)
+
+-- Filename: " " --
+
+Warning: file_get_contents( ): failed to open stream: Permission denied in %s on line %d
+bool(false)
+
+-- Filename: \0 --
+
+Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+-- Filename: array() --
+
+Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+
+-- Filename: /no/such/file/dir --
+
+Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Filename: php/php --
+
+Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt
new file mode 100644
index 0000000..5b325b0
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation8.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test file_get_contents() function : variation - obscure filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+/* An array of filenames */
+$names_arr = array(
+ /* Invalid args */
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ array(),
+
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir",
+ "php/php"
+
+);
+
+for( $i=0; $i<count($names_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ var_dump(file_get_contents($names_arr[$i]));
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file_get_contents() : variation ***
+-- Iteration 0 --
+
+Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+-- Iteration 1 --
+
+Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: file_get_contents(): Filename cannot be empty in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_variation9.phpt b/ext/standard/tests/file/file_get_contents_variation9.phpt
new file mode 100644
index 0000000..99812b5
--- /dev/null
+++ b/ext/standard/tests/file/file_get_contents_variation9.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test file_get_contents() function : variation - linked files
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
+ * Description: Read the entire file into a string
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_get_contents() : variation ***\n";
+$filename = dirname(__FILE__).'/fileGetContentsVar9.tmp';
+$softlink = dirname(__FILE__).'/fileGetContentsVar9.SoftLink';
+$hardlink = dirname(__FILE__).'/fileGetContentsVar9.HardLink';
+$chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
+
+// create file
+$h = fopen($filename,"w");
+//Data should be more than the size of a link.
+for ($i = 1; $i <= 10; $i++) {
+ fwrite($h, b"Here is a repeated amount of data");
+}
+fclose($h);
+
+// link files
+link($filename, $hardlink);
+symlink($filename, $softlink);
+symlink($softlink, $chainlink);
+
+// perform tests
+var_dump(file_get_contents($chainlink));
+var_dump(file_get_contents($softlink));
+var_dump(file_get_contents($hardlink));
+
+unlink($chainlink);
+unlink($softlink);
+unlink($hardlink);
+unlink($filename);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file_get_contents() : variation ***
+string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data"
+string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data"
+string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data"
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt
new file mode 100644
index 0000000..4566c37
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents.phpt
@@ -0,0 +1,32 @@
+--TEST--
+file_put_contents() and invalid parameters
+--FILE--
+<?php
+class foo {
+ function __toString() {
+ return __METHOD__;
+ }
+}
+$file = dirname(__FILE__)."/file_put_contents.txt";
+
+$context = stream_context_create();
+
+var_dump(file_put_contents($file, $context));
+var_dump(file_put_contents($file, new stdClass));
+var_dump(file_put_contents($file, new foo));
+$fp = fopen($file, "r");
+var_dump(file_put_contents($file, "string", 0, $fp));
+
+@unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d
+bool(false)
+bool(false)
+int(15)
+
+Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
+int(6)
+Done
diff --git a/ext/standard/tests/file/file_put_contents_variation1.phpt b/ext/standard/tests/file/file_put_contents_variation1.phpt
new file mode 100644
index 0000000..35d1930
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation1.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test file_put_contents() function : variation - test append flag
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : variation ***\n";
+
+$filename = "FilePutContentsVar1.tmp";
+
+$data = "The first string to write";
+$extra = ", followed by this";
+
+var_dump(file_put_contents($filename, $data));
+var_dump(file_put_contents($filename, $extra, FILE_APPEND));
+echo filesize($filename)."\n";
+readfile($filename);
+echo "\n";
+clearstatcache();
+file_put_contents($filename, $data);
+echo filesize($filename)."\n";
+readfile($filename);
+echo "\n";
+unlink($filename);
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_put_contents() : variation ***
+int(25)
+int(18)
+43
+The first string to write, followed by this
+25
+The first string to write
+===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt
new file mode 100644
index 0000000..753e287
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation2.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test file_put_contents() function : usage variation - different data types to write
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+$filename = __DIR__ . '/fwriteVar5.tmp';
+
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 str
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ file_put_contents($filename, $value);
+ readfile($filename);
+};
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_put_contents() : usage variation ***
+
+--int 0--
+0
+--int 1--
+1
+--int 12345--
+12345
+--int -12345--
+-2345
+--float 10.5--
+10.5
+--float -10.5--
+-10.5
+--float 12.3456789000e10--
+123456789000
+--float -12.3456789000e10--
+-123456789000
+--float .5--
+0.5
+--empty array--
+
+--int indexed array--
+123
+--associative array--
+12
+--nested arrays--
+Error: 8 - Array to string conversion, %s(%d)
+Error: 8 - Array to string conversion, %s(%d)
+fooArrayArray
+--uppercase NULL--
+
+--lowercase null--
+
+--lowercase true--
+1
+--lowercase false--
+
+--uppercase TRUE--
+1
+--uppercase FALSE--
+
+--empty string DQ--
+
+--empty string SQ--
+
+--instance of classWithToString--
+Class A object
+--instance of classWithoutToString--
+
+--undefined var--
+
+--unset var--
+===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation3.phpt b/ext/standard/tests/file/file_put_contents_variation3.phpt
new file mode 100644
index 0000000..e16f640
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation3.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test file_put_contents() function : usage variation - different types for context.
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'FilePutContentsVar4.tmp';
+$absFile = dirname(__FILE__).'/'.$filename;
+
+$fileRes = fopen(__FILE__,'r');
+$strContext = stream_context_create();
+
+$data = "data to write";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ //non context resource
+ 'file resource' => $fileRes,
+
+ //valid stream context
+ 'stream context' => $strContext,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file_put_contents($absFile, $data, null, $value) );
+};
+
+unlink($absFile);
+fclose($fileRes);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file_put_contents() : usage variation ***
+
+--int 0--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d)
+NULL
+
+--empty array--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+int(13)
+
+--lowercase null--
+int(13)
+
+--lowercase true--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file_put_contents() expects parameter 4 to be resource, object given, %s(%d)
+NULL
+
+--undefined var--
+int(13)
+
+--unset var--
+int(13)
+
+--file resource--
+Error: 2 - file_put_contents(): supplied resource is not a valid Stream-Context resource, %s(%d)
+int(13)
+
+--stream context--
+int(13)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/file_put_contents_variation4.phpt b/ext/standard/tests/file/file_put_contents_variation4.phpt
new file mode 100644
index 0000000..d919c4a
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation4.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test file_put_contents() function : variation - include path testing
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+
+require_once('fopen_include_path.inc');
+
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = basename(__FILE__, ".php") . ".tmp";
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+
+$newpath = generate_next_path();
+set_include_path($newpath);
+runtest();
+
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $filename;
+ //correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
+ // in the include path. In this case it doesn't so the file should be written in the current dir.
+ file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
+ $line = file_get_contents($filename);
+ echo "$line\n";
+ unlink($filename);
+}
+
+?>
+===DONE===
+--EXPECT--
+File in include path
+File in include path
+===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation5.phpt b/ext/standard/tests/file/file_put_contents_variation5.phpt
new file mode 100644
index 0000000..4ecb521
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation5.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test file_put_contents() function : variation - include path testing
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+
+$thisTestDir = dirname(__FILE__) . '/' .basename(__FILE__, ".php") . ".directory";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = basename(__FILE__, ".php") . ".tmp";
+$scriptLocFile = dirname(__FILE__)."/".$filename;
+
+$newpath = "rubbish";
+set_include_path($newpath);
+runtest();
+$newpath = "";
+set_include_path($newpath);
+runtest();
+set_include_path(null);
+runtest();
+set_include_path(";; ; ;c:\\rubbish");
+runtest();
+
+chdir(dirname(__FILE__));
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $scriptLocFile, $filename;
+ file_put_contents($filename, (binary) "File written in working directory", FILE_USE_INCLUDE_PATH);
+ if(file_exists($scriptLocFile)) {
+ echo "Fail - this is PHP52 behaviour\n";
+ unlink($scriptLocFile);
+ }else {
+ $line = file_get_contents($filename);
+ echo "$line\n";
+ unlink($filename);
+ }
+}
+?>
+===DONE===
+--EXPECT--
+File written in working directory
+File written in working directory
+File written in working directory
+File written in working directory
+===DONE===
+
diff --git a/ext/standard/tests/file/file_put_contents_variation6.phpt b/ext/standard/tests/file/file_put_contents_variation6.phpt
new file mode 100644
index 0000000..aaea612
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation6.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test file_put_contents() function : variation - include path testing
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : variation ***\n";
+
+require_once('fopen_include_path.inc');
+
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = basename(__FILE__, ".php") . ".tmp";
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+
+$newpath = generate_next_path();
+set_include_path($newpath);
+runtest();
+
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $filename;
+
+ //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
+ // in the include path. In this case it doesn't so the file should be written in the current dir.
+
+ file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
+ file_put_contents($filename, (binary) ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND);
+ $line = file_get_contents($filename);
+ echo "$line\n";
+ unlink($filename);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing file_put_contents() : variation ***
+File in include path. This was appended
+File in include path. This was appended
+===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation7-win32.phpt b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt
new file mode 100644
index 0000000..d7bfdf9
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt
@@ -0,0 +1,130 @@
+--TEST--
+Test file_put_contents() function : usage variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : usage variation ***\n";
+
+$mainDir = "filePutContentsVar7.dir";
+$subDir = "filePutContentsVar7Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."\\".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3);
+
+
+// Note invalid dirs in p8 result in (The system cannot find the path specified.)
+// rather than No Such File or Directory in php.net
+$allDirs = array(
+ // absolute paths
+ "$absSubDir\\",
+ "$absSubDir\\..\\".$subDir,
+ "$absSubDir\\\\..\\.\\".$subDir,
+ "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir,
+ "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir,
+ "$absSubDir\\BADDIR",
+
+ // relative paths
+ $mainDir."\\".$subDir,
+ $mainDir."\\\\".$subDir,
+ $mainDir."\\\\\\".$subDir,
+ ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir,
+ "BADDIR",
+
+ // unixifed path
+ $unixifiedDir,
+);
+
+$filename = 'FileGetContentsVar7.tmp';
+$absFile = $absSubDir.'/'.$filename;
+$data = "This was the written data";
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ $res = file_put_contents($dir."\\".$filename, ($data + $i));
+ if ($res !== false) {
+ $in = file_get_contents($absFile);
+ if ($in == ($data + $i)) {
+ echo "Data written correctly\n";
+ }
+ else {
+ echo "Data not written correctly or to correct place\n";
+ }
+ unlink($dir."/".$filename);
+ }
+ else {
+ echo "No data written\n";
+ }
+
+}
+
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file_put_contents() : usage variation ***
+
+-- Iteration 1 --
+Data written correctly
+
+-- Iteration 2 --
+Data written correctly
+
+-- Iteration 3 --
+Data written correctly
+
+-- Iteration 4 --
+Data written correctly
+
+-- Iteration 5 --
+
+Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\..\\\filePutContentsVar7Sub\\..\\..\filePutContentsVar7Sub\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+No data written
+
+-- Iteration 6 --
+
+Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+No data written
+
+-- Iteration 7 --
+Data written correctly
+
+-- Iteration 8 --
+Data written correctly
+
+-- Iteration 9 --
+Data written correctly
+
+-- Iteration 10 --
+Data written correctly
+
+-- Iteration 11 --
+
+Warning: file_put_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+No data written
+
+-- Iteration 12 --
+Data written correctly
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/file_put_contents_variation7.phpt b/ext/standard/tests/file/file_put_contents_variation7.phpt
new file mode 100644
index 0000000..5c8e5f3
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation7.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test file_put_contents() function : usage variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : usage variation ***\n";
+
+$mainDir = "filePutContentsVar7.dir";
+$subDir = "filePutContentsVar7Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+
+// Note invalid dirs in p8 result in (The system cannot find the path specified.)
+// rather than No Such File or Directory in php.net
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+
+);
+
+$filename = 'FileGetContentsVar7.tmp';
+$absFile = $absSubDir.'/'.$filename;
+$data = "This was the written data";
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ $res = file_put_contents($dir."/".$filename, ($data + $i));
+ if ($res !== false) {
+ $in = file_get_contents($absFile);
+ if ($in == ($data + $i)) {
+ echo "Data written correctly\n";
+ }
+ else {
+ echo "Data not written correctly or to correct place\n";
+ }
+ unlink($dir."/".$filename);
+ }
+ else {
+ echo "No data written\n";
+ }
+
+}
+
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file_put_contents() : usage variation ***
+
+-- Iteration 1 --
+Data written correctly
+
+-- Iteration 2 --
+Data written correctly
+
+-- Iteration 3 --
+Data written correctly
+
+-- Iteration 4 --
+Data written correctly
+
+-- Iteration 5 --
+
+Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/..///filePutContentsVar7Sub//..//../filePutContentsVar7Sub/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+No data written
+
+-- Iteration 6 --
+
+Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+No data written
+
+-- Iteration 7 --
+Data written correctly
+
+-- Iteration 8 --
+Data written correctly
+
+-- Iteration 9 --
+Data written correctly
+
+-- Iteration 10 --
+Data written correctly
+
+-- Iteration 11 --
+
+Warning: file_put_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+No data written
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
new file mode 100644
index 0000000..92fe7b3
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test file_put_contents() function : usage variation - obscure filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : usage variation ***\n";
+
+/* An array of filenames */
+$names_arr = array(
+ "-1" => -1,
+ "TRUE" => TRUE,
+ "FALSE" => FALSE,
+ "NULL" => NULL,
+ "\"\"" => "",
+ "\" \"" => " ",
+ "\\0" => "\0",
+ "array()" => array(),
+
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir" => "/no/such/file/dir",
+ "php/php"=> "php/php"
+
+);
+
+foreach($names_arr as $key =>$value) {
+ echo "\n-- Filename: $key --\n";
+ $res = file_put_contents($value, "Some data");
+ if ($res !== false && $res != null) {
+ echo "$res bytes written to: $value\n";
+ unlink($value);
+ } else {
+ echo "Failed to write data to: $key\n";
+ }
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing file_put_contents() : usage variation ***
+
+-- Filename: -1 --
+9 bytes written to: -1
+
+-- Filename: TRUE --
+9 bytes written to: 1
+
+-- Filename: FALSE --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: FALSE
+
+-- Filename: NULL --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: NULL
+
+-- Filename: "" --
+
+Warning: file_put_contents(): Filename cannot be empty in %s on line %d
+Failed to write data to: ""
+
+-- Filename: " " --
+
+Warning: file_put_contents( ): failed to open stream: Permission denied in %s on line %d
+Failed to write data to: " "
+
+-- Filename: \0 --
+
+Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d
+Failed to write data to: \0
+
+-- Filename: array() --
+
+Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d
+Failed to write data to: array()
+
+-- Filename: /no/such/file/dir --
+
+Warning: file_put_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d
+Failed to write data to: /no/such/file/dir
+
+-- Filename: php/php --
+
+Warning: file_put_contents(php/php): failed to open stream: %s in %s on line %d
+Failed to write data to: php/php
+===Done===
diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt
new file mode 100644
index 0000000..3cd92c5
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/file/file_put_contents_variation9.phpt b/ext/standard/tests/file/file_put_contents_variation9.phpt
new file mode 100644
index 0000000..7ad09c4
--- /dev/null
+++ b/ext/standard/tests/file/file_put_contents_variation9.phpt
@@ -0,0 +1,70 @@
+--TEST--
+est file_put_contents() function : usage variation - linked files
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
+ * Description: Write/Create a file with contents data and return the number of bytes written
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file_put_contents() : usage variation ***\n";
+
+$filename = dirname(__FILE__).'/fileGetContentsVar9.tmp';
+$softlink = dirname(__FILE__).'/fileGetContentsVar9.SoftLink';
+$hardlink = dirname(__FILE__).'/fileGetContentsVar9.HardLink';
+$chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
+
+
+// link files even though it original file doesn't exist yet
+symlink($filename, $softlink);
+symlink($softlink, $chainlink);
+
+
+// perform tests
+run_test($chainlink);
+run_test($softlink);
+
+//can only create a hardlink if the file exists.
+file_put_contents($filename,"");
+link($filename, $hardlink);
+run_test($hardlink);
+
+unlink($chainlink);
+unlink($softlink);
+unlink($hardlink);
+unlink($filename);
+
+
+function run_test($file) {
+ $data = "Here is some data";
+ $extra = ", more data";
+ var_dump(file_put_contents($file, $data));
+ var_dump(file_put_contents($file, $extra, FILE_APPEND));
+ readfile($file);
+ echo "\n";
+}
+
+
+echo "\n*** Done ***\n";
+?>
+--EXPECT--
+*** Testing file_put_contents() : usage variation ***
+int(17)
+int(11)
+Here is some data, more data
+int(17)
+int(11)
+Here is some data, more data
+int(17)
+int(11)
+Here is some data, more data
+
+*** Done ***
diff --git a/ext/standard/tests/file/file_variation.phpt b/ext/standard/tests/file/file_variation.phpt
new file mode 100644
index 0000000..512d5f3
--- /dev/null
+++ b/ext/standard/tests/file/file_variation.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test file() function : usage variations
+--FILE--
+<?php
+/*
+ * Prototype: array file ( string filename [,int use-include_path [,resource context]] );
+ * Description: Reads entire file into an array
+ Returns the file in an array
+ */
+require(dirname(__FILE__) . '/file.inc');
+
+$data_array = array( "Garbage data", "Gar\nba\nge d\nata", "Gar\n\nbage \n\n data" );
+echo "*** Using various flags values with different data in a file\n";
+$count=1;
+$file_path = dirname(__FILE__);
+foreach( $data_array as $data ) {
+ echo "--Iteration $count --\n";
+ $fh = fopen($file_path."/file_variation.tmp", "w");
+ fwrite($fh, (binary)$data);
+ var_dump( file($file_path."/file_variation.tmp", FILE_IGNORE_NEW_LINES) );
+ var_dump( file($file_path."/file_variation.tmp", FILE_SKIP_EMPTY_LINES) );
+ $count++;
+ fclose($fh);
+}
+
+echo "*** Testing with variation in use_include_path argument ***\n";
+$file_path1 = dirname(__FILE__)."/file_variation";
+mkdir($file_path1);
+ini_set( 'include_path',$file_path.'/file_variation' );
+
+file_put_contents( $file_path1."/file1_variation.tmp", "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222" );
+var_dump( file("file1_variation.tmp", FILE_USE_INCLUDE_PATH) );
+var_dump( file($file_path1."/file1_variation.tmp", 1) );
+
+echo "*** Using file function to remove line containing a key string ***\n";
+$file_handle = fopen($file_path."/file2_variation.tmp", "w");
+$key = "SEARCH_KEY";
+fwrite( $file_handle, (binary)"The key string to be searched is SEARCH_KEY\nLine without key string\nThe key string to be searched is SEARCH_KEY" );
+$out_array = file($file_path."/file2_variation.tmp");
+
+echo "File contents in array form Before replacement of the key\n";
+var_dump( $out_array );
+$file_handle2 = fopen($file_path."/file3_variation.tmp", "w");
+// Loop through file content array
+foreach($out_array as $line) {
+ if( !strstr( $line, $key ) )
+ fputs($file_handle2,$line);
+}
+echo "File contents in array form After replacement of the key\n";
+var_dump( file($file_path."/file3_variation.tmp" ));
+fclose($file_handle);
+fclose($file_handle2);
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/file_variation.tmp");
+unlink($file_path."/file_variation/file1_variation.tmp");
+unlink($file_path."/file2_variation.tmp");
+unlink($file_path."/file3_variation.tmp");
+rmdir($file_path."/file_variation");
+
+?>
+--EXPECTF--
+*** Using various flags values with different data in a file
+--Iteration 1 --
+array(1) {
+ [0]=>
+ string(12) "Garbage data"
+}
+array(1) {
+ [0]=>
+ string(12) "Garbage data"
+}
+--Iteration 2 --
+array(4) {
+ [0]=>
+ string(3) "Gar"
+ [1]=>
+ string(2) "ba"
+ [2]=>
+ string(4) "ge d"
+ [3]=>
+ string(3) "ata"
+}
+array(4) {
+ [0]=>
+ string(4) "Gar
+"
+ [1]=>
+ string(3) "ba
+"
+ [2]=>
+ string(5) "ge d
+"
+ [3]=>
+ string(3) "ata"
+}
+--Iteration 3 --
+array(5) {
+ [0]=>
+ string(3) "Gar"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "bage "
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(5) " data"
+}
+array(5) {
+ [0]=>
+ string(4) "Gar
+"
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ string(6) "bage
+"
+ [3]=>
+ string(1) "
+"
+ [4]=>
+ string(5) " data"
+}
+*** Testing with variation in use_include_path argument ***
+array(1) {
+ [0]=>
+ string(44) "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222"
+}
+array(1) {
+ [0]=>
+ string(44) "aaaaaaaaaaaaaaabbbbbbbbbbb111111111222222222"
+}
+*** Using file function to remove line containing a key string ***
+File contents in array form Before replacement of the key
+array(3) {
+ [0]=>
+ string(44) "The key string to be searched is SEARCH_KEY
+"
+ [1]=>
+ string(24) "Line without key string
+"
+ [2]=>
+ string(43) "The key string to be searched is SEARCH_KEY"
+}
+File contents in array form After replacement of the key
+array(1) {
+ [0]=>
+ string(24) "Line without key string
+"
+}
+
+--- Done ---
+
diff --git a/ext/standard/tests/file/file_variation2.phpt b/ext/standard/tests/file/file_variation2.phpt
new file mode 100644
index 0000000..ab37ea5
--- /dev/null
+++ b/ext/standard/tests/file/file_variation2.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test file() function : first parameter variation
+--FILE--
+<?php
+/* Prototype : array file(string filename [, int flags[, resource context]])
+ * Description: Read entire file into an array
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted
+$flags = 0;
+$context = stream_context_create();
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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( file($value, $flags, $context) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file() : usage variation ***
+
+--int 0--
+Error: 2 - file(0): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - file(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - file(12345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - file(-2345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - file(10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - file(-10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - file(123456789000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - file(-123456789000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - file(0.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - file(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - file(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - file(Class A object): failed to open stream: %s, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - file() expects parameter 1 to be a valid path, object given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - file(): Filename cannot be empty, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/file/file_variation3.phpt b/ext/standard/tests/file/file_variation3.phpt
new file mode 100644
index 0000000..1dd8520
--- /dev/null
+++ b/ext/standard/tests/file/file_variation3.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Test file() function : second parameter variation
+--FILE--
+<?php
+/* Prototype : array file(string filename [, int flags[, resource context]])
+ * Description: Read entire file into an array
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted
+$filename = __FILE__ . ".tmp";
+$fd = fopen($filename, "w+");
+fwrite($fd, "Line 1\nLine 2\nLine 3");
+fclose($fd);
+
+$context = stream_context_create();
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 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 flags
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file($filename, $value, $context) );
+};
+
+unlink(__FILE__ . ".tmp");
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file() : usage variation ***
+
+--float 10.5--
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--float -10.5--
+Error: 2 - file(): '-10' flag is not supported, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - file(): '%i' flag is not supported, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - file(): '%i' flag is not supported, %s(%d)
+bool(false)
+
+--float .5--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--empty array--
+Error: 2 - file() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--lowercase null--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--lowercase true--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--lowercase false--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--uppercase TRUE--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--uppercase FALSE--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--empty string DQ--
+Error: 2 - file() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - file() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - file() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - file() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - file() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - file() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - file() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--unset var--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+===DONE===
diff --git a/ext/standard/tests/file/file_variation4.phpt b/ext/standard/tests/file/file_variation4.phpt
new file mode 100644
index 0000000..5010368
--- /dev/null
+++ b/ext/standard/tests/file/file_variation4.phpt
@@ -0,0 +1,291 @@
+--TEST--
+Test file() function : third parameter variation
+--FILE--
+<?php
+/* Prototype : array file(string filename [, int flags[, resource context]])
+ * Description: Read entire file into an array
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted
+$filename = __FILE__ . ".tmp";
+$fd = fopen($filename, "w+");
+fwrite($fd, "Line 1\nLine 2\nLine 3");
+fclose($fd);
+
+$flags = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// create a file stream resource
+$tmp_filename = __FILE__ . ".tmp2";
+$file_stream_resource = fopen($tmp_filename, "w+");
+
+//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,
+
+ // file stream resource
+ 'file stream resource' => $file_stream_resource,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( file($filename, $flags, $value) );
+};
+
+fclose($file_stream_resource);
+unlink($tmp_filename);
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing file() : usage variation ***
+
+--int 0--
+Error: 2 - file() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - file() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - file() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - file() expects parameter 3 to be resource, integer given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - file() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - file() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - file() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - file() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - file() expects parameter 3 to be resource, double given, %s(%d)
+NULL
+
+--empty array--
+Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--lowercase null--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--lowercase true--
+Error: 2 - file() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - file() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - file() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - file() expects parameter 3 to be resource, boolean given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - file() expects parameter 3 to be resource, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - file() expects parameter 3 to be resource, object given, %s(%d)
+NULL
+
+--undefined var--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--unset var--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+--file stream resource--
+Error: 2 - file(): supplied resource is not a valid Stream-Context resource, %s(%d)
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+===DONE===
diff --git a/ext/standard/tests/file/file_variation5-win32.phpt b/ext/standard/tests/file/file_variation5-win32.phpt
new file mode 100644
index 0000000..d6390db
--- /dev/null
+++ b/ext/standard/tests/file/file_variation5-win32.phpt
@@ -0,0 +1,74 @@
+--TEST--
+file() with various paths
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+
+$script_directory = dirname(__FILE__);
+chdir($script_directory);
+$test_dirname = basename(__FILE__, ".php") . "testdir";
+mkdir($test_dirname);
+
+$filepath = __FILE__ . ".tmp";
+$filename = basename($filepath);
+$fd = fopen($filepath, "w+");
+fwrite($fd, "Line 1\nLine 2\nLine 3");
+fclose($fd);
+
+echo "file() on a path containing .. and .\n";
+var_dump(file("./$test_dirname/../$filename"));
+
+echo "\nfile() on a path containing .. with invalid directories\n";
+var_dump(file("./$test_dirname/bad_dir/../../$filename"));
+
+echo "\nfile() on a relative path from a different working directory\n";
+chdir($test_dirname);
+var_dump(file("../$filename"));
+chdir($script_directory);
+
+chdir($script_directory);
+rmdir($test_dirname);
+unlink($filepath);
+
+?>
+--EXPECT--
+file() on a path containing .. and .
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+file() on a path containing .. with invalid directories
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+file() on a relative path from a different working directory
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
diff --git a/ext/standard/tests/file/file_variation5.phpt b/ext/standard/tests/file/file_variation5.phpt
new file mode 100644
index 0000000..1f15491
--- /dev/null
+++ b/ext/standard/tests/file/file_variation5.phpt
@@ -0,0 +1,94 @@
+--TEST--
+file() with various paths
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip non-windows only test');
+}
+?>
+--FILE--
+<?php
+
+$script_directory = dirname(__FILE__);
+chdir($script_directory);
+$test_dirname = basename(__FILE__, ".php") . "testdir";
+mkdir($test_dirname);
+
+$filepath = __FILE__ . ".tmp";
+$filename = basename($filepath);
+$fd = fopen($filepath, "w+");
+fwrite($fd, "Line 1\nLine 2\nLine 3");
+fclose($fd);
+
+echo "file() on a path containing .. and .\n";
+var_dump(file("./$test_dirname/../$filename"));
+
+echo "\nfile() on a path containing .. with invalid directories\n";
+var_dump(file("./$test_dirname/bad_dir/../../$filename"));
+
+echo "\nfile() on a linked file\n";
+$linkname = "somelink";
+var_dump(symlink($filepath, $linkname));
+var_dump(file($linkname));
+var_dump(unlink($linkname));
+
+echo "\nfile() on a relative path from a different working directory\n";
+chdir($test_dirname);
+var_dump(file("../$filename"));
+chdir($script_directory);
+
+chdir($script_directory);
+rmdir($test_dirname);
+unlink($filepath);
+
+?>
+--EXPECT--
+file() on a path containing .. and .
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+file() on a path containing .. with invalid directories
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+
+file() on a linked file
+bool(true)
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+bool(true)
+
+file() on a relative path from a different working directory
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
diff --git a/ext/standard/tests/file/file_variation6.phpt b/ext/standard/tests/file/file_variation6.phpt
new file mode 100644
index 0000000..7e34f28
--- /dev/null
+++ b/ext/standard/tests/file/file_variation6.phpt
@@ -0,0 +1,261 @@
+--TEST--
+file() with a range of integer flag values
+--FILE--
+<?php
+
+$filepath = __FILE__ . ".tmp";
+$fd = fopen($filepath, "w+");
+fwrite($fd, "Line 1\nLine 2\nLine 3");
+fclose($fd);
+
+for ($flags = 0; $flags <= 32; $flags++) {
+ var_dump(file($filepath, $flags));
+}
+
+unlink($filepath);
+
+?>
+--EXPECTF--
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(7) "Line 2
+"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+
+Warning: file(): '24' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '25' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '26' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '27' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '28' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '29' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '30' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '31' flag is not supported in %s on line %d
+bool(false)
+
+Warning: file(): '32' flag is not supported in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/file/file_variation7.phpt b/ext/standard/tests/file/file_variation7.phpt
new file mode 100644
index 0000000..3cd9d7f
--- /dev/null
+++ b/ext/standard/tests/file/file_variation7.phpt
@@ -0,0 +1,87 @@
+--TEST--
+file() on a file with blank lines
+--FILE--
+<?php
+
+$filepath = __FILE__ . ".tmp";
+$fd = fopen($filepath, "w+");
+fwrite($fd, "Line 1\n\n \n \n\Line 3");
+fclose($fd);
+
+echo "file():\n";
+var_dump(file($filepath));
+
+echo "\nfile() with FILE_IGNORE_NEW_LINES:\n";
+var_dump(file($filepath, FILE_IGNORE_NEW_LINES));
+
+echo "\nfile() with FILE_SKIP_EMPTY_LINES:\n";
+var_dump(file($filepath, FILE_SKIP_EMPTY_LINES));
+
+echo "\nfile() with FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES:\n";
+var_dump(file($filepath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
+
+unlink($filepath);
+
+?>
+--EXPECT--
+file():
+array(5) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ string(2) "
+"
+ [3]=>
+ string(3) "
+"
+ [4]=>
+ string(7) "\Line 3"
+}
+
+file() with FILE_IGNORE_NEW_LINES:
+array(5) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(2) " "
+ [4]=>
+ string(7) "\Line 3"
+}
+
+file() with FILE_SKIP_EMPTY_LINES:
+array(5) {
+ [0]=>
+ string(7) "Line 1
+"
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ string(2) "
+"
+ [3]=>
+ string(3) "
+"
+ [4]=>
+ string(7) "\Line 3"
+}
+
+file() with FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES:
+array(4) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(1) " "
+ [2]=>
+ string(2) " "
+ [3]=>
+ string(7) "\Line 3"
+}
diff --git a/ext/standard/tests/file/file_variation8-win32.phpt b/ext/standard/tests/file/file_variation8-win32.phpt
new file mode 100644
index 0000000..ca3be36
--- /dev/null
+++ b/ext/standard/tests/file/file_variation8-win32.phpt
@@ -0,0 +1,142 @@
+--TEST--
+Test file() function : variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array file(string filename [, int flags[, resource context]])
+ * Description: Read entire file into an array
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file() : variation ***\n";
+$mainDir = "fileVar8.dir";
+$subDir = "fileVar8Sub";
+$absMainDir = dirname(__FILE__)."\\".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."\\".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3);
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir\\",
+ "$absSubDir\\..\\".$subDir,
+ "$absSubDir\\\\..\\.\\".$subDir,
+ "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir,
+ "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir,
+ "$absSubDir\\BADDIR",
+
+ // relative paths
+ $mainDir."\\".$subDir,
+ $mainDir."\\\\".$subDir,
+ $mainDir."\\\\\\".$subDir,
+ ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir,
+ "BADDIR",
+
+ // unixifed path
+ $unixifiedDir,
+);
+
+$filename = 'FileGetContentsVar7.tmp';
+$absFile = $absSubDir.'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ var_dump(file($dir."\\".$filename));
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file() : variation ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 5 --
+
+Warning: file(%sfileVar8.dir\fileVar8Sub\..\\\fileVar8Sub\\..\\..\fileVar8Sub\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: file(%sfileVar8.dir\fileVar8Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 11 --
+
+Warning: file(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/file_variation8.phpt b/ext/standard/tests/file/file_variation8.phpt
new file mode 100644
index 0000000..be18fcb
--- /dev/null
+++ b/ext/standard/tests/file/file_variation8.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test file function : variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array file(string filename [, int flags[, resource context]])
+ * Description: Read entire file into an array
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file() : variation ***\n";
+$mainDir = "fileVar8.dir";
+$subDir = "fileVar8Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+
+);
+
+$filename = 'FileGetContentsVar7.tmp';
+$absFile = $absSubDir.'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, "contents read");
+fclose($h);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ var_dump(file($dir."/".$filename));
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file() : variation ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 5 --
+
+Warning: file(%sfileVar8.dir/fileVar8Sub/..///fileVar8Sub//..//../fileVar8Sub/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: file(%sfileVar8.dir/fileVar8Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ string(13) "contents read"
+}
+
+-- Iteration 11 --
+
+Warning: file(BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/file_variation9.phpt b/ext/standard/tests/file/file_variation9.phpt
new file mode 100644
index 0000000..9ddd1e6
--- /dev/null
+++ b/ext/standard/tests/file/file_variation9.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Test file function : variation - test various endings of a file
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array file(string filename [, int flags[, resource context]])
+ * Description: Read entire file into an array
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing file() : variation ***\n";
+$testfile = dirname(__FILE__)."/fileVar9.txt";
+
+$contents = array(
+ "File ends on a single character\na",
+ "File ends on a new line\n",
+ "File ends on multiple newlines\n\n\n\n",
+ "File has\n\nmultiple lines and newlines\n\n",
+ "File has\r\nmultiple crlfs\n\r\n"
+ );
+
+@unlink($testfile);
+foreach ($contents as $content) {
+ $h = fopen($testfile, "w");
+ fwrite($h, $content);
+ fclose($h);
+ var_dump(file($testfile));
+ unlink($testfile);
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing file() : variation ***
+array(2) {
+ [0]=>
+ string(32) "File ends on a single character
+"
+ [1]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(24) "File ends on a new line
+"
+}
+array(4) {
+ [0]=>
+ string(31) "File ends on multiple newlines
+"
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ string(1) "
+"
+ [3]=>
+ string(1) "
+"
+}
+array(4) {
+ [0]=>
+ string(9) "File has
+"
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ string(28) "multiple lines and newlines
+"
+ [3]=>
+ string(1) "
+"
+}
+array(3) {
+ [0]=>
+ string(10) "File has
+"
+ [1]=>
+ string(15) "multiple crlfs
+"
+ [2]=>
+ string(2) "
+"
+}
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/filegroup_basic.phpt b/ext/standard/tests/file/filegroup_basic.phpt
new file mode 100644
index 0000000..36333b2
--- /dev/null
+++ b/ext/standard/tests/file/filegroup_basic.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test filegroup() function: basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int filegroup ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+echo "*** Testing filegroup(): basic functionality ***\n";
+
+echo "-- Testing with the file or directory created by owner --\n";
+
+$file_path = dirname(__FILE__);
+var_dump( filegroup(__FILE__) );
+var_dump( filegroup(".") );
+var_dump( filegroup("./..") );
+
+/* Newly created files and dirs */
+$file_name = $file_path."/filegroup_basic.tmp";
+$file_handle = fopen($file_name, "w");
+
+$string = "Hello, world\n1234\n123Hello";
+fwrite($file_handle, $string);
+var_dump( filegroup($file_name) );
+fclose($file_handle);
+
+$dir_name = $file_path."/filegroup_basic";
+mkdir($dir_name);
+var_dump( filegroup($dir_name) );
+
+echo "\n-- Testing with the standard file or directory --\n";
+var_dump( filegroup("/etc/passwd") );
+var_dump( filegroup("/etc") );
+var_dump( filegroup("/") );
+
+echo "\n*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+
+$file_path = dirname(__FILE__);
+$file_name = $file_path."/filegroup_basic.tmp";
+$dir_name = $file_path."/filegroup_basic";
+unlink($file_name);
+rmdir($dir_name);
+?>
+
+--EXPECTF--
+*** Testing filegroup(): basic functionality ***
+-- Testing with the file or directory created by owner --
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+
+-- Testing with the standard file or directory --
+int(%d)
+int(%d)
+int(%d)
+
+*** Done ***
diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt
new file mode 100644
index 0000000..3d96ffd
--- /dev/null
+++ b/ext/standard/tests/file/filegroup_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test filegroup() function: error conditions
+--FILE--
+<?php
+/* Prototype: int filegroup ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+echo "*** Testing filegroup(): error conditions ***\n";
+
+/* Non-existing file or dir */
+var_dump( filegroup("/no/such/file/dir") );
+
+/* Invalid arguments */
+var_dump( filegroup("string") );
+var_dump( filegroup(100) );
+
+/* Invalid no.of arguments */
+var_dump( filegroup() ); // args < expected
+var_dump( filegroup("/no/such/file", "root") ); // args > expected
+
+echo "\n*** Done ***\n";
+?>
+
+--EXPECTF--
+*** Testing filegroup(): error conditions ***
+
+Warning: filegroup(): stat failed for /no/such/file/dir in %s on line %d
+bool(false)
+
+Warning: filegroup(): stat failed for string in %s on line %d
+bool(false)
+
+Warning: filegroup(): stat failed for 100 in %s on line %d
+bool(false)
+
+Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/filegroup_variation1.phpt b/ext/standard/tests/file/filegroup_variation1.phpt
new file mode 100644
index 0000000..ee76477
--- /dev/null
+++ b/ext/standard/tests/file/filegroup_variation1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test filegroup() function: usage variations - links
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+--FILE--
+<?php
+/* Prototype: int filegroup ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+/* Creating soft and hard links to a file and applying filegroup() on links */
+
+$file_path = dirname(__FILE__);
+fclose( fopen($file_path."/filegroup_variation1.tmp", "w") );
+
+echo "*** Testing filegroup() with links ***\n";
+/* With symlink */
+symlink($file_path."/filegroup_variation1.tmp", $file_path."/filegroup_variation1_symlink.tmp");
+var_dump( filegroup($file_path."/filegroup_variation1_symlink.tmp") ); //expected true
+clearstatcache();
+
+/* With hardlink */
+link($file_path."/filegroup_variation1.tmp", $file_path."/filegroup_variation1_link.tmp");
+var_dump( filegroup($file_path."/filegroup_variation1_link.tmp") ); // expected: true
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filegroup_variation1_symlink.tmp");
+unlink($file_path."/filegroup_variation1_link.tmp");
+unlink($file_path."/filegroup_variation1.tmp");
+?>
+
+--EXPECTF--
+*** Testing filegroup() with links ***
+int(%d)
+int(%d)
+
+*** Done ***
diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt
new file mode 100644
index 0000000..afac40c
--- /dev/null
+++ b/ext/standard/tests/file/filegroup_variation2.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test filegroup() function: usage variations - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: int filegroup ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+/* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */
+
+$file_path = dirname(__FILE__);
+$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w");
+
+echo "*** Testing Invalid file types ***\n";
+$filenames = array(
+ /* Invalid filenames */
+ -2.34555,
+ " ",
+ "",
+ TRUE,
+ FALSE,
+ NULL,
+ $file_handle,
+
+ /* scalars */
+ 1234,
+ 0
+);
+
+/* loop through to test each element the above array */
+foreach( $filenames as $filename ) {
+ var_dump( filegroup($filename) );
+ clearstatcache();
+}
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filegroup_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing Invalid file types ***
+
+Warning: filegroup(): stat failed for -2.34555 in %s on line %d
+bool(false)
+
+Warning: filegroup(): stat failed for in %s on line %d
+bool(false)
+bool(false)
+
+Warning: filegroup(): stat failed for 1 in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+
+Warning: filegroup(): stat failed for 1234 in %s on line %d
+bool(false)
+
+Warning: filegroup(): stat failed for 0 in %s on line %d
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt
new file mode 100644
index 0000000..b275944
--- /dev/null
+++ b/ext/standard/tests/file/filegroup_variation3.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test filegroup() function: usage variations - diff. path notations
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: int filegroup ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+/* Passing file names with different notations, using slashes, wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing filegroup() with different notations of file names ***\n";
+$dir_name = $file_path."/filegroup_variation3";
+mkdir($dir_name);
+$file_handle = fopen($dir_name."/filegroup_variation3.tmp", "w");
+fclose($file_handle);
+
+$files_arr = array(
+ "/filegroup_variation3/filegroup_variation3.tmp",
+
+ /* Testing a file trailing slash */
+ "/filegroup_variation3/filegroup_variation3.tmp/",
+
+ /* Testing file with double slashes */
+ "/filegroup_variation3//filegroup_variation3.tmp",
+ "//filegroup_variation3//filegroup_variation3.tmp",
+ "/filegroup_variation3/*.tmp",
+ "filegroup_variation3/filegroup*.tmp",
+
+ /* Testing Binary safe */
+ "/filegroup_variation3/filegroup_variation3.tmp".chr(0),
+ "/filegroup_variation3/filegroup_variation3.tmp\0"
+);
+
+$count = 1;
+/* loop through to test each element in the above array */
+foreach($files_arr as $file) {
+ echo "- Iteration $count -\n";
+ var_dump( filegroup( $file_path."/".$file ) );
+ clearstatcache();
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/filegroup_variation3";
+unlink($dir_name."/filegroup_variation3.tmp");
+rmdir($dir_name);
+?>
+--EXPECTF--
+*** Testing filegroup() with different notations of file names ***
+- Iteration 1 -
+int(%d)
+- Iteration 2 -
+
+Warning: filegroup(): stat failed for %s//filegroup_variation3/filegroup_variation3.tmp/ in %s on line %d
+bool(false)
+- Iteration 3 -
+int(%d)
+- Iteration 4 -
+int(%d)
+- Iteration 5 -
+
+Warning: filegroup(): stat failed for %s//filegroup_variation3/*.tmp in %s on line %d
+bool(false)
+- Iteration 6 -
+
+Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d
+bool(false)
+- Iteration 7 -
+
+Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+- Iteration 8 -
+
+Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_basic.phpt b/ext/standard/tests/file/fileinode_basic.phpt
new file mode 100644
index 0000000..98e5cf0
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test fileinode() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+echo "*** Testing fileinode() with file, directory ***\n";
+
+/* Getting inode of created file */
+$file_path = dirname(__FILE__);
+fopen("$file_path/inode.tmp", "w");
+print( fileinode("$file_path/inode.tmp") )."\n";
+
+/* Getting inode of current file */
+print( fileinode(__FILE__) )."\n";
+
+/* Getting inode of directories */
+print( fileinode(".") )."\n";
+print( fileinode("./..") )."\n";
+
+echo "\n*** Done ***";
+--CLEAN--
+<?php
+unlink (dirname(__FILE__)."/inode.tmp");
+?>
+--EXPECTF--
+*** Testing fileinode() with file, directory ***
+%d
+%d
+%d
+%d
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt
new file mode 100644
index 0000000..d716c4a
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test fileinode() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+echo "*** Testing error conditions of fileinode() ***";
+
+/* Non-existing file or dir */
+var_dump( fileinode("/no/such/file/dir") );
+
+/* Invalid arguments */
+var_dump( fileinode("string") );
+var_dump( fileinode(100) );
+
+/* No.of argumetns less than expected */
+var_dump( fileinode() );
+
+/* No.of argumetns greater than expected */
+var_dump( fileinode(__FILE__, "string") );
+
+echo "\n*** Done ***";
+
+--EXPECTF--
+*** Testing error conditions of fileinode() ***
+Warning: fileinode(): stat failed for /no/such/file/dir in %s on line 10
+bool(false)
+
+Warning: fileinode(): stat failed for string in %s on line 13
+bool(false)
+
+Warning: fileinode(): stat failed for 100 in %s on line 14
+bool(false)
+
+Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17
+NULL
+
+Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation.phpt b/ext/standard/tests/file/fileinode_variation.phpt
new file mode 100644
index 0000000..1fac953
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_variation.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test fileinode() function: Variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no link()/symlink() on Windows');
+}
+?>
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+echo "*** Testing fileinode() with files, links and directories ***\n";
+$file_path = dirname(__FILE__);
+$file1 = $file_path."/fileinode1_variation.tmp";
+$file2 = $file_path."/fileinode2_variation.tmp";
+$link1 = $file_path."/fileinode1_variation_link.tmp";
+$link2 = $file_path."/fileinode2_variation_link.tmp";
+
+
+echo "-- Testing with files --\n";
+//creating the files
+fclose( fopen( $file1, "w" ) );
+fclose( fopen( $file2, "w" ) );
+
+print( fileinode( $file1) )."\n";
+print( fileinode( $file2) )."\n";
+clearstatcache();
+
+echo "-- Testing with links: hard link --\n";
+link( $file1, $link1); // Creating an hard link
+print( fileinode( $file1) )."\n";
+clearstatcache();
+print( fileinode( $link1) )."\n";
+clearstatcache();
+
+echo "-- Testing with links: soft link --\n";
+symlink( $file2, $link2); // Creating a soft link
+print( fileinode( $file2) )."\n";
+clearstatcache();
+print( fileinode( $link2) )."\n";
+
+unlink( $link1 );
+unlink( $link2 );
+
+echo "-- Testing after copying a file --\n";
+copy( $file1, $file_path."/fileinode1_variation_new.tmp");
+print( fileinode( $file1) )."\n";
+clearstatcache();
+print( fileinode( $file_path."/fileinode1_variation_new.tmp") )."\n";
+
+unlink( $file_path."/fileinode1_variation_new.tmp");
+unlink( $file1);
+unlink( $file2);
+
+
+echo "-- Testing after renaming the file --\n";
+fclose( fopen("$file_path/old.txt", "w") );
+print( fileinode("$file_path/old.txt") )."\n";
+clearstatcache();
+
+rename("$file_path/old.txt", "$file_path/new.txt");
+print( fileinode("$file_path/new.txt") )."\n";
+
+unlink("$file_path/new.txt");
+
+echo "-- Testing with directories --\n";
+mkdir("$file_path/dir");
+print( fileinode("$file_path/dir") )."\n";
+clearstatcache();
+
+mkdir("$file_path/dir/subdir");
+print( fileinode("$file_path/dir/subdir") )."\n";
+clearstatcache();
+
+echo "-- Testing with binary input --\n";
+print( fileinode(b"$file_path/dir") )."\n";
+clearstatcache();
+print( fileinode(b"$file_path/dir/subdir") );
+
+rmdir("$file_path/dir/subdir");
+rmdir("$file_path/dir");
+
+echo "\n*** Done ***";
+
+--EXPECTF--
+*** Testing fileinode() with files, links and directories ***
+-- Testing with files --
+%d
+%d
+-- Testing with links: hard link --
+%d
+%d
+-- Testing with links: soft link --
+%d
+%d
+-- Testing after copying a file --
+%d
+%d
+-- Testing after renaming the file --
+%d
+%d
+-- Testing with directories --
+%d
+%d
+-- Testing with binary input --
+%d
+%d
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation1.phpt b/ext/standard/tests/file/fileinode_variation1.phpt
new file mode 100644
index 0000000..d251cc3
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_variation1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test fileinode() function: usage variations - links
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+/* Creating soft and hard links to a file and applying fileinode() on links */
+
+$file_path = dirname(__FILE__);
+fclose( fopen($file_path."/fileinode_variation1.tmp", "w") );
+
+echo "*** Testing fileinode() with links ***\n";
+/* With symlink */
+symlink($file_path."/fileinode_variation1.tmp", $file_path."/fileinode_variation1_symlink.tmp");
+var_dump( fileinode($file_path."/fileinode_variation1_symlink.tmp") ); //expected true
+clearstatcache();
+
+/* With hardlink */
+link($file_path."/fileinode_variation1.tmp", $file_path."/fileinode_variation1_link.tmp");
+var_dump( fileinode($file_path."/fileinode_variation1_link.tmp") ); // expected: true
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/fileinode_variation1_symlink.tmp");
+unlink($file_path."/fileinode_variation1_link.tmp");
+unlink($file_path."/fileinode_variation1.tmp");
+?>
+
+--EXPECTF--
+*** Testing fileinode() with links ***
+int(%d)
+int(%d)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt
new file mode 100644
index 0000000..e8e7af6
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_variation2.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test fileinode() function: usage variations - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */
+
+$file_path = dirname(__FILE__);
+$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w");
+
+echo "*** Testing Invalid file types ***\n";
+$filenames = array(
+ /* Invalid filenames */
+ -2.34555,
+ " ",
+ "",
+ TRUE,
+ FALSE,
+ NULL,
+ $file_handle,
+
+ /* scalars */
+ 1234,
+ 0
+);
+
+/* loop through to test each element the above array */
+foreach( $filenames as $filename ) {
+ var_dump( fileinode($filename) );
+ clearstatcache();
+}
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/fileinode_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing Invalid file types ***
+
+Warning: fileinode(): stat failed for -2.34555 in %s on line %d
+bool(false)
+
+Warning: fileinode(): stat failed for in %s on line %d
+bool(false)
+bool(false)
+
+Warning: fileinode(): stat failed for 1 in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+
+Warning: fileinode(): stat failed for 1234 in %s on line %d
+bool(false)
+
+Warning: fileinode(): stat failed for 0 in %s on line %d
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt
new file mode 100644
index 0000000..ca84864
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_variation3.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test fileinode() function: usage variations - diff. path notations
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+/* Passing file names with different notations, using slashes, wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing fileinode() with different notations of file names ***\n";
+$dir_name = $file_path."/fileinode_variation3";
+mkdir($dir_name);
+$file_handle = fopen($dir_name."/fileinode_variation3.tmp", "w");
+fclose($file_handle);
+
+$files_arr = array(
+ "/fileinode_variation3/fileinode_variation3.tmp",
+
+ /* Testing a file trailing slash */
+ "/fileinode_variation3/fileinode_variation3.tmp/",
+
+ /* Testing file with double slashes */
+ "/fileinode_variation3//fileinode_variation3.tmp",
+ "//fileinode_variation3//fileinode_variation3.tmp",
+ "/fileinode_variation3/*.tmp",
+ "fileinode_variation3/fileinode*.tmp",
+
+ /* Testing Binary safe */
+ "/fileinode_variation3/fileinode_variation3.tmp".chr(0),
+ "/fileinode_variation3/fileinode_variation3.tmp\0"
+);
+
+$count = 1;
+/* loop through to test each element in the above array */
+foreach($files_arr as $file) {
+ echo "- Iteration $count -\n";
+ var_dump( fileinode( $file_path."/".$file ) );
+ clearstatcache();
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/fileinode_variation3";
+unlink($dir_name."/fileinode_variation3.tmp");
+rmdir($dir_name);
+?>
+--EXPECTF--
+*** Testing fileinode() with different notations of file names ***
+- Iteration 1 -
+int(%i)
+- Iteration 2 -
+
+Warning: fileinode(): stat failed for %s//fileinode_variation3/fileinode_variation3.tmp/ in %s on line %d
+bool(false)
+- Iteration 3 -
+int(%i)
+- Iteration 4 -
+int(%i)
+- Iteration 5 -
+
+Warning: fileinode(): stat failed for %s//fileinode_variation3/*.tmp in %s on line %d
+bool(false)
+- Iteration 6 -
+
+Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d
+bool(false)
+- Iteration 7 -
+
+Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+- Iteration 8 -
+
+Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileowner_basic.phpt b/ext/standard/tests/file/fileowner_basic.phpt
new file mode 100644
index 0000000..5b5ff9a
--- /dev/null
+++ b/ext/standard/tests/file/fileowner_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test fileowner() function: basic functionality
+--FILE--
+<?php
+/* Prototype: int fileowner ( string $filename )
+ * Description: Returns the user ID of the owner of the file, or
+ * FALSE in case of an error.
+ */
+
+echo "*** Testing fileowner(): basic functionality ***\n";
+
+echo "-- Testing with the file or directory created by owner --\n";
+var_dump( fileowner(__FILE__) );
+var_dump( fileowner(".") );
+var_dump( fileowner("./..") );
+
+/* Newly created files and dirs */
+$file_path = dirname(__FILE__);
+$file_name = $file_path."/fileowner_basic.tmp";
+$file_handle = fopen($file_name, "w");
+$string = "Hello, world\n1234\n123Hello";
+fwrite($file_handle, $string);
+var_dump( fileowner($file_name) );
+fclose($file_handle);
+
+$dir_name = $file_path."/fileowner_basic";
+mkdir($dir_name);
+var_dump( fileowner($dir_name) );
+
+echo "*** Done ***\n";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$file_name = $file_path."/fileowner_basic.tmp";
+$dir_name = $file_path."/fileowner_basic";
+unlink($file_name);
+rmdir($dir_name);
+?>
+
+--EXPECTF--
+*** Testing fileowner(): basic functionality ***
+-- Testing with the file or directory created by owner --
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Done ***
+
diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt
new file mode 100644
index 0000000..efffb36
--- /dev/null
+++ b/ext/standard/tests/file/fileowner_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test of fileowner() function: error conditions
+--FILE--
+<?php
+/* Prototype: int fileowner ( string $filename )
+ * Description: Returns the user ID of the owner of the file, or
+ * FALSE in case of an error.
+ */
+
+echo "*** Testing fileowner(): error conditions ***\n";
+/* Non-existing file or dir */
+var_dump( fileowner("/no/such/file/dir") );
+
+/* Invalid arguments */
+var_dump( fileowner("string") );
+var_dump( fileowner(100) );
+
+/* Invalid no.of arguments */
+var_dump( fileowner() ); // args < expected
+var_dump( fileowner("/no/such/file", "root") ); // args > expected
+
+echo "\n*** Done ***\n";
+?>
+
+--EXPECTF--
+*** Testing fileowner(): error conditions ***
+
+Warning: fileowner(): stat failed for /no/such/file/dir in %s on line %d
+bool(false)
+
+Warning: fileowner(): stat failed for string in %s on line %d
+bool(false)
+
+Warning: fileowner(): stat failed for 100 in %s on line %d
+bool(false)
+
+Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fileowner_variation1.phpt b/ext/standard/tests/file/fileowner_variation1.phpt
new file mode 100644
index 0000000..b70ac36
--- /dev/null
+++ b/ext/standard/tests/file/fileowner_variation1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test fileowner() function: usage variations - links
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+--FILE--
+<?php
+/* Prototype: int fileowner ( string $filename )
+ * Description: Returns the user ID of the owner of the file, or
+ * FALSE in case of an error.
+ */
+
+/* Creating soft and hard links to a file and applying fileowner() on links */
+
+$file_path = dirname(__FILE__);
+fclose( fopen($file_path."/fileowner_variation1.tmp", "w") );
+
+echo "*** Testing fileowner() with links ***\n";
+/* With symlink */
+symlink($file_path."/fileowner_variation1.tmp", $file_path."/fileowner_variation1_symlink.tmp");
+var_dump( fileowner($file_path."/fileowner_variation1_symlink.tmp") ); //expected true
+clearstatcache();
+
+/* With hardlink */
+link($file_path."/fileowner_variation1.tmp", $file_path."/fileowner_variation1_link.tmp");
+var_dump( fileowner($file_path."/fileowner_variation1_link.tmp") ); // expected: true
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/fileowner_variation1_symlink.tmp");
+unlink($file_path."/fileowner_variation1_link.tmp");
+unlink($file_path."/fileowner_variation1.tmp");
+?>
+
+--EXPECTF--
+*** Testing fileowner() with links ***
+int(%d)
+int(%d)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt
new file mode 100644
index 0000000..feff767
--- /dev/null
+++ b/ext/standard/tests/file/fileowner_variation2.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test fileowner() function: usage variations - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: int fileowner ( string $filename )
+ * Description: Returns the user ID of the owner of the file, or
+ * FALSE in case of an error.
+ */
+
+/* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */
+
+$file_path = dirname(__FILE__);
+$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w");
+
+echo "*** Testing Invalid file types ***\n";
+$filenames = array(
+ /* Invalid filenames */
+ -2.34555,
+ " ",
+ "",
+ TRUE,
+ FALSE,
+ NULL,
+ $file_handle,
+
+ /* scalars */
+ 1234,
+ 0
+);
+
+/* loop through to test each element the above array */
+foreach( $filenames as $filename ) {
+ var_dump( fileowner($filename) );
+ clearstatcache();
+}
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/fileowner_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing Invalid file types ***
+
+Warning: fileowner(): stat failed for -2.34555 in %s on line %d
+bool(false)
+
+Warning: fileowner(): stat failed for in %s on line %d
+bool(false)
+bool(false)
+
+Warning: fileowner(): stat failed for 1 in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+
+Warning: fileowner(): stat failed for 1234 in %s on line %d
+bool(false)
+
+Warning: fileowner(): stat failed for 0 in %s on line %d
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt
new file mode 100644
index 0000000..6f91c31
--- /dev/null
+++ b/ext/standard/tests/file/fileowner_variation3.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test fileowner() function: usage variations - diff. path notations
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: int fileowner ( string $filename )
+ * Description: Returns the user ID of the owner of the file, or
+ * FALSE in case of an error.
+ */
+
+/* Passing file names with different notations, using slashes, wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing fileowner() with different notations of file names ***\n";
+$dir_name = $file_path."/fileowner_variation3";
+mkdir($dir_name);
+$file_handle = fopen($dir_name."/fileowner_variation3.tmp", "w");
+fclose($file_handle);
+
+$files_arr = array(
+ "/fileowner_variation3/fileowner_variation3.tmp",
+
+ /* Testing a file trailing slash */
+ "/fileowner_variation3/fileowner_variation3.tmp/",
+
+ /* Testing file with double slashes */
+ "/fileowner_variation3//fileowner_variation3.tmp",
+ "//fileowner_variation3//fileowner_variation3.tmp",
+ "/fileowner_variation3/*.tmp",
+ "fileowner_variation3/fileowner*.tmp",
+
+ /* Testing Binary safe */
+ "/fileowner_variation3/fileowner_variation3.tmp".chr(0),
+ "/fileowner_variation3/fileowner_variation3.tmp\0"
+);
+
+$count = 1;
+/* loop through to test each element in the above array */
+foreach($files_arr as $file) {
+ echo "- Iteration $count -\n";
+ var_dump( fileowner( $file_path."/".$file ) );
+ clearstatcache();
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/fileowner_variation3";
+unlink($dir_name."/fileowner_variation3.tmp");
+rmdir($dir_name);
+?>
+--EXPECTF--
+*** Testing fileowner() with different notations of file names ***
+- Iteration 1 -
+int(%d)
+- Iteration 2 -
+
+Warning: fileowner(): stat failed for %s//fileowner_variation3/fileowner_variation3.tmp/ in %s on line %d
+bool(false)
+- Iteration 3 -
+int(%d)
+- Iteration 4 -
+int(%d)
+- Iteration 5 -
+
+Warning: fileowner(): stat failed for %s//fileowner_variation3/*.tmp in %s on line %d
+bool(false)
+- Iteration 6 -
+
+Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d
+bool(false)
+- Iteration 7 -
+
+Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+- Iteration 8 -
+
+Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileperms_variation1.phpt b/ext/standard/tests/file/fileperms_variation1.phpt
new file mode 100644
index 0000000..e90cf87
--- /dev/null
+++ b/ext/standard/tests/file/fileperms_variation1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fileperms() function: usage variations - links
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+--FILE--
+<?php
+/* Prototype: int fileperms ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+/* Creating soft and hard links to a file and applying fileperms() on links */
+
+$file_path = dirname(__FILE__);
+fclose( fopen($file_path."/fileperms_variation1.tmp", "w") );
+
+echo "*** Testing fileperms() with links ***\n";
+/* With symlink */
+symlink($file_path."/fileperms_variation1.tmp", $file_path."/fileperms_variation1_symlink.tmp");
+var_dump( fileperms($file_path."/fileperms_variation1_symlink.tmp") ); //expected true
+clearstatcache();
+
+/* With hardlink */
+link($file_path."/fileperms_variation1.tmp", $file_path."/fileperms_variation1_link.tmp");
+var_dump( fileperms($file_path."/fileperms_variation1_link.tmp") ); // expected: true
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/fileperms_variation1_symlink.tmp");
+unlink($file_path."/fileperms_variation1_link.tmp");
+unlink($file_path."/fileperms_variation1.tmp");
+?>
+
+--EXPECTF--
+*** Testing fileperms() with links ***
+int(%d)
+int(%d)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt
new file mode 100644
index 0000000..47c0c65
--- /dev/null
+++ b/ext/standard/tests/file/fileperms_variation2.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test fileperms() function: usage variations - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: int fileperms ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+/* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */
+
+$file_path = dirname(__FILE__);
+$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w");
+
+echo "*** Testing Invalid file types ***\n";
+$filenames = array(
+ /* Invalid filenames */
+ -2.34555,
+ " ",
+ "",
+ TRUE,
+ FALSE,
+ NULL,
+ $file_handle,
+
+ /* scalars */
+ 1234,
+ 0
+);
+
+/* loop through to test each element the above array */
+foreach( $filenames as $filename ) {
+ var_dump( fileperms($filename) );
+ clearstatcache();
+}
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/fileperms_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing Invalid file types ***
+
+Warning: fileperms(): stat failed for -2.34555 in %s on line %d
+bool(false)
+
+Warning: fileperms(): stat failed for in %s on line %d
+bool(false)
+bool(false)
+
+Warning: fileperms(): stat failed for 1 in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+
+Warning: fileperms(): stat failed for 1234 in %s on line %d
+bool(false)
+
+Warning: fileperms(): stat failed for 0 in %s on line %d
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt
new file mode 100644
index 0000000..575fe11
--- /dev/null
+++ b/ext/standard/tests/file/fileperms_variation3.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test fileperms() function: usage variations - diff. path notations
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype: int fileperms ( string $filename )
+ * Description: Returns the group ID of the file, or FALSE in case of an error.
+ */
+
+/* Passing file names with different notations, using slashes, wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing fileperms() with different notations of file names ***\n";
+$dir_name = $file_path."/fileperms_variation3";
+mkdir($dir_name);
+$file_handle = fopen($dir_name."/fileperms_variation3.tmp", "w");
+fclose($file_handle);
+
+$files_arr = array(
+ "/fileperms_variation3/fileperms_variation3.tmp",
+
+ /* Testing a file trailing slash */
+ "/fileperms_variation3/fileperms_variation3.tmp/",
+
+ /* Testing file with double slashes */
+ "/fileperms_variation3//fileperms_variation3.tmp",
+ "//fileperms_variation3//fileperms_variation3.tmp",
+ "/fileperms_variation3/*.tmp",
+ "fileperms_variation3/fileperms*.tmp",
+
+ /* Testing Binary safe */
+ "/fileperms_variation3/fileperms_variation3.tmp".chr(0),
+ "/fileperms_variation3/fileperms_variation3.tmp\0"
+);
+
+$count = 1;
+/* loop through to test each element in the above array */
+foreach($files_arr as $file) {
+ echo "- Iteration $count -\n";
+ var_dump( fileperms( $file_path."/".$file ) );
+ clearstatcache();
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/fileperms_variation3";
+unlink($dir_name."/fileperms_variation3.tmp");
+rmdir($dir_name);
+?>
+--EXPECTF--
+*** Testing fileperms() with different notations of file names ***
+- Iteration 1 -
+int(%d)
+- Iteration 2 -
+
+Warning: fileperms(): stat failed for %s//fileperms_variation3/fileperms_variation3.tmp/ in %s on line %d
+bool(false)
+- Iteration 3 -
+int(%d)
+- Iteration 4 -
+int(%d)
+- Iteration 5 -
+
+Warning: fileperms(): stat failed for %s//fileperms_variation3/*.tmp in %s on line %d
+bool(false)
+- Iteration 6 -
+
+Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d
+bool(false)
+- Iteration 7 -
+
+Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+- Iteration 8 -
+
+Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_basic.phpt b/ext/standard/tests/file/filesize_basic.phpt
new file mode 100644
index 0000000..58041b9
--- /dev/null
+++ b/ext/standard/tests/file/filesize_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test filesize() function: basic functionaity
+--FILE--
+<?php
+/*
+ * Prototype: int filesize ( string $filename );
+ * Description: Returns the size of the file in bytes, or FALSE
+ * (and generates an error of level E_WARNING) in case of an error.
+ */
+
+
+echo "*** Testing size of files and directories with filesize() ***\n";
+
+$file_path = dirname(__FILE__);
+
+var_dump( filesize(__FILE__) );
+var_dump( filesize(".") );
+
+/* Empty file */
+$file_name = $file_path."/filesize_basic.tmp";
+$file_handle = fopen($file_name, "w");
+fclose($file_handle);
+var_dump( filesize($file_name) );
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$file_name = $file_path."/filesize_basic.tmp";
+unlink($file_name);
+?>
+--EXPECTF--
+*** Testing size of files and directories with filesize() ***
+int(%d)
+int(%d)
+int(0)
+*** Done ***
+
diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt
new file mode 100644
index 0000000..6d8cfa8
--- /dev/null
+++ b/ext/standard/tests/file/filesize_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test filesize() function: error conditions
+--FILE--
+<?php
+/*
+ * Prototype : int filesize ( string $filename );
+ * Description : Returns the size of the file in bytes, or FALSE
+ * (and generates an error of level E_WARNING) in case of an error.
+ */
+
+echo "*** Testing filesize(): error conditions ***";
+
+/* Non-existing file or dir */
+var_dump( filesize("/no/such/file") );
+var_dump( filesize("/no/such/dir") );
+
+/* No.of arguments less than expected */
+var_dump( filesize() );
+
+/* No.of arguments greater than expected */
+var_dump( filesize(__FILE__, 2000) );
+echo "\n";
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filesize(): error conditions ***
+Warning: filesize(): stat failed for /no/such/file in %s on line %d
+bool(false)
+
+Warning: filesize(): stat failed for /no/such/dir in %s on line %d
+bool(false)
+
+Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/filesize_variation1-win32.phpt b/ext/standard/tests/file/filesize_variation1-win32.phpt
new file mode 100644
index 0000000..e9ff053
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation1-win32.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test filesize() function: usage variations - size of files
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only valid for Windows');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+echo "*** Testing filesize(): usage variations ***\n";
+
+echo "*** Checking filesize() with different size of files ***\n";
+for($size = 1; $size <10000; $size = $size+1000)
+{
+ create_files($file_path, 1, "numeric", 0755, $size, "w", "filesize_variation");
+ var_dump( filesize( $file_path."/filesize_variation1.tmp") );
+ clearstatcache();
+ delete_files($file_path, 1, "filesize_variation");
+}
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+*** Checking filesize() with different size of files ***
+int(1024)
+int(1025024)
+int(2049024)
+int(3073024)
+int(4097024)
+int(5121024)
+int(6145024)
+int(7169024)
+int(8193024)
+int(9217024)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation1.phpt b/ext/standard/tests/file/filesize_variation1.phpt
new file mode 100644
index 0000000..0a490cd
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation1.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test filesize() function: usage variations - size of files
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid on Windows');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+echo "*** Testing filesize(): usage variations ***\n";
+
+echo "*** Checking filesize() with different size of files ***\n";
+for($size = 1; $size <10000; $size = $size+1000)
+{
+ create_files($file_path, 1, "numeric", 0755, $size, "w", "filesize_variation");
+ var_dump( filesize( $file_path."/filesize_variation1.tmp") );
+ clearstatcache();
+ delete_files($file_path, 1, "filesize_variation");
+}
+
+echo "Done\n";
+
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+*** Checking filesize() with different size of files ***
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+Done
diff --git a/ext/standard/tests/file/filesize_variation2-win32.phpt b/ext/standard/tests/file/filesize_variation2-win32.phpt
new file mode 100644
index 0000000..544e3aa
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation2-win32.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test filesize() function: usage variations - size of dir/subdir
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only valid for Windows');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+echo "*** Testing filesize(): usage variations ***\n";
+
+echo "\n*** Testing size of a dir, sub-dir and file with filesize() ***\n";
+echo "-- Creating a base dir, and checking its size --\n";
+mkdir( $file_path."/filesize_variation2");
+var_dump( filesize( $file_path."/filesize_variation2"));
+clearstatcache();
+
+echo "-- Creating a file inside base dir, and checking dir & file size --\n";
+create_files($file_path."/filesize_variation2", 1, "numeric", 0755, 1, "w", "filesize_variation", 2);
+var_dump( filesize( $file_path."/filesize_variation2"));
+clearstatcache();
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2.tmp"));
+clearstatcache();
+delete_files($file_path."/filesize_variation2", 1, "filesize_variation", 2);
+
+echo "-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --\n";
+mkdir( $file_path."/filesize_variation2/filesize_variation2_sub");
+var_dump( filesize( $file_path."/filesize_variation2")); // size of base dir
+clearstatcache();
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2_sub")); // size of subdir
+clearstatcache();
+
+echo "-- Creating a file inside sub-dir, and checking size of base, subdir and file created --\n";
+// create only the file, as base and subdir is already created
+$filename = $file_path."/filesize_variation2/filesize_variation2_sub/filesize_variation2.tmp";
+$file_handle = fopen($filename, "w");
+fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
+fclose($file_handle);
+// size of base dir
+var_dump( filesize( $file_path."/filesize_variation2"));
+clearstatcache();
+// size of subdir
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2_sub"));
+clearstatcache();
+// size of file inside subdir
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2_sub/filesize_variation2.tmp"));
+clearstatcache();
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filesize_variation2/filesize_variation2_sub/filesize_variation2.tmp");
+rmdir($file_path."/filesize_variation2/filesize_variation2_sub");
+rmdir($file_path."/filesize_variation2");
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+
+*** Testing size of a dir, sub-dir and file with filesize() ***
+-- Creating a base dir, and checking its size --
+int(0)
+-- Creating a file inside base dir, and checking dir & file size --
+int(0)
+int(1024)
+-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --
+int(0)
+int(0)
+-- Creating a file inside sub-dir, and checking size of base, subdir and file created --
+int(0)
+int(0)
+int(12000)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation2.phpt b/ext/standard/tests/file/filesize_variation2.phpt
new file mode 100644
index 0000000..8a7594e
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation2.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test filesize() function: usage variations - size of dir/subdir
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only valid for Linux');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+echo "*** Testing filesize(): usage variations ***\n";
+
+echo "\n*** Testing size of a dir, sub-dir and file with filesize() ***\n";
+echo "-- Creating a base dir, and checking its size --\n";
+mkdir( $file_path."/filesize_variation2");
+var_dump( filesize( $file_path."/filesize_variation2"));
+clearstatcache();
+
+echo "-- Creating a file inside base dir, and checking dir & file size --\n";
+create_files($file_path."/filesize_variation2", 1, "numeric", 0755, 1, "w", "filesize_variation");
+var_dump( filesize( $file_path."/filesize_variation2"));
+clearstatcache();
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation1.tmp"));
+clearstatcache();
+delete_files($file_path."/filesize_variation2", 1, "filesize_variation");
+
+echo "-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --\n";
+mkdir( $file_path."/filesize_variation2/filesize_variation2_sub");
+var_dump( filesize( $file_path."/filesize_variation2")); // size of base dir
+clearstatcache();
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2_sub")); // size of subdir
+clearstatcache();
+
+echo "-- Creating a file inside sub-dir, and checking size of base, subdir and file created --\n";
+// create only the file, as base and subdir is already created
+$filename = $file_path."/filesize_variation2/filesize_variation2_sub/filesize_variation2.tmp";
+$file_handle = fopen($filename, "w");
+fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
+fclose($file_handle);
+// size of base dir
+var_dump( filesize( $file_path."/filesize_variation2"));
+clearstatcache();
+// size of subdir
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2_sub"));
+clearstatcache();
+// size of file inside subdir
+var_dump( filesize( $file_path."/filesize_variation2/filesize_variation2_sub/filesize_variation2.tmp"));
+clearstatcache();
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filesize_variation2/filesize_variation2_sub/filesize_variation2.tmp");
+rmdir($file_path."/filesize_variation2/filesize_variation2_sub");
+rmdir($file_path."/filesize_variation2");
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+
+*** Testing size of a dir, sub-dir and file with filesize() ***
+-- Creating a base dir, and checking its size --
+int(%d)
+-- Creating a file inside base dir, and checking dir & file size --
+int(%d)
+int(1024)
+-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --
+int(%d)
+int(%d)
+-- Creating a file inside sub-dir, and checking size of base, subdir and file created --
+int(%d)
+int(%d)
+int(12000)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation3-win32.phpt b/ext/standard/tests/file/filesize_variation3-win32.phpt
new file mode 100644
index 0000000..f466959
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation3-win32.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test filesize() function: usage variations - file size after truncate
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only valid for Windows');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing filesize(): usage variations ***\n";
+$filename = $file_path."/filesize_variation3.tmp";
+$file_handle = fopen($filename, "w");
+fwrite($file_handle, (binary)str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
+fclose($file_handle);
+
+echo "-- Testing filesize() after truncating the file to a new length --\n";
+// truncate the file created earlier in subdir, the size of the file is 12000bytes
+// truncate the same file, in the loop , each time with the decrement in size by 1200 bytes,
+// until -1200bytes size
+for($size = filesize($filename); $size>=-1200; $size-=1200) {
+ $file_handle = fopen($filename, "r+");
+ var_dump( ftruncate($file_handle, $size) );
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+ clearstatcache();
+}
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filesize_variation3.tmp");
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+-- Testing filesize() after truncating the file to a new length --
+bool(true)
+int(12000)
+bool(true)
+int(10800)
+bool(true)
+int(9600)
+bool(true)
+int(8400)
+bool(true)
+int(7200)
+bool(true)
+int(6000)
+bool(true)
+int(4800)
+bool(true)
+int(3600)
+bool(true)
+int(2400)
+bool(true)
+int(1200)
+bool(true)
+int(0)
+bool(false)
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation3.phpt b/ext/standard/tests/file/filesize_variation3.phpt
new file mode 100644
index 0000000..3ae06fa
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation3.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test filesize() function: usage variations - file size after truncate
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only valid for Linux');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing filesize(): usage variations ***\n";
+$filename = $file_path."/filesize_variation3.tmp";
+$file_handle = fopen($filename, "w");
+fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
+fclose($file_handle);
+
+echo "-- Testing filesize() after truncating the file to a new length --\n";
+// truncate the file created earlier in subdir, the size of the file is 12000bytes
+// truncate the same file, in the loop , each time with the decrement in size by 1200 bytes,
+// until -1200bytes size
+for($size = filesize($filename); $size>=-1200; $size-=1200) {
+ $file_handle = fopen($filename, "r+");
+ var_dump( ftruncate($file_handle, $size) );
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+ clearstatcache();
+}
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filesize_variation3.tmp");
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+-- Testing filesize() after truncating the file to a new length --
+bool(true)
+int(12000)
+bool(true)
+int(10800)
+bool(true)
+int(9600)
+bool(true)
+int(8400)
+bool(true)
+int(7200)
+bool(true)
+int(6000)
+bool(true)
+int(4800)
+bool(true)
+int(3600)
+bool(true)
+int(2400)
+bool(true)
+int(1200)
+bool(true)
+int(0)
+bool(false)
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation4-win32.phpt b/ext/standard/tests/file/filesize_variation4-win32.phpt
new file mode 100644
index 0000000..5f20f42
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation4-win32.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test filesize() function: usage variations - file mode & holes in file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only valid for Windows');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+echo "*** Testing filesize(): usage variations ***\n";
+echo "\n*** Testing filesize() with data written using different file modes and by creating holes in file ***\n";
+
+$filename = $file_path."/filesize_variation4.tmp";
+$string = "Test 2 test the filesize() fn, with data containing all the types like !@@##$%^&*():<>?|~+!;',.\][{}(special) chars, 12345(numeric) chars, and \n(newline char), \t(tab), \0, \r and so on........\0";
+echo "-- opening the file in 'w' mode and get the size --\n";
+$file_handle = fopen($filename, "w");
+var_dump( strlen($string) ); //strlen of the string
+fwrite($file_handle, $string);
+fclose($file_handle);
+var_dump( filesize($filename) ); //size of the file = strlen of string
+clearstatcache();
+
+echo "-- opening the file in 'wt' mode and get the size --\n";
+$file_handle = fopen($filename, "wt");
+var_dump( strlen($string) ); //strlen of the string = 191 bytes
+fwrite($file_handle, $string);
+fclose($file_handle);
+var_dump( filesize($filename) ); //size of the file = 192 bytes != strlen of string
+clearstatcache();
+
+echo "-- opening the file in 'a' mode, adding data and checking the file --\n";
+$file_handle = fopen($filename, "a");
+fwrite($file_handle, "Hello, world");
+fclose($file_handle);
+var_dump( filesize($filename) ); //204 bytes
+clearstatcache();
+
+echo "-- opening the file in 'at' mode, adding data and checking the file --\n";
+$file_handle = fopen($filename, "at");
+fwrite($file_handle, "Hello, world\n");
+fclose($file_handle);
+var_dump( filesize($filename) ); //218 bytes
+clearstatcache();
+
+echo "-- creating a hole and checking the size --\n";
+$file_handle = fopen($filename, "a");
+var_dump( ftruncate($file_handle, 220) ); //creating 4 bytes of hole
+fclose($file_handle);
+var_dump( filesize($filename) ); //220 bytes
+clearstatcache();
+
+echo "-- writing data after hole and checking the size --\n";
+$file_handle = fopen($filename, "a");
+fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data
+fclose($file_handle);
+var_dump( filesize($filename) ); //226 bytes
+clearstatcache();
+
+echo "-- opening the existing file in write mode --\n";
+fclose( fopen($filename, "w") );
+var_dump( filesize($filename) ); //0 bytes
+clearstatcache();
+
+echo "-- with empty file --\n";
+$filename = dirname(__FILE__)."/filesize_variation4_empty.tmp";
+fclose( fopen($filename, "w") );
+var_dump( filesize($filename) ); //0 bytes
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filesize_variation4.tmp");
+unlink($file_path."/filesize_variation4_empty.tmp");
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+
+*** Testing filesize() with data written using different file modes and by creating holes in file ***
+-- opening the file in 'w' mode and get the size --
+int(191)
+int(191)
+-- opening the file in 'wt' mode and get the size --
+int(191)
+int(192)
+-- opening the file in 'a' mode, adding data and checking the file --
+int(204)
+-- opening the file in 'at' mode, adding data and checking the file --
+int(218)
+-- creating a hole and checking the size --
+bool(true)
+int(220)
+-- writing data after hole and checking the size --
+int(226)
+-- opening the existing file in write mode --
+int(0)
+-- with empty file --
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation4.phpt b/ext/standard/tests/file/filesize_variation4.phpt
new file mode 100644
index 0000000..29f85fc
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation4.phpt
@@ -0,0 +1,111 @@
+--TEST--
+Test filesize() function: usage variations - file mode & holes in file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only valid for Linux');
+}
+--FILE--
+<?php
+/*
+ Prototype : int filesize ( string $filename );
+ Description : Returns the size of the file in bytes, or FALSE
+ (and generates an error of level E_WARNING) in case of an error.
+*/
+
+/* Testing filesize() with data written using different file modes and by creating holes in file */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing filesize(): usage variations ***\n";
+echo "\n*** Testing filesize() with data written using different file modes and by creating holes in file ***\n";
+
+$filename = $file_path."/filesize_variation4.tmp";
+$string = "Test 2 test the filesize() fn, with data containing all the types like !@@##$%^&*():<>?|~+!;',.\][{}(special) cha
+rs, 12345(numeric) chars, and \n(newline char), \t(tab), \0, \r and so on........\0";
+echo "-- opening the file in 'w' mode and get the size --\n";
+$file_handle = fopen($filename, "w");
+var_dump( strlen($string) ); //strlen of the string
+fwrite($file_handle, $string);
+fclose($file_handle);
+var_dump( filesize($filename) ); //size of the file = strlen of string
+clearstatcache();
+
+echo "-- opening the file in 'wt' mode and get the size --\n";
+$file_handle = fopen($filename, "wt");
+var_dump( strlen($string) ); //strlen of the string = 191 bytes
+fwrite($file_handle, $string);
+fclose($file_handle);
+var_dump( filesize($filename) ); //size of the file = strlen of string = 191 bytes
+clearstatcache();
+
+echo "-- opening the file in 'a' mode, adding data and checking the file --\n";
+$file_handle = fopen($filename, "a");
+fwrite($file_handle, "Hello, world");
+fclose($file_handle);
+var_dump( filesize($filename) ); //203 bytes
+clearstatcache();
+
+echo "-- opening the file in 'at' mode, adding data and checking the file --\n";
+$file_handle = fopen($filename, "at");
+fwrite($file_handle, "Hello, world\n");
+fclose($file_handle);
+var_dump( filesize($filename) ); //216 bytes
+clearstatcache();
+
+echo "-- creating a hole and checking the size --\n";
+$file_handle = fopen($filename, "a");
+var_dump( ftruncate($file_handle, 220) ); //creating 4 bytes of hole
+fclose($file_handle);
+var_dump( filesize($filename) ); //220 bytes
+clearstatcache();
+
+echo "-- writing data after hole and checking the size --\n";
+$file_handle = fopen($filename, "a");
+fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data
+fclose($file_handle);
+var_dump( filesize($filename) ); //226 bytes
+clearstatcache();
+
+echo "-- opening the existing file in write mode --\n";
+fclose( fopen($filename, "w") );
+var_dump( filesize($filename) ); //0 bytes
+clearstatcache();
+
+echo "-- with empty file --\n";
+$filename = dirname(__FILE__)."/filesize_variation4_empty.tmp";
+fclose( fopen($filename, "w") );
+var_dump( filesize($filename) ); //0 bytes
+
+echo "*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/filesize_variation4.tmp");
+unlink($file_path."/filesize_variation4_empty.tmp");
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+
+*** Testing filesize() with data written using different file modes and by creating holes in file ***
+-- opening the file in 'w' mode and get the size --
+int(192)
+int(192)
+-- opening the file in 'wt' mode and get the size --
+int(192)
+int(192)
+-- opening the file in 'a' mode, adding data and checking the file --
+int(204)
+-- opening the file in 'at' mode, adding data and checking the file --
+int(217)
+-- creating a hole and checking the size --
+bool(true)
+int(220)
+-- writing data after hole and checking the size --
+int(226)
+-- opening the existing file in write mode --
+int(0)
+-- with empty file --
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation5.phpt b/ext/standard/tests/file/filesize_variation5.phpt
new file mode 100644
index 0000000..638f8ba
--- /dev/null
+++ b/ext/standard/tests/file/filesize_variation5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test filesize() function: usage variations - size of files
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/*
+ * Prototype : int filesize ( string $filename );
+ * Description : Returns the size of the file in bytes, or FALSE
+ * (and generates an error of level E_WARNING) in case of an error.
+ */
+
+echo "*** Testing filesize(): usage variations ***\n";
+
+/* null, false, "", " " */
+var_dump( filesize(NULL) );
+var_dump( filesize(false) );
+var_dump( filesize('') );
+var_dump( filesize(' ') );
+var_dump( filesize('|') );
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filesize(): usage variations ***
+bool(false)
+bool(false)
+bool(false)
+
+Warning: filesize(): stat failed for in %s on line %d
+bool(false)
+
+Warning: filesize(): stat failed for | in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/file/filestat.phpt b/ext/standard/tests/file/filestat.phpt
new file mode 100644
index 0000000..d02f9f2
--- /dev/null
+++ b/ext/standard/tests/file/filestat.phpt
@@ -0,0 +1,63 @@
+--TEST--
+various file stat func tests
+--FILE--
+<?php
+
+var_dump(fileinode("."));
+var_dump(fileowner("."));
+var_dump(filegroup("."));
+var_dump(fileatime("."));
+var_dump(filectime("."));
+
+var_dump(fileinode("./.."));
+var_dump(fileowner("./.."));
+var_dump(filegroup("./.."));
+var_dump(fileatime("./.."));
+var_dump(filectime("./.."));
+
+var_dump(fileinode(__FILE__));
+var_dump(fileowner(__FILE__));
+var_dump(filegroup(__FILE__));
+var_dump(fileatime(__FILE__));
+var_dump(filectime(__FILE__));
+
+var_dump(fileinode("/no/such/file/or/dir"));
+var_dump(fileowner("/no/such/file/or/dir"));
+var_dump(filegroup("/no/such/file/or/dir"));
+var_dump(fileatime("/no/such/file/or/dir"));
+var_dump(filectime("/no/such/file/or/dir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+
+Warning: fileinode(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: fileowner(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: filegroup(): stat failed for /no/such/file/or/dir in %s on line %d
+bool(false)
+
+Warning: fileatime(): 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)
+Done
diff --git a/ext/standard/tests/file/filetype_basic.phpt b/ext/standard/tests/file/filetype_basic.phpt
new file mode 100644
index 0000000..4a6d3b2
--- /dev/null
+++ b/ext/standard/tests/file/filetype_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test filetype() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "*** Testing filetype() with files and dirs ***\n";
+
+print( filetype(__FILE__) )."\n";
+print( filetype(".") )."\n";
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filetype() with files and dirs ***
+file
+dir
+*** Done ***
diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt
new file mode 100644
index 0000000..b965272
--- /dev/null
+++ b/ext/standard/tests/file/filetype_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test filetype() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "*** Testing error conditions ***";
+/* non-existing file or dir */
+print( filetype("/no/such/file/dir") );
+
+/* unknown type */
+print( filetype("string") );
+print( filetype(100) );
+
+/* No.of args less than expected */
+print( filetype() );
+
+/* No.of args greater than expected */
+print( filetype("file", "file") );
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+Warning: filetype(): Lstat failed for /no/such/file/dir in %s on line %d
+
+Warning: filetype(): Lstat failed for string in %s on line %d
+
+Warning: filetype(): Lstat failed for 100 in %s on line %d
+
+Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d
+
+*** Done ***
diff --git a/ext/standard/tests/file/filetype_variation.phpt b/ext/standard/tests/file/filetype_variation.phpt
new file mode 100644
index 0000000..3308cee
--- /dev/null
+++ b/ext/standard/tests/file/filetype_variation.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test filetype() function: Variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no link()/symlink() on Windows');
+}
+if (!function_exists("posix_mkfifo")) {
+ die("skip no posix_mkfifo()");
+}
+?>
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "*** Testing filetype() with various types ***\n";
+$file_path = dirname(__FILE__);
+$file1 = $file_path."/filetype1_variation.tmp";
+$file2 = $file_path."/filetype2_variation.tmp";
+$file3 = $file_path."/filetype3_variation.tmp";
+$link1 = $file_path."/filetype1_variation_link.tmp";
+$link2 = $file_path."/filetype2_variation_link.tmp";
+
+fclose( fopen($file1, "w") );
+fclose( fopen($file2, "w") );
+
+echo "-- Checking with files --\n";
+print( filetype($file1) )."\n";
+print( filetype($file2) )."\n";
+clearstatcache();
+
+echo "-- Checking with links: hardlink --\n";
+link( $file1, $link1);
+print( filetype($link1 ) )."\n";
+
+echo "-- Checking with links: symlink --\n";
+symlink( $file2, $link2);
+print( filetype($link2) )."\n";
+
+unlink($link1);
+unlink($link2);
+unlink($file1);
+unlink($file2);
+
+echo "-- Checking with directory --\n";
+mkdir("$file_path/filetype_variation");
+print( filetype("$file_path/filetype_variation") )."\n";
+rmdir( "$file_path/filetype_variation" );
+
+echo "-- Checking with fifo --\n";
+posix_mkfifo( $file3, 0755);
+print( filetype( $file3) )."\n";
+unlink($file3);
+
+/* Checking with block in file */
+/* To test this PEAR package should be installed */
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filetype() with various types ***
+-- Checking with files --
+file
+file
+-- Checking with links: hardlink --
+file
+-- Checking with links: symlink --
+link
+-- Checking with directory --
+dir
+-- Checking with fifo --
+fifo
+
+*** Done ***
diff --git a/ext/standard/tests/file/filetype_variation2.phpt b/ext/standard/tests/file/filetype_variation2.phpt
new file mode 100644
index 0000000..d538e32
--- /dev/null
+++ b/ext/standard/tests/file/filetype_variation2.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test filetype() function: Check character type
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no /dev on Windows');
+}
+if (!file_exists("/dev/console")) {
+ die('skip /dev/console not available');
+}
+?>
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "-- Checking for char --\n";
+print( filetype("/dev/console") )."\n";
+?>
+===DONE===
+--EXPECTF--
+-- Checking for char --
+char
+===DONE===
diff --git a/ext/standard/tests/file/filetype_variation3.phpt b/ext/standard/tests/file/filetype_variation3.phpt
new file mode 100644
index 0000000..9a1a68f
--- /dev/null
+++ b/ext/standard/tests/file/filetype_variation3.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test filetype() function: Check block device
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no /dev on Windows');
+}
+if (!file_exists("/dev/ram0")) {
+ die('skip /dev/ram0 not available');
+}
+?>
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "-- Checking for block --\n";
+print( filetype("/dev/ram0") )."\n";
+?>
+===DONE===
+--EXPECTF--
+-- Checking for block --
+block
+===DONE===
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
new file mode 100644
index 0000000..efc059c
--- /dev/null
+++ b/ext/standard/tests/file/flock.phpt
@@ -0,0 +1,64 @@
+--TEST--
+flock() tests
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/flock.dat";
+
+var_dump(flock());
+var_dump(flock("", "", $var));
+
+$fp = fopen($file, "w");
+fclose($fp);
+
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+
+$fp = fopen($file, "w");
+
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+var_dump(flock($fp, LOCK_UN));
+var_dump(flock($fp, LOCK_EX));
+var_dump(flock($fp, LOCK_UN));
+
+$would = array(1,2,3);
+var_dump(flock($fp, LOCK_SH|LOCK_NB, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_UN, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_EX, $would));
+var_dump($would);
+var_dump(flock($fp, LOCK_UN, $would));
+var_dump($would);
+
+var_dump(flock($fp, -1));
+var_dump(flock($fp, 0));
+
+@unlink($file);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+Warning: flock(): %d is not a valid stream resource in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/flock_basic.phpt b/ext/standard/tests/file/flock_basic.phpt
new file mode 100644
index 0000000..d218cee
--- /dev/null
+++ b/ext/standard/tests/file/flock_basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test flock() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
+*/
+
+echo "*** Testing flock() fun with file and dir ***\n";
+$file_path = dirname(__FILE__);
+
+$file_handle = fopen("$file_path/lock.tmp", "w");
+var_dump(flock($file_handle, LOCK_SH|LOCK_NB));
+var_dump(flock($file_handle, LOCK_UN));
+var_dump(flock($file_handle, LOCK_EX));
+var_dump(flock($file_handle, LOCK_UN));
+fclose($file_handle);
+unlink("$file_path/lock.tmp");
+
+mkdir("$file_path/dir");
+$dir_handle = opendir("$file_path/dir");
+var_dump(flock($dir_handle, LOCK_SH|LOCK_NB));
+var_dump(flock($dir_handle, LOCK_UN));
+var_dump(flock($dir_handle, LOCK_EX));
+var_dump(flock($dir_handle, LOCK_UN));
+closedir($dir_handle);
+rmdir("$file_path/dir");
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing flock() fun with file and dir ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt
new file mode 100644
index 0000000..fe61e2a
--- /dev/null
+++ b/ext/standard/tests/file/flock_error.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test flock() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
+*/
+
+echo "*** Testing error conditions ***\n";
+
+$file = dirname(__FILE__)."/flock.tmp";
+$fp = fopen($file, "w");
+
+/* array of operatons */
+$operations = array(
+ 0,
+ LOCK_NB,
+ FALSE,
+ NULL,
+ array(1,2,3),
+ array(),
+ "string",
+ "",
+ "\0"
+);
+
+$i = 0;
+foreach($operations as $operation) {
+ echo "\n--- Iteration $i ---";
+ var_dump(flock($fp, $operation));
+ $i++;
+}
+
+
+/* Invalid arguments */
+$fp = fopen($file, "w");
+fclose($fp);
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+
+var_dump(flock("", "", $var));
+
+/* No.of args leass than expected */
+var_dump(flock());
+var_dump(flock($fp));
+
+/* No.of args greater than expected */
+var_dump(flock($fp, "", $var, ""));
+
+echo "\n*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file = dirname(__FILE__)."/flock.tmp";
+unlink($file);
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+--- Iteration 0 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 1 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 2 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 3 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 4 ---
+Warning: flock() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+--- Iteration 5 ---
+Warning: flock() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+--- Iteration 6 ---
+Warning: flock() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+--- Iteration 7 ---
+Warning: flock() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+--- Iteration 8 ---
+Warning: flock() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: flock(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: flock() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: flock() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt
new file mode 100644
index 0000000..af67ab4
--- /dev/null
+++ b/ext/standard/tests/file/flock_variation.phpt
@@ -0,0 +1,371 @@
+--TEST--
+Test flock() function: Variations
+--FILE--
+<?php
+/*
+Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
+*/
+
+echo "*** Testing flock() fun with the various operation and
+ wouldblock values ***\n";
+$file = dirname(__FILE__)."/flock.tmp";
+$fp = fopen($file, "w");
+
+/* array of operatons */
+$operations = array(
+ LOCK_SH,
+ LOCK_EX,
+ LOCK_SH|LOCK_NB,
+ LOCK_EX|LOCK_NB,
+ LOCK_SH|LOCK_EX,
+ LOCK_UN,
+ 1,
+ 2,
+ 2.234,
+ TRUE
+);
+
+/* array of wouldblocks */
+$wouldblocks = array(
+ 0,
+ 1,
+ 2,
+ 1.234,
+ TRUE,
+ FALSE,
+ NULL,
+ array(1,2,3),
+ array(),
+ "string",
+ "",
+ /* binary input */
+ b"string",
+ b"",
+ "\0"
+);
+
+$i = 0;
+foreach($operations as $operation) {
+ echo "--- Outer iteration $i ---\n";
+ var_dump(flock($fp, $operation));
+ $j = 0;
+ foreach($wouldblocks as $wouldblock) {
+ echo "-- Inner iteration $j in $i --\n";
+ var_dump(flock($fp, $operation, $wouldblock));
+ $j++;
+ }
+ $i++;
+}
+
+fclose($fp);
+@unlink($file);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing flock() fun with the various operation and
+ wouldblock values ***
+--- Outer iteration 0 ---
+bool(true)
+-- Inner iteration 0 in 0 --
+bool(true)
+-- Inner iteration 1 in 0 --
+bool(true)
+-- Inner iteration 2 in 0 --
+bool(true)
+-- Inner iteration 3 in 0 --
+bool(true)
+-- Inner iteration 4 in 0 --
+bool(true)
+-- Inner iteration 5 in 0 --
+bool(true)
+-- Inner iteration 6 in 0 --
+bool(true)
+-- Inner iteration 7 in 0 --
+bool(true)
+-- Inner iteration 8 in 0 --
+bool(true)
+-- Inner iteration 9 in 0 --
+bool(true)
+-- Inner iteration 10 in 0 --
+bool(true)
+-- Inner iteration 11 in 0 --
+bool(true)
+-- Inner iteration 12 in 0 --
+bool(true)
+-- Inner iteration 13 in 0 --
+bool(true)
+--- Outer iteration 1 ---
+bool(true)
+-- Inner iteration 0 in 1 --
+bool(true)
+-- Inner iteration 1 in 1 --
+bool(true)
+-- Inner iteration 2 in 1 --
+bool(true)
+-- Inner iteration 3 in 1 --
+bool(true)
+-- Inner iteration 4 in 1 --
+bool(true)
+-- Inner iteration 5 in 1 --
+bool(true)
+-- Inner iteration 6 in 1 --
+bool(true)
+-- Inner iteration 7 in 1 --
+bool(true)
+-- Inner iteration 8 in 1 --
+bool(true)
+-- Inner iteration 9 in 1 --
+bool(true)
+-- Inner iteration 10 in 1 --
+bool(true)
+-- Inner iteration 11 in 1 --
+bool(true)
+-- Inner iteration 12 in 1 --
+bool(true)
+-- Inner iteration 13 in 1 --
+bool(true)
+--- Outer iteration 2 ---
+bool(true)
+-- Inner iteration 0 in 2 --
+bool(true)
+-- Inner iteration 1 in 2 --
+bool(true)
+-- Inner iteration 2 in 2 --
+bool(true)
+-- Inner iteration 3 in 2 --
+bool(true)
+-- Inner iteration 4 in 2 --
+bool(true)
+-- Inner iteration 5 in 2 --
+bool(true)
+-- Inner iteration 6 in 2 --
+bool(true)
+-- Inner iteration 7 in 2 --
+bool(true)
+-- Inner iteration 8 in 2 --
+bool(true)
+-- Inner iteration 9 in 2 --
+bool(true)
+-- Inner iteration 10 in 2 --
+bool(true)
+-- Inner iteration 11 in 2 --
+bool(true)
+-- Inner iteration 12 in 2 --
+bool(true)
+-- Inner iteration 13 in 2 --
+bool(true)
+--- Outer iteration 3 ---
+bool(true)
+-- Inner iteration 0 in 3 --
+bool(true)
+-- Inner iteration 1 in 3 --
+bool(true)
+-- Inner iteration 2 in 3 --
+bool(true)
+-- Inner iteration 3 in 3 --
+bool(true)
+-- Inner iteration 4 in 3 --
+bool(true)
+-- Inner iteration 5 in 3 --
+bool(true)
+-- Inner iteration 6 in 3 --
+bool(true)
+-- Inner iteration 7 in 3 --
+bool(true)
+-- Inner iteration 8 in 3 --
+bool(true)
+-- Inner iteration 9 in 3 --
+bool(true)
+-- Inner iteration 10 in 3 --
+bool(true)
+-- Inner iteration 11 in 3 --
+bool(true)
+-- Inner iteration 12 in 3 --
+bool(true)
+-- Inner iteration 13 in 3 --
+bool(true)
+--- Outer iteration 4 ---
+bool(true)
+-- Inner iteration 0 in 4 --
+bool(true)
+-- Inner iteration 1 in 4 --
+bool(true)
+-- Inner iteration 2 in 4 --
+bool(true)
+-- Inner iteration 3 in 4 --
+bool(true)
+-- Inner iteration 4 in 4 --
+bool(true)
+-- Inner iteration 5 in 4 --
+bool(true)
+-- Inner iteration 6 in 4 --
+bool(true)
+-- Inner iteration 7 in 4 --
+bool(true)
+-- Inner iteration 8 in 4 --
+bool(true)
+-- Inner iteration 9 in 4 --
+bool(true)
+-- Inner iteration 10 in 4 --
+bool(true)
+-- Inner iteration 11 in 4 --
+bool(true)
+-- Inner iteration 12 in 4 --
+bool(true)
+-- Inner iteration 13 in 4 --
+bool(true)
+--- Outer iteration 5 ---
+bool(true)
+-- Inner iteration 0 in 5 --
+bool(true)
+-- Inner iteration 1 in 5 --
+bool(true)
+-- Inner iteration 2 in 5 --
+bool(true)
+-- Inner iteration 3 in 5 --
+bool(true)
+-- Inner iteration 4 in 5 --
+bool(true)
+-- Inner iteration 5 in 5 --
+bool(true)
+-- Inner iteration 6 in 5 --
+bool(true)
+-- Inner iteration 7 in 5 --
+bool(true)
+-- Inner iteration 8 in 5 --
+bool(true)
+-- Inner iteration 9 in 5 --
+bool(true)
+-- Inner iteration 10 in 5 --
+bool(true)
+-- Inner iteration 11 in 5 --
+bool(true)
+-- Inner iteration 12 in 5 --
+bool(true)
+-- Inner iteration 13 in 5 --
+bool(true)
+--- Outer iteration 6 ---
+bool(true)
+-- Inner iteration 0 in 6 --
+bool(true)
+-- Inner iteration 1 in 6 --
+bool(true)
+-- Inner iteration 2 in 6 --
+bool(true)
+-- Inner iteration 3 in 6 --
+bool(true)
+-- Inner iteration 4 in 6 --
+bool(true)
+-- Inner iteration 5 in 6 --
+bool(true)
+-- Inner iteration 6 in 6 --
+bool(true)
+-- Inner iteration 7 in 6 --
+bool(true)
+-- Inner iteration 8 in 6 --
+bool(true)
+-- Inner iteration 9 in 6 --
+bool(true)
+-- Inner iteration 10 in 6 --
+bool(true)
+-- Inner iteration 11 in 6 --
+bool(true)
+-- Inner iteration 12 in 6 --
+bool(true)
+-- Inner iteration 13 in 6 --
+bool(true)
+--- Outer iteration 7 ---
+bool(true)
+-- Inner iteration 0 in 7 --
+bool(true)
+-- Inner iteration 1 in 7 --
+bool(true)
+-- Inner iteration 2 in 7 --
+bool(true)
+-- Inner iteration 3 in 7 --
+bool(true)
+-- Inner iteration 4 in 7 --
+bool(true)
+-- Inner iteration 5 in 7 --
+bool(true)
+-- Inner iteration 6 in 7 --
+bool(true)
+-- Inner iteration 7 in 7 --
+bool(true)
+-- Inner iteration 8 in 7 --
+bool(true)
+-- Inner iteration 9 in 7 --
+bool(true)
+-- Inner iteration 10 in 7 --
+bool(true)
+-- Inner iteration 11 in 7 --
+bool(true)
+-- Inner iteration 12 in 7 --
+bool(true)
+-- Inner iteration 13 in 7 --
+bool(true)
+--- Outer iteration 8 ---
+bool(true)
+-- Inner iteration 0 in 8 --
+bool(true)
+-- Inner iteration 1 in 8 --
+bool(true)
+-- Inner iteration 2 in 8 --
+bool(true)
+-- Inner iteration 3 in 8 --
+bool(true)
+-- Inner iteration 4 in 8 --
+bool(true)
+-- Inner iteration 5 in 8 --
+bool(true)
+-- Inner iteration 6 in 8 --
+bool(true)
+-- Inner iteration 7 in 8 --
+bool(true)
+-- Inner iteration 8 in 8 --
+bool(true)
+-- Inner iteration 9 in 8 --
+bool(true)
+-- Inner iteration 10 in 8 --
+bool(true)
+-- Inner iteration 11 in 8 --
+bool(true)
+-- Inner iteration 12 in 8 --
+bool(true)
+-- Inner iteration 13 in 8 --
+bool(true)
+--- Outer iteration 9 ---
+bool(true)
+-- Inner iteration 0 in 9 --
+bool(true)
+-- Inner iteration 1 in 9 --
+bool(true)
+-- Inner iteration 2 in 9 --
+bool(true)
+-- Inner iteration 3 in 9 --
+bool(true)
+-- Inner iteration 4 in 9 --
+bool(true)
+-- Inner iteration 5 in 9 --
+bool(true)
+-- Inner iteration 6 in 9 --
+bool(true)
+-- Inner iteration 7 in 9 --
+bool(true)
+-- Inner iteration 8 in 9 --
+bool(true)
+-- Inner iteration 9 in 9 --
+bool(true)
+-- Inner iteration 10 in 9 --
+bool(true)
+-- Inner iteration 11 in 9 --
+bool(true)
+-- Inner iteration 12 in 9 --
+bool(true)
+-- Inner iteration 13 in 9 --
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_basic.phpt b/ext/standard/tests/file/fnmatch_basic.phpt
new file mode 100644
index 0000000..1896051
--- /dev/null
+++ b/ext/standard/tests/file/fnmatch_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test fnmatch() function: Basic functionality
+--SKIPIF--
+<?php
+if (!function_exists('fnmatch'))
+ die("skip fnmatch() function is not available");
+?>
+--FILE--
+<?php
+/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
+ Description: fnmatch() checks if the passed string would match
+ the given shell wildcard pattern.
+*/
+
+echo "*** Testing fnmatch() with file ***\n";
+$file = basename(__FILE__);
+
+var_dump( fnmatch("*.php", $file) );
+var_dump( fnmatch("*.p*p", $file) );
+var_dump( fnmatch("*.p*", $file) );
+var_dump( fnmatch("*", $file) );
+var_dump( fnmatch("**", $file) );
+var_dump( fnmatch("*.phpt", $file) );
+
+echo "*** Testing fnmatch() with other than file ***\n";
+var_dump( fnmatch(100, 100) );
+var_dump( fnmatch("string", "string") );
+var_dump( fnmatch(TRUE, TRUE) );
+var_dump( fnmatch(FALSE, FALSE) );
+var_dump( fnmatch(NULL, NULL) );
+
+echo "\n*** Done ***\n";
+?>
+--EXPECT--
+*** Testing fnmatch() with file ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+*** Testing fnmatch() with other than file ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_error.phpt b/ext/standard/tests/file/fnmatch_error.phpt
new file mode 100644
index 0000000..5277874
--- /dev/null
+++ b/ext/standard/tests/file/fnmatch_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test fnmatch() function: Error conditions
+--SKIPIF--
+<?php
+if (!function_exists('fnmatch'))
+ die("skip fnmatch() function is not available");
+?>
+--FILE--
+<?php
+/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
+ Description: fnmatch() checks if the passed string would match
+ the given shell wildcard pattern.
+*/
+
+echo "*** Testing error conditions for fnmatch() ***";
+
+/* Invalid arguments */
+var_dump( fnmatch(array(), array()) );
+
+$file_handle = fopen(__FILE__, "r");
+var_dump( fnmatch($file_handle, $file_handle) );
+fclose( $file_handle );
+
+$std_obj = new stdClass();
+var_dump( fnmatch($std_obj, $std_obj) );
+
+
+/* No.of arguments less than expected */
+var_dump( fnmatch("match.txt") );
+var_dump( fnmatch("") );
+
+/* No.of arguments greater than expected */
+var_dump( fnmatch("match.txt", "match.txt", TRUE, 100) );
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing error conditions for fnmatch() ***
+Warning: fnmatch() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, object given in %s on line %d
+NULL
+
+Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d%d
+NULL
+
+Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d%d
+NULL
+
+Warning: fnmatch() expects at most 3 parameters, 4 given in %s on line %d%d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt
new file mode 100644
index 0000000..6d28528
--- /dev/null
+++ b/ext/standard/tests/file/fnmatch_variation.phpt
@@ -0,0 +1,505 @@
+--TEST--
+Test fnmatch() function: Variations
+--SKIPIF--
+<?php
+if (!function_exists('fnmatch'))
+ die("skip fnmatch() function is not available");
+?>
+--FILE--
+<?php
+/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
+ Description: fnmatch() checks if the passed string would match
+ the given shell wildcard pattern.
+*/
+
+echo "*** Testing fnmatch() with file and various patterns ***\n";
+$file_name = dirname(__FILE__)."/match.tmp";
+
+/* avoid using \, it breaks the pattern */
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ $file_name = str_replace('\\','/', $file_name);
+}
+
+fopen($file_name, "w");
+
+$pattern_arr = array(
+0 => "*.tmp",
+1 => "match*",
+2 => "mat*",
+3 => "mat*tmp",
+4 => "m*t",
+5 => "ma[pt]ch*",
+6 => "*.t*",
+7 => "***.tmp",
+8 => "match**",
+9 => "*.t*p",
+10 => "",
+11 => "match",
+12 => ".tmp",
+13 => "?match",
+14 => "match?tmp",
+15 => "?tmp",
+16 => "match?",
+17 => "?match?",
+18 => "match.tmp",
+19 => "/match.tmp",
+20 => "/match.tmp/",
+21 => 'match.tmp',
+22 => 'match.tmp\0',
+23 => "match.tmp\0",
+24 => "match\0.tmp",
+25 => chr(109).chr(97)."tch.tmp",
+26 => chr(109).chr(97).chr(116).chr(99).chr(104).".tmp",
+27 => chr(109).chr(97).chr(116).chr(99).chr(104).chr(46).chr(116).chr(120).chr(116),
+28 => chr(109).chr(97).chr(116).chr(99).chr(104).".".chr(116).chr(120).chr(116),
+29 => "MATCH.TMP",
+30 => "MATCH*",
+31 => $file_name,
+
+/* binary inputs */
+32 => b"match*",
+33 => b"*.tmp",
+34 => b"mat*",
+35 => b"mat*tmp",
+36 => b"m*t",
+);
+
+for( $i = 0; $i<count($pattern_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ var_dump( fnmatch($pattern_arr[$i], $file_name) );
+}
+unlink($file_name);
+
+
+echo "\n*** Testing fnmatch() with other types other than files ***";
+
+/* defining a common function */
+function match( $pattern, $string ) {
+ for( $i = 0; $i<count($pattern); $i++ ) {
+ echo "-- Iteration $i --\n";
+ for( $j = 0; $j<count($string); $j++ ) {
+ var_dump( fnmatch($pattern[$i], $string[$j]) );
+ }
+ }
+}
+
+echo "\n--- With Integers ---\n";
+$int_arr = array(
+ 16,
+ 16.00,
+ 020,
+ 020.00,
+ 0xF,
+ 0xF0000
+);
+match($int_arr, $int_arr);
+
+echo "\n--- With Strings ---\n";
+$str_arr = array(
+ "string",
+ "string\0",
+ 'string',
+ "str\0ing",
+ "stringstring",
+
+ /* binary input */
+ b"string"
+);
+match($str_arr, $str_arr);
+
+echo "\n--- With booleans ---\n";
+$bool_arr = array(
+ TRUE,
+ true,
+ 1,
+ 10,
+ FALSE,
+ false,
+ 0,
+ "",
+ "string"
+);
+match($bool_arr, $bool_arr);
+
+echo "\n--- With NULL ---\n";
+$null_arr = array(
+ NULL,
+ null,
+ "",
+ "\0",
+ "string",
+ 0
+);
+match($null_arr, $null_arr);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing fnmatch() with file and various patterns ***
+-- Iteration 0 --
+bool(true)
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(true)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+
+*** Testing fnmatch() with other types other than files ***
+--- With Integers ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+--- With Strings ---
+-- Iteration 0 --
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(true)
+-- Iteration 1 --
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 2 --
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(true)
+-- Iteration 3 --
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 4 --
+bool(false)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(true)
+
+--- With booleans ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+--- With NULL ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(false)
+-- Iteration 3 --
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+
+Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
+NULL
+bool(false)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fopen_include_path.inc b/ext/standard/tests/file/fopen_include_path.inc
new file mode 100644
index 0000000..7d6723a
--- /dev/null
+++ b/ext/standard/tests/file/fopen_include_path.inc
@@ -0,0 +1,92 @@
+<?php
+$pwd = getcwd();
+$f = basename(__FILE__);
+$dir1 = $pwd."/".$f.".dir1";
+$dir2 = $pwd."/".$f.".dir2";
+$dir3 = $pwd."/".$f.".dir3";
+//invalid directory
+$dir4 = $pwd."/".$f.".dir4";
+$newdirs = array($dir1, $dir2, $dir3);
+
+$reldirs = array("dir1", "dir2", "dir3");
+
+function generate_next_rel_path() {
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return "dir4".$pathSep . $newIncludePath;
+}
+
+function generate_next_path() {
+ global $newdirs, $dir4;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $dir4.$pathSep . $newIncludePath;
+}
+
+
+function create_include_path() {
+
+ global $newdirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
+}
+
+function relative_include_path() {
+
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
+}
+
+
+function teardown_include_path() {
+
+ global $newdirs;
+ // remove the directory structure
+ foreach($newdirs as $newdir) {
+ rmdir($newdir);
+ }
+}
+
+function teardown_relative_path() {
+
+ global $reldirs;
+ // remove the directory structure
+ foreach($reldirs as $newdir) {
+ rmdir($newdir);
+ }
+}
+?> \ No newline at end of file
diff --git a/ext/standard/tests/file/fopen_variation1.phpt b/ext/standard/tests/file/fopen_variation1.phpt
new file mode 100644
index 0000000..53f635b
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation1.phpt
@@ -0,0 +1,14 @@
+--TEST--
+fopen() with relative path on a file in the script directory
+--FILE--
+<?php
+
+$file = basename(__FILE__);
+
+$fd = fopen($file, "r", true);
+var_dump($fd);
+fclose($fd);
+
+?>
+--EXPECTF--
+resource(%d) of type (stream)
diff --git a/ext/standard/tests/file/fopen_variation10-win32.phpt b/ext/standard/tests/file/fopen_variation10-win32.phpt
new file mode 100644
index 0000000..c949f86
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation10-win32.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test fopen() function : variation: interesting paths, no use include path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+
+if (!is_writable('c:\\fopen_variation10.tmp')) {
+ die('skip. C:\\ not writable.');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+
+// fopen with interesting windows paths.
+$testdir = dirname(__FILE__).'/fopen10.tmpDir';
+$rootdir = 'fopen10.tmpdirTwo';
+mkdir($testdir);
+mkdir('c:\\'.$rootdir);
+
+$unixifiedDir = '/'.substr(str_replace('\\','/',$testdir),3);
+
+$paths = array('c:\\',
+ 'c:',
+ 'c',
+ '\\',
+ '/',
+ 'c:'.$rootdir,
+ 'c:adir',
+ 'c:\\/',
+ 'c:\\'.$rootdir.'\\/',
+ 'c:\\'.$rootdir.'\\',
+ 'c:\\'.$rootdir.'/',
+ $unixifiedDir,
+ '/sortout');
+
+$file = "fopen_variation10.tmp";
+$firstfile = 'c:\\'.$rootdir.'\\'.$file;
+$secondfile = $testdir.'\\'.$file;
+$thirdfile = 'c:\\'.$file;
+
+$h = fopen($firstfile, 'w');
+fwrite($h, "file in $rootdir");
+fclose($h);
+
+$h = fopen($secondfile, 'w');
+fwrite($h, "file in fopen10.tmpDir");
+fclose($h);
+
+$h = fopen($thirdfile, 'w');
+fwrite($h, "file in root");
+fclose($h);
+
+foreach($paths as $path) {
+ echo "\n--$path--\n";
+ $toFind = $path.'\\'.$file;
+ $h = fopen($toFind, 'r');
+ if ($h === false) {
+ echo "file not opened for read\n";
+ }
+ else {
+ fpassthru($h);
+ echo "\n";
+ }
+ fclose($h);
+};
+
+unlink($firstfile);
+unlink($secondfile);
+unlink($thirdfile);
+rmdir($testdir);
+rmdir('c:\\'.$rootdir);
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+
+--c:\--
+file in root
+
+--c:--
+file in root
+
+--c--
+
+Warning: fopen(c\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--\--
+
+Warning: fopen(\\fopen_variation10.tmp): failed to open stream: Invalid argument in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--/--
+
+Warning: fopen(/\fopen_variation10.tmp): failed to open stream: Invalid argument in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--c:fopen10.tmpdirTwo--
+file in fopen10.tmpdirTwo
+
+--c:adir--
+
+Warning: fopen(c:adir\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--c:\/--
+file in root
+
+--c:\fopen10.tmpdirTwo\/--
+file in fopen10.tmpdirTwo
+
+--c:\fopen10.tmpdirTwo\--
+file in fopen10.tmpdirTwo
+
+--c:\fopen10.tmpdirTwo/--
+file in fopen10.tmpdirTwo
+
+--%s/fopen10.tmpDir--
+file in fopen10.tmpDir
+
+--/sortout--
+
+Warning: fopen(/sortout\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+===DONE===
+
diff --git a/ext/standard/tests/file/fopen_variation11-win32.phpt b/ext/standard/tests/file/fopen_variation11-win32.phpt
new file mode 100644
index 0000000..61a2f60
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation11-win32.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test fopen() function : variation: interesting paths, use include path = true
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+if (!is_writable('c:\\fopen_variation10.tmp')) {
+ die('skip. C:\\ not writable.');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+
+// fopen with interesting windows paths.
+$testdir = dirname(__FILE__).'/fopen11.tmpDir';
+$rootdir = 'fopen11.tmpdirTwo';
+mkdir($testdir);
+mkdir('c:\\'.$rootdir);
+
+$unixifiedDir = '/'.substr(str_replace('\\','/',$testdir),3);
+
+$paths = array('c:\\',
+ 'c:',
+ 'c',
+ '\\',
+ '/',
+ 'c:'.$rootdir,
+ 'c:adir',
+ 'c:\\/',
+ 'c:\\'.$rootdir.'\\/',
+ 'c:\\'.$rootdir.'\\',
+ 'c:\\'.$rootdir.'/',
+ $unixifiedDir,
+ '/sortout');
+
+$file = "fopen_variation11.tmp";
+$firstfile = 'c:\\'.$rootdir.'\\'.$file;
+$secondfile = $testdir.'\\'.$file;
+$thirdfile = 'c:\\'.$file;
+
+$h = fopen($firstfile, 'w');
+fwrite($h, "file in $rootdir");
+fclose($h);
+
+$h = fopen($secondfile, 'w');
+fwrite($h, "file in fopen11.tmpDir");
+fclose($h);
+
+$h = fopen($thirdfile, 'w');
+fwrite($h, "file in root");
+fclose($h);
+
+foreach($paths as $path) {
+ echo "\n--$path--\n";
+ $toFind = $path.'\\'.$file;
+ $h = fopen($toFind, 'r', true);
+ if ($h === false) {
+ echo "file not opened for read\n";
+ }
+ else {
+ fpassthru($h);
+ echo "\n";
+ }
+ fclose($h);
+};
+
+unlink($firstfile);
+unlink($secondfile);
+unlink($thirdfile);
+rmdir($testdir);
+rmdir('c:\\'.$rootdir);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+
+--c:\--
+file in root
+
+--c:--
+file in root
+
+--c--
+
+Warning: fopen(c\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--\--
+
+Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: Invalid argument in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--/--
+
+Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: Invalid argument in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--c:fopen11.tmpdirTwo--
+file in fopen11.tmpdirTwo
+
+--c:adir--
+
+Warning: fopen(c:adir\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+--c:\/--
+file in root
+
+--c:\fopen11.tmpdirTwo\/--
+file in fopen11.tmpdirTwo
+
+--c:\fopen11.tmpdirTwo\--
+file in fopen11.tmpdirTwo
+
+--c:\fopen11.tmpdirTwo/--
+file in fopen11.tmpdirTwo
+
+--%s/fopen11.tmpDir--
+file in fopen11.tmpDir
+
+--/sortout--
+
+Warning: fopen(/sortout\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d
+file not opened for read
+
+Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d
+===DONE===
+
diff --git a/ext/standard/tests/file/fopen_variation12.phpt b/ext/standard/tests/file/fopen_variation12.phpt
new file mode 100644
index 0000000..9df4490
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation12.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test fopen() function : variation: use include path (path is bad) create a file (relative)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+set_include_path("rubbish");
+testme();
+restore_include_path();
+
+
+function testme() {
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w", true);
+ fwrite($h, (binary) "This is the test file");
+ fclose($h);
+
+
+ $h = @fopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ fclose($h);
+ unlink($tmpfile);
+ }
+
+
+ $scriptDirFile = dirname(__FILE__).'/'.$tmpfile;
+ $h = @fopen($scriptDirFile, "r");
+ if ($h === false) {
+ echo "Not created in script dir\n";
+ }
+ else {
+ echo "created in script dir\n";
+ fclose($h);
+ unlink($scriptDirFile);
+ }
+}
+?>
+===DONE===
+--EXPECT--
+created in working dir
+Not created in script dir
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation13.phpt b/ext/standard/tests/file/fopen_variation13.phpt
new file mode 100644
index 0000000..d540d70
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation13.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test fopen() function : variation: use include path create a file (absolute)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+echo "*** Testing fopen() : variation ***\n";
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+$newpath = generate_next_path();
+set_include_path($newpath);
+runtest();
+
+teardown_include_path();
+restore_include_path();
+
+
+function runtest() {
+ $tempDir = 'fopen_variation13.dir.tmp';
+ $tmpfile = 'fopen_variation13.tmp';
+ $absFile = getcwd().'/'.$tempDir.'/'.$tmpfile;
+
+ mkdir($tempDir);
+ $h = fopen($absFile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
+
+
+ $h = fopen($absFile, "r");
+ if ($h === false) {
+ echo "Not created absolute location\n";
+ }
+ else {
+ echo "Created in correct location\n";
+ fclose($h);
+ }
+ unlink($absFile);
+ rmdir($tempDir);
+
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing fopen() : variation ***
+Created in correct location
+Created in correct location
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation14-win32.phpt b/ext/standard/tests/file/fopen_variation14-win32.phpt
new file mode 100644
index 0000000..554d8c6
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation14-win32.phpt
@@ -0,0 +1,189 @@
+--TEST--
+Test fopen() function : variation: file uri, no use include path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+
+// fopen with interesting windows paths.
+$testDir = 'fopen14.tmpDir';
+$absTestDir = getcwd().'/'.$testDir;
+$file = "fopen_variation14.tmp";
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absTestDir),3);
+$absFile = $absTestDir.'/'.$file;
+
+mkdir($testDir);
+
+$files = array("file://$testDir\\$file",
+ "file://$testDir/$file",
+ "file://./$testDir/$file",
+ "file://.\\$testDir\\$file",
+ "file://$absTestDir/$file",
+ "file://$absTestDir\\$file",
+ "file://$unixifiedDir/$file"
+);
+
+runtest($files);
+
+chdir($testDir);
+$files = array("file://../$testDir/$file",
+ "file://..\\$testDir\\$file",
+ "file://$absTestDir/$file",
+ "file://$absTestDir\\$file",
+ "file://$unixifiedDir/$file"
+);
+runtest($files);
+chdir("..");
+rmdir($testDir);
+
+function runtest($fileURIs) {
+ global $absFile;
+ $iteration = 0;
+ foreach($fileURIs as $fileURI) {
+ echo "--- READ: $fileURI ---\n";
+
+ $readData = "read:$iteration";
+ $writeData = "write:$iteration";
+
+ // create the file and test read
+ $h = fopen($absFile, 'w');
+ fwrite($h, $readData);
+ fclose($h);
+
+ $h = fopen($fileURI, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $readData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+
+ echo "--- WRITE: $fileURI ---\n";
+ // create the file to test write
+ $h = fopen($fileURI, 'w');
+ if ($h !== false) {
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+--- READ: file://fopen14.tmpDir\fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://fopen14.tmpDir\fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://./fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://.\fopen14.tmpDir\fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://.\fopen14.tmpDir\fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- READ: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
+test passed
+--- WRITE: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
+test passed
+--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- READ: file://../fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://..\fopen14.tmpDir\fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://..\fopen14.tmpDir\fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- READ: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
+test passed
+--- WRITE: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
+test passed
+--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+===DONE===
+
diff --git a/ext/standard/tests/file/fopen_variation14.phpt b/ext/standard/tests/file/fopen_variation14.phpt
new file mode 100644
index 0000000..aa4e05b
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation14.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Test fopen() function : variation: file uri, no use include path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip not for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+
+// fopen with interesting windows paths.
+$testDir = 'fopen14.tmpDir';
+$absTestDir = getcwd().'/'.$testDir;
+$file = "fopen_variation14.tmp";
+$absFile = $absTestDir.'/'.$file;
+
+mkdir($testDir);
+
+$files = array("file://$testDir/$file",
+ "file://./$testDir/$file",
+ "file://$absTestDir/$file"
+);
+
+runtest($files);
+
+chdir($testDir);
+$files = array("file://../$testDir/$file",
+ "file://$absTestDir/$file",
+);
+runtest($files);
+chdir("..");
+rmdir($testDir);
+
+function runtest($fileURIs) {
+ global $absFile;
+ $iteration = 0;
+ foreach($fileURIs as $fileURI) {
+ echo "--- READ: $fileURI ---\n";
+
+ $readData = "read:$iteration";
+ $writeData = "write:$iteration";
+
+ // create the file and test read
+ $h = fopen($absFile, 'w');
+ fwrite($h, $readData);
+ fclose($h);
+
+ $h = fopen($fileURI, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $readData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+
+ echo "--- WRITE: $fileURI ---\n";
+ // create the file to test write
+ $h = fopen($fileURI, 'w');
+ if ($h !== false) {
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+--- READ: file://fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://./fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- READ: file://../fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
+test passed
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fopen_variation15-win32.phpt b/ext/standard/tests/file/fopen_variation15-win32.phpt
new file mode 100644
index 0000000..8599306
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation15-win32.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test fopen() function : variation: file uri, use include path = true
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Run only on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+
+// fopen with interesting windows paths.
+$includePathDir = getcwd().'/fopen15.includeDir';
+$testDir = 'fopen15.tmpDir';
+$absTestDir = getcwd().'/'.$testDir;
+$file = "fopen_variation15.tmp";
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absTestDir),3);
+$absFile = $absTestDir.'/'.$file;
+
+mkdir($testDir);
+mkdir($includePathDir);
+set_include_path($includePathDir);
+
+$files = array("file://$testDir\\$file",
+ "file://$testDir/$file",
+ "file://./$testDir/$file",
+ "file://.\\$testDir\\$file",
+ "file://$absTestDir/$file",
+ "file://$absTestDir\\$file",
+ "file://$unixifiedDir/$file"
+);
+
+runtest($files);
+
+chdir($testDir);
+$files = array("file://../$testDir/$file",
+ "file://..\\$testDir\\$file",
+ "file://$absTestDir/$file",
+ "file://$absTestDir\\$file",
+ "file://$unixifiedDir/$file"
+);
+runtest($files);
+chdir("..");
+rmdir($testDir);
+rmdir($includePathDir);
+
+function runtest($fileURIs) {
+ global $absFile;
+ $iteration = 0;
+ foreach($fileURIs as $fileURI) {
+ echo "--- READ: $fileURI ---\n";
+
+ $readData = "read:$iteration";
+ $writeData = "write:$iteration";
+
+ // create the file and test read
+ $h = fopen($absFile, 'w');
+ fwrite($h, $readData);
+ fclose($h);
+
+ $h = fopen($fileURI, 'r', true);
+ if ($h !== false) {
+ if (fread($h, 4096) != $readData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+
+ echo "--- WRITE: $fileURI ---\n";
+ // create the file to test write
+ $h = fopen($fileURI, 'w', true);
+ if ($h !== false) {
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+--- READ: file://fopen15.tmpDir\fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://fopen15.tmpDir\fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://./fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://./fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://.\fopen15.tmpDir\fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://.\fopen15.tmpDir\fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- WRITE: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- READ: file://%s/fopen15.tmpDir\fopen_variation15.tmp ---
+test passed
+--- WRITE: file://%s/fopen15.tmpDir\fopen_variation15.tmp ---
+test passed
+--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- READ: file://../fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://../fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://..\fopen15.tmpDir\fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://..\fopen15.tmpDir\fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- WRITE: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- READ: file://%s/fopen15.tmpDir\fopen_variation15.tmp ---
+test passed
+--- WRITE: file://%s/fopen15.tmpDir\fopen_variation15.tmp ---
+test passed
+--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+===DONE===
+
diff --git a/ext/standard/tests/file/fopen_variation15.phpt b/ext/standard/tests/file/fopen_variation15.phpt
new file mode 100644
index 0000000..24b01fb
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation15.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test fopen() function : variation: file uri, use include path = true
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+
+// fopen with interesting windows paths.
+$includePathDir = getcwd().'/fopen15.includeDir';
+$testDir = 'fopen15.tmpDir';
+$absTestDir = getcwd().'/'.$testDir;
+$file = "fopen_variation15.tmp";
+$absFile = $absTestDir.'/'.$file;
+
+mkdir($testDir);
+mkdir($includePathDir);
+set_include_path($includePathDir);
+
+$files = array("file://$testDir/$file",
+ "file://./$testDir/$file",
+ "file://$absTestDir/$file"
+);
+
+runtest($files);
+
+chdir($testDir);
+$files = array("file://../$testDir/$file",
+ "file://$absTestDir/$file"
+);
+runtest($files);
+chdir("..");
+rmdir($testDir);
+rmdir($includePathDir);
+
+function runtest($fileURIs) {
+ global $absFile;
+ $iteration = 0;
+ foreach($fileURIs as $fileURI) {
+ echo "--- READ: $fileURI ---\n";
+
+ $readData = "read:$iteration";
+ $writeData = "write:$iteration";
+
+ // create the file and test read
+ $h = fopen($absFile, 'w');
+ fwrite($h, $readData);
+ fclose($h);
+
+ $h = fopen($fileURI, 'r', true);
+ if ($h !== false) {
+ if (fread($h, 4096) != $readData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+
+ echo "--- WRITE: $fileURI ---\n";
+ // create the file to test write
+ $h = fopen($fileURI, 'w', true);
+ if ($h !== false) {
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+--- READ: file://fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file://./fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://./fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- READ: file://../fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- WRITE: file://../fopen15.tmpDir/fopen_variation15.tmp ---
+
+Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
+test passed
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fopen_variation16.phpt b/ext/standard/tests/file/fopen_variation16.phpt
new file mode 100644
index 0000000..3f220aa
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation16.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test fopen() function : variation: use include path create and read a file (relative)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+$thisTestDir = "fopenVariation16.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+
+$newpath = generate_next_path();
+set_include_path($newpath);
+runtest();
+
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+function runtest() {
+ global $dir1;
+
+ $extraDir = "extraDir";
+
+ mkdir($dir1.'/'.$extraDir);
+ mkdir($extraDir);
+
+ $tmpfile = $extraDir.'/fopen_variation16.tmp';
+
+ $h = fopen($tmpfile, "w+", true);
+ fwrite($h, (binary) "This is the test file");
+ fclose($h);
+
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ }
+
+ $h = fopen($tmpfile, "r", true);
+ if ($h === false) {
+ echo "could not find file for reading\n";
+ }
+ else {
+ echo "found file - not in dir1\n";
+ fclose($h);
+ }
+
+ unlink($tmpfile);
+ rmdir($dir1.'/'.$extraDir);
+ rmdir($extraDir);
+}
+?>
+===DONE===
+--EXPECT--
+Not created in dir1
+found file - not in dir1
+Not created in dir1
+found file - not in dir1
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation17.phpt b/ext/standard/tests/file/fopen_variation17.phpt
new file mode 100644
index 0000000..bc75c11
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation17.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test fopen() function : variation: use include path create and read a file (relative)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+
+$newpath = generate_next_path();
+set_include_path($newpath);
+runtest();
+
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+function runtest() {
+ global $dir1;
+
+ $extraDir = "extraDir";
+
+ mkdir($dir1.'/'.$extraDir);
+ mkdir($extraDir);
+
+ $tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w+", true);
+ fwrite($h, (binary) "This is the test file");
+ fclose($h);
+
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ }
+
+ $h = fopen($tmpfile, "r", true);
+ if ($h === false) {
+ echo "could not find file for reading\n";
+ }
+ else {
+ echo "found file for reading\n";
+ fclose($h);
+ }
+
+ unlink($tmpfile);
+ rmdir($dir1.'/'.$extraDir);
+ rmdir($extraDir);
+}
+?>
+===DONE===
+--EXPECT--
+Not created in dir1
+found file for reading
+Not created in dir1
+found file for reading
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation19.phpt b/ext/standard/tests/file/fopen_variation19.phpt
new file mode 100644
index 0000000..031ba45
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation19.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Test fopen() function : variation: test opening linked files
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+$tmpDir = 'fopenVar19.Dir';
+$realFilename = __FILE__.'.real';
+$sortFilename = __FILE__.'.soft';
+$hardFilename = __FILE__.'.hard';
+$linkOfLink = __FILE__.'.soft2';
+
+echo "*** Testing fopen() : variation ***\n";
+// start the test
+mkdir($tmpDir);
+chdir($tmpDir);
+
+$h = fopen($realFilename, "w");
+fwrite($h, "Hello World");
+fclose($h);
+
+symlink($realFilename, $sortFilename);
+symlink($sortFilename, $linkOfLink);
+link($realFilename, $hardFilename);
+
+
+
+echo "*** testing reading of links ***\n";
+echo "soft link:";
+readFile2($sortFilename);
+echo "hard link:";
+readFile2($hardFilename);
+echo "link of link:";
+readFile2($linkOfLink);
+
+echo "*** test appending to links ***\n";
+echo "soft link:";
+appendFile($sortFilename);
+echo "hard link:";
+appendFile($hardFilename);
+echo "link of link:";
+appendFile($linkOfLink);
+
+echo "*** test overwriting links ***\n";
+echo "soft link:";
+writeFile($sortFilename);
+echo "hard link:";
+writeFile($hardFilename);
+echo "link of link:";
+writeFile($linkOfLink);
+
+unlink($linkOfLink);
+unlink($sortFilename);
+unlink($hardFilename);
+unlink($realFilename);
+chdir("..");
+rmdir($tmpDir);
+
+function readFile2($file) {
+ $h = fopen($file, 'r');
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+}
+
+function appendFile($file) {
+ $h = fopen($file, 'a+');
+ fwrite($h, ' again!');
+ fseek($h, 0);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+}
+
+function writeFile($file) {
+ $h = fopen($file, 'w');
+ fwrite($h, 'Goodbye World');
+ fclose($h);
+ readFile2($file);
+}
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing fopen() : variation ***
+*** testing reading of links ***
+soft link:Hello World
+hard link:Hello World
+link of link:Hello World
+*** test appending to links ***
+soft link:Hello World again!
+hard link:Hello World again! again!
+link of link:Hello World again! again! again!
+*** test overwriting links ***
+soft link:Goodbye World
+hard link:Goodbye World
+link of link:Goodbye World
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation3.phpt b/ext/standard/tests/file/fopen_variation3.phpt
new file mode 100644
index 0000000..3467a3a
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation3.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test fopen() function : usage variation different datatypes for use_include_path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = __FILE__;
+$mode = 'r';
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 use_include_path
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $h = fopen($filename, $mode, $value);
+ if ($h !== false) {
+ echo "ok\n";
+ fclose($h);
+ }
+ else {
+ var_dump($h);
+ }
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : usage variation ***
+
+--int 0--
+ok
+
+--int 1--
+ok
+
+--int 12345--
+ok
+
+--int -12345--
+ok
+
+--float 10.5--
+ok
+
+--float -10.5--
+ok
+
+--float 12.3456789000e10--
+ok
+
+--float -12.3456789000e10--
+ok
+
+--float .5--
+ok
+
+--empty array--
+Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+ok
+
+--lowercase null--
+ok
+
+--lowercase true--
+ok
+
+--lowercase false--
+ok
+
+--uppercase TRUE--
+ok
+
+--uppercase FALSE--
+ok
+
+--empty string DQ--
+ok
+
+--empty string SQ--
+ok
+
+--string DQ--
+ok
+
+--string SQ--
+ok
+
+--mixed case string--
+ok
+
+--heredoc--
+ok
+
+--instance of classWithToString--
+Error: 2 - fopen() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - fopen() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+ok
+
+--unset var--
+ok
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation4.phpt b/ext/standard/tests/file/fopen_variation4.phpt
new file mode 100644
index 0000000..61d850c
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation4.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test fopen() function : usage variation different datatypes for stream context
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = __FILE__;
+$mode = 'r';
+$use_include_path = false;
+$fileresource = fopen($filename, $mode);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ //file resource
+ 'file resource' => $fileresource
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $h = fopen($filename, $mode, false, $value);
+ if ($h !== false) {
+ echo "ok\n";
+ fclose($h);
+ }
+ else {
+ var_dump($h);
+ }
+};
+
+fclose($fileresource);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : usage variation ***
+
+--int 0--
+Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d)
+bool(false)
+
+--string DQ--
+Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d)
+bool(false)
+
+--string SQ--
+Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d)
+bool(false)
+
+--mixed case string--
+Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d)
+bool(false)
+
+--heredoc--
+Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - fopen() expects parameter 4 to be resource, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - fopen() expects parameter 4 to be resource, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d)
+bool(false)
+
+--file resource--
+Error: 2 - fopen(): supplied resource is not a valid Stream-Context resource, %s(%d)
+ok
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation5.phpt b/ext/standard/tests/file/fopen_variation5.phpt
new file mode 100644
index 0000000..975560f
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation5.phpt
@@ -0,0 +1,151 @@
+--TEST--
+Test fopen() function : variation: use include path and stream context (absolute directories in path)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+
+
+//create the include directory structure
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$workingDir = "workdir";
+$filename = basename(__FILE__, ".php") . ".tmp";
+$scriptDir = dirname(__FILE__);
+$baseDir = getcwd();
+$secondFile = $baseDir."/dir2/".$filename;
+$firstFile = "../dir1/".$filename;
+$scriptFile = $scriptDir.'/'.$filename;
+
+$newdirs = array("dir1", "dir2", "dir3");
+$pathSep = ":";
+$newIncludePath = "";
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+}
+foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $baseDir.'/'.$newdir.$pathSep;
+}
+mkdir($workingDir);
+chdir($workingDir);
+
+//define the files to go into these directories, create one in dir2
+echo "\n--- testing include path ---\n";
+set_include_path($newIncludePath);
+$modes = array("r", "r+", "rt");
+foreach($modes as $mode) {
+ test_fopen($mode);
+}
+restore_include_path();
+
+// remove the directory structure
+chdir($baseDir);
+rmdir($workingDir);
+foreach($newdirs as $newdir) {
+ rmdir($newdir);
+}
+
+chdir("..");
+rmdir($thisTestDir);
+
+
+function test_fopen($mode) {
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = fopen($secondFile, "w");
+ fwrite($h, (binary) "in dir2");
+ fclose($h);
+
+ echo "\n** testing with mode=$mode **\n";
+ // should read dir2 file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ //create a file in dir1
+ $h = fopen($firstFile, "w");
+ fwrite($h, (binary) "in dir1");
+ fclose($h);
+
+ //should now read dir1 file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ // create a file in working directory
+ $h = fopen($filename, "w");
+ fwrite($h, (binary) "in working dir");
+ fclose($h);
+
+ //should still read dir1 file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the file in working dir
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ // create a file in the script directory
+ $h = fopen($scriptFile, "w");
+ fwrite($h, (binary) "in script dir");
+ fclose($h);
+
+ //should read the file in script dir
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
+
+}
+
+?>
+===DONE===
+--EXPECTF--
+
+--- testing include path ---
+
+** testing with mode=r **
+in dir2
+in dir1
+in dir1
+in working dir
+in script dir
+
+** testing with mode=r+ **
+in dir2
+in dir1
+in dir1
+in working dir
+in script dir
+
+** testing with mode=rt **
+in dir2
+in dir1
+in dir1
+in working dir
+in script dir
+===DONE===
+
diff --git a/ext/standard/tests/file/fopen_variation6.phpt b/ext/standard/tests/file/fopen_variation6.phpt
new file mode 100644
index 0000000..3a99212
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation6.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test fopen() function : variation: use include path and stream context relative/absolute file
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fopen() : variation ***\n";
+$absfile = __FILE__.'.tmp';
+$relfile = "fopen_variation6.tmp";
+
+$h = fopen($absfile, "w");
+fwrite($h, "This is an absolute file");
+fclose($h);
+
+$h = fopen($relfile, "w");
+fwrite($h, "This is a relative file");
+fclose($h);
+
+$ctx = stream_context_create();
+$h = fopen($absfile, "r", true, $ctx);
+fpassthru($h);
+fclose($h);
+echo "\n";
+
+$h = fopen($relfile, "r", true, $ctx);
+fpassthru($h);
+fclose($h);
+echo "\n";
+
+unlink($absfile);
+unlink($relfile);
+?>
+===DONE===
+--EXPECTF--
+*** Testing fopen() : variation ***
+This is an absolute file
+This is a relative file
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation7.phpt b/ext/standard/tests/file/fopen_variation7.phpt
new file mode 100644
index 0000000..13f075c
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation7.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test fopen() function : variation: use include path create a file (relative)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+$newpath = generate_next_path();
+set_include_path($newpath);
+runtest();
+
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+function runtest() {
+ global $dir1;
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w", true);
+ fwrite($h, (binary)"This is the test file");
+ fclose($h);
+
+
+ $h = @fopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ fclose($h);
+ unlink($tmpfile);
+ }
+
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ unlink($dir1.'/'.$tmpfile);
+ }
+}
+?>
+===DONE===
+--EXPECT--
+created in working dir
+Not created in dir1
+created in working dir
+Not created in dir1
+===DONE===
diff --git a/ext/standard/tests/file/fopen_variation8.phpt b/ext/standard/tests/file/fopen_variation8.phpt
new file mode 100644
index 0000000..dd95014
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation8.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test fopen() function : variation: use include path and stream context (relative directories in path)
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+
+
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+//create the include directory structure
+$workingDir = "workdir";
+$filename = basename(__FILE__, ".php") . ".tmp";
+$scriptDir = dirname(__FILE__);
+$baseDir = getcwd();
+$secondFile = $baseDir."/dir2/".$filename;
+$firstFile = "../dir1/".$filename;
+$scriptFile = $scriptDir.'/'.$filename;
+
+$newdirs = array("dir1", "dir2", "dir3");
+$pathSep = ":";
+$newIncludePath = "";
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+}
+foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= '../'.$newdir.$pathSep;
+}
+mkdir($workingDir);
+chdir($workingDir);
+
+//define the files to go into these directories, create one in dir2
+echo "\n--- testing include path ---\n";
+set_include_path($newIncludePath);
+$modes = array("r", "r+", "rt");
+foreach($modes as $mode) {
+ test_fopen($mode);
+}
+restore_include_path();
+
+// remove the directory structure
+chdir($baseDir);
+rmdir($workingDir);
+foreach($newdirs as $newdir) {
+ rmdir($newdir);
+}
+
+chdir("..");
+rmdir($thisTestDir);
+
+function test_fopen($mode) {
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = fopen($secondFile, "w");
+ fwrite($h, (binary) "in dir2");
+ fclose($h);
+
+ echo "\n** testing with mode=$mode **\n";
+ // should read dir2 file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ //create a file in dir1
+ $h = fopen($firstFile, "w");
+ fwrite($h, (binary) "in dir1");
+ fclose($h);
+
+ //should now read dir1 file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ // create a file in working directory
+ $h = fopen($filename, "w");
+ fwrite($h, (binary) "in working dir");
+ fclose($h);
+
+ //should read the dir1 file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the working dir file
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ // create a file in the script directory
+ $h = fopen($scriptFile, "w");
+ fwrite($h, (binary) "in script dir");
+ fclose($h);
+
+ //should read the file in script dir
+ $h = fopen($filename, $mode, true);
+ fpassthru($h);
+ fclose($h);
+ echo "\n";
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
+
+}
+
+?>
+===DONE===
+--EXPECTF--
+
+--- testing include path ---
+
+** testing with mode=r **
+in dir2
+in dir1
+in dir1
+in working dir
+in script dir
+
+** testing with mode=r+ **
+in dir2
+in dir1
+in dir1
+in working dir
+in script dir
+
+** testing with mode=rt **
+in dir2
+in dir1
+in dir1
+in working dir
+in script dir
+===DONE===
+
diff --git a/ext/standard/tests/file/fopen_variation9.phpt b/ext/standard/tests/file/fopen_variation9.phpt
new file mode 100644
index 0000000..4b0a727
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation9.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test fopen() function : variation: use include path and stream context create a file, relative path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
+ * Description: Open a file or a URL and return a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+$thisTestDir = basename(__FILE__, ".php") . ".dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$newpath = relative_include_path();
+set_include_path($newpath);
+runtest();
+
+$newpath = generate_next_rel_path();
+set_include_path($newpath);
+runtest();
+
+teardown_relative_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+function runtest() {
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w", true);
+ fwrite($h, (binary) "This is the test file");
+ fclose($h);
+
+
+ $h = @fopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ fclose($h);
+ unlink($tmpfile);
+ }
+
+ $h = @fopen('dir1/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ unlink('dir1/'.$tmpfile);
+ }
+}
+?>
+===DONE===
+--EXPECT--
+created in working dir
+Not created in dir1
+created in working dir
+Not created in dir1
+===DONE===
diff --git a/ext/standard/tests/file/fopencookie.phpt b/ext/standard/tests/file/fopencookie.phpt
new file mode 100644
index 0000000..cd6bed8
--- /dev/null
+++ b/ext/standard/tests/file/fopencookie.phpt
@@ -0,0 +1,88 @@
+--TEST--
+fopencookie detected and working (or cast mechanism works)
+--FILE--
+<?php
+# vim600:syn=php:
+
+/* This test verifies that the casting mechanism is working correctly.
+ * On systems with fopencookie, a FILE* is created around the user
+ * stream and that is passed back to the ZE to include.
+ * On systems without fopencookie, the stream is fed into a temporary
+ * file, and that temporary file is passed back to the ZE.
+ * The important thing here is really fopencookie; the glibc people
+ * changed the binary interface, so if haven't detected it correctly,
+ * you can expect this test to segfault.
+ *
+ * FIXME: the test really needs something to fseek(3) on the FILE*
+ * used internally for this test to be really effective.
+ */
+
+class userstream {
+ public $position = 0;
+ public $data = "If you can read this, it worked";
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($this->data, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($this->data);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($this->data) && $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($this->data) + $offset >= 0) {
+ $this->position = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+ function stream_stat() {
+ return array('size' => strlen($this->data));
+ }
+}
+
+stream_wrapper_register("cookietest", "userstream");
+
+include("cookietest://foo");
+
+?>
+--EXPECT--
+If you can read this, it worked
diff --git a/ext/standard/tests/file/fpassthru_basic.phpt b/ext/standard/tests/file/fpassthru_basic.phpt
new file mode 100644
index 0000000..8924b27
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_basic.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test fpassthru() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: int fpassthru ( resource $handle );
+Description: Reads to EOF on the given file pointer from the current position
+ and writes the results to the output buffer.
+*/
+
+$file_name = dirname(__FILE__)."/passthru.tmp";
+$write_handle = fopen($file_name, "w");
+
+$string = "Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^
+ Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^\n";
+if(substr(PHP_OS, 0, 3) == "WIN") {
+ $string = str_replace("\r",'', $string);
+}
+fwrite($write_handle, $string);
+fclose($write_handle);
+
+$read_handle = fopen($file_name, "r");
+
+echo "*** Test basic functionality of fpassthru() function ***\n";
+echo "\n-- Before seek operation --\n";
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 0 --\n";
+fseek($read_handle, 0);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 3 --\n";
+fseek($read_handle, 3);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 13 --\n";
+fseek($read_handle, 13);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 14 --\n";
+fseek($read_handle, 14);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 23 --\n";
+fseek($read_handle, 23);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 34 --\n";
+fseek($read_handle, 34);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 1000 --\n";
+fseek($read_handle, 1000);
+var_dump( fpassthru($read_handle) );
+
+fclose($read_handle);
+
+echo "*** Done ***\n";
+
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/passthru.tmp");
+?>
+--EXPECTF--
+*** Test basic functionality of fpassthru() function ***
+
+-- Before seek operation --
+Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(133)
+
+-- After seeking position to 0 --
+Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(133)
+
+-- After seeking position to 3 --
+lo, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(130)
+
+-- After seeking position to 13 --
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(120)
+
+-- After seeking position to 14 --
+ abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(119)
+
+-- After seeking position to 23 --
+adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(110)
+
+-- After seeking position to 34 --
+2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(99)
+
+-- After seeking position to 1000 --
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/file/fpassthru_error.phpt b/ext/standard/tests/file/fpassthru_error.phpt
new file mode 100644
index 0000000..958397b
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test fpassthru() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: int fpassthru ( resource $handle );
+Description: Reads to EOF on the given file pointer from the current position
+ and writes the results to the output buffer.
+*/
+
+echo "*** Test error conditions of fpassthru() function ***\n";
+
+/* Non-existing file resource */
+$no_file = fread("/no/such/file", "r");
+var_dump( fpassthru($no_file) );
+
+/* No.of args less than expected */
+var_dump( fpassthru() );
+
+/* No.of args greaer than expected */
+var_dump( fpassthru("", "") );
+
+echo "\n*** Done ***\n";
+
+?>
+--EXPECTF--
+*** Test error conditions of fpassthru() function ***
+
+Warning: fread() expects parameter 1 to be resource, string given in %s on line %d
+
+Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Warning: fpassthru() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: fpassthru() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fpassthru_variation.phpt b/ext/standard/tests/file/fpassthru_variation.phpt
new file mode 100644
index 0000000..56a039e
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_variation.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test fpassthru() function: Variations
+--FILE--
+<?php
+/*
+Prototype: int fpassthru ( resource $handle );
+Description: Reads to EOF on the given file pointer from the current position
+ and writes the results to the output buffer.
+*/
+
+echo "*** Testing fpassthru() function with files ***\n\n";
+
+echo "--- Testing with different offsets ---\n";
+
+$file_name = dirname(__FILE__)."/passthru.tmp";
+$file_write = fopen($file_name, "w");
+fwrite($file_write, "1234567890abcdefghijklmnopqrstuvwxyz");
+fclose($file_write);
+
+$file_read = fopen($file_name, "r");
+
+$offset_arr = array(
+ /* Positive offsets */
+ 0,
+ 1,
+ 5,
+ 10,
+ 20,
+ 30,
+ 35,
+ 36,
+ 70,
+ /* Negative offsets, the file pointer should be at the end of file
+ to get data */
+ -1,
+ -5,
+ -10,
+ -20,
+ -35,
+ -36,
+ -70
+);
+
+for( $i=0; $i<count($offset_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ if( $offset_arr[$i] >= 0 ) {
+ fseek($file_read, $offset_arr[$i], SEEK_SET);
+ var_dump(fpassthru($file_read) );
+ rewind( $file_read );
+ }else
+ {
+ fseek($file_read, $offset_arr[$i], SEEK_END);
+ var_dump( fpassthru($file_read) );
+ rewind( $file_read );
+ }
+}
+
+fclose($file_read); // closing the handle
+
+echo "\n--- Testing with binary mode file ---\n";
+/* Opening the file in binary read mode */
+$file_read = fopen($file_name, "rb");
+
+fseek($file_read, 12, SEEK_SET);
+var_dump(fpassthru($file_read) );
+rewind( $file_read );
+fclose($file_read);
+
+unlink($file_name);
+
+echo "\n*** Done ***\n";
+
+?>
+--EXPECTF--
+*** Testing fpassthru() function with files ***
+
+--- Testing with different offsets ---
+-- Iteration 0 --
+1234567890abcdefghijklmnopqrstuvwxyzint(36)
+-- Iteration 1 --
+234567890abcdefghijklmnopqrstuvwxyzint(35)
+-- Iteration 2 --
+67890abcdefghijklmnopqrstuvwxyzint(31)
+-- Iteration 3 --
+abcdefghijklmnopqrstuvwxyzint(26)
+-- Iteration 4 --
+klmnopqrstuvwxyzint(16)
+-- Iteration 5 --
+uvwxyzint(6)
+-- Iteration 6 --
+zint(1)
+-- Iteration 7 --
+int(0)
+-- Iteration 8 --
+int(0)
+-- Iteration 9 --
+zint(1)
+-- Iteration 10 --
+vwxyzint(5)
+-- Iteration 11 --
+qrstuvwxyzint(10)
+-- Iteration 12 --
+ghijklmnopqrstuvwxyzint(20)
+-- Iteration 13 --
+234567890abcdefghijklmnopqrstuvwxyzint(35)
+-- Iteration 14 --
+1234567890abcdefghijklmnopqrstuvwxyzint(36)
+-- Iteration 15 --
+1234567890abcdefghijklmnopqrstuvwxyzint(36)
+
+--- Testing with binary mode file ---
+cdefghijklmnopqrstuvwxyzint(24)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fpassthru_variation1.phpt b/ext/standard/tests/file/fpassthru_variation1.phpt
new file mode 100644
index 0000000..f6868e3
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_variation1.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test fpassthru() function : usage variations - different parameter types
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto int fpassthru(resource fp)
+ * Description: Output all remaining data from a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions: gzpassthru
+ */
+
+echo "*** Testing fpassthru() : usage variations ***\n";
+error_reporting(E_ALL & ~E_NOTICE);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+class testClass {
+ public function __toString() {
+ return "testClass";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new testClass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for fp
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( fpassthru($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing fpassthru() : usage variations ***
+
+Arg value 0
+
+Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Arg value 1
+
+Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Arg value 12345
+
+Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Arg value -2345
+
+Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Arg value 10.5
+
+Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Arg value -10.5
+
+Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Arg value 101234567000
+
+Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Arg value 1.07654321E-9
+
+Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Arg value 0.5
+
+Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Arg value 1
+
+Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Arg value 1
+
+Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Arg value testClass
+
+Warning: fpassthru() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/fputcsv.phpt b/ext/standard/tests/file/fputcsv.phpt
new file mode 100644
index 0000000..63c4150
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv.phpt
@@ -0,0 +1,105 @@
+--TEST--
+various fputcsv() functionality tests
+--FILE--
+<?php
+
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"bbb"',
+ 2 => '"aaa","bbb"',
+ 3 => 'aaa,bbb',
+ 4 => '"aaa",bbb',
+ 5 => '"aaa", "bbb"',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"aaa"',
+ 9 => '"",""',
+ 10 => '"""""",',
+ 11 => '""""",aaa',
+ 12 => 'aaa,bbb ',
+ 13 => 'aaa,"bbb "',
+ 14 => 'aaa"aaa","bbb"bbb',
+ 15 => 'aaa"aaa""",bbb',
+ 16 => 'aaa,"\\"bbb,ccc',
+ 17 => 'aaa"\\"a","bbb"',
+ 18 => '"\\"","aaa"',
+ 19 => '"\\""",aaa',
+);
+
+$file = dirname(__FILE__) . 'fgetcsv.csv';
+@unlink($file);
+
+$fp = fopen($file, "w");
+foreach ($list as $v) {
+ fputcsv($fp, explode(',', $v));
+}
+fclose($fp);
+
+$res = file($file);
+foreach($res as &$val)
+{
+ $val = substr($val, 0, -1);
+}
+echo '$list = ';var_export($res);echo ";\n";
+
+$fp = fopen($file, "r");
+$res = array();
+while($l=fgetcsv($fp))
+{
+ $res[] = join(',',$l);
+}
+fclose($fp);
+
+echo '$list = ';var_export($res);echo ";\n";
+
+@unlink($file);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"""bbb"""',
+ 2 => '"""aaa""","""bbb"""',
+ 3 => 'aaa,bbb',
+ 4 => '"""aaa""",bbb',
+ 5 => '"""aaa"""," ""bbb"""',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"""aaa"""',
+ 9 => '"""""",""""""',
+ 10 => '"""""""""""""",',
+ 11 => '"""""""""""",aaa',
+ 12 => 'aaa,"bbb "',
+ 13 => 'aaa,"""bbb """',
+ 14 => '"aaa""aaa""","""bbb""bbb"',
+ 15 => '"aaa""aaa""""""",bbb',
+ 16 => 'aaa,"""\\"bbb",ccc',
+ 17 => '"aaa""\\"a""","""bbb"""',
+ 18 => '"""\\"""","""aaa"""',
+ 19 => '"""\\"""""",aaa',
+);
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"bbb"',
+ 2 => '"aaa","bbb"',
+ 3 => 'aaa,bbb',
+ 4 => '"aaa",bbb',
+ 5 => '"aaa", "bbb"',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"aaa"',
+ 9 => '"",""',
+ 10 => '"""""",',
+ 11 => '""""",aaa',
+ 12 => 'aaa,bbb ',
+ 13 => 'aaa,"bbb "',
+ 14 => 'aaa"aaa","bbb"bbb',
+ 15 => 'aaa"aaa""",bbb',
+ 16 => 'aaa,"\\"bbb,ccc',
+ 17 => 'aaa"\\"a","bbb"',
+ 18 => '"\\"","aaa"',
+ 19 => '"\\""",aaa',
+);
+===DONE===
diff --git a/ext/standard/tests/file/fputcsv_002.phpt b/ext/standard/tests/file/fputcsv_002.phpt
new file mode 100644
index 0000000..544ad30
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_002.phpt
@@ -0,0 +1,43 @@
+--TEST--
+fputcsv(): Checking data after calling the function
+--FILE--
+<?php
+
+$file = dirname(__FILE__) .'/fgetcsv-test.csv';
+
+$data = array(1, 2, 'foo', 'haha', array(4, 5, 6), 1.3, null);
+
+$fp = fopen($file, 'w');
+
+fputcsv($fp, $data);
+
+var_dump($data);
+
+@unlink($file);
+
+?>
+--EXPECTF--
+Notice: Array to string conversion in %s on line %d
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "foo"
+ [3]=>
+ string(4) "haha"
+ [4]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+ }
+ [5]=>
+ float(1.3)
+ [6]=>
+ NULL
+}
diff --git a/ext/standard/tests/file/fputcsv_error.phpt b/ext/standard/tests/file/fputcsv_error.phpt
new file mode 100644
index 0000000..9403cf4
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_error.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test fputcsv() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: int fputcsv ( resource $handle [, array $fields [, string $delimiter [, string $enclosure]]] );
+ Description:fputcsv() formats a line (passed as a fields array) as CSV and write it to the specified file
+ handle. Returns the length of the written string, or FALSE on failure.
+*/
+
+echo "*** Testing error conditions ***\n";
+// zero argument
+echo "-- Testing fputcsv() with zero argument --\n";
+var_dump( fputcsv() );
+
+// more than expected no. of args
+echo "-- Testing fputcsv() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+$fields = array("fld1", "fld2");
+$delim = ";";
+$enclosure ="\"";
+var_dump( fputcsv($fp, $fields, $delim, $enclosure, $fp) );
+fclose($fp);
+
+// test invalid arguments : non-resources
+echo "-- Testing fputcsv() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fputcsv() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fputcsv($invalid_args[$loop_counter - 1]) ); // with default args
+ var_dump( fputcsv($invalid_args[$loop_counter - 1], $fields, $delim, $enclosure) ); // all args specified
+}
+
+echo "Done\n";
+--EXPECTF--
+*** Testing error conditions ***
+-- Testing fputcsv() with zero argument --
+
+Warning: fputcsv() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+-- Testing fputcsv() with more than expected number of arguments --
+
+Warning: fputcsv() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+-- Testing fputcsv() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fputcsv() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fputcsv() expects parameter 1 to be resource, integer given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fputcsv() expects parameter 1 to be resource, double given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fputcsv() expects parameter 1 to be resource, boolean given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fputcsv() expects parameter 1 to be resource, array given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: fputcsv() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fputcsv() expects parameter 1 to be resource, object given in %s on line %d
+NULL
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation1.phpt b/ext/standard/tests/file/fputcsv_variation1.phpt
new file mode 100644
index 0000000..68df33c
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation1.phpt
@@ -0,0 +1,834 @@
+--TEST--
+Test fputcsv() : usage variations - with all parameters specified
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when all its parameters are provided */
+
+echo "*** Testing fputcsv() : with all parameters specified ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water','fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation1.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+
+ var_dump( fputcsv($file_handle, $csv_field, $delimiter, $enclosure) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with all parameters specified ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in a+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in w+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in x+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation10.phpt b/ext/standard/tests/file/fputcsv_variation10.phpt
new file mode 100644
index 0000000..21d845f
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation10.phpt
@@ -0,0 +1,336 @@
+--TEST--
+Test fputcsv() : usage variations - with line without any csv fields
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+
+/* Testing fputcsv() to write to a file when the field has no CSV format */
+
+echo "*** Testing fputcsv() : with no CSV format in the field ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+
+$fields = array( array('water_fruit\n'),
+ array("water_fruit\n"),
+ array("")
+ );
+
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation10.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($fields as $field) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $csv_field = $field;
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field) );
+
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with no CSV format in the field ***
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water_fruit\n"
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water_fruit\n"
+"
+
+-- file opened in r+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in r+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in r+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in a+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in a+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in a+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in w+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in w+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in w+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in x+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in x+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water_fruit
+"
+"
+
+-- file opened in x+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water_fruit
+"
+"
+
+-- file opened in r+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in r+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in r+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+
+-- file opened in a+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in a+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in a+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+
+-- file opened in w+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in w+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in w+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+
+-- file opened in x+ --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in x+b --
+int(1)
+int(1)
+bool(false)
+string(1) "
+"
+
+-- file opened in x+t --
+int(1)
+int(1)
+bool(false)
+string(%d) "
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation11.phpt b/ext/standard/tests/file/fputcsv_variation11.phpt
new file mode 100644
index 0000000..770b89b
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation11.phpt
@@ -0,0 +1,834 @@
+--TEST--
+Test fputcsv() : usage variations - with default enclosure value
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when default enclosure value is provided */
+
+echo "*** Testing fputcsv() : with default enclosure value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation11.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, $delimiter) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with default enclosure value ***
+
+-- file opened in r+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in r+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in r+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in a+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in a+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in a+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in w+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in w+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in w+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in x+ --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in x+b --
+int(14)
+int(14)
+bool(false)
+string(14) ""water,fruit"
+"
+
+-- file opened in x+t --
+int(14)
+int(14)
+bool(false)
+string(%d) ""water,fruit"
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""&water&:&fruit&"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""&water&:&fruit&"
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""=water===fruit="
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""=water===fruit="
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) ""-water--fruit-air"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) ""-water--fruit-air"
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) ""-water---fruit---air-"
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) ""-water---fruit---air-"
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation12.phpt b/ext/standard/tests/file/fputcsv_variation12.phpt
new file mode 100644
index 0000000..24fe5c4
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation12.phpt
@@ -0,0 +1,835 @@
+--TEST--
+Test fputcsv() : usage variations - with default enclosure and different delimiter
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when default enclosure value and delimiter value
+ other than that in the field is provided */
+
+echo "*** Testing fputcsv() : with default enclosure and different delimiter value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation12.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, '+') );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with default enclosure and different delimiter value ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation13.phpt b/ext/standard/tests/file/fputcsv_variation13.phpt
new file mode 100644
index 0000000..a8a350b
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation13.phpt
@@ -0,0 +1,1051 @@
+--TEST--
+Test fputcsv() : usage variations - with default enclosure & delimiter of two chars
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when default enclosure value and delimiter
+ of two chars is provided */
+
+echo "*** Testing fputcsv() : with default enclosure & delimiter of two chars ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation13.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, '++') );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with default enclosure & delimiter of two chars ***
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation14.phpt b/ext/standard/tests/file/fputcsv_variation14.phpt
new file mode 100644
index 0000000..36a4975
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation14.phpt
@@ -0,0 +1,357 @@
+--TEST--
+Test fputcsv() : usage variations - with enclosure & delimiter of two chars(read only modes)
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when default enclosure value and delimiter
+ of two chars is provided and file is opened in read only mode */
+
+echo "*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation14.tmp";
+
+$file_modes = array ("r", "rb", "rt");
+
+// create the file
+$file_handle = fopen($filename, "w" );
+if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+}
+fclose($file_handle);
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ // create the file
+ $file_handle = fopen($filename, "w" );
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ fclose($file_handle);
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // add the content with has csv fields
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, '++', '%%') );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rb --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in rt --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(0)
+int(0)
+bool(false)
+string(0) ""
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation2.phpt b/ext/standard/tests/file/fputcsv_variation2.phpt
new file mode 100644
index 0000000..3ec4e91
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation2.phpt
@@ -0,0 +1,942 @@
+--TEST--
+Test fputcsv() : usage variations - with delimiter as NULL
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when delimiter is NULL */
+
+echo "*** Testing fputcsv() : with delimiter as NULL ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water','fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation2.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, NULL, $enclosure) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with delimiter as NULL ***
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation3.phpt b/ext/standard/tests/file/fputcsv_variation3.phpt
new file mode 100644
index 0000000..14a2503
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation3.phpt
@@ -0,0 +1,942 @@
+--TEST--
+Test fputcsv() : usage variations - with enclosure as NULL
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when enclosure is NULL */
+
+echo "*** Testing fputcsv() : with enclosure as NULL ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water','fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation3.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, $delimiter, NULL) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with enclosure as NULL ***
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): enclosure must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation4.phpt b/ext/standard/tests/file/fputcsv_variation4.phpt
new file mode 100644
index 0000000..bc374ad
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation4.phpt
@@ -0,0 +1,942 @@
+--TEST--
+Test fputcsv() : usage variations - with delimiter and enclosure as NULL
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when delimiter and enclosure is NULL */
+
+echo "*** Testing fputcsv() : with delimiter and enclosure as NULL ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water','fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation4.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, NULL, NULL) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with delimiter and enclosure as NULL ***
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in r+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in a+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in w+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+ --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+b --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+
+-- file opened in x+t --
+
+Warning: fputcsv(): delimiter must be a character in %s on line %d
+bool(false)
+int(0)
+bool(false)
+string(0) ""
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation5.phpt b/ext/standard/tests/file/fputcsv_variation5.phpt
new file mode 100644
index 0000000..9d78854
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation5.phpt
@@ -0,0 +1,834 @@
+--TEST--
+Test fputcsv() : usage variations - with default arguments value
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/* Testing fputcsv() to write to a file when default arguments values are considered */
+
+echo "*** Testing fputcsv() : with default arguments value ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water','fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation5.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with default arguments value ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) ""^water^ ^fruit^"
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) ""^water^ ^fruit^"
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) ""&""""""""&:&""&:,:"":&,&:,,,,"
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation6.phpt b/ext/standard/tests/file/fputcsv_variation6.phpt
new file mode 100644
index 0000000..f30ce24
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation6.phpt
@@ -0,0 +1,837 @@
+--TEST--
+Test fputcsv() : usage variations - with different delimiter and enclosure
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/*
+ Testing fputcsv() to write to a file when delimiter are different from those
+ present in the field to be written to the file
+ */
+
+echo "*** Testing fputcsv() : with different delimiter and enclosure ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation6.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, '+', '%') );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with different delimiter and enclosure ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in r+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in r+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in a+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in a+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in a+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in w+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in w+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in w+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in x+ --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in x+b --
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in x+t --
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation7.phpt b/ext/standard/tests/file/fputcsv_variation7.phpt
new file mode 100644
index 0000000..8329251
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation7.phpt
@@ -0,0 +1,837 @@
+--TEST--
+Test fputcsv() : usage variations - with different delimiter and same enclosure
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/*
+ Testing fputcsv() to write to a file when enclosure is same but delimiter is different from those
+ present in the field to be written to the file
+ */
+
+echo "*** Testing fputcsv() : with different delimiter and same enclosure ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water','fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation7.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, '+', $enclosure) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with different delimiter and same enclosure ***
+
+-- file opened in r+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in r+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in r+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in a+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in a+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in a+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in w+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in w+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in w+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in x+ --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in x+b --
+int(12)
+int(12)
+bool(false)
+string(12) "water+fruit
+"
+
+-- file opened in x+t --
+int(12)
+int(12)
+bool(false)
+string(%d) "water+fruit
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) """"water"",""fruit"
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) """"water"",""fruit"
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) """"water"",""fruit"""
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) """"water"",""fruit"""
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "^^^water^^ ^^fruit^^^
+"
+
+-- file opened in r+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in a+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in w+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+ --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+b --
+int(22)
+int(22)
+bool(false)
+string(22) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in x+t --
+int(22)
+int(22)
+bool(false)
+string(%d) "&&&water&&:&&fruit&&&
+"
+
+-- file opened in r+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in r+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in a+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in a+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in w+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in w+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in x+ --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+b --
+int(23)
+int(23)
+bool(false)
+string(23) "===water======fruit===
+"
+
+-- file opened in x+t --
+int(23)
+int(23)
+bool(false)
+string(%d) "===water======fruit===
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "---water----fruit--air-
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "---water----fruit--air-
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "---water------fruit------air---
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "---water------fruit------air---
+"
+
+-- file opened in r+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in r+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in a+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in w+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+ --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+b --
+int(32)
+int(32)
+bool(false)
+string(32) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+
+-- file opened in x+t --
+int(32)
+int(32)
+bool(false)
+string(%d) "&&&""""&&:&&"&&:,:":&&,&&:,,,,&
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation8.phpt b/ext/standard/tests/file/fputcsv_variation8.phpt
new file mode 100644
index 0000000..096f379
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation8.phpt
@@ -0,0 +1,837 @@
+--TEST--
+Test fputcsv() : usage variations - with same delimiter and different enclosure
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+/*
+ Testing fputcsv() to write to a file when delimiter is same but enclosure is different from those
+ present in the field to be written to the file
+ */
+
+echo "*** Testing fputcsv() : with same delimiter and different enclosure ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation8.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, $delimiter, '+') );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with same delimiter and different enclosure ***
+
+-- file opened in r+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in r+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in r+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in a+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in a+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in a+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in w+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in w+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in w+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in x+ --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in x+b --
+int(14)
+int(14)
+bool(false)
+string(14) "+water,fruit+
+"
+
+-- file opened in x+t --
+int(14)
+int(14)
+bool(false)
+string(%d) "+water,fruit+
+"
+
+-- file opened in r+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in r+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in r+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in a+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in a+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in a+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in w+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in w+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in w+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in x+ --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in x+b --
+int(17)
+int(17)
+bool(false)
+string(17) "+"water","fruit+
+"
+
+-- file opened in x+t --
+int(17)
+int(17)
+bool(false)
+string(%d) "+"water","fruit+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+"water","fruit"+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+"water","fruit"+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+^water^ ^fruit^+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+^water^ ^fruit^+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+&water&:&fruit&+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+&water&:&fruit&+
+"
+
+-- file opened in r+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in r+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in r+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in a+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in a+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in a+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in w+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in w+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in w+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in x+ --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in x+b --
+int(18)
+int(18)
+bool(false)
+string(18) "+=water===fruit=+
+"
+
+-- file opened in x+t --
+int(18)
+int(18)
+bool(false)
+string(%d) "+=water===fruit=+
+"
+
+-- file opened in r+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in r+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in r+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in a+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in a+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in a+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in w+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in w+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in w+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in x+ --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in x+b --
+int(20)
+int(20)
+bool(false)
+string(20) "+-water--fruit-air+
+"
+
+-- file opened in x+t --
+int(20)
+int(20)
+bool(false)
+string(%d) "+-water--fruit-air+
+"
+
+-- file opened in r+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in r+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in r+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in a+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in a+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in a+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in w+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in w+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in w+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in x+ --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in x+b --
+int(24)
+int(24)
+bool(false)
+string(24) "+-water---fruit---air-+
+"
+
+-- file opened in x+t --
+int(24)
+int(24)
+bool(false)
+string(%d) "+-water---fruit---air-+
+"
+
+-- file opened in r+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in r+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in r+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in a+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in a+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in a+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in w+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in w+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in w+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in x+ --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in x+b --
+int(26)
+int(26)
+bool(false)
+string(26) "+&""""&:&"&:,:":&,&:,,,,+
+"
+
+-- file opened in x+t --
+int(26)
+int(26)
+bool(false)
+string(%d) "+&""""&:&"&:,:":&,&:,,,,+
+"
+Done
+
diff --git a/ext/standard/tests/file/fputcsv_variation9.phpt b/ext/standard/tests/file/fputcsv_variation9.phpt
new file mode 100644
index 0000000..386d7bd
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation9.phpt
@@ -0,0 +1,1268 @@
+--TEST--
+Test fputcsv() : usage variations - two chars as enclosure & delimiter
+--FILE--
+<?php
+/*
+ Prototype: array fputcsv ( resource $handle , array $fields [, string $delimiter [, string $enclosure]]] );
+ Description: Format line as CSV and write to the file pointer
+*/
+
+
+/* Testing fputcsv() to write to a file when delimiter and enclosure are of two chars each */
+
+echo "*** Testing fputcsv() : with two chars as enclosure & delimiter ***\n";
+
+/* the array is with three elements in it. Each element should be read as
+ 1st element is delimiter, 2nd element is enclosure
+ and 3rd element is csv fields
+*/
+$csv_lists = array (
+ array(',', '"', array('water,fruit') ),
+ array(',', '"', array('"water","fruit') ),
+ array(',', '"', array('"water","fruit"') ),
+ array(' ', '^', array('^water^ ^fruit^')),
+ array(':', '&', array('&water&:&fruit&')),
+ array('=', '=', array('=water===fruit=')),
+ array('-', '-', array('-water--fruit-air')),
+ array('-', '-', array('-water---fruit---air-')),
+ array(':', '&', array('&""""&:&"&:,:":&,&:,,,,'))
+
+);
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fputcsv_variation9.tmp";
+
+$file_modes = array ("r+", "r+b", "r+t",
+ "a+", "a+b", "a+t",
+ "w+", "w+b", "w+t",
+ "x+", "x+b", "x+t");
+
+$loop_counter = 1;
+foreach ($csv_lists as $csv_list) {
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+
+ echo "\n-- file opened in $file_modes[$mode_counter] --\n";
+ // create the file and add the content with has csv fields
+ if ( strstr($file_modes[$mode_counter], "r") ) {
+ $file_handle = fopen($filename, "w");
+ } else {
+ $file_handle = fopen($filename, $file_modes[$mode_counter] );
+ }
+ if ( !$file_handle ) {
+ echo "Error: failed to create file $filename!\n";
+ exit();
+ }
+ $delimiter = $csv_list[0];
+ $enclosure = $csv_list[1];
+ $csv_field = $csv_list[2];
+
+ // write to a file in csv format
+ var_dump( fputcsv($file_handle, $csv_field, '++', '%%'
+) );
+ // check the file pointer position and eof
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ //close the file
+ fclose($file_handle);
+
+ // print the file contents
+ var_dump( file_get_contents($filename) );
+
+ //delete file
+ unlink($filename);
+ } //end of mode loop
+} // end of foreach
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fputcsv() : with two chars as enclosure & delimiter ***
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(12) "water,fruit
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(12)
+int(12)
+bool(false)
+string(%d) "water,fruit
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(15) ""water","fruit
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(15)
+int(15)
+bool(false)
+string(%d) ""water","fruit
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) ""water","fruit"
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) ""water","fruit"
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "%^water^ ^fruit^%
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "%^water^ ^fruit^%
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "&water&:&fruit&
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "&water&:&fruit&
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(16) "=water===fruit=
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(16)
+int(16)
+bool(false)
+string(%d) "=water===fruit=
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(18) "-water--fruit-air
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(18)
+int(18)
+bool(false)
+string(%d) "-water--fruit-air
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(22) "-water---fruit---air-
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(22)
+int(22)
+bool(false)
+string(%d) "-water---fruit---air-
+"
+
+-- file opened in r+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in r+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in r+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in a+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in w+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+ --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+b --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(24) "&""""&:&"&:,:":&,&:,,,,
+"
+
+-- file opened in x+t --
+
+Notice: fputcsv(): delimiter must be a single character in %s on line %d
+
+Notice: fputcsv(): enclosure must be a single character in %s on line %d
+int(24)
+int(24)
+bool(false)
+string(%d) "&""""&:&"&:,:":&,&:,,,,
+"
+Done
+
diff --git a/ext/standard/tests/file/fread_basic.phpt b/ext/standard/tests/file/fread_basic.phpt
new file mode 100644
index 0000000..44e5342
--- /dev/null
+++ b/ext/standard/tests/file/fread_basic.phpt
@@ -0,0 +1,640 @@
+--TEST--
+Test fread() function : basic functionality
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_size(string $data, int $expect_size)
+ Description : Check the length of the data, and compare the size with $expect_size
+ $data : Text data.
+ $expect_size : Expected data length
+*/
+function check_size($data, $expect_size) {
+
+ $size=strlen($data);
+ if ( $size == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error: Expected: $expect_size, Actual: $size";
+ }
+
+
+echo "*** Testing fread() basic operations ***\n";
+/*
+ test fread with file opened in "r" and "rb" mode only
+ Content with numeric and strings with it
+*/
+$file_modes = array( "r", "rb", "rt", "r+", "r+b", "r+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+ foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread) with file having data of type ". $file_content_type ." --\n";
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_basic");
+ $filename = dirname(__FILE__)."/fread_basic1.tmp"; // this is name of the file created by create_files()
+
+ /* open the file using $files_modes and perform fread() on it */
+ for($inner_loop_counter = 0;
+ $inner_loop_counter < count($file_modes);
+ $inner_loop_counter++) {
+
+ echo "-- File opened in mode ".$file_modes[$inner_loop_counter]." --\n";
+ $file_handle = fopen($filename, $file_modes[$inner_loop_counter]);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ /* read file by giving the acutal length, check the length and content by calculating the
+ hash using md5() function
+ */
+ /* Reading 1024 bytes from file, expecting 1024 bytes */ ;
+
+ var_dump(ftell($file_handle));
+ var_dump( feof($file_handle) );
+ echo "Reading 1024 bytes from file, expecting 1024 bytes ... ";
+ $data_from_file=fread($file_handle, 1024);
+ check_size($data_from_file,1024);
+ var_dump(ftell($file_handle));
+ var_dump( feof($file_handle) );
+ var_dump( md5($data_from_file) ); // calculate the hash and dump it
+
+ /* read file by giving size more than its size */
+ var_dump(rewind($file_handle));
+ var_dump(ftell($file_handle));
+ var_dump( feof($file_handle) );
+ /*reading 1030 bytes from file, expecting 1024 bytes */ ;
+ echo "Reading 1030 bytes from file, expecting 1024 bytes ... ";
+ $data_from_file=fread($file_handle, 1030);// request for 6 bytes more than its size
+ check_size($data_from_file,1024);
+ var_dump(ftell($file_handle));
+ var_dump( feof($file_handle) );
+ var_dump( md5($data_from_file) ); // calculate the hash and dump it
+
+ // reading 1000 bytes within the file max size
+ var_dump(rewind($file_handle));
+ var_dump(ftell($file_handle));
+ var_dump( feof($file_handle) );
+ /*reading 1000 bytes from file, expecting 1000 bytes */ ;
+ echo "Reading 1000 bytes from file, expecting 1000 bytes ... ";
+ $data_from_file=fread($file_handle, 1000);// request for 24 bytes less than its size
+ check_size($data_from_file,1000);
+ var_dump(ftell($file_handle));
+ var_dump( feof($file_handle) );
+ var_dump( md5($data_from_file) ); // calculate the hash and dump it
+ var_dump(fclose($file_handle)); // now close the file
+ } // end of inner for loop
+
+ // delete the file created
+ delete_file($filename); // delete file with name
+} // end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fread() basic operations ***
+
+-- Testing fread) with file having data of type numeric --
+-- File opened in mode r --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+bool(true)
+-- File opened in mode rb --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+bool(true)
+-- File opened in mode rt --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+bool(true)
+-- File opened in mode r+ --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+bool(true)
+-- File opened in mode r+b --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+bool(true)
+-- File opened in mode r+t --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+bool(true)
+
+-- Testing fread) with file having data of type text --
+-- File opened in mode r --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+bool(true)
+-- File opened in mode rb --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+bool(true)
+-- File opened in mode rt --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+bool(true)
+-- File opened in mode r+ --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+bool(true)
+-- File opened in mode r+b --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+bool(true)
+-- File opened in mode r+t --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+bool(true)
+
+-- Testing fread) with file having data of type text_with_new_line --
+-- File opened in mode r --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+bool(true)
+-- File opened in mode rb --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+bool(true)
+-- File opened in mode rt --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+bool(true)
+-- File opened in mode r+ --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+bool(true)
+-- File opened in mode r+b --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+bool(true)
+-- File opened in mode r+t --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+bool(true)
+
+-- Testing fread) with file having data of type alphanumeric --
+-- File opened in mode r --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+bool(true)
+-- File opened in mode rb --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+bool(true)
+-- File opened in mode rt --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+bool(true)
+-- File opened in mode r+ --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+bool(true)
+-- File opened in mode r+b --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+bool(true)
+-- File opened in mode r+t --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+bool(true)
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+bool(true)
+Done
diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt
new file mode 100644
index 0000000..45a5ad1
--- /dev/null
+++ b/ext/standard/tests/file/fread_error.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test fread() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+echo "*** Testing error conditions ***\n";
+$filename = __FILE__;
+$file_handle = fopen($filename, "r");
+
+// zero argument
+echo "-- Testing fread() with zero argument --\n";
+var_dump( fread() );
+
+// more than expected no. of args
+echo "-- Testing fread() with more than expected number of arguments --\n";
+var_dump( fread($file_handle, 10, $file_handle) );
+
+// invalid length argument
+echo "-- Testing fread() with invalid length arguments --\n";
+$len = 0;
+var_dump( fread($file_handle, $len) );
+$len = -10;
+var_dump( fread($file_handle, $len) );
+
+// test invalid arguments : non-resources
+echo "-- Testing fread() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fread() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fread($invalid_args[$loop_counter - 1], 10) );
+}
+
+// fwrite() on a file handle which is already closed
+echo "-- Testing fwrite() with closed/unset file handle --\n";
+fclose($file_handle);
+var_dump( fread($file_handle,$file_content_type) );
+
+// fwrite on a file handle which is unset
+$fp = fopen($filename, "r");
+unset($fp); //unset file handle
+var_dump( fread(@$fp,10) );
+var_dump( fclose(@$fp) );
+
+echo "Done\n";
+--EXPECTF--
+*** Testing error conditions ***
+-- Testing fread() with zero argument --
+
+Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+-- Testing fread() with more than expected number of arguments --
+
+Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+-- Testing fread() with invalid length arguments --
+
+Warning: fread(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+
+Warning: fread(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+-- Testing fread() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fread() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: fread() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: fread() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: fread() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: fread() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: fread() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing fwrite() with closed/unset file handle --
+
+Notice: Undefined variable: file_content_type in %s on line %d
+
+Warning: fread(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: fread() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fread_fwrite_basic.phpt b/ext/standard/tests/file/fread_fwrite_basic.phpt
new file mode 100644
index 0000000..0f5c4ed
--- /dev/null
+++ b/ext/standard/tests/file/fread_fwrite_basic.phpt
@@ -0,0 +1,72 @@
+--TEST--
+fread & fwrite - Test reading and writing using a single resource
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+/*
+ * proto int fwrite(resource fp, string str [, int length])
+ * Function is implemented in ext/standard/file.c
+ */
+
+ /*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+
+$outputfile = __FILE__.".tmp";
+
+echo "--- testing rw moving about the file ---\n";
+$h = fopen($outputfile, 'wb+');
+$out1 = "The 1st prrt";
+$out2 = " part of the ttxt";
+$out3 = "text";
+fwrite($h, $out1);
+fseek($h, 0, SEEK_SET);
+echo "start:".fread($h, strlen($out1) - 5). "\n";
+fwrite($h, $out2);
+echo "at end:".fread($h,100)."\n";
+var_dump(feof($h));
+fseek($h, -4, SEEK_CUR);
+fwrite($h, $out3);
+fseek($h, 0, SEEK_SET);
+echo "final:".fread($h, 100)."\n";
+fclose($h);
+
+echo "--- testing eof ---\n";
+$h = fopen($outputfile, 'ab+');
+fread($h,1024);
+var_dump(feof($h));
+fread($h,1);
+var_dump(feof($h));
+$out = "extra";
+fwrite($h, $out);
+var_dump(feof($h));
+fread($h,1);
+var_dump(feof($h));
+fseek($h, -strlen($out) + 1, SEEK_CUR);
+echo "last bytes: ".fread($h, strlen($out))."\n";
+fclose($h);
+
+unlink($outputfile);
+
+echo "Done";
+?>
+--EXPECT--
+--- testing rw moving about the file ---
+start:The 1st
+at end:
+bool(true)
+final:The 1st part of the text
+--- testing eof ---
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+last bytes: xtra
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fread_socket_variation1.phpt b/ext/standard/tests/file/fread_socket_variation1.phpt
new file mode 100644
index 0000000..a615d2f
--- /dev/null
+++ b/ext/standard/tests/file/fread_socket_variation1.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Testing fread() on a TCP server socket
+--FILE--
+<?php
+
+$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
+
+socket_set_timeout($tcp_socket, 0, 1000);
+
+var_dump(fread($tcp_socket, 1));
+
+fclose($tcp_socket);
+
+?>
+--EXPECT--
+string(0) ""
diff --git a/ext/standard/tests/file/fread_variation1.phpt b/ext/standard/tests/file/fread_variation1.phpt
new file mode 100644
index 0000000..c46dbe2
--- /dev/null
+++ b/ext/standard/tests/file/fread_variation1.phpt
@@ -0,0 +1,657 @@
+--TEST--
+Test fread() function : usage variations - read some/all chars, read/write modes
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+/* Read content less than file size &
+ Read entire file
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
+ Description : Read data from file of size $read_size and verifies that $expected_size no. of
+ bytes are read.
+ $file_handle : File Handle
+ $read_size : No. of bytes to be read.
+ $expect_size : Expected data length
+ Returns: returns the data read
+*/
+function check_read($file_handle, $read_size, $expect_size) {
+ // print file pointer position before read
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read the data of size $read_size
+ echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
+ $data_from_file = fread($file_handle, $read_size);
+
+ // check if data read is of expected size
+ if ( strlen($data_from_file) == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
+
+ // file pointer position after read
+ var_dump( ftell($file_handle) );
+ // check if file pointer at eof()
+ var_dump( feof($file_handle) );
+
+ return $data_from_file;
+}
+
+echo "*** Testing fread() : usage variations ***\n";
+
+$file_modes = array("a+","a+b","a+t",
+ "w+","w+b","w+t",
+ "x+","x+b","x+t");
+
+$file_content_types = array("numeric","text","text_with_new_line", "alphanumeric");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fread() on it */
+ foreach($file_modes as $file_mode) {
+ if(!strstr($file_mode,"x")){
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_variation");
+ }
+
+ $filename = dirname(__FILE__)."/fread_variation1.tmp"; // this is name of the file created by create_files()
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
+ fill_file($file_handle, $file_content_type, 1024);
+ }
+
+ rewind($file_handle);
+ echo "-- Reading entire file content, expeceted : 1024 bytes --\n";
+ // read from file, by giving the file actual size,
+ $data_from_file = check_read($file_handle, 1024, (strstr($file_mode, "+") ? 1024 : 1024 ) );
+ // calculate the hash and dump it, if data read, expecting here no data was read
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // reading file by giving less than its size
+ echo "-- Reading file content less than max. file size, expeceted : 1000 bytes --\n";
+ rewind($file_handle);
+ $data_from_file = check_read($file_handle, 1000, (strstr($file_mode, "+") ? 1000 : 1000 ) );
+ // calculate the hash and dump it, if data read, expecting here no data was read
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // now close the file
+ fclose($file_handle);
+
+ // delete the file created
+ delete_file($filename); // delete file
+ } // end of inner foreach loop
+}// end of outer foreach loop
+
+echo"Done\n";
+?>
+--EXPECTF--
+*** Testing fread() : usage variations ***
+
+-- Testing fread() with file having content of type numeric --
+-- File opened in mode a+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode a+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode a+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode w+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode w+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode w+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode x+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode x+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+-- File opened in mode x+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "4501f99f2b79d0345f26f1394aca58a3"
+
+-- Testing fread() with file having content of type text --
+-- File opened in mode a+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode a+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode a+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode w+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode w+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode w+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode x+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode x+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+-- File opened in mode x+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
+
+-- Testing fread() with file having content of type text_with_new_line --
+-- File opened in mode a+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode a+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode a+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode w+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode w+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode w+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode x+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode x+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+-- File opened in mode x+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a148fa8110bbac875d84fc9d7056c0a1"
+
+-- Testing fread() with file having content of type alphanumeric --
+-- File opened in mode a+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode a+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode a+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode w+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode w+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode w+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode x+ --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode x+b --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+-- File opened in mode x+t --
+-- Reading entire file content, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(false)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Reading file content less than max. file size, expeceted : 1000 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 1000 bytes ... OK
+int(1000)
+bool(false)
+string(32) "a49d752f980184c7f44568e930f89c72"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fread_variation2.phpt b/ext/standard/tests/file/fread_variation2.phpt
new file mode 100644
index 0000000..23813a6
--- /dev/null
+++ b/ext/standard/tests/file/fread_variation2.phpt
@@ -0,0 +1,656 @@
+--TEST--
+Test fread() function : usage variations - read some/all chars, write only mode (Bug #42036)
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+/* Try reading some or all content of the file opened in write only mode */
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
+ Description : Read data from file of size $read_size and verifies that $expected_size no. of
+ bytes are read.
+ $file_handle : File Handle
+ $read_size : No. of bytes to be read.
+ $expect_size : Expected data length
+ Returns: returns the data read
+*/
+function check_read($file_handle, $read_size, $expect_size) {
+ // print file pointer position before read
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read the data of size $read_size
+ echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
+ $data_from_file = fread($file_handle, $read_size);
+
+ // check if data read is of expected size
+ if ( strlen($data_from_file) == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
+
+ // file pointer position after read
+ var_dump( ftell($file_handle) );
+ // check if file pointer at eof()
+ var_dump( feof($file_handle) );
+ echo "\n";
+
+ return $data_from_file;
+}
+
+echo "*** Testing fread() : usage variations ***\n";
+
+$file_modes = array("a","ab","at",
+ "w","wb","wt",
+ "x","xb","xt" );
+
+$file_content_types = array("numeric","text","text_with_new_line", "alphanumeric");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fread() on it */
+ foreach($file_modes as $file_mode) {
+ if(!strstr($file_mode,"x")){
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_variation", 2);
+ }
+
+ $filename = dirname(__FILE__)."/fread_variation2.tmp"; // this is name of the file created by create_files()
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
+ fill_file($file_handle, $file_content_type, 1024);
+ }
+
+ rewind($file_handle);
+ echo "-- Reading entire file content, expeceted : 0 bytes --\n";
+ // read from file, by giving the file actual size,
+ $data_from_file = check_read($file_handle, 1024, (strstr($file_mode, "+") ? 1024 : 0 ) );
+ // calculate the hash and dump it, if data read, expecting here no data was read
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // reading file by giving less than its size
+ echo "-- Reading file content less than max. file size, expeceted : 0 bytes --\n";
+ rewind($file_handle);
+ $data_from_file = check_read($file_handle, 1000, (strstr($file_mode, "+") ? 1000 : 0 ) );
+ // calculate the hash and dump it, if data read, expecting here no data was read
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // now close the file
+ fclose($file_handle);
+
+ // delete the file created
+ delete_file($filename); // delete file
+ } // end of inner foreach loop
+}// end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fread() : usage variations ***
+
+-- Testing fread() with file having content of type numeric --
+-- File opened in mode a --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode ab --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode at --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode w --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode x --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+
+-- Testing fread() with file having content of type text --
+-- File opened in mode a --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode ab --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode at --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode w --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode x --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+
+-- Testing fread() with file having content of type text_with_new_line --
+-- File opened in mode a --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode ab --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode at --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode w --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode x --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+
+-- Testing fread() with file having content of type alphanumeric --
+-- File opened in mode a --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode ab --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode at --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode w --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode wt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode x --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xb --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- File opened in mode xt --
+-- Reading entire file content, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1024 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+-- Reading file content less than max. file size, expeceted : 0 bytes --
+int(0)
+bool(false)
+Reading 1000 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+
+Done
diff --git a/ext/standard/tests/file/fread_variation3-win32.phpt b/ext/standard/tests/file/fread_variation3-win32.phpt
new file mode 100644
index 0000000..5491555
--- /dev/null
+++ b/ext/standard/tests/file/fread_variation3-win32.phpt
@@ -0,0 +1,498 @@
+--TEST--
+Test fread() function : usage variations - read beyond file size, read/write mode
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip...only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
+ Description : Read data from file of size $read_size and verifies that $expected_size no. of
+ bytes are read.
+ $file_handle : File Handle
+ $read_size : No. of bytes to be read.
+ $expect_size : Expected data length
+ Returns: returns the data read
+*/
+function check_read($file_handle, $read_size, $expect_size) {
+ // print file pointer position before read
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read the data of size $read_size
+ echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
+ $data_from_file = fread($file_handle, $read_size);
+
+ // check if data read is of expected size
+ if ( strlen($data_from_file) == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
+
+ // file pointer position after read
+ var_dump( ftell($file_handle) );
+ // check if file pointer at eof()
+ var_dump( feof($file_handle) );
+
+ return $data_from_file;
+}
+
+echo "*** Testing fread() : usage variations ***\n";
+
+$file_modes = array("a+","a+b","a+t",
+ "w+","w+b","w+t",
+ "x+","x+b","x+t");
+
+$file_content_types = array("numeric","text","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fread() on it */
+ foreach($file_modes as $file_mode) {
+ if(!strstr($file_mode,"x")){
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_variation", 3);
+ }
+
+ $filename = dirname(__FILE__)."/fread_variation3.tmp"; // this is name of the file created by create_files()
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
+ $data_to_be_written="";
+ fill_file($file_handle, $file_content_type, 1024);
+ }
+
+ rewind($file_handle);
+
+ // read file by giving size more than its size
+ echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ rewind($file_handle);
+ $data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 1024) );
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ rewind($file_handle);
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ // try fread when file pointer at end
+ fseek($file_handle, 0, SEEK_END);
+ //reading file when file pointer at end
+ $data_from_file = check_read($file_handle, 10, 0);
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // now close the file
+ fclose($file_handle);
+
+ // delete the file created
+ delete_file($filename); // delete file
+ } // end of inner foreach loop
+}// end of outer foreach loop
+
+echo"Done\n";
+?>
+--EXPECTF--
+*** Testing fread() : usage variations ***
+
+-- Testing fread() with file having content of type numeric --
+-- File opened in mode a+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+
+-- Testing fread() with file having content of type text --
+-- File opened in mode a+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+
+-- Testing fread() with file having content of type text_with_new_line --
+-- File opened in mode a+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1137)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1137)
+bool(true)
+-- File opened in mode x+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1137)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1137)
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fread_variation3.phpt b/ext/standard/tests/file/fread_variation3.phpt
new file mode 100644
index 0000000..949e7b8
--- /dev/null
+++ b/ext/standard/tests/file/fread_variation3.phpt
@@ -0,0 +1,498 @@
+--TEST--
+Test fread() function : usage variations - read beyond file size, read/write mode
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip...Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
+ Description : Read data from file of size $read_size and verifies that $expected_size no. of
+ bytes are read.
+ $file_handle : File Handle
+ $read_size : No. of bytes to be read.
+ $expect_size : Expected data length
+ Returns: returns the data read
+*/
+function check_read($file_handle, $read_size, $expect_size) {
+ // print file pointer position before read
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read the data of size $read_size
+ echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
+ $data_from_file = fread($file_handle, $read_size);
+
+ // check if data read is of expected size
+ if ( strlen($data_from_file) == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
+
+ // file pointer position after read
+ var_dump( ftell($file_handle) );
+ // check if file pointer at eof()
+ var_dump( feof($file_handle) );
+
+ return $data_from_file;
+}
+
+echo "*** Testing fread() : usage variations ***\n";
+
+$file_modes = array("a+","a+b","a+t",
+ "w+","w+b","w+t",
+ "x+","x+b","x+t");
+
+$file_content_types = array("numeric","text","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fread() on it */
+ foreach($file_modes as $file_mode) {
+ if(!strstr($file_mode,"x")){
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_variation", 3);
+ }
+
+ $filename = dirname(__FILE__)."/fread_variation3.tmp"; // this is name of the file created by create_files()
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
+ $data_to_be_written="";
+ fill_file($file_handle, $file_content_type, 1024);
+ }
+
+ rewind($file_handle);
+
+ // read file by giving size more than its size
+ echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ rewind($file_handle);
+ $data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 1024) );
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ rewind($file_handle);
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ // try fread when file pointer at end
+ fseek($file_handle, 0, SEEK_END);
+ //reading file when file pointer at end
+ $data_from_file = check_read($file_handle, 10, 0);
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // now close the file
+ fclose($file_handle);
+
+ // delete the file created
+ delete_file($filename); // delete file
+ } // end of inner foreach loop
+}// end of outer foreach loop
+
+echo"Done\n";
+?>
+--EXPECTF--
+*** Testing fread() : usage variations ***
+
+-- Testing fread() with file having content of type numeric --
+-- File opened in mode a+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+
+-- Testing fread() with file having content of type text --
+-- File opened in mode a+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+
+-- Testing fread() with file having content of type text_with_new_line --
+-- File opened in mode a+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode a+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode w+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+ --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+b --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+-- File opened in mode x+t --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 1024 bytes ... OK
+int(1024)
+bool(true)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fread_variation4-win32.phpt b/ext/standard/tests/file/fread_variation4-win32.phpt
new file mode 100644
index 0000000..77d733a
--- /dev/null
+++ b/ext/standard/tests/file/fread_variation4-win32.phpt
@@ -0,0 +1,469 @@
+--TEST--
+Test fread() function : usage variations - read beyond file size, write only mode
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip...only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
+ Description : Read data from file of size $read_size and verifies that $expected_size no. of
+ bytes are read.
+ $file_handle : File Handle
+ $read_size : No. of bytes to be read.
+ $expect_size : Expected data length
+ Returns: returns the data read
+*/
+function check_read($file_handle, $read_size, $expect_size) {
+ // print file pointer position before read
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read the data of size $read_size
+ echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
+ $data_from_file = fread($file_handle, $read_size);
+
+ // check if data read is of expected size
+ if ( strlen($data_from_file) == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
+
+ // file pointer position after read
+ var_dump( ftell($file_handle) );
+ // check if file pointer at eof()
+ var_dump( feof($file_handle) );
+
+ return $data_from_file;
+}
+
+echo "*** Testing fread() : usage variations ***\n";
+
+$file_modes = array("a","ab","at",
+ "w","wb","wt",
+ "x","xb","xt" );
+
+$file_content_types = array("numeric","text","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fread() on it */
+ foreach($file_modes as $file_mode) {
+ if(!strstr($file_mode,"x")){
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_variation", 4);
+ }
+
+ $filename = dirname(__FILE__)."/fread_variation4.tmp"; // this is name of the file created by create_files()
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
+ fill_file($file_handle, $file_content_type, 1024);
+ }
+
+ rewind($file_handle);
+ echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ // read file by giving size more than its size
+ rewind($file_handle);
+ $data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 0) );
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ rewind($file_handle);
+ // try fread when file pointer at end
+ fseek($file_handle, 0, SEEK_END);
+ //reading file when file pointer at end
+ $data_from_file = check_read($file_handle, 10, 0);
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // now close the file
+ fclose($file_handle);
+
+ // delete the file created
+ delete_file($filename); // delete file
+ } // end of inner foreach loop
+}// end of outer foreach loop
+
+echo"Done\n";
+?>
+--EXPECTF--
+*** Testing fread() : usage variations ***
+
+-- Testing fread() with file having content of type numeric --
+-- File opened in mode a --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode ab --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode at --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode w --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode x --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+
+-- Testing fread() with file having content of type text --
+-- File opened in mode a --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode ab --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode at --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode w --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode x --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+
+-- Testing fread() with file having content of type text_with_new_line --
+-- File opened in mode a --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode ab --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode at --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode w --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1137)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1137)
+bool(false)
+-- File opened in mode x --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1137)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1137)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fread_variation4.phpt b/ext/standard/tests/file/fread_variation4.phpt
new file mode 100644
index 0000000..fdff8de
--- /dev/null
+++ b/ext/standard/tests/file/fread_variation4.phpt
@@ -0,0 +1,469 @@
+--TEST--
+Test fread() function : usage variations - read beyond file size, write only mode
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: string fread ( resource $handle [, int $length] );
+ Description: reads up to length bytes from the file pointer referenced by handle.
+ Reading stops when up to length bytes have been read, EOF (end of file) is
+ reached, (for network streams) when a packet becomes available, or (after
+ opening userspace stream) when 8192 bytes have been read whichever comes first.
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
+ Description : Read data from file of size $read_size and verifies that $expected_size no. of
+ bytes are read.
+ $file_handle : File Handle
+ $read_size : No. of bytes to be read.
+ $expect_size : Expected data length
+ Returns: returns the data read
+*/
+function check_read($file_handle, $read_size, $expect_size) {
+ // print file pointer position before read
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+
+ // read the data of size $read_size
+ echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
+ $data_from_file = fread($file_handle, $read_size);
+
+ // check if data read is of expected size
+ if ( strlen($data_from_file) == $expect_size)
+ echo "OK\n";
+ else
+ echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
+
+ // file pointer position after read
+ var_dump( ftell($file_handle) );
+ // check if file pointer at eof()
+ var_dump( feof($file_handle) );
+
+ return $data_from_file;
+}
+
+echo "*** Testing fread() : usage variations ***\n";
+
+$file_modes = array("a","ab","at",
+ "w","wb","wt",
+ "x","xb","xt" );
+
+$file_content_types = array("numeric","text","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fread() on it */
+ foreach($file_modes as $file_mode) {
+ if(!strstr($file_mode,"x")){
+ /* create files with $file_content_type */
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fread_variation", 4);
+ }
+
+ $filename = dirname(__FILE__)."/fread_variation4.tmp"; // this is name of the file created by create_files()
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
+ fill_file($file_handle, $file_content_type, 1024);
+ }
+
+ rewind($file_handle);
+ echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ // read file by giving size more than its size
+ rewind($file_handle);
+ $data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 0) );
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ rewind($file_handle);
+ // try fread when file pointer at end
+ fseek($file_handle, 0, SEEK_END);
+ //reading file when file pointer at end
+ $data_from_file = check_read($file_handle, 10, 0);
+ if ( $data_from_file != false)
+ var_dump( md5($data_from_file) );
+
+ // now close the file
+ fclose($file_handle);
+
+ // delete the file created
+ delete_file($filename); // delete file
+ } // end of inner foreach loop
+}// end of outer foreach loop
+
+echo"Done\n";
+?>
+--EXPECTF--
+*** Testing fread() : usage variations ***
+
+-- Testing fread() with file having content of type numeric --
+-- File opened in mode a --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode ab --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode at --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode w --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode x --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+
+-- Testing fread() with file having content of type text --
+-- File opened in mode a --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode ab --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode at --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode w --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode x --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+
+-- Testing fread() with file having content of type text_with_new_line --
+-- File opened in mode a --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode ab --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode at --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode w --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode wt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode x --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xb --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+-- File opened in mode xt --
+-- Reading beyond filesize, expeceted : 1024 bytes --
+int(0)
+bool(false)
+Reading 1030 bytes from file, expecting 0 bytes ... OK
+int(0)
+bool(false)
+-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+int(1024)
+bool(false)
+Reading 10 bytes from file, expecting 0 bytes ... OK
+int(1024)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt
new file mode 100644
index 0000000..c37bdeb
--- /dev/null
+++ b/ext/standard/tests/file/fscanf.phpt
@@ -0,0 +1,100 @@
+--TEST--
+fscanf() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fscanf.dat";
+
+var_dump(fscanf());
+var_dump(fscanf(array()));
+var_dump(fscanf(array(), array(), new stdclass));
+
+file_put_contents($filename, "data");
+
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "%d", $v));
+var_dump($v);
+fclose($fp);
+
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "%s", $v));
+var_dump($v);
+fclose($fp);
+
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "%s", $v, $v1));
+var_dump($v);
+var_dump($v1);
+fclose($fp);
+
+$v = array();
+$v1 = array();
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "", $v, $v1));
+var_dump($v);
+var_dump($v1);
+fclose($fp);
+
+$v = array();
+$v1 = array();
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "%.a", $v, $v1));
+var_dump($v);
+var_dump($v1);
+fclose($fp);
+
+@unlink($filename);
+touch($filename);
+
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "%s", $v));
+var_dump($v);
+fclose($fp);
+
+file_put_contents($filename, "data");
+
+$fp = fopen($filename, "rt");
+var_dump(fscanf($fp, "%s%d", $v));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d
+NULL
+int(0)
+NULL
+int(1)
+string(4) "data"
+
+Warning: fscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
+int(-1)
+string(4) "data"
+NULL
+
+Warning: fscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
+int(-1)
+array(0) {
+}
+array(0) {
+}
+
+Warning: fscanf(): Bad scan conversion character "." in %s on line %d
+int(-1)
+array(0) {
+}
+array(0) {
+}
+bool(false)
+array(0) {
+}
+
+Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
+int(-1)
+Done
diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt
new file mode 100644
index 0000000..85c0ac4
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_error.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test fscanf() function: error conditions
+
+--FILE--
+<?php
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+echo "*** Testing fscanf() for error conditions ***\n";
+$file_path = dirname(__FILE__);
+
+$filename = "$file_path/fscanf_error.tmp";
+$file_handle = fopen($filename, 'w');
+if ($file_handle == false)
+ exit("Error:failed to open file $filename");
+fwrite($file_handle, "hello world");
+fclose($file_handle);
+
+// zero argument
+var_dump( fscanf() );
+
+// single argument
+$file_handle = fopen($filename, 'r');
+if ($file_handle == false)
+ exit("Error:failed to open file $filename");
+var_dump( fscanf($file_handle) );
+fclose($file_handle);
+
+// invalid file handle
+var_dump( fscanf($file_handle, "%s") );
+
+// number of formats in format strings not matching the no of variables
+$file_handle = fopen($filename, 'r');
+if ($file_handle == false)
+ exit("Error:failed to open file $filename");
+var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) );
+fclose($file_handle);
+
+// different invalid format strings
+$invalid_formats = array( $undefined_var, undefined_constant,
+ "%", "%h", "%.", "%d%m"
+ );
+
+
+// looping to use various invalid formats with fscanf()
+foreach($invalid_formats as $format) {
+ $file_handle = fopen($filename, 'r');
+ if ($file_handle == false)
+ exit("Error:failed to open file $filename");
+ var_dump( fscanf($file_handle, $format) );
+ fclose($file_handle);
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_error.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Testing fscanf() for error conditions ***
+
+Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fscanf(): %d is not a valid File-Handle resource in %s on line %d
+bool(false)
+
+Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
+int(-1)
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Use of undefined constant undefined_constant - assumed 'undefined_constant' in %s on line %d
+array(0) {
+}
+array(0) {
+}
+
+Warning: fscanf(): Bad scan conversion character " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character "." in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character "m" in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fscanf_variation1.phpt b/ext/standard/tests/file/fscanf_variation1.phpt
new file mode 100644
index 0000000..b0c41e5
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation1.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test fscanf() function: usage variations - return type without third argument
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* test fscanf() for its return type */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing fscanf(): for its return type without third argument ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation1.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+@fwrite($file_handle, "hello_world ");
+@fwrite($file_handle, 12345);
+fclose($file_handle);
+
+// open file for reading
+$file_handle = fopen($filename, "r");
+// capturing the return value from fscanf() called without third argument
+$return_value = fscanf($file_handle, "%s");
+var_dump( is_array($return_value), $return_value); // return type is an array
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation1.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Testing fscanf(): for its return type without third argument ***
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "hello_world"
+}
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation10.phpt b/ext/standard/tests/file/fscanf_variation10.phpt
new file mode 100644
index 0000000..a46c112
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation10.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test fscanf() function: usage variations - float formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different float format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different float format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation10.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$float_formats = array( "%f",
+ "%hf", "%lf", "%Lf",
+ " %f", "%f ", "% f",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different formats formats
+foreach($float_formats as $float_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$float_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation10.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different float format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation11.phpt b/ext/standard/tests/file/fscanf_variation11.phpt
new file mode 100644
index 0000000..27de2ae
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation11.phpt
@@ -0,0 +1,713 @@
+--TEST--
+Test fscanf() function: usage variations - float formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different float format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different float format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation11.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$float_formats = array( "%f",
+ "%hf", "%lf", "%Lf",
+ " %f", "%f ", "% f",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different float formats
+foreach($float_formats as $float_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$float_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation11.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different float format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation12.phpt b/ext/standard/tests/file/fscanf_variation12.phpt
new file mode 100644
index 0000000..33bfb67
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation12.phpt
@@ -0,0 +1,946 @@
+--TEST--
+Test fscanf() function: usage variations - float formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different float format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different float format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation12.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "% f", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different float formats
+foreach($float_formats as $float_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$float_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation12.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different float format types with strings ***
+
+-- iteration 1 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation13.phpt b/ext/standard/tests/file/fscanf_variation13.phpt
new file mode 100644
index 0000000..49525b4
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation13.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test fscanf() function: usage variations - float formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different float format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different float format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation13.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "% f", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different float formats
+foreach($float_formats as $float_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$float_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation13.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different float format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf_variation14.phpt
new file mode 100644
index 0000000..2b497c9
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation14.phpt
@@ -0,0 +1,1079 @@
+--TEST--
+Test fscanf() function: usage variations - string formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different strings using different string format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different string format types with different string ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation14.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid strings
+
+/* string created using Heredoc (<<<) */
+$heredoc_string = <<<EOT
+This is string defined
+using heredoc.
+EOT;
+/* heredoc string with only numerics */
+$heredoc_numeric_string = <<<EOT
+123456 3993
+4849 string
+EOT;
+/* null heardoc string */
+$heredoc_empty_string = <<<EOT
+EOT;
+$heredoc_null_string = <<<EOT
+NULL
+EOT;
+
+$valid_strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'true',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070",
+ "0x55F",
+ "055",
+ "@#$#$%%$^^$%^%^$^&",
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string,
+ $heredoc_null_string
+);
+
+// various string formats
+$string_formats = array( "%s",
+ "%hs", "%ls", "%Ls",
+ " %s", "%s ", "% s",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different string formats
+foreach($string_formats as $string_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$string_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation14.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different string format types with different string ***
+
+-- iteration 1 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(4) "stri"
+}
+array(1) {
+ [0]=>
+ string(4) "stri"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(4) "FALS"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(4) "0x55"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(4) "usin"
+}
+array(1) {
+ [0]=>
+ string(4) "1234"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(2) "\0"
+}
+array(1) {
+ [0]=>
+ string(4) "\060"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+NULL
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+NULL
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(5) "0x55F"
+}
+array(1) {
+ [0]=>
+ string(3) "055"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+array(1) {
+ [0]=>
+ string(5) "using"
+}
+array(1) {
+ [0]=>
+ string(6) "123456"
+}
+array(1) {
+ [0]=>
+ string(4) "4849"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation15.phpt b/ext/standard/tests/file/fscanf_variation15.phpt
new file mode 100644
index 0000000..76422db
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation15.phpt
@@ -0,0 +1,863 @@
+--TEST--
+Test fscanf() function: usage variations - string formats with float values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different string format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different string format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation15.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$string_formats = array( "%s",
+ "%hs", "%ls", "%Ls",
+ " %s", "%s ", "% s",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s");
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different string formats
+foreach($string_formats as $string_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$string_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation15.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different string format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "3435"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(4) "1000"
+}
+array(1) {
+ [0]=>
+ string(4) "-100"
+}
+array(1) {
+ [0]=>
+ string(4) "1000"
+}
+array(1) {
+ [0]=>
+ string(4) "-100"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(4) "1050"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation16.phpt b/ext/standard/tests/file/fscanf_variation16.phpt
new file mode 100644
index 0000000..8025767
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation16.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test fscanf() function: usage variations - string formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different string format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different string format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation16.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$string_formats = array( "%s",
+ "%hs", "%ls", "%Ls",
+ " %s", "%s ", "% s",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s");
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different string formats
+foreach($string_formats as $string_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$string_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation16.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different string format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(4) "Reso"
+}
+array(1) {
+ [0]=>
+ string(4) "Reso"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation17.phpt b/ext/standard/tests/file/fscanf_variation17.phpt
new file mode 100644
index 0000000..2db8871
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation17.phpt
@@ -0,0 +1,712 @@
+--TEST--
+Test fscanf() function: usage variations - string formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different string format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different string format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation17.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$string_formats = array( "%s",
+ "%hs", "%ls", "%Ls",
+ " %s", "%s ", "% s",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s");
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different string formats
+foreach($string_formats as $string_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$string_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation17.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different string format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation18.phpt b/ext/standard/tests/file/fscanf_variation18.phpt
new file mode 100644
index 0000000..71b7298
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation18.phpt
@@ -0,0 +1,1014 @@
+--TEST--
+Test fscanf() function: usage variations - string formats with integer values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan integer values using different string format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different string format types with integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation18.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of string type values
+
+$integer_values = array (
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+$string_formats = array( "%s",
+ "%hs", "%ls", "%Ls",
+ " %s", "%s ", "% s",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($integer_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different string formats
+foreach($string_formats as $string_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$string_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation18.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different string format types with integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation19.phpt b/ext/standard/tests/file/fscanf_variation19.phpt
new file mode 100644
index 0000000..08edc52
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation19.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test fscanf() function: usage variations - string formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different string format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different string format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation19.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$string_formats = array( "%s",
+ "%hs", "%ls", "%Ls",
+ " %s", "%s ", "% s",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different string formats
+foreach($string_formats as $string_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$string_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation19.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different string format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation2.phpt b/ext/standard/tests/file/fscanf_variation2.phpt
new file mode 100644
index 0000000..77ae474
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation2.phpt
@@ -0,0 +1,1008 @@
+--TEST--
+Test fscanf() function: usage variations - integer formats with integer values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different integer values using different interger format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different integer format types with different integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation2.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various integer formats
+$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d");
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_ints as $int_value) {
+ @fprintf($file_handle, $int_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($int_formats as $int_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation2.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different integer format types with different integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation20.phpt b/ext/standard/tests/file/fscanf_variation20.phpt
new file mode 100644
index 0000000..7ce609c
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation20.phpt
@@ -0,0 +1,1012 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with integer values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different integer values using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with different integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation20.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various char formats
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-bA-B@#$&]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_ints as $int_value) {
+ @fprintf($file_handle, $int_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation20.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with different integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation21.phpt b/ext/standard/tests/file/fscanf_variation21.phpt
new file mode 100644
index 0000000..51381ce
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation21.phpt
@@ -0,0 +1,863 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with float values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation21.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation21.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(4) "3435"
+}
+array(1) {
+ [0]=>
+ string(4) "2147"
+}
+array(1) {
+ [0]=>
+ string(4) "-214"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(4) "1000"
+}
+array(1) {
+ [0]=>
+ string(4) "-100"
+}
+array(1) {
+ [0]=>
+ string(4) "1000"
+}
+array(1) {
+ [0]=>
+ string(4) "-100"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(4) "1050"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ string(11) "-2147483649"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(4) "-0.1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ string(8) "-1000000"
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ string(11) "-1000000000"
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation22.phpt b/ext/standard/tests/file/fscanf_variation22.phpt
new file mode 100644
index 0000000..a380950
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation22.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation22.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation22.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+array(1) {
+ [0]=>
+ string(1) "R"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(4) "Reso"
+}
+array(1) {
+ [0]=>
+ string(4) "Reso"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+array(1) {
+ [0]=>
+ string(8) "Resource"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation23.phpt b/ext/standard/tests/file/fscanf_variation23.phpt
new file mode 100644
index 0000000..d536c28
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation23.phpt
@@ -0,0 +1,712 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation23.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation23.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+array(1) {
+ [0]=>
+ string(4) "Arra"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+array(1) {
+ [0]=>
+ string(5) "Array"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation24.phpt b/ext/standard/tests/file/fscanf_variation24.phpt
new file mode 100644
index 0000000..ddca007
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation24.phpt
@@ -0,0 +1,994 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation24.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation24.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with strings ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(1) "\"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "s"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "F"
+}
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+array(1) {
+ [0]=>
+ string(1) "T"
+}
+array(1) {
+ [0]=>
+ string(1) "N"
+}
+array(1) {
+ [0]=>
+ string(1) "n"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(4) "\x01"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(3) "\01"
+}
+array(1) {
+ [0]=>
+ string(4) "stri"
+}
+array(1) {
+ [0]=>
+ string(4) "stri"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+array(1) {
+ [0]=>
+ string(4) "FALS"
+}
+array(1) {
+ [0]=>
+ string(4) "fals"
+}
+array(1) {
+ [0]=>
+ string(4) "TRUE"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(4) "\x01"
+}
+array(1) {
+ [0]=>
+ string(1) ""
+}
+array(1) {
+ [0]=>
+ string(3) "\01"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(5) "false"
+}
+array(1) {
+ [0]=>
+ string(4) "TRUE"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+array(1) {
+ [0]=>
+ string(4) "true"
+}
+array(1) {
+ [0]=>
+ string(5) "FALSE"
+}
+array(1) {
+ [0]=>
+ string(5) "false"
+}
+array(1) {
+ [0]=>
+ string(4) "TRUE"
+}
+array(1) {
+ [0]=>
+ string(4) "NULL"
+}
+array(1) {
+ [0]=>
+ string(4) "null"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt
new file mode 100644
index 0000000..d874aba
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation25.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation25.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation25.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation26.phpt b/ext/standard/tests/file/fscanf_variation26.phpt
new file mode 100644
index 0000000..1a883f4
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation26.phpt
@@ -0,0 +1,356 @@
+--TEST--
+Test fscanf() function: usage variations - char formats with chars
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different chars using different char format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different char format types with chars ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation26.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of chars
+$char_types = array( 'a', "a", 67, -67, 99 );
+
+$char_formats = array( "%c",
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+
+$counter = 1;
+
+// writing to the file
+foreach($char_types as $char) {
+ @fprintf($file_handle, $char);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different char formats
+foreach($char_formats as $char_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$char_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation26.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different char format types with chars ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+array(1) {
+ [0]=>
+ string(1) "9"
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(2) "67"
+}
+array(1) {
+ [0]=>
+ string(3) "-67"
+}
+array(1) {
+ [0]=>
+ string(2) "99"
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(2) "67"
+}
+array(1) {
+ [0]=>
+ string(3) "-67"
+}
+array(1) {
+ [0]=>
+ string(2) "99"
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(2) "67"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "99"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation27.phpt b/ext/standard/tests/file/fscanf_variation27.phpt
new file mode 100644
index 0000000..7a691fc
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation27.phpt
@@ -0,0 +1,1013 @@
+--TEST--
+Test fscanf() function: usage variations - octal formats with integer values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different integer values using different octal format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different octal format types with different integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation27.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various octal formats
+$octal_formats = array( "%o",
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_ints as $int_value) {
+ @fprintf($file_handle, $int_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different octal formats
+foreach($octal_formats as $octal_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$octal_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation27.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different octal format types with different integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(2487)
+}
+array(1) {
+ [0]=>
+ int(319)
+}
+array(1) {
+ [0]=>
+ int(32)
+}
+array(1) {
+ [0]=>
+ int(168)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(3) "477"
+}
+array(1) {
+ [0]=>
+ string(2) "40"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation28.phpt b/ext/standard/tests/file/fscanf_variation28.phpt
new file mode 100644
index 0000000..97f7208
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation28.phpt
@@ -0,0 +1,863 @@
+--TEST--
+Test fscanf() function: usage variations - octal formats with float values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different octal format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different octal format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation28.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$octal_formats = array( "%o",
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different octal formats
+foreach($octal_formats as $octal_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$octal_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation28.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different octal format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(1127)
+}
+array(1) {
+ [0]=>
+ int(-140)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(512)
+}
+array(1) {
+ [0]=>
+ int(-64)
+}
+array(1) {
+ [0]=>
+ int(512)
+}
+array(1) {
+ [0]=>
+ int(-64)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(552)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(1821)
+}
+array(1) {
+ [0]=>
+ int(9020)
+}
+array(1) {
+ [0]=>
+ int(-9020)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(32768)
+}
+array(1) {
+ [0]=>
+ int(-262144)
+}
+array(1) {
+ [0]=>
+ int(16777216)
+}
+array(1) {
+ [0]=>
+ int(-134217728)
+}
+array(1) {
+ [0]=>
+ int(8)
+}
+array(1) {
+ [0]=>
+ int(282624)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(4) "3435"
+}
+array(1) {
+ [0]=>
+ string(5) "21474"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fscanf_variation29.phpt b/ext/standard/tests/file/fscanf_variation29.phpt
new file mode 100644
index 0000000..ce7083b
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation29.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test fscanf() function: usage variations - octal formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different octal format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different octal format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation29.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$octal_formats = array( "%o",
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different octal formats
+foreach($octal_formats as $octal_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$octal_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation29.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different octal format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation3.phpt b/ext/standard/tests/file/fscanf_variation3.phpt
new file mode 100644
index 0000000..8faff9d
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation3.phpt
@@ -0,0 +1,865 @@
+--TEST--
+Test fscanf() function: usage variations - integer formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different integer format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different integer format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation3.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d");
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($int_formats as $int_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation3.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different integer format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(3435)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(-214)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1000)
+}
+array(1) {
+ [0]=>
+ int(-100)
+}
+array(1) {
+ [0]=>
+ int(1000)
+}
+array(1) {
+ [0]=>
+ int(-100)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ int(-1000000)
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ int(-1000000000)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation30.phpt b/ext/standard/tests/file/fscanf_variation30.phpt
new file mode 100644
index 0000000..b4cb350
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation30.phpt
@@ -0,0 +1,713 @@
+--TEST--
+Test fscanf() function: usage variations - octal formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different octal format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different octal format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation30.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$octal_formats = array ( "%o",
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different octal formats
+foreach($octal_formats as $octal_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$octal_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation30.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different octal format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation31.phpt b/ext/standard/tests/file/fscanf_variation31.phpt
new file mode 100644
index 0000000..f6bc746
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation31.phpt
@@ -0,0 +1,946 @@
+--TEST--
+Test fscanf() function: usage variations - octal formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different octal format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different octal format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation31.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "% o", "\t%o", "\n%o", "%4o", "%30o", "%[0-9]", "%*o");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different octal formats
+foreach($octal_formats as $octal_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$octal_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation31.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different octal format types with strings ***
+
+-- iteration 1 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation32.phpt b/ext/standard/tests/file/fscanf_variation32.phpt
new file mode 100644
index 0000000..52e4540
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation32.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test fscanf() function: usage variations - octal formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different octal format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different octal format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation32.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$octal_formats = array( "%o",
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different octal formats
+foreach($octal_formats as $octal_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$octal_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation32.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different octal format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation33.phpt b/ext/standard/tests/file/fscanf_variation33.phpt
new file mode 100644
index 0000000..7ecff33
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation33.phpt
@@ -0,0 +1,1019 @@
+--TEST--
+Test fscanf() function: usage variations - hexa formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different integer values using different hexa format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different hexa format types with different integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation33.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various hexa formats
+$hexa_formats = array( "%x",
+ "%xx", "%lx", "%Lx",
+ " %x", "%x ", "% x",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_ints as $int_value) {
+ @fprintf($file_handle, $int_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different hexa formats
+foreach($hexa_formats as $hexa_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$hexa_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation33.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different hexa format types with different integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(18023)
+}
+array(1) {
+ [0]=>
+ int(18297)
+}
+array(1) {
+ [0]=>
+ int(16533)
+}
+array(1) {
+ [0]=>
+ int(592)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(131)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation34.phpt b/ext/standard/tests/file/fscanf_variation34.phpt
new file mode 100644
index 0000000..2acdc8b
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation34.phpt
@@ -0,0 +1,869 @@
+--TEST--
+Test fscanf() function: usage variations - hexa formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different hexa format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different hexa format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation34.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$hexa_formats = array( "%x",
+ "%hx", "%lx", "%Lx",
+ " %x", "%x ", "% x",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Za-z]", "%*x");
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different hexa formats
+foreach($hexa_formats as $hexa_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$hexa_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation34.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different hexa format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(13365)
+}
+array(1) {
+ [0]=>
+ int(8519)
+}
+array(1) {
+ [0]=>
+ int(-532)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(4096)
+}
+array(1) {
+ [0]=>
+ int(-256)
+}
+array(1) {
+ [0]=>
+ int(4096)
+}
+array(1) {
+ [0]=>
+ int(-256)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(4176)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1048576)
+}
+array(1) {
+ [0]=>
+ int(-16777216)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(-2147483648)
+}
+array(1) {
+ [0]=>
+ int(16)
+}
+array(1) {
+ [0]=>
+ int(17104896)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation35.phpt b/ext/standard/tests/file/fscanf_variation35.phpt
new file mode 100644
index 0000000..1f98bd8
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation35.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test fscanf() function: usage variations - hexa formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different hexa format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different hexa format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation35.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x");
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different hexa formats
+foreach($hexa_formats as $hexa_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$hexa_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation35.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different hexa format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation36.phpt b/ext/standard/tests/file/fscanf_variation36.phpt
new file mode 100644
index 0000000..44ff295
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation36.phpt
@@ -0,0 +1,708 @@
+--TEST--
+Test fscanf() function: usage variations - hexa formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different hexa format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different hexa format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation36.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x");
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different hexa formats
+foreach($hexa_formats as $hexa_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$hexa_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation36.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different hexa format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation37.phpt b/ext/standard/tests/file/fscanf_variation37.phpt
new file mode 100644
index 0000000..7ab302d
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation37.phpt
@@ -0,0 +1,946 @@
+--TEST--
+Test fscanf() function: usage variations - hexa formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different hexa format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different hexa format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation37.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different hexa formats
+foreach($hexa_formats as $hexa_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$hexa_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation37.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different hexa format types with strings ***
+
+-- iteration 1 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation38.phpt b/ext/standard/tests/file/fscanf_variation38.phpt
new file mode 100644
index 0000000..32a7f77
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation38.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test fscanf() function: usage variations - hexa formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different hexa format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different hexa format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation38.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different hexa formats
+foreach($hexa_formats as $hexa_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$hexa_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation38.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different hexa format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation39.phpt b/ext/standard/tests/file/fscanf_variation39.phpt
new file mode 100644
index 0000000..1b17015
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation39.phpt
@@ -0,0 +1,1014 @@
+--TEST--
+Test fscanf() function: usage variations - unsigned int formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different integer values using different unsigned int format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different unsigned int format types with different integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation39.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid integer values
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various unsigned int formats
+$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u");
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_ints as $int_value) {
+ @fprintf($file_handle, $int_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different unsigned int formats
+foreach($unsigned_formats as $unsigned_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$unsigned_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation39.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different unsigned int format types with different integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483640)
+}
+array(1) {
+ [0]=>
+ int(4667)
+}
+array(1) {
+ [0]=>
+ int(4779)
+}
+array(1) {
+ [0]=>
+ int(4095)
+}
+array(1) {
+ [0]=>
+ int(250)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(83)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation4.phpt b/ext/standard/tests/file/fscanf_variation4.phpt
new file mode 100644
index 0000000..0d9cd9d
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation4.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test fscanf() function: usage variations - integer formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different integer format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different integer format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation4.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// non-integer type of data
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d");
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($int_formats as $int_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation4.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different integer format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation40.phpt b/ext/standard/tests/file/fscanf_variation40.phpt
new file mode 100644
index 0000000..f3a0c96
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation40.phpt
@@ -0,0 +1,865 @@
+--TEST--
+Test fscanf() function: usage variations - unsigned formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different unsigned format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different unsigned format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation40.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u");
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different unsigned formats
+foreach($unsigned_formats as $unsigned_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$unsigned_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation40.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different unsigned format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ int(3435)
+}
+array(1) {
+ [0]=>
+ int(2147)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967082"
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1000)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967196"
+}
+array(1) {
+ [0]=>
+ int(1000)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967196"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ string(10) "4294967295"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(100000)
+}
+array(1) {
+ [0]=>
+ string(10) "4293967296"
+}
+array(1) {
+ [0]=>
+ int(100000000)
+}
+array(1) {
+ [0]=>
+ string(10) "3294967296"
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(1) {
+ [0]=>
+ int(1050000)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation41.phpt b/ext/standard/tests/file/fscanf_variation41.phpt
new file mode 100644
index 0000000..080ce98
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation41.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test fscanf() function: usage variations - unsigned formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different unsigned format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different unsigned format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation41.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u");
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different unsigned formats
+foreach($unsigned_formats as $unsigned_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$unsigned_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation41.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different unsigned format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation42.phpt b/ext/standard/tests/file/fscanf_variation42.phpt
new file mode 100644
index 0000000..978187c
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation42.phpt
@@ -0,0 +1,708 @@
+--TEST--
+Test fscanf() function: usage variations - unsigned formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different unsigned format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different unsigned format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation42.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u");
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different unsigned formats
+foreach($unsigned_formats as $unsigned_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$unsigned_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation42.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different unsigned format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation43.phpt b/ext/standard/tests/file/fscanf_variation43.phpt
new file mode 100644
index 0000000..8a0052f
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation43.phpt
@@ -0,0 +1,946 @@
+--TEST--
+Test fscanf() function: usage variations - unsigned formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different unsigned format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different unsigned format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation43.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different unsigned formats
+foreach($unsigned_formats as $unsigned_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$unsigned_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation43.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different unsigned format types with strings ***
+
+-- iteration 1 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation44.phpt b/ext/standard/tests/file/fscanf_variation44.phpt
new file mode 100644
index 0000000..0b30b61
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation44.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test fscanf() function: usage variations - unsigned formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different unsigned format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different unsigned format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation44.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different unsigned formats
+foreach($unsigned_formats as $unsigned_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$unsigned_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation44.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different unsigned format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation45.phpt b/ext/standard/tests/file/fscanf_variation45.phpt
new file mode 100644
index 0000000..7db0cc9
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation45.phpt
@@ -0,0 +1,1008 @@
+--TEST--
+Test fscanf() function: usage variations - scientific formats with integer values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different integer values using different scientific format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different scientific format types with different integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation45.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various scientific formats
+$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-1]", "%*e");
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_ints as $int_value) {
+ @fprintf($file_handle, $int_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different scientific formats
+foreach($scientific_formats as $scientific_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$scientific_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation45.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different scientific format types with different integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation46.phpt b/ext/standard/tests/file/fscanf_variation46.phpt
new file mode 100644
index 0000000..7145c86
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation46.phpt
@@ -0,0 +1,859 @@
+--TEST--
+Test fscanf() function: usage variations - scientific formats with float values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan float values using different scientific format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different scientific format types with float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation46.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$float_values = array (
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e");
+
+$counter = 1;
+
+// writing to the file
+foreach($float_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different scientific formats
+foreach($scientific_formats as $scientific_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$scientific_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation46.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different scientific format types with float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(3435)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1000)
+}
+array(1) {
+ [0]=>
+ float(-100)
+}
+array(1) {
+ [0]=>
+ float(1000)
+}
+array(1) {
+ [0]=>
+ float(-100)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-1000000)
+}
+array(1) {
+ [0]=>
+ float(100000000)
+}
+array(1) {
+ [0]=>
+ float(-1000000000)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(9) "100000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation47.phpt b/ext/standard/tests/file/fscanf_variation47.phpt
new file mode 100644
index 0000000..7010571
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation47.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test fscanf() function: usage variations - scientific formats with resource
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan resource type using different scientific format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different scientific format types with resource ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation47.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e");
+
+$counter = 1;
+
+// writing to the file
+foreach($resource_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different scientific formats
+foreach($scientific_formats as $scientific_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$scientific_format) );
+ }
+ $counter++;
+}
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation47.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different scientific format types with resource ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation48.phpt b/ext/standard/tests/file/fscanf_variation48.phpt
new file mode 100644
index 0000000..5b61e5b
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation48.phpt
@@ -0,0 +1,707 @@
+--TEST--
+Test fscanf() function: usage variations - scientific formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different scientific format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different scientific format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation48.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e");
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different scientific formats
+foreach($scientific_formats as $scientific_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$scientific_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation48.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different scientific format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fscanf_variation49.phpt b/ext/standard/tests/file/fscanf_variation49.phpt
new file mode 100644
index 0000000..4e314fb
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation49.phpt
@@ -0,0 +1,946 @@
+--TEST--
+Test fscanf() function: usage variations - scientific formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different scientific format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different scientific format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation49.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different scientific formats
+foreach($scientific_formats as $scientific_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$scientific_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation49.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different scientific format types with strings ***
+
+-- iteration 1 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation5.phpt b/ext/standard/tests/file/fscanf_variation5.phpt
new file mode 100644
index 0000000..750e604
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation5.phpt
@@ -0,0 +1,708 @@
+--TEST--
+Test fscanf() function: usage variations - integer formats with arrays
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan arrays using different integer format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different integer format types with arrays ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation5.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array types
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d");
+
+$counter = 1;
+
+// writing to the file
+foreach($array_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($int_formats as $int_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation5.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different integer format types with arrays ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation50.phpt b/ext/standard/tests/file/fscanf_variation50.phpt
new file mode 100644
index 0000000..e46dbdb
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation50.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test fscanf() function: usage variations - scientific formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different scientific format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different scientific format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation50.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different scientific formats
+foreach($scientific_formats as $scientific_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$scientific_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation50.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different scientific format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+array(1) {
+ [0]=>
+ float(1)
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation51.phpt b/ext/standard/tests/file/fscanf_variation51.phpt
new file mode 100644
index 0000000..0f5ab5a
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation51.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test fscanf() function: usage variations - file opened in write only mode
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan a file for read when file is opened inwrite only mode */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): to read from a file opened in write only mode ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation51.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+//writing data to the file
+@fwrite($file_handle,"sample text\n");
+
+//closing the file
+fclose($file_handle);
+
+// various formats
+$formats = array( "%d", "%f", "%e", "%u", " %s", "%x", "%o");
+
+$counter = 1;
+
+// various write only modes
+$modes = array("w", "wb", "wt",
+ "a", "ab", "at",
+ "x", "xb", "xt"
+ );
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($modes as $mode) {
+
+ $file_handle = fopen($filename, $mode);
+ if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+ }
+ echo "\n-- iteration $counter --\n";
+
+ foreach($formats as $format) {
+ var_dump( fscanf($file_handle,$format) );
+ rewind($file_handle);
+ }
+ $counter++;
+ fclose($file_handle);
+ unlink($filename);
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation51.tmp";
+if(file_exists($filename)) {
+ unlink($filename);
+}
+?>
+--EXPECT--
+*** Test fscanf(): to read from a file opened in write only mode ***
+
+-- 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(false)
+
+-- iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- 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(false)
+
+-- iteration 8 --
+bool(false)
+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)
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation52.phpt b/ext/standard/tests/file/fscanf_variation52.phpt
new file mode 100644
index 0000000..bf82ab8
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation52.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test fscanf() function: usage variations - empty file
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan an empty file */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): to read an empty file ***\n";
+
+// various formats
+$formats = array( "%d", "%f", "%e", "%u", " %s", "%x", "%o");
+
+$counter = 1;
+
+// various read modes
+$modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w+", "w+b", "w+t",
+ "a+", "a+b", "a+t"
+ );
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($modes as $mode) {
+
+ // create an empty file
+ $filename = "$file_path/fscanf_variation52.tmp";
+ $file_handle = fopen($filename, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $filename");
+ //closing the file
+ fclose($file_handle);
+
+ // opening file in $mode mode
+ $file_handle = fopen($filename, $mode);
+ if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+ }
+ echo "\n-- iteration $counter --\n";
+
+ foreach($formats as $format) {
+ var_dump( fscanf($file_handle,$format) );
+ rewind($file_handle);
+ }
+ $counter++;
+ fclose($file_handle);
+ unlink($filename);
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation52.tmp";
+if(file_exists($filename)) {
+ unlink($filename);
+}
+?>
+--EXPECT--
+*** Test fscanf(): to read an empty file ***
+
+-- 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(false)
+
+-- iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- 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(false)
+
+-- iteration 8 --
+bool(false)
+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)
+bool(false)
+
+-- iteration 10 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 11 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 12 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation53.phpt b/ext/standard/tests/file/fscanf_variation53.phpt
new file mode 100644
index 0000000..b65bccf
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation53.phpt
@@ -0,0 +1,229 @@
+--TEST--
+Test fscanf() function: usage variations - file pointer pointing to EOF
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to read a file when file pointer is pointing to EOF */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): to read a file when file pointer is pointing to EOF ***\n";
+
+// various formats
+$formats = array( "%d", "%f", "%e", "%u", " %s", "%x", "%o");
+
+$counter = 1;
+
+// various read modes
+$modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w+", "w+b", "w+t",
+ "a+", "a+b", "a+t"
+ );
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($modes as $mode) {
+
+ // create an empty file
+ $filename = "$file_path/fscanf_variation52.tmp";
+ $file_handle = fopen($filename, "w");
+ if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+ //writing data to the file
+ @fwrite($file_handle, "Sample text\n");
+
+ // writing a blank line
+ @fwrite($file_handle, "\n");
+
+ //closing the file
+ fclose($file_handle);
+
+ // opening file in $mode mode
+ $file_handle = fopen($filename, $mode);
+ if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+ }
+ echo "\n-- iteration $counter --\n";
+
+ // current location
+ var_dump( ftell($file_handle) );
+
+ // set the file pointer to eof
+ var_dump( fseek($file_handle, 0, SEEK_END) );
+
+ // current location
+ var_dump( ftell($file_handle) );
+
+ foreach($formats as $format) {
+ var_dump( fscanf($file_handle,$format) );
+ }
+ $counter++;
+ fclose($file_handle);
+ unlink($filename);
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation53.tmp";
+if(file_exists($filename)) {
+ unlink($filename);
+}
+?>
+--EXPECT--
+*** Test fscanf(): to read a file when file pointer is pointing to EOF ***
+
+-- iteration 1 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 2 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 3 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 4 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 5 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 6 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 7 --
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 8 --
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 9 --
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 10 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 11 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- iteration 12 --
+int(0)
+int(0)
+int(13)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation54.phpt b/ext/standard/tests/file/fscanf_variation54.phpt
new file mode 100644
index 0000000..0937e5b
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation54.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Test fscanf() function: usage variations - objects
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan a file to read objects */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): to read objects from a file ***\n";
+
+// declare a class
+class foo
+{
+ public $var1 = 1;
+ public $var2 = 2;
+ function __toString() {
+ return "Object";
+ }
+}
+
+// create an object
+$obj = new foo(); //creating new object
+
+// create a file
+$filename = "$file_path/fscanf_variation54.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+//writing object to the file
+fwrite($file_handle, $obj);
+
+//closing the file
+fclose($file_handle);
+
+// various formats
+$formats = array( "%d", "%f", "%e", "%u", " %s", "%x", "%o");
+
+$counter = 1;
+
+// opening file for read
+$file_handle = fopen($filename, "r");
+ if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+ }
+echo "\n-- iteration $counter --\n";
+
+foreach($formats as $format) {
+ var_dump( fscanf($file_handle,$format) );
+ rewind($file_handle);
+}
+
+fclose($file_handle);
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation54.tmp";
+unlink($filename);
+?>
+--EXPECT--
+*** Test fscanf(): to read objects from a file ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(6) "Object"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation55.phpt b/ext/standard/tests/file/fscanf_variation55.phpt
new file mode 100644
index 0000000..1777f79
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation55.phpt
@@ -0,0 +1,1691 @@
+--TEST--
+Test fscanf() function: usage variations - tracking file pointer while reading
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/*
+ Test fscanf() to scan data using different format types and also
+ tracking the file pointer movement along with reading
+ */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): tracking file pointer along with reading data from file ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation55.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid data
+$valid_data = array(
+ 12345, // integer value
+ -12345,
+ 123.45, // float value
+ -123.45,
+ 0x123B, // hexadecimal value
+ 0x12ab,
+ 0123, // octal value
+ -0123,
+ "abcde", // string
+ 'abcde',
+ 10e3, // exponential value
+ 10e-3
+);
+// various formats
+$int_formats = array( "%d", "%f", "%s", "%o", "%x", "%u", "%c", "%e");
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_data as $data) {
+ @fprintf($file_handle, $data);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+$modes = array("r", "rb", "rt");
+
+foreach($modes as $mode) {
+
+ echo "\n*** File opened in $mode mode ***\n";
+ // opening the file for reading
+ $file_handle = fopen($filename, $mode);
+ if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+ }
+
+ $counter = 1;
+ // reading different data from file using different formats
+ foreach($int_formats as $int_format) {
+ // current file pointer position
+ var_dump( ftell($file_handle) );
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ // current file pointer position after rewind operation
+ var_dump( ftell($file_handle) );
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( ftell($file_handle) );
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+ } // end of inner for loop
+} // end of outer for loop
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation55.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): tracking file pointer along with reading data from file ***
+
+*** File opened in r mode ***
+int(0)
+int(0)
+
+-- iteration 1 --
+int(0)
+array(1) {
+ [0]=>
+ int(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(123)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-123)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ int(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 2 --
+int(0)
+array(1) {
+ [0]=>
+ float(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ float(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ float(123.45)
+}
+int(20)
+array(1) {
+ [0]=>
+ float(-123.45)
+}
+int(28)
+array(1) {
+ [0]=>
+ float(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ float(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ float(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ float(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ float(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ float(0.01)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 3 --
+int(0)
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+int(6)
+array(1) {
+ [0]=>
+ string(6) "-12345"
+}
+int(13)
+array(1) {
+ [0]=>
+ string(6) "123.45"
+}
+int(20)
+array(1) {
+ [0]=>
+ string(7) "-123.45"
+}
+int(28)
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+int(33)
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+int(38)
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+int(41)
+array(1) {
+ [0]=>
+ string(3) "-83"
+}
+int(45)
+array(1) {
+ [0]=>
+ string(5) "abcde"
+}
+int(51)
+array(1) {
+ [0]=>
+ string(5) "abcde"
+}
+int(57)
+array(1) {
+ [0]=>
+ string(5) "10000"
+}
+int(63)
+array(1) {
+ [0]=>
+ string(4) "0.01"
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 4 --
+int(0)
+array(1) {
+ [0]=>
+ int(5349)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-5349)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-83)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(2487)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(319)
+}
+int(38)
+array(1) {
+ [0]=>
+ NULL
+}
+int(41)
+array(1) {
+ [0]=>
+ NULL
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(4096)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 5 --
+int(0)
+array(1) {
+ [0]=>
+ int(74565)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-74565)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(291)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-291)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(18023)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(18297)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(131)
+}
+int(41)
+array(1) {
+ [0]=>
+ int(-131)
+}
+int(45)
+array(1) {
+ [0]=>
+ int(703710)
+}
+int(51)
+array(1) {
+ [0]=>
+ int(703710)
+}
+int(57)
+array(1) {
+ [0]=>
+ int(65536)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 6 --
+int(0)
+array(1) {
+ [0]=>
+ int(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ string(10) "4294954951"
+}
+int(13)
+array(1) {
+ [0]=>
+ int(123)
+}
+int(20)
+array(1) {
+ [0]=>
+ string(10) "4294967173"
+}
+int(28)
+array(1) {
+ [0]=>
+ int(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ string(10) "4294967213"
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 7 --
+int(0)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(6)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(13)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(20)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(28)
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+int(33)
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+int(38)
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+int(41)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(45)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(51)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(57)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(63)
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 8 --
+int(0)
+array(1) {
+ [0]=>
+ float(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ float(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ float(123.45)
+}
+int(20)
+array(1) {
+ [0]=>
+ float(-123.45)
+}
+int(28)
+array(1) {
+ [0]=>
+ float(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ float(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ float(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ float(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ float(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ float(0.01)
+}
+int(68)
+bool(false)
+
+*** File opened in rb mode ***
+int(0)
+int(0)
+
+-- iteration 1 --
+int(0)
+array(1) {
+ [0]=>
+ int(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(123)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-123)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ int(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 2 --
+int(0)
+array(1) {
+ [0]=>
+ float(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ float(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ float(123.45)
+}
+int(20)
+array(1) {
+ [0]=>
+ float(-123.45)
+}
+int(28)
+array(1) {
+ [0]=>
+ float(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ float(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ float(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ float(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ float(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ float(0.01)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 3 --
+int(0)
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+int(6)
+array(1) {
+ [0]=>
+ string(6) "-12345"
+}
+int(13)
+array(1) {
+ [0]=>
+ string(6) "123.45"
+}
+int(20)
+array(1) {
+ [0]=>
+ string(7) "-123.45"
+}
+int(28)
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+int(33)
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+int(38)
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+int(41)
+array(1) {
+ [0]=>
+ string(3) "-83"
+}
+int(45)
+array(1) {
+ [0]=>
+ string(5) "abcde"
+}
+int(51)
+array(1) {
+ [0]=>
+ string(5) "abcde"
+}
+int(57)
+array(1) {
+ [0]=>
+ string(5) "10000"
+}
+int(63)
+array(1) {
+ [0]=>
+ string(4) "0.01"
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 4 --
+int(0)
+array(1) {
+ [0]=>
+ int(5349)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-5349)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-83)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(2487)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(319)
+}
+int(38)
+array(1) {
+ [0]=>
+ NULL
+}
+int(41)
+array(1) {
+ [0]=>
+ NULL
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(4096)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 5 --
+int(0)
+array(1) {
+ [0]=>
+ int(74565)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-74565)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(291)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-291)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(18023)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(18297)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(131)
+}
+int(41)
+array(1) {
+ [0]=>
+ int(-131)
+}
+int(45)
+array(1) {
+ [0]=>
+ int(703710)
+}
+int(51)
+array(1) {
+ [0]=>
+ int(703710)
+}
+int(57)
+array(1) {
+ [0]=>
+ int(65536)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 6 --
+int(0)
+array(1) {
+ [0]=>
+ int(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ string(10) "4294954951"
+}
+int(13)
+array(1) {
+ [0]=>
+ int(123)
+}
+int(20)
+array(1) {
+ [0]=>
+ string(10) "4294967173"
+}
+int(28)
+array(1) {
+ [0]=>
+ int(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ string(10) "4294967213"
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 7 --
+int(0)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(6)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(13)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(20)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(28)
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+int(33)
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+int(38)
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+int(41)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(45)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(51)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(57)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(63)
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 8 --
+int(0)
+array(1) {
+ [0]=>
+ float(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ float(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ float(123.45)
+}
+int(20)
+array(1) {
+ [0]=>
+ float(-123.45)
+}
+int(28)
+array(1) {
+ [0]=>
+ float(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ float(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ float(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ float(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ float(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ float(0.01)
+}
+int(68)
+bool(false)
+
+*** File opened in rt mode ***
+int(0)
+int(0)
+
+-- iteration 1 --
+int(0)
+array(1) {
+ [0]=>
+ int(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(123)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-123)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ int(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 2 --
+int(0)
+array(1) {
+ [0]=>
+ float(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ float(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ float(123.45)
+}
+int(20)
+array(1) {
+ [0]=>
+ float(-123.45)
+}
+int(28)
+array(1) {
+ [0]=>
+ float(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ float(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ float(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ float(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ float(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ float(0.01)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 3 --
+int(0)
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+int(6)
+array(1) {
+ [0]=>
+ string(6) "-12345"
+}
+int(13)
+array(1) {
+ [0]=>
+ string(6) "123.45"
+}
+int(20)
+array(1) {
+ [0]=>
+ string(7) "-123.45"
+}
+int(28)
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+int(33)
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+int(38)
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+int(41)
+array(1) {
+ [0]=>
+ string(3) "-83"
+}
+int(45)
+array(1) {
+ [0]=>
+ string(5) "abcde"
+}
+int(51)
+array(1) {
+ [0]=>
+ string(5) "abcde"
+}
+int(57)
+array(1) {
+ [0]=>
+ string(5) "10000"
+}
+int(63)
+array(1) {
+ [0]=>
+ string(4) "0.01"
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 4 --
+int(0)
+array(1) {
+ [0]=>
+ int(5349)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-5349)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-83)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(2487)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(319)
+}
+int(38)
+array(1) {
+ [0]=>
+ NULL
+}
+int(41)
+array(1) {
+ [0]=>
+ NULL
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(4096)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 5 --
+int(0)
+array(1) {
+ [0]=>
+ int(74565)
+}
+int(6)
+array(1) {
+ [0]=>
+ int(-74565)
+}
+int(13)
+array(1) {
+ [0]=>
+ int(291)
+}
+int(20)
+array(1) {
+ [0]=>
+ int(-291)
+}
+int(28)
+array(1) {
+ [0]=>
+ int(18023)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(18297)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(131)
+}
+int(41)
+array(1) {
+ [0]=>
+ int(-131)
+}
+int(45)
+array(1) {
+ [0]=>
+ int(703710)
+}
+int(51)
+array(1) {
+ [0]=>
+ int(703710)
+}
+int(57)
+array(1) {
+ [0]=>
+ int(65536)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 6 --
+int(0)
+array(1) {
+ [0]=>
+ int(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ string(10) "4294954951"
+}
+int(13)
+array(1) {
+ [0]=>
+ int(123)
+}
+int(20)
+array(1) {
+ [0]=>
+ string(10) "4294967173"
+}
+int(28)
+array(1) {
+ [0]=>
+ int(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ int(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ int(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ string(10) "4294967213"
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ int(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 7 --
+int(0)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(6)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(13)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(20)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(28)
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+int(33)
+array(1) {
+ [0]=>
+ string(1) "4"
+}
+int(38)
+array(1) {
+ [0]=>
+ string(1) "8"
+}
+int(41)
+array(1) {
+ [0]=>
+ string(1) "-"
+}
+int(45)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(51)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(57)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+int(63)
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+int(68)
+bool(false)
+int(68)
+int(0)
+
+-- iteration 8 --
+int(0)
+array(1) {
+ [0]=>
+ float(12345)
+}
+int(6)
+array(1) {
+ [0]=>
+ float(-12345)
+}
+int(13)
+array(1) {
+ [0]=>
+ float(123.45)
+}
+int(20)
+array(1) {
+ [0]=>
+ float(-123.45)
+}
+int(28)
+array(1) {
+ [0]=>
+ float(4667)
+}
+int(33)
+array(1) {
+ [0]=>
+ float(4779)
+}
+int(38)
+array(1) {
+ [0]=>
+ float(83)
+}
+int(41)
+array(1) {
+ [0]=>
+ float(-83)
+}
+int(45)
+array(1) {
+ [0]=>
+ NULL
+}
+int(51)
+array(1) {
+ [0]=>
+ NULL
+}
+int(57)
+array(1) {
+ [0]=>
+ float(10000)
+}
+int(63)
+array(1) {
+ [0]=>
+ float(0.01)
+}
+int(68)
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation6.phpt b/ext/standard/tests/file/fscanf_variation6.phpt
new file mode 100644
index 0000000..74446f0
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation6.phpt
@@ -0,0 +1,946 @@
+--TEST--
+Test fscanf() function: usage variations - integer formats with strings
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan strings using different integer format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different integer format types with strings ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation6.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of strings
+$strings = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d");
+
+$counter = 1;
+
+// writing to the file
+foreach($strings as $string) {
+ @fprintf($file_handle, $string);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($int_formats as $int_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation6.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different integer format types with strings ***
+
+-- iteration 1 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 2 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 3 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 4 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 5 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 6 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 9 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 10 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 11 --
+NULL
+NULL
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+NULL
+NULL
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation7.phpt b/ext/standard/tests/file/fscanf_variation7.phpt
new file mode 100644
index 0000000..33354e7
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation7.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test fscanf() function: usage variations - integer formats with boolean
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan boolean data using different integer format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different integer format types with boolean data ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation7.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of boolean types
+$bool_types = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d");
+
+$counter = 1;
+
+// writing to the file
+foreach($bool_types as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different integer formats
+foreach($int_formats as $int_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$int_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation7.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different integer format types with boolean data ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+array(1) {
+ [0]=>
+ int(1)
+}
+NULL
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+NULL
+array(0) {
+}
+NULL
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation8.phpt b/ext/standard/tests/file/fscanf_variation8.phpt
new file mode 100644
index 0000000..b1f5f4e
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation8.phpt
@@ -0,0 +1,1614 @@
+--TEST--
+Test fscanf() function: usage variations - float formats with float values
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan different float values using different format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different float format types with different float values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation8.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// different valid float vlaues
+$valid_floats = array(
+-2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+
+// various float formats
+$float_formats = array( "%f",
+ "%hf", "%lf", "%Lf",
+ " %f", "%f ", "% f",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f",
+ );
+
+$counter = 1;
+
+// writing to the file
+foreach($valid_floats as $float_value) {
+ @fprintf($file_handle, $float_value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different float formats
+foreach($float_formats as $float_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$float_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation8.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different float format types with different float values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(3435)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050)
+}
+array(1) {
+ [0]=>
+ float(1000)
+}
+array(1) {
+ [0]=>
+ float(-100)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(1000)
+}
+array(1) {
+ [0]=>
+ float(-100)
+}
+array(1) {
+ [0]=>
+ float(1000)
+}
+array(1) {
+ [0]=>
+ float(-100)
+}
+array(1) {
+ [0]=>
+ float(1000)
+}
+array(1) {
+ [0]=>
+ float(-100)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(5000)
+}
+array(1) {
+ [0]=>
+ float(-500)
+}
+array(1) {
+ [0]=>
+ float(6)
+}
+array(1) {
+ [0]=>
+ float(-6)
+}
+array(1) {
+ [0]=>
+ float(5)
+}
+array(1) {
+ [0]=>
+ float(-5)
+}
+array(1) {
+ [0]=>
+ float(3.4)
+}
+array(1) {
+ [0]=>
+ float(-3.4)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(34359738369)
+}
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+array(1) {
+ [0]=>
+ float(-2147483649)
+}
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(-0.1)
+}
+array(1) {
+ [0]=>
+ float(10)
+}
+array(1) {
+ [0]=>
+ float(1050000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(100000)
+}
+array(1) {
+ [0]=>
+ float(-100000)
+}
+array(1) {
+ [0]=>
+ float(1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(-1.0E-5)
+}
+array(1) {
+ [0]=>
+ float(5000000)
+}
+array(1) {
+ [0]=>
+ float(-5000000)
+}
+array(1) {
+ [0]=>
+ float(6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(-6.0E-20)
+}
+array(1) {
+ [0]=>
+ float(5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(-5.0E+42)
+}
+array(1) {
+ [0]=>
+ float(3.4E-33)
+}
+array(1) {
+ [0]=>
+ float(-3.4E-33)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483648"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(11) "34359738369"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483649"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+array(1) {
+ [0]=>
+ string(7) "1050000"
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(6) "100000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(7) "5000000"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "6"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "5"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(1) "3"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fscanf_variation9.phpt b/ext/standard/tests/file/fscanf_variation9.phpt
new file mode 100644
index 0000000..f3551f0
--- /dev/null
+++ b/ext/standard/tests/file/fscanf_variation9.phpt
@@ -0,0 +1,1015 @@
+--TEST--
+Test fscanf() function: usage variations - float formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/*
+ Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] );
+ Description: Parses input from a file according to a format
+*/
+
+/* Test fscanf() to scan integer values using different float format types */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test fscanf(): different float format types with integer values ***\n";
+
+// create a file
+$filename = "$file_path/fscanf_variation9.tmp";
+$file_handle = fopen($filename, "w");
+if($file_handle == false)
+ exit("Error:failed to open file $filename");
+
+// array of float type values
+
+$integer_values = array (
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "% f", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f");
+
+$counter = 1;
+
+// writing to the file
+foreach($integer_values as $value) {
+ @fprintf($file_handle, $value);
+ @fprintf($file_handle, "\n");
+}
+// closing the file
+fclose($file_handle);
+
+// opening the file for reading
+$file_handle = fopen($filename, "r");
+if($file_handle == false) {
+ exit("Error:failed to open file $filename");
+}
+
+$counter = 1;
+// reading the values from file using different float formats
+foreach($float_formats as $float_format) {
+ // rewind the file so that for every foreach iteration the file pointer starts from bof
+ rewind($file_handle);
+ echo "\n-- iteration $counter --\n";
+ while( !feof($file_handle) ) {
+ var_dump( fscanf($file_handle,$float_format) );
+ }
+ $counter++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$filename = "$file_path/fscanf_variation9.tmp";
+unlink($filename);
+?>
+--EXPECTF--
+*** Test fscanf(): different float format types with integer values ***
+
+-- iteration 1 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 2 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 3 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 4 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 5 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 6 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 7 --
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+
+Warning: fscanf(): Bad scan conversion character " " in %s on line %d
+NULL
+bool(false)
+
+-- iteration 8 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 9 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 10 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-214)
+}
+array(1) {
+ [0]=>
+ float(2147)
+}
+bool(false)
+
+-- iteration 11 --
+array(1) {
+ [0]=>
+ float(0)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(-2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483640)
+}
+array(1) {
+ [0]=>
+ float(4667)
+}
+array(1) {
+ [0]=>
+ float(4779)
+}
+array(1) {
+ [0]=>
+ float(4095)
+}
+array(1) {
+ [0]=>
+ float(250)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+array(1) {
+ [0]=>
+ float(83)
+}
+array(1) {
+ [0]=>
+ float(1)
+}
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+array(1) {
+ [0]=>
+ float(2147483647)
+}
+bool(false)
+
+-- iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483640"
+}
+array(1) {
+ [0]=>
+ string(4) "4667"
+}
+array(1) {
+ [0]=>
+ string(4) "4779"
+}
+array(1) {
+ [0]=>
+ string(4) "4095"
+}
+array(1) {
+ [0]=>
+ string(3) "250"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+array(1) {
+ [0]=>
+ string(2) "83"
+}
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+bool(false)
+
+-- iteration 13 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/fseek_dir_basic.phpt b/ext/standard/tests/file/fseek_dir_basic.phpt
new file mode 100644
index 0000000..cde0bf2
--- /dev/null
+++ b/ext/standard/tests/file/fseek_dir_basic.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Testing fseek() on a directory stream
+--FILE--
+<?php
+
+// include the file.inc for Function: function create_files()
+require(dirname(__FILE__) . '/file.inc');
+
+$path = dirname(__FILE__) . '/fseek_dir_basic';
+mkdir($path);
+create_files($path, 3);
+
+echo "call readdir():\n";
+var_dump($dh = opendir($path));
+$files = array();
+while( FALSE !== ($files[] = readdir($dh)) ) {}
+sort($files);
+var_dump($files);
+$files = array();
+
+echo "\ncall fseek() on directory resource:\n";
+var_dump(fseek($dh, 20));
+
+echo "call readdir():\n";
+while( FALSE !== ($files[] = readdir($dh)) ) {}
+sort($files);
+var_dump($files);
+$files = array();
+
+echo "\ncall fseek() with different arguments on directory resource:\n";
+var_dump(fseek($dh, 20, SEEK_END));
+
+echo "call readdir():\n";
+while( FALSE !== ($files[] = readdir($dh)) ) {}
+sort($files);
+var_dump($files);
+
+delete_files($path, 3);
+closedir($dh);
+var_dump(rmdir($path));
+
+?>
+--EXPECTF--
+call readdir():
+resource(%d) of type (stream)
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "."
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(9) "file1.tmp"
+ [4]=>
+ string(9) "file2.tmp"
+ [5]=>
+ string(9) "file3.tmp"
+}
+
+call fseek() on directory resource:
+int(0)
+call readdir():
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "."
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(9) "file1.tmp"
+ [4]=>
+ string(9) "file2.tmp"
+ [5]=>
+ string(9) "file3.tmp"
+}
+
+call fseek() with different arguments on directory resource:
+int(0)
+call readdir():
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "."
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(9) "file1.tmp"
+ [4]=>
+ string(9) "file2.tmp"
+ [5]=>
+ string(9) "file3.tmp"
+}
+bool(true)
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic1.phpt
new file mode 100644
index 0000000..a9a54ab
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_basic1.phpt
@@ -0,0 +1,453 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : Basic functionality - all r and a modes
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions on all read and append modes */
+echo "*** Testing fseek(), ftell(), rewind() : basic operations ***\n";
+$file_modes = array( "r","rb","rt","r+","r+b","r+t",
+ "a","ab","at","a+","a+b","a+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$whence_set = array(SEEK_SET,SEEK_CUR,SEEK_END);
+$whence_string = array("SEEK_SET", "SEEK_CUR", "SEEK_END");
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_basic1.tmp"; // this is name of the file created by create_files()
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 512, "w", "fseek_ftell_rewind_basic"
+ ,1,"bytes",".tmp"); //create a file with 512 bytes size
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ // set the file pointer to 0
+ var_dump( rewind($file_handle) ); // Confirm file pointer moves correctly
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+
+ foreach($whence_set as $whence){
+ echo "-- Testing fseek() with whence = $whence_string[$whence] --\n";
+ var_dump( fseek($file_handle,10,$whence) ); //expecting int(0)
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of whence loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_modes loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : basic operations ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode r --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode rb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode rt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode ab --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode at --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode r --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode rb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode rt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode ab --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode at --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt
new file mode 100644
index 0000000..18ecf9a
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt
@@ -0,0 +1,464 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : basic functionality - all w and x modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only valid for Windows");
+?>
+
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions on all write and create with write modes */
+
+echo "*** Testing fseek(), ftell(), rewind() : basic operations ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+
+$file_content_types = array("text_with_new_line","alphanumeric");
+
+$whence_set = array(SEEK_SET,SEEK_CUR,SEEK_END);
+$whence_string = array("SEEK_SET", "SEEK_CUR", "SEEK_END");
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_basic2.tmp"; // this is name of the file created by create_files()
+
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+
+ // set file pointer to 0
+ var_dump( rewind($file_handle) ); // set to begining of file
+ var_dump( ftell($file_handle) );
+
+ foreach($whence_set as $whence){
+ echo "-- Testing fseek() with whence = $whence_string[$whence] --\n";
+ var_dump( fseek($file_handle, 10, $whence) ); //expecting int(0)
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of whence loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of File content type loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : basic operations ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(579)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(579)
+bool(false)
+int(569)
+-- File opened in mode x --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(579)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(579)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt
new file mode 100644
index 0000000..8660094
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt
@@ -0,0 +1,463 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : basic functionality - all w and x modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions on all write and create with write modes */
+
+echo "*** Testing fseek(), ftell(), rewind() : basic operations ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+
+$file_content_types = array("text_with_new_line","alphanumeric");
+
+$whence_set = array(SEEK_SET,SEEK_CUR,SEEK_END);
+$whence_string = array("SEEK_SET", "SEEK_CUR", "SEEK_END");
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_basic2.tmp"; // this is name of the file created by create_files()
+
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+
+ // set file pointer to 0
+ var_dump( rewind($file_handle) ); // set to begining of file
+ var_dump( ftell($file_handle) );
+
+ foreach($whence_set as $whence){
+ echo "-- Testing fseek() with whence = $whence_string[$whence] --\n";
+ var_dump( fseek($file_handle, 10, $whence) ); //expecting int(0)
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of whence loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of File content type loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : basic operations ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode wt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xb --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode xt --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+bool(true)
+int(0)
+-- Testing fseek() with whence = SEEK_SET --
+int(0)
+int(10)
+bool(false)
+-- Testing fseek() with whence = SEEK_CUR --
+int(0)
+int(20)
+bool(false)
+-- Testing fseek() with whence = SEEK_END --
+int(0)
+int(522)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
new file mode 100644
index 0000000..1779383
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : error conditions - fseek()
+--FILE--
+<?php
+
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+echo "*** Testing fseek() : error conditions ***\n";
+// zero argument
+echo "-- Testing fseek() with zero argument --\n";
+var_dump( fseek() );
+
+// unexpected no. of args
+echo "-- Testing fseek() with unexpected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( fseek($fp) );
+var_dump( fseek($fp, 10, $fp,10) );
+
+// test invalid arguments : non-resources
+echo "-- Testing fseek() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass
+);
+/* loop to test fseek() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fseek($invalid_args[$loop_counter - 1], 10) );
+}
+
+// fseek() on a file handle which is already closed
+echo "-- Testing fseek() with closed/unset file handle --";
+fclose($fp);
+var_dump(fseek($fp,10));
+
+// fseek() on a file handle which is unset
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle); //unset file handle
+var_dump( fseek(@$file_handle,10));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek() : error conditions ***
+-- Testing fseek() with zero argument --
+
+Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+-- Testing fseek() with unexpected number of arguments --
+
+Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+-- Testing fseek() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: fseek() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: fseek() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: fseek() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing fseek() with closed/unset file handle --
+Warning: fseek(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
new file mode 100644
index 0000000..1f28abc
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : error conditions - ftell()
+--FILE--
+<?php
+
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+echo "*** Testing ftell() : error conditions ***\n";
+// zero argument
+echo "-- Testing ftell() with zero argument --\n";
+var_dump( ftell() );
+
+// more than expected no. of args
+echo "-- Testing ftell() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( ftell($fp, 10) );
+
+// test invalid arguments : non-resources
+echo "-- Testing ftell() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test ftell with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( ftell($invalid_args[$loop_counter - 1]) );
+}
+
+// ftell on a file handle which is already closed
+echo "-- Testing ftell with closed/unset file handle --";
+fclose($fp);
+var_dump(ftell($fp));
+
+// ftell on a file handle which is unset
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle); //unset file handle
+var_dump( ftell(@$file_handle) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftell() : error conditions ***
+-- Testing ftell() with zero argument --
+
+Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+-- Testing ftell() with more than expected number of arguments --
+
+Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+-- Testing ftell() with invalid arguments --
+-- Iteration 1 --
+
+Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: ftell() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: ftell() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: ftell() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing ftell with closed/unset file handle --
+Warning: ftell(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
new file mode 100644
index 0000000..3c928e6
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : error conditions - rewind()
+--FILE--
+<?php
+
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+echo "*** Testing rewind() : error conditions ***\n";
+// zero argument
+echo "-- Testing rewind() with zero argument --\n";
+var_dump( rewind() );
+
+// more than expected no. of args
+echo "-- Testing rewind() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( rewind($fp, 10) );
+
+// test invalid arguments : non-resources
+echo "-- Testing rewind() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test rewind with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( rewind($invalid_args[$loop_counter - 1]) );
+}
+
+// rewind on a file handle which is already closed
+echo "-- Testing rewind() with closed/unset file handle --";
+fclose($fp);
+var_dump(rewind($fp));
+
+// rewind on a file handle which is unset
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle); //unset file handle
+var_dump( rewind(@$file_handle) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing rewind() : error conditions ***
+-- Testing rewind() with zero argument --
+
+Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+-- Testing rewind() with more than expected number of arguments --
+
+Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+-- Testing rewind() with invalid arguments --
+-- Iteration 1 --
+
+Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: rewind() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: rewind() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: rewind() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing rewind() with closed/unset file handle --
+Warning: rewind(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation1.phpt
new file mode 100644
index 0000000..7f6b2b4
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation1.phpt
@@ -0,0 +1,428 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all r & a modes, default whence
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All read and append modes
+ 2. Testing fseek() without using argument whence
+*/
+echo "*** Testing fseek(), ftell(), rewind() : default whence & all r and a modes ***\n";
+$file_modes = array( "r","rb","rt","r+","r+b","r+t",
+ "a","ab","at","a+","a+b","a+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 513); // different offsets, including negative and beyond size
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation1.tmp"; // this is name of the file created by create_files()
+
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 512, "w", "fseek_ftell_rewind_variation"
+ ,1,"bytes",".tmp"); //create a file with 512 bytes size
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ echo "-- Testing fseek() without using argument whence --\n";
+ foreach($offset as $count){
+ var_dump( fseek($file_handle, $count) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : default whence & all r and a modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode r --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode rb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode rt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode ab --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode at --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode r --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode rb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode rt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode ab --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode at --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
new file mode 100644
index 0000000..ad01c3a
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
@@ -0,0 +1,437 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, default whence
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() without using argument whence
+*/
+
+echo "*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 513); // different offsets, including negative and beyond size
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation2.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ echo "-- Testing fseek() without using argument whence --\n";
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt
new file mode 100644
index 0000000..67987cb
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt
@@ -0,0 +1,437 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, default whence
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() without using argument whence
+*/
+
+echo "*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 513); // different offsets, including negative and beyond size
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation2.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ echo "-- Testing fseek() without using argument whence --\n";
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation3.phpt
new file mode 100644
index 0000000..4b84d40
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation3.phpt
@@ -0,0 +1,478 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all r and a modes, SEEK_SET
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All read and append modes
+ 2. Testing fseek() with whence = SEEK_SET
+*/
+
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_SET & all r and a modes ***\n";
+
+$file_modes = array( "r","rb","rt","r+","r+b","r+t",
+ "a","ab","at","a+","a+b","a+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 512, 600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation3.tmp"; // this is name of the file created by create_files()
+
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+echo "*** Testing fseek() with whence = SEEK_SET ***\n";
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 512, "w", "fseek_ftell_rewind_variation",
+ 3, "bytes", ".tmp"); //create a file with 512 bytes size
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_SET) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_SET & all r and a modes ***
+*** Testing fseek() with whence = SEEK_SET ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode r --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode rb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode rt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode ab --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode at --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode r --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode rb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode rt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode ab --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode at --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt
new file mode 100644
index 0000000..09c8344
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt
@@ -0,0 +1,483 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, SEEK_SET
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() with whence = SEEK_SET
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_SET & all w and x modes ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 512, 600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation4.tmp"; // this is name of the file created by create_files()
+
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_SET) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_SET & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(569)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt
new file mode 100644
index 0000000..e4029c7
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt
@@ -0,0 +1,483 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, SEEK_SET
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() with whence = SEEK_SET
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_SET & all w and x modes ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 512, 600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation4.tmp"; // this is name of the file created by create_files()
+
+ /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_SET) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_SET & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(600)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation5.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation5.phpt
new file mode 100644
index 0000000..75f2812
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation5.phpt
@@ -0,0 +1,474 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all r & a modes, SEEK_CUR
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All read and append modes
+ 2. Testing fseek() with whence = SEEK_CUR
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_CUR & all r and a modes ***\n";
+
+$file_modes = array( "r","rb","rt","r+","r+b","r+t",
+ "a","ab","at","a+","a+b","a+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 512, 600);// different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation5.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 512, "w", "fseek_ftell_rewind_variation"
+ ,5,"bytes",".tmp"); //create a file with 512 bytes size
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ rewind($file_handle);
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_CUR) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_CUR & all r and a modes ***
+-- File having data of type text_with_new_line --
+-- File opened in mode r --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode rb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode rt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode ab --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode at --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File having data of type alphanumeric --
+-- File opened in mode r --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode rb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode rt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode ab --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode at --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt
new file mode 100644
index 0000000..d451912
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt
@@ -0,0 +1,483 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w & x modes, SEEK_CUR
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() with whence = SEEK_CUR
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_CUR & all w and x modes ***\n";
+
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1,0,1,512,600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation6.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_CUR) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_CUR & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(569)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt
new file mode 100644
index 0000000..4451988
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt
@@ -0,0 +1,483 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w & x modes, SEEK_CUR
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() with whence = SEEK_CUR
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_CUR & all w and x modes ***\n";
+
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1,0,1,512,600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation6.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_CUR) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_CUR & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1113)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation7.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation7.phpt
new file mode 100644
index 0000000..f0e8e46
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation7.phpt
@@ -0,0 +1,477 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all r and a modes, SEEK_END
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All read and append modes
+ 2. Testing fseek() with whence = SEEK_END
+*/
+
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_END & all r and a modes ***\n";
+
+$file_modes = array( "r","rb","rt","r+","r+b","r+t",
+ "a","ab","at","a+","a+b","a+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1,0,1,512,600);// different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation7.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 512, "w", "fseek_ftell_rewind_variation"
+ ,7,"bytes",".tmp"); //create a file with 512 bytes size
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ rewind($file_handle);
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_END) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size, the size will have increased
+ // by 10 bytes because of holes
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_END & all r and a modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode r --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode rb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode rt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode ab --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode at --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode r --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode rb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode rt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode r+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode r+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode r+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode ab --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode at --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode a+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt
new file mode 100644
index 0000000..5586e2b
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt
@@ -0,0 +1,484 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, SEEK_END
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() with whence = SEEK_END
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_END & all r and a modes ***\n";
+
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1,0,1,512,600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation8.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_END) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_END & all r and a modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(0)
+int(568)
+bool(false)
+int(0)
+int(569)
+bool(false)
+int(0)
+int(570)
+bool(false)
+int(0)
+int(1081)
+bool(false)
+int(0)
+int(1169)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(0)
+int(568)
+bool(false)
+int(0)
+int(569)
+bool(false)
+int(0)
+int(570)
+bool(false)
+int(0)
+int(1081)
+bool(false)
+int(0)
+int(1169)
+bool(false)
+int(569)
+-- File opened in mode x --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(0)
+int(568)
+bool(false)
+int(0)
+int(569)
+bool(false)
+int(0)
+int(570)
+bool(false)
+int(0)
+int(1081)
+bool(false)
+int(0)
+int(1169)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(0)
+int(568)
+bool(false)
+int(0)
+int(569)
+bool(false)
+int(0)
+int(570)
+bool(false)
+int(0)
+int(1081)
+bool(false)
+int(0)
+int(1169)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt
new file mode 100644
index 0000000..a2a0d67
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt
@@ -0,0 +1,484 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, SEEK_END
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() with whence = SEEK_END
+*/
+echo "*** Testing fseek(), ftell(), rewind() : whence = SEEK_END & all r and a modes ***\n";
+
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1,0,1,512,600); // different offsets
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation8.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count,SEEK_END) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : whence = SEEK_END & all r and a modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode wt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xb --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode xt --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+int(0)
+int(511)
+bool(false)
+int(0)
+int(512)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(0)
+int(1024)
+bool(false)
+int(0)
+int(1112)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/fseek_variation1.phpt b/ext/standard/tests/file/fseek_variation1.phpt
new file mode 100644
index 0000000..fbe4673
--- /dev/null
+++ b/ext/standard/tests/file/fseek_variation1.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test fseek() function : usage variations - different types for offset
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto int fseek(resource fp, int offset [, int whence])
+ * Description: Seek on a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions: gzseek
+ */
+
+echo "*** Testing fseek() : usage variations ***\n";
+error_reporting(E_ALL & ~E_NOTICE);
+
+// Initialise function arguments not being substituted (if any)
+
+$fp = fopen(__FILE__, 'r');
+$whence = SEEK_SET;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+class testClass {
+ public function __toString() {
+ return "testClass";
+ }
+}
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new testClass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for offset
+
+foreach($values as $value) {
+ echo @"\nArg value $value \n";
+ var_dump( fseek($fp, $value, $whence) );
+ var_dump( ftell($fp));
+};
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing fseek() : usage variations ***
+
+Arg value 10.5
+int(0)
+int(10)
+
+Arg value -10.5
+int(-1)
+int(10)
+
+Arg value 1.07654321E-9
+int(0)
+int(0)
+
+Arg value 0.5
+int(0)
+int(0)
+
+Arg value Array
+
+Warning: fseek() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+int(0)
+
+Arg value Array
+
+Warning: fseek() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+int(0)
+
+Arg value Array
+
+Warning: fseek() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+int(0)
+
+Arg value Array
+
+Warning: fseek() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+int(0)
+
+Arg value Array
+
+Warning: fseek() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+int(0)
+
+Arg value
+int(0)
+int(0)
+
+Arg value
+int(0)
+int(0)
+
+Arg value 1
+int(0)
+int(1)
+
+Arg value
+int(0)
+int(0)
+
+Arg value 1
+int(0)
+int(1)
+
+Arg value
+int(0)
+int(0)
+
+Arg value
+
+Warning: fseek() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+int(0)
+
+Arg value
+
+Warning: fseek() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+int(0)
+
+Arg value string
+
+Warning: fseek() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+int(0)
+
+Arg value string
+
+Warning: fseek() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+int(0)
+
+Arg value testClass
+
+Warning: fseek() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+int(0)
+
+Arg value
+int(0)
+int(0)
+
+Arg value
+int(0)
+int(0)
+Done
+
diff --git a/ext/standard/tests/file/fseek_variation2.phpt b/ext/standard/tests/file/fseek_variation2.phpt
new file mode 100644
index 0000000..f454352
--- /dev/null
+++ b/ext/standard/tests/file/fseek_variation2.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test fseek() function : usage variations - different types for whence
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto int fseek(resource fp, int offset [, int whence])
+ * Description: Seek on a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions: gzseek
+ */
+
+echo "*** Testing fseek() : usage variations ***\n";
+error_reporting(E_ALL & ~E_NOTICE);
+$fp = fopen(__FILE__, 'r');
+$offset = 3;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // outside of whence range
+ -100,
+ 100,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for whence
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( fseek($fp, $offset, $value) );
+ var_dump( ftell($fp));
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing fseek() : usage variations ***
+
+Arg value -100
+int(-1)
+int(0)
+
+Arg value 100
+int(-1)
+int(0)
+
+Arg value 10.5
+int(-1)
+int(0)
+
+Arg value -10.5
+int(-1)
+int(0)
+
+Arg value 101234567000
+int(-1)
+int(0)
+
+Arg value 1.07654321E-9
+int(0)
+int(3)
+
+Arg value 0.5
+int(0)
+int(3)
+
+Arg value
+int(0)
+int(3)
+
+Arg value
+int(0)
+int(3)
+
+Arg value 1
+int(0)
+int(6)
+
+Arg value
+int(0)
+int(3)
+
+Arg value 1
+int(0)
+int(6)
+
+Arg value
+int(0)
+int(3)
+
+Arg value
+
+Warning: fseek() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+int(3)
+
+Arg value
+
+Warning: fseek() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+int(3)
+
+Arg value string
+
+Warning: fseek() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+int(3)
+
+Arg value string
+
+Warning: fseek() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+int(3)
+
+Arg value
+int(0)
+int(3)
+
+Arg value
+int(0)
+int(3)
+Done
+
diff --git a/ext/standard/tests/file/fseek_variation3.phpt b/ext/standard/tests/file/fseek_variation3.phpt
new file mode 100644
index 0000000..c29ed31
--- /dev/null
+++ b/ext/standard/tests/file/fseek_variation3.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test fseek() function : variation functionality beyond file boundaries
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : proto int fseek(resource fp, int offset [, int whence])
+ * Description: Seek on a file pointer
+ * Source code: ext/standard/file.c
+ * Alias to functions: gzseek
+ */
+
+echo "*** Testing fseek() : variation - beyond file boundaries ***\n";
+
+$outputfile = __FILE__.".tmp";
+
+$h = fopen($outputfile, "wb+");
+for ($i = 1; $i < 10; $i++) {
+ fwrite($h, chr(0x30 + $i));
+}
+
+echo "--- fseek beyond start of file ---\n";
+var_dump(fseek($h, -4, SEEK_SET));
+echo "after -4 seek: ".bin2hex(fread($h,1))."\n";
+var_dump(fseek($h, -1, SEEK_CUR));
+echo "after seek back 1: ".bin2hex(fread($h,1))."\n";
+var_dump(fseek($h, -20, SEEK_CUR));
+echo "after seek back 20: ".bin2hex(fread($h,1))."\n";
+
+echo "--- fseek beyond end of file ---\n";
+var_dump(fseek($h, 16, SEEK_SET));
+fwrite($h, b"end");
+fseek($h ,0, SEEK_SET);
+$data = fread($h, 4096);
+echo bin2hex($data)."\n";
+
+fclose($h);
+unlink($outputfile);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing fseek() : variation - beyond file boundaries ***
+--- fseek beyond start of file ---
+int(-1)
+after -4 seek:
+int(0)
+after seek back 1: 39
+int(-1)
+after seek back 20:
+--- fseek beyond end of file ---
+int(0)
+31323334353637383900000000000000656e64
+Done
diff --git a/ext/standard/tests/file/fstat.phpt b/ext/standard/tests/file/fstat.phpt
new file mode 100644
index 0000000..e1ae3e2
--- /dev/null
+++ b/ext/standard/tests/file/fstat.phpt
@@ -0,0 +1,74 @@
+--TEST--
+fstat() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fstat.dat";
+
+$fp = fopen($filename, "w");
+var_dump(fstat($fp));
+fclose($fp);
+var_dump(fstat($fp));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+
+Warning: fstat(): %d is not a valid stream resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/fstat_basic.phpt b/ext/standard/tests/file/fstat_basic.phpt
new file mode 100644
index 0000000..a404929
--- /dev/null
+++ b/ext/standard/tests/file/fstat_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test function fstat() by calling it with its expected arguments
+--FILE--
+<?php
+$fp = fopen (__FILE__, 'r');
+var_dump(fstat( $fp ) );
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_error.phpt b/ext/standard/tests/file/fstat_error.phpt
new file mode 100644
index 0000000..d75ddb9
--- /dev/null
+++ b/ext/standard/tests/file/fstat_error.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test function fstat() by calling it more than or less than its expected arguments
+--FILE--
+<?php
+$fp = fopen (__FILE__, 'r');
+$extra_arg = 'nothing';
+
+var_dump(fstat( $fp, $extra_arg ) );
+var_dump(fstat());
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: fstat() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation1.phpt b/ext/standard/tests/file/fstat_variation1.phpt
new file mode 100644
index 0000000..b2ad541
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function fstat() by substituting agument 1 with array values.
+--FILE--
+<?php
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation2.phpt b/ext/standard/tests/file/fstat_variation2.phpt
new file mode 100644
index 0000000..fd62f23
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function fstat() by substituting agument 1 with boolean values.
+--FILE--
+<?php
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation3.phpt b/ext/standard/tests/file/fstat_variation3.phpt
new file mode 100644
index 0000000..4cd74e3
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation3.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function fstat() by substituting agument 1 with emptyUnsetUndefNull values.
+--FILE--
+<?php
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation4.phpt b/ext/standard/tests/file/fstat_variation4.phpt
new file mode 100644
index 0000000..1649776
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation4.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function fstat() by substituting agument 1 with float values.
+--FILE--
+<?php
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation5.phpt b/ext/standard/tests/file/fstat_variation5.phpt
new file mode 100644
index 0000000..ef4f4ea
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation5.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function fstat() by substituting agument 1 with int values.
+--FILE--
+<?php
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation6.phpt b/ext/standard/tests/file/fstat_variation6.phpt
new file mode 100644
index 0000000..0789ff7
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation6.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test function fstat() by substituting agument 1 with object values.
+--FILE--
+<?php
+
+
+
+
+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 classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
+bool(false)
+Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation7.phpt b/ext/standard/tests/file/fstat_variation7.phpt
new file mode 100644
index 0000000..1f3f001
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation7.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function fstat() by substituting agument 1 with string values.
+--FILE--
+<?php
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(fstat( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/fstat_variation8.phpt b/ext/standard/tests/file/fstat_variation8.phpt
new file mode 100644
index 0000000..b493d4e
--- /dev/null
+++ b/ext/standard/tests/file/fstat_variation8.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function fstat() by calling it with its expected arguments
+--FILE--
+<?php
+$stat_result = stat(__FILE__);
+clearstatcache();
+$fp = fopen (__FILE__, 'r');
+$fstat_result = fstat($fp);
+fclose($fp);
+
+$isWin = (substr(PHP_OS, 0, 3) == 'WIN');
+$failed = false;
+foreach($stat_result as $key =>$value) {
+ if ($isWin && ($key === 0 || $key === 6 || $key === 'dev' || $key === 'rdev')) {
+ // windows, dev and rdev will not match this is expected
+ }
+ else {
+ if ($fstat_result[$key] != $value) {
+ echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n";
+ $failed = true;
+ }
+ }
+}
+if ($failed !== true) {
+ echo "PASSED: all elements are the same\n";
+}
+
+
+?>
+===DONE===
+--EXPECT--
+PASSED: all elements are the same
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/ftruncate.phpt b/ext/standard/tests/file/ftruncate.phpt
new file mode 100644
index 0000000..8954ef1
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate.phpt
Binary files differ
diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt
new file mode 100644
index 0000000..a28095b
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_error.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test ftruncate() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: truncates a file to a given length
+*/
+
+echo "*** Testing ftruncate() : error conditions ***\n";
+
+$filename = dirname(__FILE__)."/ftruncate_error.tmp";
+$file_handle = fopen($filename, "w" );
+fwrite($file_handle, (binary)"Testing ftruncate error conditions \n");
+fflush($file_handle);
+echo "\n Initial file size = ".filesize($filename)."\n";
+
+echo "-- Testing ftruncate() with less than expected number of arguments --\n";
+
+// zero arguments
+var_dump( ftruncate() );
+
+// arguments less than expected numbers
+var_dump( ftruncate( $file_handle ) );
+// check the first size
+var_dump( filesize($filename) );
+
+echo "-- Testing ftruncate() with more than expected number of arguments --\n";
+// more than expected number of arguments
+var_dump( ftruncate($file_handle, 10, 20) );
+// check the first size
+var_dump( filesize($filename) );
+
+// test invalid arguments : non-resources
+echo "-- Testing ftruncate() with invalid file pointer --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test ftruncate() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) );
+}
+
+// ftruncate() on a file handle which is already closed/unset
+echo "-- Testing ftruncate() with closed/unset file handle --\n";
+
+// ftruncate on close file handle
+fclose($file_handle);
+var_dump( ftruncate($file_handle,10) );
+// check the first size
+var_dump( filesize($filename) );
+
+// ftruncate on a file handle which is unset
+$fp = fopen($filename, "w");
+unset($fp); //unset file handle
+var_dump( ftruncate(@$fp,10));
+// check the first size
+var_dump( filesize($filename) );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$filename = dirname(__FILE__)."/ftruncate_error.tmp";
+unlink( $filename );
+?>
+--EXPECTF--
+*** Testing ftruncate() : error conditions ***
+
+ Initial file size = 36
+-- Testing ftruncate() with less than expected number of arguments --
+
+Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+int(36)
+-- Testing ftruncate() with more than expected number of arguments --
+
+Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+int(36)
+-- Testing ftruncate() with invalid file pointer --
+-- Iteration 1 --
+
+Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: ftruncate() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: ftruncate() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: ftruncate() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing ftruncate() with closed/unset file handle --
+
+Warning: ftruncate(): 5 is not a valid stream resource in %s on line %d
+bool(false)
+int(36)
+
+Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+int(36)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation1-win32.phpt b/ext/standard/tests/file/ftruncate_variation1-win32.phpt
new file mode 100644
index 0000000..dbf1896
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation1-win32.phpt
@@ -0,0 +1,461 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate filesize to zero
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation1.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation");
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ /* truncate it to size 0 */
+ echo "-- Testing ftruncate(): truncate file to size = 0 --\n";
+ $new_size = 0;
+ var_dump( filesize($filename) ); // check the current file size
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // check the file size, should be 0
+
+ //delete all files created
+ delete_file($filename);
+ } //end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation1.phpt b/ext/standard/tests/file/ftruncate_variation1.phpt
new file mode 100644
index 0000000..cf51e20
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation1.phpt
@@ -0,0 +1,461 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate filesize to zero
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation1.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation");
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ /* truncate it to size 0 */
+ echo "-- Testing ftruncate(): truncate file to size = 0 --\n";
+ $new_size = 0;
+ var_dump( filesize($filename) ); // check the current file size
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // check the file size, should be 0
+
+ //delete all files created
+ delete_file($filename);
+ } //end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = 0 --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(0)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation2-win32.phpt b/ext/standard/tests/file/ftruncate_variation2-win32.phpt
new file mode 100644
index 0000000..7b2e0b4
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation2-win32.phpt
@@ -0,0 +1,462 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to current size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation2.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 2);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): truncate file to size = current size --\n";
+ /* truncate the file to its current filesize, size should not change*/
+
+ $new_size = filesize($filename);
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size, should be same as before truncating
+
+ //delete all files created
+ delete_file($filename);
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation2.phpt b/ext/standard/tests/file/ftruncate_variation2.phpt
new file mode 100644
index 0000000..e01a167
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation2.phpt
@@ -0,0 +1,462 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to current size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation2.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 2);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): truncate file to size = current size --\n";
+ /* truncate the file to its current filesize, size should not change*/
+
+ $new_size = filesize($filename);
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size, should be same as before truncating
+
+ //delete all files created
+ delete_file($filename);
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to size = current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1024)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation3-win32.phpt b/ext/standard/tests/file/ftruncate_variation3-win32.phpt
new file mode 100644
index 0000000..d9aa40e
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation3-win32.phpt
@@ -0,0 +1,461 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to half size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation3.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 3);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): truncate file to half of its current size --\n";
+ /* truncate it to half of its current size */
+ $new_size = filesize($filename)/2;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size = $new_size
+
+ // delete file
+ delete_file($filename);
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(568)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(568)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(568)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(568)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation3.phpt b/ext/standard/tests/file/ftruncate_variation3.phpt
new file mode 100644
index 0000000..cdbeb8e
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation3.phpt
@@ -0,0 +1,461 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to half size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation3.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 3);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): truncate file to half of its current size --\n";
+ /* truncate it to half of its current size */
+ $new_size = filesize($filename)/2;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size = $new_size
+
+ // delete file
+ delete_file($filename);
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate file to half of its current size --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(512)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation4-win32.phpt b/ext/standard/tests/file/ftruncate_variation4-win32.phpt
new file mode 100644
index 0000000..ae9e5a4
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation4-win32.phpt
@@ -0,0 +1,462 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to negative size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation4.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 4);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): try truncating file to a negative size --\n";
+ /* try to truncate it to a negative size, size should not change*/
+
+ $new_size = -1000;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size = actual size, no change
+
+ //delete all files created
+ delete_file( $filename );
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1137)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1137)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1137)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1137)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1137)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation4.phpt b/ext/standard/tests/file/ftruncate_variation4.phpt
new file mode 100644
index 0000000..4a5a362
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation4.phpt
@@ -0,0 +1,462 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to negative size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation4.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 4);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): try truncating file to a negative size --\n";
+ /* try to truncate it to a negative size, size should not change*/
+
+ $new_size = -1000;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size = actual size, no change
+
+ //delete all files created
+ delete_file( $filename );
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to a negative size --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation5-win32.phpt b/ext/standard/tests/file/ftruncate_variation5-win32.phpt
new file mode 100644
index 0000000..eb45ffc
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation5-win32.phpt
@@ -0,0 +1,463 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to bigger size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation5.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 5);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): try truncating file to size, bigger than existing --\n";
+ /* try to truncate it to size bigger then current */
+
+ $new_size = filesize($filename) + 100;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size = actual size, no change
+
+ //delete all files created
+ delete_file($filename);
+ }//end of inner for loop
+
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1237)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1237)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1237)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1137)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1237)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation5.phpt b/ext/standard/tests/file/ftruncate_variation5.phpt
new file mode 100644
index 0000000..5d282d1
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation5.phpt
@@ -0,0 +1,463 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to bigger size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation5.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 5);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): try truncating file to size, bigger than existing --\n";
+ /* try to truncate it to size bigger then current */
+
+ $new_size = filesize($filename) + 100;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) ); // new file size = actual size, no change
+
+ //delete all files created
+ delete_file($filename);
+ }//end of inner for loop
+
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): try truncating file to size, bigger than existing --
+int(1024)
+int(0)
+bool(true)
+int(0)
+bool(false)
+int(1124)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation6-win32.phpt b/ext/standard/tests/file/ftruncate_variation6-win32.phpt
new file mode 100644
index 0000000..0815092
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation6-win32.phpt
@@ -0,0 +1,482 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to smaller size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+/* truncate the file to smaller size and display the content */
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation6.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 6);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): truncate to smaller size and display the file content --\n";
+ /* try to truncate it and display the file content */
+
+ $new_size = 15;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ if(ftruncate($file_handle, $new_size) ){// truncate it
+ echo "File content after truncating file to $new_size size : ";
+ var_dump( file_get_contents($filename) );
+ }
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) );
+
+ //delete all files created
+ delete_file( $filename );
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1137)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of t"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1137)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of t"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1137)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of t"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1137)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of t"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation6.phpt b/ext/standard/tests/file/ftruncate_variation6.phpt
new file mode 100644
index 0000000..e9d5eb3
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation6.phpt
@@ -0,0 +1,482 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate file to smaller size
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+/* truncate the file to smaller size and display the content */
+
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation6.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 6);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): truncate to smaller size and display the file content --\n";
+ /* try to truncate it and display the file content */
+
+ $new_size = 15;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ if(ftruncate($file_handle, $new_size) ){// truncate it
+ echo "File content after truncating file to $new_size size : ";
+ var_dump( file_get_contents($filename) );
+ }
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) );
+
+ //delete all files created
+ delete_file( $filename );
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "222222222222222"
+int(0)
+bool(false)
+int(15)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+int(0)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): truncate to smaller size and display the file content --
+int(1024)
+int(0)
+File content after truncating file to 15 size : string(15) "line
+line of te"
+int(0)
+bool(false)
+int(15)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation7-win32.phpt b/ext/standard/tests/file/ftruncate_variation7-win32.phpt
new file mode 100644
index 0000000..dc3a4cc
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation7-win32.phpt
@@ -0,0 +1,463 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate when file pointer at EOF
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+/* truncate the file when file pointer is positioned at end of the file */
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation7.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 7);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): File pointer at the end --\n";
+ /* try to truncate it to while file pointer at the end */
+ fseek($file_handle, 0, SEEK_END);
+ $new_size = 200;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) );
+
+ //delete all files created
+ delete_file($filename);
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1137)
+int(1137)
+bool(true)
+int(1137)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1137)
+int(1137)
+bool(true)
+int(1137)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1137)
+int(1137)
+bool(true)
+int(1137)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1137)
+int(1137)
+bool(true)
+int(1137)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+Done
diff --git a/ext/standard/tests/file/ftruncate_variation7.phpt b/ext/standard/tests/file/ftruncate_variation7.phpt
new file mode 100644
index 0000000..5b38adf
--- /dev/null
+++ b/ext/standard/tests/file/ftruncate_variation7.phpt
@@ -0,0 +1,463 @@
+--TEST--
+Test ftruncate() function : usage variations - truncate when file pointer at EOF
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: bool ftruncate ( resource $handle, int $size );
+ Description: Truncates a file to a given length
+*/
+
+/* truncate the file when file pointer is positioned at end of the file */
+// include common file related test functions
+include ("file.inc");
+
+echo "*** Testing ftruncate() : usage variations ***\n";
+
+/* test ftruncate with file opened in different modes */
+$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
+ "w", "wb", "wt", "w+", "w+b", "w+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t",
+ "a", "ab", "at", "a+", "a+b", "a+t");
+
+$file_content_types = array("numeric","text_with_new_line");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = dirname(__FILE__)."/ftruncate_variation7.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 7);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): File pointer at the end --\n";
+ /* try to truncate it to while file pointer at the end */
+ fseek($file_handle, 0, SEEK_END);
+ $new_size = 200;
+ var_dump( filesize($filename) ); // current filesize
+ var_dump( ftell($file_handle) );
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ var_dump( filesize($filename) );
+
+ //delete all files created
+ delete_file($filename);
+ }//end of inner for loop
+}//end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ftruncate() : usage variations ***
+
+-- Testing ftruncate() with file having data of type numeric --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+
+-- Testing ftruncate() with file having data of type text_with_new_line --
+-- Testing ftruncate() with file opening using r mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using rt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(false)
+int(1024)
+bool(false)
+int(1024)
+-- Testing ftruncate() with file opening using r+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using r+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using wt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using w+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xb mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using xt mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using x+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using ab mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using at mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+ mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+b mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+-- Testing ftruncate() with file opening using a+t mode --
+-- Testing ftruncate(): File pointer at the end --
+int(1024)
+int(1024)
+bool(true)
+int(1024)
+bool(false)
+int(200)
+Done
diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt
new file mode 100644
index 0000000..7f12ebb
--- /dev/null
+++ b/ext/standard/tests/file/fwrite.phpt
@@ -0,0 +1,52 @@
+--TEST--
+fwrite() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/fwrite.dat";
+
+$fp = fopen($filename, "w");
+var_dump(fwrite($fp));
+var_dump(fwrite($fp, array()));
+fclose($fp);
+
+$fp = fopen($filename, "r");
+var_dump(fwrite($fp, "data"));
+
+$fp = fopen($filename, "w");
+var_dump(fwrite($fp, "data", -1));
+var_dump(fwrite($fp, "data", 100000));
+fclose($fp);
+
+var_dump(fwrite($fp, "data", -1));
+
+var_dump(fwrite(array(), "data", -1));
+var_dump(fwrite(array(), "data"));
+var_dump(fwrite(array()));
+
+var_dump(file_get_contents($filename));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d
+bool(false)
+int(0)
+int(0)
+int(4)
+int(0)
+
+Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+
+Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+string(4) "data"
+Done
diff --git a/ext/standard/tests/file/fwrite_basic-win32.phpt b/ext/standard/tests/file/fwrite_basic-win32.phpt
new file mode 100644
index 0000000..81d9360
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_basic-win32.phpt
@@ -0,0 +1,424 @@
+--TEST--
+Test fwrite() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Valid for Windows only');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+echo "*** Testing fwrite() basic operations ***\n";
+/*
+ test fwrite with file opened in mode : w,wb,wt,w+,w+b,w+t
+ File containing data of type, numeric, text, text_with_new_line, alphanumeric
+*/
+$file_modes = array( "w", "wb", "wt", "w+", "w+b", "w+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having data of type ". $file_content_type ." --\n";
+ $filename = dirname(__FILE__)."/fwrite_basic-win32.tmp"; // this is name of the file
+
+ for($inner_loop_counter = 0;
+ $inner_loop_counter < count($file_modes);
+ $inner_loop_counter++) {
+ echo "-- File opened in mode : " . $file_modes[$inner_loop_counter]. " --\n";
+ /* open the file using $files_modes and perform fwrite() on it */
+ $file_handle = fopen($filename, $file_modes[$inner_loop_counter]);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 1024); //get the data of size 1024
+
+ /* Write the data in to the file, verify the write by checking file pointer position,
+ eof position, and data. */
+ // writing 100 bytes
+ var_dump( ftell($file_handle) ); // Expecting 0
+ var_dump( fwrite($file_handle, $data_to_be_written, 100)); //int(100)
+ var_dump( feof($file_handle) ); // expected : false
+ var_dump( ftell($file_handle) ); //expected: 100
+
+ // trying to write more than the available data, available 1024 bytes but trying 2048
+ var_dump( fwrite($file_handle, $data_to_be_written, 2048)); //int(1024)
+ var_dump( feof($file_handle) ); // expected : false
+ var_dump( ftell($file_handle) ); // expected: 1124
+
+ // fwrite() without length parameter
+ var_dump( fwrite($file_handle, $data_to_be_written)); //int(1024)
+ var_dump( ftell($file_handle) ); // expected: 2148
+ var_dump( feof($file_handle) ); // expected: false
+
+ // close the file, get the size and content of the file.
+ var_dump( fclose($file_handle) ); //expected : true
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) ); // expected: 2148
+ var_dump(md5(file_get_contents($filename))); // hash the output
+
+ } // end of inner for loop
+
+ // delete the file created : fwrite_basic.tmp
+ delete_file($filename);
+} // end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() basic operations ***
+
+-- Testing fwrite() with file having data of type numeric --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+
+-- Testing fwrite() with file having data of type text --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+
+-- Testing fwrite() with file having data of type text_with_new_line --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2385)
+string(32) "62b09dac6d598bf54de7b02e0e68e5c7"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2385)
+string(32) "62b09dac6d598bf54de7b02e0e68e5c7"
+
+-- Testing fwrite() with file having data of type alphanumeric --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fwrite_basic.phpt b/ext/standard/tests/file/fwrite_basic.phpt
new file mode 100644
index 0000000..c568b7c
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_basic.phpt
@@ -0,0 +1,424 @@
+--TEST--
+Test fwrite() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip...Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+echo "*** Testing fwrite() basic operations ***\n";
+/*
+ test fwrite with file opened in mode : w,wb,wt,w+,w+b,w+t
+ File containing data of type, numeric, text, text_with_new_line, alphanumeric
+*/
+$file_modes = array( "w", "wb", "wt", "w+", "w+b", "w+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having data of type ". $file_content_type ." --\n";
+ $filename = dirname(__FILE__)."/fwrite_basic.tmp"; // this is name of the file
+
+ for($inner_loop_counter = 0;
+ $inner_loop_counter < count($file_modes);
+ $inner_loop_counter++) {
+ echo "-- File opened in mode : " . $file_modes[$inner_loop_counter]. " --\n";
+ /* open the file using $files_modes and perform fwrite() on it */
+ $file_handle = fopen($filename, $file_modes[$inner_loop_counter]);
+ if (!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 1024); //get the data of size 1024
+
+ /* Write the data in to the file, verify the write by checking file pointer position,
+ eof position, and data. */
+ // writing 100 bytes
+ var_dump( ftell($file_handle) ); // Expecting 0
+ var_dump( fwrite($file_handle, $data_to_be_written, 100)); //int(100)
+ var_dump( feof($file_handle) ); // expected : false
+ var_dump( ftell($file_handle) ); //expected: 100
+
+ // trying to write more than the available data, available 1024 bytes but trying 2048
+ var_dump( fwrite($file_handle, $data_to_be_written, 2048)); //int(1024)
+ var_dump( feof($file_handle) ); // expected : false
+ var_dump( ftell($file_handle) ); // expected: 1124
+
+ // fwrite() without length parameter
+ var_dump( fwrite($file_handle, $data_to_be_written)); //int(1024)
+ var_dump( ftell($file_handle) ); // expected: 2148
+ var_dump( feof($file_handle) ); // expected: false
+
+ // close the file, get the size and content of the file.
+ var_dump( fclose($file_handle) ); //expected : true
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) ); // expected: 2148
+ var_dump(md5(file_get_contents($filename))); // hash the output
+
+ } // end of inner for loop
+
+ // delete the file created : fwrite_basic.tmp
+ delete_file($filename);
+} // end of outer foreach loop
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() basic operations ***
+
+-- Testing fwrite() with file having data of type numeric --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "04db34906fe2c56dcfbd649b7d916974"
+
+-- Testing fwrite() with file having data of type text --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "9c08ac77b7a93a84dd0b055900165e84"
+
+-- Testing fwrite() with file having data of type text_with_new_line --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "56a1963cc292d7f8245219116d9eca40"
+
+-- Testing fwrite() with file having data of type alphanumeric --
+-- File opened in mode : w --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : wb --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : wt --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : w+ --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : w+b --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+-- File opened in mode : w+t --
+int(0)
+int(100)
+bool(false)
+int(100)
+int(1024)
+bool(false)
+int(1124)
+int(1024)
+int(2148)
+bool(false)
+bool(true)
+int(2148)
+string(32) "719e3329c19218c12d232f2ee81e100f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt
new file mode 100644
index 0000000..988d618
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_error.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test fwrite() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+echo "*** Testing fwrite() : error conditions ***\n";
+
+$filename = dirname(__FILE__)."/fwrite_error.tmp";
+
+echo "-- Testing fwrite() with less than expected number of arguments --\n";
+// zero argument
+var_dump( fwrite() );
+// less than expected, 1 arg
+$file_handle = fopen ( $filename, "w");
+var_dump( fwrite($file_handle) );
+
+// more than expected no. of args
+echo "-- Testing fwrite() with more than expected number of arguments --\n";
+$data = "data";
+var_dump( fwrite($file_handle, $data, strlen($data), 10) );
+
+// invalid length argument
+echo "-- Testing fwrite() with invalid length arguments --\n";
+$len = 0;
+var_dump( fwrite($file_handle, $data, $len) );
+$len = -10;
+var_dump( fwrite($file_handle, $data, $len) );
+
+// test invalid arguments : non-resources
+echo "-- Testing fwrite() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fwrite() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fwrite($invalid_args[$loop_counter - 1], 10) );
+}
+
+// fwrite() on a file handle which is already closed
+echo "-- Testing fwrite() with closed/unset file handle --\n";
+fclose($file_handle);
+var_dump(fwrite($file_handle,"data"));
+
+// fwrite on a file handle which is unset
+$fp = fopen($filename, "w");
+unset($fp); //unset file handle
+var_dump( fwrite(@$fp,"data"));
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$filename = dirname(__FILE__)."/fwrite_error.tmp";
+unlink( $filename );
+?>
+--EXPECTF--
+*** Testing fwrite() : error conditions ***
+-- Testing fwrite() with less than expected number of arguments --
+
+Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+-- Testing fwrite() with more than expected number of arguments --
+
+Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+-- Testing fwrite() with invalid length arguments --
+int(0)
+int(0)
+-- Testing fwrite() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: fwrite() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: fwrite() expects parameter 1 to be resource, double given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: fwrite() expects parameter 1 to be resource, boolean given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d
+bool(false)
+-- Testing fwrite() with closed/unset file handle --
+
+Warning: fwrite(): %d is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/fwrite_variation1-win32.phpt b/ext/standard/tests/file/fwrite_variation1-win32.phpt
new file mode 100644
index 0000000..1091aeb
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation1-win32.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test fwrite() function : usage variations - r, rb & rt modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Not valid for Linux');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : r,rb,rt
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("r","rb","rt");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ // create the temp file with content of type $file_content_type
+ $filename = dirname(__FILE__)."/fwrite_variation1.tmp"; // this is name of the file
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation");
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+
+ var_dump( ftell($file_handle) ); // expected: 0
+ var_dump( fwrite($file_handle, $data_to_be_written ));
+ var_dump( ftell($file_handle) ); // expected: 0
+ var_dump( feof($file_handle) ); // expected: false
+
+ // move the file pointer to end of the file and try fwrite()
+ fseek($file_handle, SEEK_END, 0);
+ var_dump( ftell($file_handle) ); // expecting 1024
+ var_dump( fwrite($file_handle, $data_to_be_written) ); // fwrite to fail
+ var_dump( ftell($file_handle) ); //check that file pointer points at eof, expected: 1024
+ var_dump( feof($file_handle) ); // ensure that feof() points to eof, expected: true
+
+ // ensure that file content/size didn't change.
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) ); // expected: 1024
+ var_dump(md5(file_get_contents($filename))); // hash the output
+ delete_file($filename); // delete file with name fwrite_variation1.tmp
+
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "e486000c4c8452774f746a27658d87fa"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation1.phpt b/ext/standard/tests/file/fwrite_variation1.phpt
new file mode 100644
index 0000000..44f6939
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation1.phpt
@@ -0,0 +1,233 @@
+--TEST--
+Test fwrite() function : usage variations - r, rb & rt modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip...Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : r,rb,rt
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("r","rb","rt");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ // create the temp file with content of type $file_content_type
+ $filename = dirname(__FILE__)."/fwrite_variation1.tmp"; // this is name of the file
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation");
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+
+ var_dump( ftell($file_handle) ); // expected: 0
+ var_dump( fwrite($file_handle, $data_to_be_written ));
+ var_dump( ftell($file_handle) ); // expected: 0
+ var_dump( feof($file_handle) ); // expected: false
+
+ // move the file pointer to end of the file and try fwrite()
+ fseek($file_handle, SEEK_END, 0);
+ var_dump( ftell($file_handle) ); // expecting 1024
+ var_dump( fwrite($file_handle, $data_to_be_written) ); // fwrite to fail
+ var_dump( ftell($file_handle) ); //check that file pointer points at eof, expected: 1024
+ var_dump( feof($file_handle) ); // ensure that feof() points to eof, expected: true
+
+ // ensure that file content/size didn't change.
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) ); // expected: 1024
+ var_dump(md5(file_get_contents($filename))); // hash the output
+ delete_file($filename); // delete file with name fwrite_variation1.tmp
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "e486000c4c8452774f746a27658d87fa"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "e486000c4c8452774f746a27658d87fa"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b09c8026a64a88d36d4c2f17983964bb"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in r --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Opening file in rb --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+-- Opening file in rt --
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(2)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation2-win32.phpt b/ext/standard/tests/file/fwrite_variation2-win32.phpt
new file mode 100644
index 0000000..8545db9
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation2-win32.phpt
@@ -0,0 +1,304 @@
+--TEST--
+Test fwrite() function : usage variations - r+, r+b & r+t modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Not valid for Linux');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : r+,r+b,r+t
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("r+", "r+b", "r+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ // create temp file and fill the data of type $file_content_type
+ $filename = dirname(__FILE__)."/fwrite_variation2.tmp"; // this is name of the file
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation", 2);
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+
+ /*overwrite first 400 bytes in the file*/
+ var_dump( ftell($file_handle) ); // expected : 0
+ var_dump( fwrite($file_handle, $data_to_be_written, 400));
+ var_dump( ftell($file_handle) ); // expected: 400
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /*overwrite data in middle of the file*/
+ fseek($file_handle, SEEK_SET, 1024/2 );
+ var_dump( ftell($file_handle)); // expected: 1024/2
+ var_dump( fwrite($file_handle, $data_to_be_written, 200) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /* write at the end of the file */
+ fseek($file_handle, SEEK_END, 0);
+ var_dump( ftell($file_handle) ); // expected: 1024
+ var_dump( feof($file_handle) );
+ var_dump( fwrite($file_handle, $data_to_be_written, 200) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /* display the file content, check the file size */
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) );
+ var_dump(md5(file_get_contents($filename)));
+ delete_file($filename); // delete file with name fwrite_variation2.tmp
+
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3bdaf80dae28bc24bb304daa5ffee16c"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3bdaf80dae28bc24bb304daa5ffee16c"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3bdaf80dae28bc24bb304daa5ffee16c"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b188d7c8aa229cbef067e5970f2daba9"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b188d7c8aa229cbef067e5970f2daba9"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "991652c76db8d17c790c702ac0a6dc5f"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "5d4ec23a3d9dd447e2f702d9e0e114d9"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "5d4ec23a3d9dd447e2f702d9e0e114d9"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "5d4ec23a3d9dd447e2f702d9e0e114d9"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation2.phpt b/ext/standard/tests/file/fwrite_variation2.phpt
new file mode 100644
index 0000000..34804b6
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation2.phpt
@@ -0,0 +1,303 @@
+--TEST--
+Test fwrite() function : usage variations - r+, r+b & r+t modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip...Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : r+,r+b,r+t
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("r+", "r+b", "r+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ // create temp file and fill the data of type $file_content_type
+ $filename = dirname(__FILE__)."/fwrite_variation2.tmp"; // this is name of the file
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation", 2);
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+
+ /*overwrite first 400 bytes in the file*/
+ var_dump( ftell($file_handle) ); // expected : 0
+ var_dump( fwrite($file_handle, $data_to_be_written, 400));
+ var_dump( ftell($file_handle) ); // expected: 400
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /*overwrite data in middle of the file*/
+ fseek($file_handle, SEEK_SET, 1024/2 );
+ var_dump( ftell($file_handle)); // expected: 1024/2
+ var_dump( fwrite($file_handle, $data_to_be_written, 200) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /* write at the end of the file */
+ fseek($file_handle, SEEK_END, 0);
+ var_dump( ftell($file_handle) ); // expected: 1024
+ var_dump( feof($file_handle) );
+ var_dump( fwrite($file_handle, $data_to_be_written, 200) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /* display the file content, check the file size */
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) );
+ var_dump(md5(file_get_contents($filename)));
+ delete_file($filename); // delete file with name fwrite_variation2.tmp
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "950b7457d1deb6332f2fc5d42f3129d6"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3bdaf80dae28bc24bb304daa5ffee16c"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3bdaf80dae28bc24bb304daa5ffee16c"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "3bdaf80dae28bc24bb304daa5ffee16c"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b188d7c8aa229cbef067e5970f2daba9"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b188d7c8aa229cbef067e5970f2daba9"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "b188d7c8aa229cbef067e5970f2daba9"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in r+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "5d4ec23a3d9dd447e2f702d9e0e114d9"
+-- Opening file in r+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "5d4ec23a3d9dd447e2f702d9e0e114d9"
+-- Opening file in r+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+int(2)
+bool(false)
+int(200)
+int(202)
+bool(false)
+bool(true)
+int(1024)
+string(32) "5d4ec23a3d9dd447e2f702d9e0e114d9"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation3-win32.phpt b/ext/standard/tests/file/fwrite_variation3-win32.phpt
new file mode 100644
index 0000000..125f88d
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation3-win32.phpt
@@ -0,0 +1,380 @@
+--TEST--
+Test fwrite() function : usage variations - a, ab, at, a+, a+b & a+t mode
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Not valid for Linux');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : a,ab,at,a+,a+b,a+
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("a","ab","at","a+","a+b","a+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ // create temp file and fill it content of type $file_content_type
+ $filename = dirname(__FILE__)."/fwrite_variation3.tmp"; // this is name of the file
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation", 3);
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+ // append the data to the file, starting from current position of the file pointer
+ var_dump( ftell($file_handle) ); // expected: 1024
+ var_dump( fwrite($file_handle,$data_to_be_written,400) );
+ var_dump( ftell($file_handle) ); // expected: 1024 + 400
+ var_dump( feof($file_handle) ); // expected : true
+
+ /*overwrite data in middle of the file*/
+ fseek($file_handle, SEEK_SET, (1024 + 400)/2 );
+ var_dump( ftell($file_handle)); // expected: (1024 + 400)/2
+ var_dump( fwrite($file_handle, $data_to_be_written, 200) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /* check the filesize and display file content */
+ // close the file, get the size and content of the file.
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) );
+ var_dump(md5(file_get_contents($filename)));
+ // delete the file created
+ delete_file($filename); // delete file with name fwrite_variation3.tmp
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1690)
+string(32) "656648355b64df6fded53b12fb355ab8"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1690)
+string(32) "656648355b64df6fded53b12fb355ab8"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation3.phpt b/ext/standard/tests/file/fwrite_variation3.phpt
new file mode 100644
index 0000000..7d635fd
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation3.phpt
@@ -0,0 +1,381 @@
+--TEST--
+Test fwrite() function : usage variations - a, ab, at, a+, a+b & a+t modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip...Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : a,ab,at,a+,a+b,a+t
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("a","ab","at","a+","a+b","a+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ // create temp file and fill it content of type $file_content_type
+ $filename = dirname(__FILE__)."/fwrite_variation3.tmp"; // this is name of the file
+ create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation", 3);
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+
+ // append the data to the file, starting from current position of the file pointer
+ var_dump( ftell($file_handle) ); // expected: 1024
+ var_dump( fwrite($file_handle,$data_to_be_written,400) );
+ var_dump( ftell($file_handle) ); // expected: 1024 + 400
+ var_dump( feof($file_handle) ); // expected : true
+
+ /*overwrite data in middle of the file*/
+ fseek($file_handle, SEEK_SET, (1024 + 400)/2 );
+ var_dump( ftell($file_handle)); // expected: (1024 + 400)/2
+ var_dump( fwrite($file_handle, $data_to_be_written, 200) );
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); //Expecting bool(false)
+
+ /* check the filesize and display file content */
+ // close the file, get the size and content of the file.
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) );
+ var_dump(md5(file_get_contents($filename)));
+ // delete the file created
+ delete_file($filename); // delete file with name fwrite_variation3.tmp
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "59ce5bf03b69069d00d6354bdc969ff6"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "dbd9dffd809d82e299bc1e5c55087f3b"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "3f0a483fe8a2f405677844e0b1af6cf4"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in a --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in ab --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in at --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in a+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in a+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+-- Opening file in a+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+int(400)
+int(200)
+int(600)
+bool(false)
+bool(true)
+int(1624)
+string(32) "ea0c0bfa0b10aa8e614fd33ffe295cb9"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation4-win32.phpt b/ext/standard/tests/file/fwrite_variation4-win32.phpt
new file mode 100644
index 0000000..ed2114e
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation4-win32.phpt
@@ -0,0 +1,275 @@
+--TEST--
+Test fwrite() function : usage variations - x, xb, xt, x+, x+b & x+t modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Not valid for Linux');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : x, xb, xt, x+, x+b, x+t
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("x","xb","xt","x+","x+b","x+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ $filename = dirname(__FILE__)."/fwrite_variation4.tmp"; // this is name of the file
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+ // write data to the file
+ var_dump( ftell($file_handle) );
+ var_dump( fwrite($file_handle,$data_to_be_written,400));
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); // expected: true
+
+ //check the filesize and content
+ // close the file, get the size and content of the file.
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) );
+ var_dump(md5(file_get_contents($filename)));
+ // delete the file created
+ delete_file($filename); // delete file with name fwrite_variation4.tmp
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(444)
+string(32) "c96531f6b4c8d9e829c25b87f96ea86e"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(444)
+string(32) "c96531f6b4c8d9e829c25b87f96ea86e"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation4.phpt b/ext/standard/tests/file/fwrite_variation4.phpt
new file mode 100644
index 0000000..eefc2f8
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation4.phpt
@@ -0,0 +1,275 @@
+--TEST--
+Test fwrite() function : usage variations - x, xb, xt, x+, x+b & x+t modes
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip...Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: int fwrite ( resource $handle,string string, [, int $length] );
+ Description: fwrite() writes the contents of string to the file stream pointed to by handle.
+ If the length arquement is given,writing will stop after length bytes have been
+ written or the end of string reached, whichever comes first.
+ fwrite() returns the number of bytes written or FALSE on error
+*/
+
+
+echo "*** Testing fwrite() various operations ***\n";
+
+// include the file.inc for Function: function delete_file($filename)
+include ("file.inc");
+
+/*
+ Test fwrite with file opened in mode : x, xb, xt, x+, x+b, x+t
+ File having content of type numeric, text,text_with_new_line & alphanumeric
+*/
+
+$file_modes = array("x","xb","xt","x+","x+b","x+t");
+$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
+
+
+foreach($file_content_types as $file_content_type) {
+ echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n";
+
+ /* open the file using $files_modes and perform fwrite() on it */
+ foreach($file_modes as $file_mode) {
+ echo "-- Opening file in $file_mode --\n";
+
+ $filename = dirname(__FILE__)."/fwrite_variation4.tmp"; // this is name of the file
+
+ $file_handle = fopen($filename, $file_mode);
+ if(!$file_handle) {
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024
+
+ /* Write the data into the file, verify it by checking the file pointer position, eof position,
+ filesize & by displaying the content */
+ // write data to the file
+ var_dump( ftell($file_handle) );
+ var_dump( fwrite($file_handle,$data_to_be_written,400));
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) ); // expected: true
+
+ //check the filesize and content
+ // close the file, get the size and content of the file.
+ var_dump( fclose($file_handle) );
+ clearstatcache();//clears file status cache
+ var_dump( filesize($filename) );
+ var_dump(md5(file_get_contents($filename)));
+ // delete the file created
+ delete_file($filename); // delete file with name fwrite_variation4.tmp
+ } // end of inner foreach loop
+} // end of outer foreach loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fwrite() various operations ***
+
+-- Testing fwrite() with file having content of type numeric --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "f255efe87ebdf755e515868cea9ad24b"
+
+-- Testing fwrite() with file having content of type text --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "c2244282eeca7c2d32d0dacf21e19432"
+
+-- Testing fwrite() with file having content of type text_with_new_line --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "fa6c79b925c2fc754b9d063c6de1d8df"
+
+-- Testing fwrite() with file having content of type alphanumeric --
+-- Opening file in x --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in xb --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in xt --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in x+ --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in x+b --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+-- Opening file in x+t --
+int(0)
+int(400)
+int(400)
+bool(false)
+bool(true)
+int(400)
+string(32) "b2a123e1d84e6a03c8520aff7689219e"
+Done
diff --git a/ext/standard/tests/file/fwrite_variation5.phpt b/ext/standard/tests/file/fwrite_variation5.phpt
new file mode 100644
index 0000000..b12af31
--- /dev/null
+++ b/ext/standard/tests/file/fwrite_variation5.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test fwrite() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int fwrite(resource fp, string str [, int length])
+ * Description: Binary-safe file write
+ * Source code: ext/standard/file.c
+ * Alias to functions: bzwrite fputs gzwrite
+ */
+
+echo "*** Testing fwrite() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+$filename = __DIR__ . '/fwriteVar5.tmp';
+
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 str
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $fp = fopen($filename,'w');
+ fwrite($fp, $value);
+ fclose($fp);
+ readfile($filename);
+};
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing fwrite() : usage variation ***
+
+--int 0--
+0
+--int 1--
+1
+--int 12345--
+12345
+--int -12345--
+-2345
+--float 10.5--
+10.5
+--float -10.5--
+-10.5
+--float 12.3456789000e10--
+123456789000
+--float -12.3456789000e10--
+-123456789000
+--float .5--
+0.5
+--empty array--
+Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d)
+
+--int indexed array--
+Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d)
+
+--associative array--
+Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d)
+
+--nested arrays--
+Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d)
+
+--uppercase NULL--
+
+--lowercase null--
+
+--lowercase true--
+1
+--lowercase false--
+
+--uppercase TRUE--
+1
+--uppercase FALSE--
+
+--empty string DQ--
+
+--empty string SQ--
+
+--instance of classWithToString--
+Class A object
+--instance of classWithoutToString--
+Error: 2 - fwrite() expects parameter 2 to be string, object given, %s(%d)
+
+--undefined var--
+
+--unset var--
+===DONE===
+
diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt
new file mode 100644
index 0000000..b67195b
--- /dev/null
+++ b/ext/standard/tests/file/get_current_user.phpt
@@ -0,0 +1,15 @@
+--TEST--
+get_current_user() tests
+--FILE--
+<?php
+
+var_dump(get_current_user("blah"));
+var_dump(get_current_user());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+string(%d) %s
+Done
diff --git a/ext/standard/tests/file/glob_basic.phpt b/ext/standard/tests/file/glob_basic.phpt
new file mode 100644
index 0000000..fc269c4
--- /dev/null
+++ b/ext/standard/tests/file/glob_basic.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test glob() function: basic functions
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+echo "*** Testing glob() : basic functions ***\n";
+
+$file_path = dirname(__FILE__);
+
+// temp dirname used here
+$dirname = "$file_path/glob_basic";
+
+// temp dir created
+mkdir($dirname);
+
+// temp files created
+$fp = fopen("$dirname/wonder12345", "w");
+fclose($fp);
+$fp = fopen("$dirname/wonder.txt", "w");
+fclose($fp);
+$fp = fopen("$dirname/file.text", "w");
+fclose($fp);
+
+// glob() with default arguments
+sort_var_dump( glob($dirname."/*") );
+sort_var_dump( glob($dirname."/*.txt") );
+sort_var_dump( glob($dirname."/*.t?t") );
+sort_var_dump( glob($dirname."/*.t*t") );
+sort_var_dump( glob($dirname."/*.?") );
+sort_var_dump( glob($dirname."/*.*") );
+
+echo "Done\n";
+
+function sort_var_dump($results) {
+ sort($results);
+ var_dump($results);
+}
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/glob_basic/wonder12345");
+unlink("$file_path/glob_basic/wonder.txt");
+unlink("$file_path/glob_basic/file.text");
+rmdir("$file_path/glob_basic/");
+?>
+--EXPECTF--
+*** Testing glob() : basic functions ***
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_basic/file.text"
+ [1]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+ [2]=>
+ string(%d) "%s/glob_basic/wonder12345"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_basic/file.text"
+ [1]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+array(0) {
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_basic/file.text"
+ [1]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+Done
diff --git a/ext/standard/tests/file/glob_error.phpt b/ext/standard/tests/file/glob_error.phpt
new file mode 100644
index 0000000..546b40d
--- /dev/null
+++ b/ext/standard/tests/file/glob_error.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test glob() function: error conditions
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+$file_path = dirname(__FILE__);
+
+// temp dir created
+mkdir("$file_path/glob_error");
+// temp file created
+$fp = fopen("$file_path/glob_error/wonder12345", "w");
+fclose($fp);
+
+echo "*** Testing glob() : error conditions ***\n";
+
+echo "-- Testing glob() with unexpected no. of arguments --\n";
+var_dump( glob() ); // args < expected
+var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", GLOB_ERR, 3) ); // args > expected
+
+echo "\n-- Testing glob() with invalid arguments --\n";
+var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", '') );
+var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", "string") );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+// temp file deleted
+unlink(dirname(__FILE__)."/glob_error/wonder12345");
+// temp dir deleted
+rmdir(dirname(__FILE__)."/glob_error");
+?>
+--EXPECTF--
+*** Testing glob() : error conditions ***
+-- Testing glob() with unexpected no. of arguments --
+
+Warning: glob() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: glob() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing glob() with invalid arguments --
+
+Warning: glob() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: glob() expects parameter 2 to be long, string given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/file/glob_error_002-win32.phpt b/ext/standard/tests/file/glob_error_002-win32.phpt
new file mode 100644
index 0000000..a61efd1
--- /dev/null
+++ b/ext/standard/tests/file/glob_error_002-win32.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test glob() function: error condition - pattern too long.
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+echo "*** Testing glob() : error condition - pattern too long. ***\n";
+
+var_dump(glob(str_repeat('x', 3000)));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing glob() : error condition - pattern too long. ***
+
+Warning: glob(): Pattern exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt
new file mode 100644
index 0000000..5027ac0
--- /dev/null
+++ b/ext/standard/tests/file/glob_variation-win32.phpt
@@ -0,0 +1,465 @@
+--TEST--
+Test glob() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+echo "*** Testing glob() : usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+
+// temp dir created
+mkdir("$file_path/glob_variation");
+mkdir("$file_path/glob_variation/wonder");
+
+// temp files created
+$fp = fopen("$file_path/glob_variation/wonder12345", "w");
+fclose($fp);
+$fp = fopen("$file_path/glob_variation/wonder;123456", "w");
+fclose($fp);
+
+$patterns = array (
+ "$file_path/glob_variation/*der*",
+ "$file_path/glob_variation/?onder*",
+ "$file_path/glob_variation/w*der?*",
+ "$file_path/glob_variation/*der5",
+ "$file_path/glob_variation/??onder*",
+ "$file_path/glob_variation/***der***",
+ "$file_path/glob_variation/++onder*",
+ "$file_path/glob_variation/WONDER5\0",
+ '$file_path/glob_variation/wonder5',
+ "$file_path/glob_variation/?wonder?",
+ "$file_path/glob_variation/wonder?",
+ TRUE // boolean true
+);
+$counter = 1;
+/* loop through $patterns to match each $pattern with the files created
+ using glob() */
+foreach($patterns as $pattern) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ $counter++;
+}
+
+echo "\n*** Testing glob() with pattern within braces ***\n";
+var_dump( glob("$file_path/glob_variation/*{5}", GLOB_BRACE) );
+
+// delete temp files and dir
+unlink("$file_path/glob_variation/wonder12345");
+unlink("$file_path/glob_variation/wonder;123456");
+rmdir("$file_path/glob_variation/wonder");
+rmdir("$file_path/glob_variation");
+
+echo "\n*** Testing glob() on directories ***\n";
+// temp dir created to check for pattern matching the sub dir created in it
+mkdir("$file_path/glob_variation/wonder1/wonder2", 0777, true);
+
+$counter = 1;
+/* loop through $patterns to match each $pattern with the directories created
+ using glob() */
+foreach($patterns as $pattern) {
+ echo "-- Iteration $counter --\n";
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/glob_variation/wonder1/wonder2");
+rmdir("$file_path/glob_variation/wonder1/");
+rmdir("$file_path/glob_variation/");
+?>
+--EXPECTF--
+*** Testing glob() : usage variations ***
+
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder\"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 2 --
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder\"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/*der5"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 5 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/??onder*"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 6 --
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder\"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 7 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/++onder*"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 8 --
+
+Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
+NULL
+
+-- Iteration 9 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "$file_path/glob_variation/wonder5"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/?wonder?"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 11 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder?"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 12 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "1"
+}
+array(0) {
+}
+array(0) {
+}
+
+*** Testing glob() with pattern within braces ***
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+}
+
+*** Testing glob() on directories ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 4 --
+array(0) {
+}
+-- Iteration 5 --
+array(0) {
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 7 --
+array(0) {
+}
+-- Iteration 8 --
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d
+NULL
+-- Iteration 9 --
+array(0) {
+}
+-- Iteration 10 --
+array(0) {
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 12 --
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt
new file mode 100644
index 0000000..00fd6ff
--- /dev/null
+++ b/ext/standard/tests/file/glob_variation.phpt
@@ -0,0 +1,465 @@
+--TEST--
+Test glob() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+echo "*** Testing glob() : usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+
+// temp dir created
+mkdir("$file_path/glob_variation");
+mkdir("$file_path/glob_variation/wonder");
+
+// temp files created
+$fp = fopen("$file_path/glob_variation/wonder12345", "w");
+fclose($fp);
+$fp = fopen("$file_path/glob_variation/wonder;123456", "w");
+fclose($fp);
+
+$patterns = array (
+ "$file_path/glob_variation/*der*",
+ "$file_path/glob_variation/?onder*",
+ "$file_path/glob_variation/w*der?*",
+ "$file_path/glob_variation/*der5",
+ "$file_path/glob_variation/??onder*",
+ "$file_path/glob_variation/***der***",
+ "$file_path/glob_variation/++onder*",
+ "$file_path/glob_variation/WONDER5\0",
+ '$file_path/glob_variation/wonder5',
+ "$file_path/glob_variation/?wonder?",
+ "$file_path/glob_variation/wonder?",
+ TRUE // boolean true
+);
+$counter = 1;
+/* loop through $patterns to match each $pattern with the files created
+ using glob() */
+foreach($patterns as $pattern) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ $counter++;
+}
+
+echo "\n*** Testing glob() with pattern within braces ***\n";
+var_dump( glob("$file_path/glob_variation/*{5}", GLOB_BRACE) );
+
+// delete temp files and dir
+unlink("$file_path/glob_variation/wonder12345");
+unlink("$file_path/glob_variation/wonder;123456");
+rmdir("$file_path/glob_variation/wonder");
+rmdir("$file_path/glob_variation");
+
+echo "\n*** Testing glob() on directories ***\n";
+// temp dir created to check for pattern matching the sub dir created in it
+mkdir("$file_path/glob_variation/wonder1/wonder2", 0777, true);
+
+$counter = 1;
+/* loop through $patterns to match each $pattern with the directories created
+ using glob() */
+foreach($patterns as $pattern) {
+ echo "-- Iteration $counter --\n";
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/glob_variation/wonder1/wonder2");
+rmdir("$file_path/glob_variation/wonder1/");
+rmdir("$file_path/glob_variation/");
+?>
+--EXPECTF--
+*** Testing glob() : usage variations ***
+
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder/"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 2 --
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder/"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/*der5"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 5 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/??onder*"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 6 --
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder/"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder"
+ [1]=>
+ string(%d) "%s/glob_variation/wonder12345"
+ [2]=>
+ string(%d) "%s/glob_variation/wonder;123456"
+}
+
+-- Iteration 7 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/++onder*"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 8 --
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+-- Iteration 9 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "$file_path/glob_variation/wonder5"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/?wonder?"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 11 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder?"
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 12 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(%d) "1"
+}
+array(0) {
+}
+array(0) {
+}
+
+*** Testing glob() with pattern within braces ***
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder12345"
+}
+
+*** Testing glob() on directories ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 4 --
+array(0) {
+}
+-- Iteration 5 --
+array(0) {
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 7 --
+array(0) {
+}
+-- Iteration 8 --
+
+Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 9 --
+array(0) {
+}
+-- Iteration 10 --
+array(0) {
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_variation/wonder1"
+}
+-- Iteration 12 --
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/file/glob_variation2.phpt b/ext/standard/tests/file/glob_variation2.phpt
new file mode 100644
index 0000000..f95fd17
--- /dev/null
+++ b/ext/standard/tests/file/glob_variation2.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test glob() function with relative path
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+$file_path = dirname(__FILE__);
+
+// temp dirname used here
+$dir_name = 'glob_test';
+
+// create temp directory
+mkdir("$file_path/$dir_name");
+
+// create temp file
+$fp = fopen("$file_path/$dir_name/file.text", "w");
+fclose($fp);
+
+echo "Testing glob() with relative paths:\n";
+
+chdir("$file_path/$dir_name");
+var_dump( glob("./*") );
+var_dump( glob("../$dir_name/*"));
+
+chdir("$file_path");
+var_dump( glob("$dir_name/*"));
+var_dump( glob("$dir_name"));
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/glob_test/file.text");
+rmdir("$file_path/glob_test/");
+?>
+--EXPECT--
+Testing glob() with relative paths:
+array(1) {
+ [0]=>
+ string(11) "./file.text"
+}
+array(1) {
+ [0]=>
+ string(22) "../glob_test/file.text"
+}
+array(1) {
+ [0]=>
+ string(19) "glob_test/file.text"
+}
+array(1) {
+ [0]=>
+ string(9) "glob_test"
+}
+Done
diff --git a/ext/standard/tests/file/include_streams.phpt b/ext/standard/tests/file/include_streams.phpt
new file mode 100644
index 0000000..e459c6a
--- /dev/null
+++ b/ext/standard/tests/file/include_streams.phpt
@@ -0,0 +1,130 @@
+--TEST--
+Stream wrappers in include_path
+--FILE--
+<?php
+$data1 = $data2 = $data3 = $data4 = $data5 = $data6 = <<<'EOD'
+<?php echo __FILE__ . "\n";?>
+
+EOD;
+/*<?*/
+
+class mystream
+{
+ public $path;
+ public $mode;
+ public $options;
+
+ public $position;
+ public $varname;
+
+ function url_stat($path, $flags) {
+ return array();
+ }
+
+ function stream_stat() {
+ return array();
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $this->path = $path;
+ $this->mode = $mode;
+ $this->options = $options;
+
+ $split = parse_url($path);
+ if ($split["host"] !== b"GLOBALS" ||
+ empty($split["path"]) ||
+ empty($GLOBALS[substr($split["path"],1)])) {
+ return false;
+ }
+ $this->varname = substr($split["path"],1);
+
+ if (strchr($mode, 'a'))
+ $this->position = strlen($GLOBALS[$this->varname]);
+ else
+ $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_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;
+ }
+ }
+
+}
+
+if (!stream_wrapper_register("test", "mystream")) {
+ die("test wrapper registration failed");
+}
+
+echo file_get_contents("test://GLOBALS/data1");
+include("test://GLOBALS/data1");
+include_once("test://GLOBALS/data2");
+include_once("test://GLOBALS/data2");
+$include_path = get_include_path();
+set_include_path($include_path . PATH_SEPARATOR . "test://GLOBALS");
+echo file_get_contents("data3", true);
+include("data3");
+include_once("data4");
+include_once("data4");
+set_include_path("test://GLOBALS" . PATH_SEPARATOR . $include_path);
+echo file_get_contents("data5", true);
+include("data5");
+include_once("data6");
+include_once("data6");
+?>
+--EXPECT--
+<?php echo __FILE__ . "\n";?>
+test://GLOBALS/data1
+test://GLOBALS/data2
+<?php echo __FILE__ . "\n";?>
+test://GLOBALS/data3
+test://GLOBALS/data4
+<?php echo __FILE__ . "\n";?>
+test://GLOBALS/data5
+test://GLOBALS/data6
diff --git a/ext/standard/tests/file/include_userstream_001.phpt b/ext/standard/tests/file/include_userstream_001.phpt
new file mode 100644
index 0000000..d805afd
--- /dev/null
+++ b/ext/standard/tests/file/include_userstream_001.phpt
@@ -0,0 +1,82 @@
+--TEST--
+User streams and include()
+--INI--
+allow_url_fopen=1
+allow_url_include=0
+--FILE--
+<?php
+class test {
+ private $data = '<?php echo "Hello World\n";?>';
+ private $pos;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ if (strchr($mode, 'a'))
+ $this->pos = strlen($this->data);
+ else
+ $this->po = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($this->data, $this->pos, $count);
+ $this->pos += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ return $this->pos;
+ }
+
+ function stream_eof()
+ {
+ return $this->pos >= strlen($this->data);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < $this->data && $offset >= 0) {
+ $this->pos = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->pos += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->pos = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+
+}
+
+stream_register_wrapper("test1", "test", STREAM_IS_URL);
+stream_register_wrapper("test2", "test");
+echo @file_get_contents("test1://hello"),"\n";
+@include "test1://hello";
+echo @file_get_contents("test2://hello"),"\n";
+@include "test2://hello";
+--EXPECT--
+<?php echo "Hello World\n";?>
+<?php echo "Hello World\n";?>
+Hello World
diff --git a/ext/standard/tests/file/include_userstream_002.phpt b/ext/standard/tests/file/include_userstream_002.phpt
new file mode 100644
index 0000000..4841d39
--- /dev/null
+++ b/ext/standard/tests/file/include_userstream_002.phpt
@@ -0,0 +1,106 @@
+--TEST--
+local user streams must not be able to open() url's
+--INI--
+allow_url_fopen=1
+allow_url_include=0
+--FILE--
+<?php
+class test {
+ private $data = '<?php echo "Hello World\n";?>';
+ private $pos;
+ private $stream = null;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ if (strpos($path, "test2://") === 0) {
+ $this->stream = fopen("test1://".substr($path, 8), $mode);
+ return !empty($this->stream);
+ }
+ if (strchr($mode, 'a'))
+ $this->pos = strlen($this->data);
+ else
+ $this->po = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ if (!empty($this->stream)) {
+ return fread($this->stream, $count);
+ }
+ $ret = substr($this->data, $this->pos, $count);
+ $this->pos += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ if (!empty($this->stream)) {
+ return ftell($this->stream);
+ }
+ return $this->pos;
+ }
+
+ function stream_eof()
+ {
+ if (!empty($this->stream)) {
+ return feof($this->stream);
+ }
+ return $this->pos >= strlen($this->data);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ if (!empty($this->stream)) {
+ return fseek($this->stream, $offset, $whence);
+ }
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < $this->data && $offset >= 0) {
+ $this->pos = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->pos += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->pos = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+
+}
+
+stream_register_wrapper("test1", "test", STREAM_IS_URL);
+stream_register_wrapper("test2", "test");
+echo @file_get_contents("test1://hello"),"\n";
+@include "test1://hello";
+echo @file_get_contents("test2://hello"),"\n";
+include "test2://hello";
+--EXPECTF--
+<?php echo "Hello World\n";?>
+<?php echo "Hello World\n";?>
+
+Warning: fopen(): test1:// wrapper is disabled in the server configuration by allow_url_include=0 in %sinclude_userstream_002.php on line 10
+
+Warning: fopen(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_002.php on line 10
+
+Warning: include(test2://hello): failed to open stream: "test::stream_open" call failed in %sinclude_userstream_002.php on line 89
+
+Warning: include(): Failed opening 'test2://hello' for inclusion (include_path='%s') in %sinclude_userstream_002.php on line 89
diff --git a/ext/standard/tests/file/include_userstream_003.phpt b/ext/standard/tests/file/include_userstream_003.phpt
new file mode 100644
index 0000000..2b439cf
--- /dev/null
+++ b/ext/standard/tests/file/include_userstream_003.phpt
@@ -0,0 +1,121 @@
+--TEST--
+allow_url_fopen disabled
+--INI--
+allow_url_fopen=0
+allow_url_include=1
+--FILE--
+<?php
+class test {
+ private $data = '<?php echo "Hello World\n";?>';
+ private $pos;
+ private $stream = null;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ if (strpos($path, "test2://") === 0) {
+ $this->stream = fopen("test1://".substr($path, 8), $mode);
+ return !empty($this->stream);
+ }
+ if (strchr($mode, 'a'))
+ $this->pos = strlen($this->data);
+ else
+ $this->po = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ if (!empty($this->stream)) {
+ return fread($this->stream, $count);
+ }
+ $ret = substr($this->data, $this->pos, $count);
+ $this->pos += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ if (!empty($this->stream)) {
+ return ftell($this->stream);
+ }
+ return $this->pos;
+ }
+
+ function stream_eof()
+ {
+ if (!empty($this->stream)) {
+ return feof($this->stream);
+ }
+ return $this->pos >= strlen($this->data);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ if (!empty($this->stream)) {
+ return fseek($this->stream, $offset, $whence);
+ }
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < $this->data && $offset >= 0) {
+ $this->pos = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->pos += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->pos = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+
+}
+
+stream_register_wrapper("test1", "test", STREAM_IS_URL);
+stream_register_wrapper("test2", "test");
+echo file_get_contents("test1://hello"),"\n";
+include "test1://hello";
+echo file_get_contents("test2://hello"),"\n";
+include "test2://hello";
+--EXPECTF--
+Warning: file_get_contents(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 86
+
+Warning: file_get_contents(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 86
+
+
+Warning: include(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 87
+
+Warning: include(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 87
+
+Warning: include(): Failed opening 'test1://hello' for inclusion (include_path='%s') in %sinclude_userstream_003.php on line 87
+
+Warning: fopen(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 10
+
+Warning: fopen(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 10
+
+Warning: file_get_contents(test2://hello): failed to open stream: "test::stream_open" call failed in %sinclude_userstream_003.php on line 88
+
+
+Warning: fopen(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 10
+
+Warning: fopen(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 10
+
+Warning: include(test2://hello): failed to open stream: "test::stream_open" call failed in %sinclude_userstream_003.php on line 89
+
+Warning: include(): Failed opening 'test2://hello' for inclusion (include_path='%s') in %sinclude_userstream_003.php on line 89 \ No newline at end of file
diff --git a/ext/standard/tests/file/is_dir_basic.phpt b/ext/standard/tests/file/is_dir_basic.phpt
new file mode 100644
index 0000000..7265d50
--- /dev/null
+++ b/ext/standard/tests/file/is_dir_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test is_dir() function: basic functionality
+--FILE--
+<?php
+/* Prototype: bool is_dir ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+echo "*** Testing is_dir(): basic functionality ***\n";
+$file_path = dirname(__FILE__);
+var_dump( is_dir($file_path) );
+clearstatcache();
+var_dump( is_dir(".") );
+var_dump( is_dir(__FILE__) ); // expected: bool(false)
+
+$dir_name = $file_path."/is_dir_basic";
+mkdir($dir_name);
+var_dump( is_dir($dir_name) );
+
+echo "*** Testing is_dir() for its return value type ***\n";
+var_dump( is_bool( is_dir($file_path) ) );
+var_dump( is_bool( is_dir("/no/such/dir") ) );
+
+echo "*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/is_dir_basic";
+rmdir($dir_name);
+?>
+
+--EXPECTF--
+*** Testing is_dir(): basic functionality ***
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+*** Testing is_dir() for its return value type ***
+bool(true)
+bool(true)
+*** Done ***
diff --git a/ext/standard/tests/file/is_dir_error.phpt b/ext/standard/tests/file/is_dir_error.phpt
new file mode 100644
index 0000000..6040767
--- /dev/null
+++ b/ext/standard/tests/file/is_dir_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test is_dir() function: error conditions
+--FILE--
+<?php
+/* Prototype: bool is_dir ( string $filename );
+ * Description: Tells whether the filename is a regular file
+ * Returns TRUE if the filename exists and is a regular file
+ */
+
+echo "*** Testing is_dir() error conditions ***";
+var_dump( is_dir() ); // Zero No. of args
+
+$dir_name = dirname(__FILE__)."/is_dir_error";
+mkdir($dir_name);
+var_dump( is_dir($dir_name, "is_dir_error1") ); // args > expected no.of args
+
+/* Non-existing dir */
+var_dump( is_dir("/no/such/dir") );
+
+echo "*** Done ***";
+?>
+
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/is_dir_error");
+?>
+--EXPECTF--
+*** Testing is_dir() error conditions ***
+Warning: is_dir() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_dir() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/file/is_dir_variation1.phpt b/ext/standard/tests/file/is_dir_variation1.phpt
new file mode 100644
index 0000000..1a0b556
--- /dev/null
+++ b/ext/standard/tests/file/is_dir_variation1.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test is_dir() function: usage variations - dir/subdir
+--FILE--
+<?php
+/* Prototype: bool is_dir ( string $dirname );
+ Description: Tells whether the dirname is a directory
+ Returns TRUE if the dirname exists and is a directory, FALSE otherwise.
+*/
+
+/* Testing is_dir() with base and sub dirs */
+
+$file_path = dirname(__FILE__);
+
+echo "-- Testing is_dir() with an empty dir --\n";
+$dirname = $file_path."/is_dir_variation1";
+mkdir($dirname);
+var_dump( is_dir($dirname) );
+clearstatcache();
+
+echo "-- Testing is_dir() with a subdir in base dir --\n";
+$subdirname = $dirname."/is_dir_variation1_sub";
+mkdir($subdirname);
+var_dump( is_dir($subdirname) );
+var_dump( is_dir($dirname) );
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/is_dir_variation1";
+rmdir($dir_name."/is_dir_variation1_sub");
+rmdir($dir_name);
+?>
+--EXPECTF--
+-- Testing is_dir() with an empty dir --
+bool(true)
+-- Testing is_dir() with a subdir in base dir --
+bool(true)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_dir_variation2.phpt b/ext/standard/tests/file/is_dir_variation2.phpt
new file mode 100644
index 0000000..65efeab
--- /dev/null
+++ b/ext/standard/tests/file/is_dir_variation2.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test is_dir() function: usage variations - links
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+--FILE--
+<?php
+/* Prototype: bool is_dir ( string $dirname );
+ Description: Tells whether the dirname is a directory
+ Returns TRUE if the dirname exists and is a directory, FALSE otherwise.
+*/
+
+/* Testing is_dir() with dir, soft & hard link to dir,
+ and with file, soft & hard link to file */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing is_dir() with dir and links to dir ***\n";
+echo "-- With dir --\n";
+$dirname = $file_path."/is_dir_variation2";
+mkdir($dirname);
+var_dump( is_dir($dirname) );
+clearstatcache();
+
+echo "-- With symlink --\n";
+symlink($file_path."/is_dir_variation2", $file_path."/is_dir_variation2_symlink");
+var_dump( is_dir($file_path."/is_dir_variation2_symlink") ); //is_dir() resolves symlinks
+clearstatcache();
+
+echo "-- With hardlink --";
+link($file_path."/is_dir_variation2", $file_path."/is_dir_variation2_link"); //Not permitted to create hard-link to a dir
+var_dump( is_dir($file_path."/is_dir_variation2_link") );
+clearstatcache();
+
+echo "\n*** Testing is_dir() with file and links to a file ***\n";
+echo "-- With file --\n";
+$filename = $file_path."/is_dir_variation2.tmp";
+fclose( fopen($filename, "w") );
+var_dump( is_dir($filename) );
+clearstatcache();
+
+echo "-- With symlink --\n";
+symlink($file_path."/is_dir_variation2.tmp", $file_path."/is_dir_variation2_symlink.tmp");
+var_dump( is_dir($file_path."/is_dir_variation2_symlink.tmp") );
+clearstatcache();
+
+echo "-- With hardlink --\n";
+link($file_path."/is_dir_variation2.tmp", $file_path."/is_dir_variation2_link.tmp");
+var_dump( is_dir($file_path."/is_dir_variation2_link.tmp") );
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+if(file_exists($file_path."/is_dir_variation2_symlink")) {
+ unlink($file_path."/is_dir_variation2_symlink");
+}
+if(file_exists($file_path."/is_dir_variation2_symlink")) {
+ unlink($file_path."/is_dir_variation2_symlink");
+}
+if(file_exists($file_path."/is_dir_variation2_symlink.tmp")) {
+ unlink($file_path."/is_dir_variation2_symlink.tmp");
+}
+if(file_exists($file_path."/is_dir_variation2_link.tmp")) {
+ unlink($file_path."/is_dir_variation2_link.tmp");
+}
+if(file_exists($file_path."/is_dir_variation2.tmp")) {
+ unlink($file_path."/is_dir_variation2.tmp");
+}
+if(file_exists($file_path."/is_dir_variation2")) {
+ rmdir($file_path."/is_dir_variation2");
+}
+?>
+--EXPECTF--
+*** Testing is_dir() with dir and links to dir ***
+-- With dir --
+bool(true)
+-- With symlink --
+bool(true)
+-- With hardlink --
+Warning: link(): %s in %s on line %d
+bool(false)
+
+*** Testing is_dir() with file and links to a file ***
+-- With file --
+bool(false)
+-- With symlink --
+bool(false)
+-- With hardlink --
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt
new file mode 100644
index 0000000..41826ad
--- /dev/null
+++ b/ext/standard/tests/file/is_dir_variation3.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test is_dir() function: usage variations - invalid arguments
+--FILE--
+<?php
+/* Prototype: bool is_dir ( string $dirname );
+ Description: Tells whether the dirname is a directory
+ Returns TRUE if the dirname exists and is a directory, FALSE otherwise.
+*/
+
+/* Passing invalid arguments to is_dir() */
+
+$dir_handle = opendir( dirname(__FILE__) );
+
+echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n";
+$dirnames = array(
+ /* Invalid dirnames */
+ -2.34555,
+ TRUE,
+ FALSE,
+ NULL,
+ " ",
+ $dir_handle,
+
+ /* scalars */
+ 0,
+ 1234
+);
+
+/* loop through to test each element the above array */
+foreach($dirnames as $dirname) {
+ var_dump( is_dir($dirname) );
+}
+closedir($dir_handle);
+
+echo "\n*** Done ***";
+?>
+--EXPECTF--
+*** Testing is_dir() with Invalid arguments: expected bool(false) ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+bool(false)
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt
new file mode 100644
index 0000000..5c0be48
--- /dev/null
+++ b/ext/standard/tests/file/is_dir_variation4.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Test is_dir() function: usage variations - diff. path notations
+--FILE--
+<?php
+/* Prototype: bool is_dir ( string $dirname );
+ Description: Tells whether the dirname is a directory
+ Returns TRUE if the dirname exists and is a directory, FALSE otherwise.
+*/
+
+/* Passing dir names with different notations, using slashes, wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing is_dir() with different notations of dir names ***";
+$dir_name = "/is_dir_variation4";
+mkdir($file_path.$dir_name);
+
+$dirs_arr = array(
+ "is_dir_variation4",
+ "./is_dir_variation4",
+
+ /* Testing a file trailing slash */
+ "is_dir_variation4/",
+ "./is_dir_variation4/",
+
+ /* Testing file with double trailing slashes */
+ "is_dir_variation4//",
+ "./is_dir_variation4//",
+ ".//is_dir_variation4//",
+ "is_dir_vari*",
+
+ /* Testing Binary safe */
+ "./is_dir_variation4/".chr(0),
+ "is_dir_variation4\0"
+);
+
+$count = 1;
+/* loop through to test each element the above array */
+foreach($dirs_arr as $dir) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( is_dir($file_path."/".$dir ) );
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/is_dir_variation4";
+rmdir($dir_name);
+?>
+--EXPECTF--
+*** Testing is_dir() with different notations of dir names ***
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+
+Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_executable_basic-win32.phpt b/ext/standard/tests/file/is_executable_basic-win32.phpt
new file mode 100644
index 0000000..1462368
--- /dev/null
+++ b/ext/standard/tests/file/is_executable_basic-win32.phpt
@@ -0,0 +1,1064 @@
+--TEST--
+Test is_executable() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_executable ( string $filename );
+ Description: Tells whether the filename is executable
+*/
+require dirname(__FILE__).'/file.inc';
+
+echo "*** Testing is_executable(): basic functionality ***\n";
+
+// create a file
+$filename = dirname(__FILE__)."/is_executable.tmp";
+create_file($filename);
+
+$counter = 1;
+/* loop to check if the file with new mode is executable
+ using is_executable() */
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of file to $mode --\n";
+ chmod($filename, $mode); // change mode of file
+ var_dump( is_executable($filename) );
+ $counter++;
+ clearstatcache();
+}
+
+// delete the temp file
+delete_file($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_executable(): basic functionality ***
+-- Changing mode of file to 0 --
+bool(false)
+-- Changing mode of file to 1 --
+bool(false)
+-- Changing mode of file to 2 --
+bool(false)
+-- Changing mode of file to 3 --
+bool(false)
+-- Changing mode of file to 4 --
+bool(false)
+-- Changing mode of file to 5 --
+bool(false)
+-- Changing mode of file to 6 --
+bool(false)
+-- Changing mode of file to 7 --
+bool(false)
+-- Changing mode of file to 8 --
+bool(false)
+-- Changing mode of file to 9 --
+bool(false)
+-- Changing mode of file to 10 --
+bool(false)
+-- Changing mode of file to 11 --
+bool(false)
+-- Changing mode of file to 12 --
+bool(false)
+-- Changing mode of file to 13 --
+bool(false)
+-- Changing mode of file to 14 --
+bool(false)
+-- Changing mode of file to 15 --
+bool(false)
+-- Changing mode of file to 16 --
+bool(false)
+-- Changing mode of file to 17 --
+bool(false)
+-- Changing mode of file to 18 --
+bool(false)
+-- Changing mode of file to 19 --
+bool(false)
+-- Changing mode of file to 20 --
+bool(false)
+-- Changing mode of file to 21 --
+bool(false)
+-- Changing mode of file to 22 --
+bool(false)
+-- Changing mode of file to 23 --
+bool(false)
+-- Changing mode of file to 24 --
+bool(false)
+-- Changing mode of file to 25 --
+bool(false)
+-- Changing mode of file to 26 --
+bool(false)
+-- Changing mode of file to 27 --
+bool(false)
+-- Changing mode of file to 28 --
+bool(false)
+-- Changing mode of file to 29 --
+bool(false)
+-- Changing mode of file to 30 --
+bool(false)
+-- Changing mode of file to 31 --
+bool(false)
+-- Changing mode of file to 32 --
+bool(false)
+-- Changing mode of file to 33 --
+bool(false)
+-- Changing mode of file to 34 --
+bool(false)
+-- Changing mode of file to 35 --
+bool(false)
+-- Changing mode of file to 36 --
+bool(false)
+-- Changing mode of file to 37 --
+bool(false)
+-- Changing mode of file to 38 --
+bool(false)
+-- Changing mode of file to 39 --
+bool(false)
+-- Changing mode of file to 40 --
+bool(false)
+-- Changing mode of file to 41 --
+bool(false)
+-- Changing mode of file to 42 --
+bool(false)
+-- Changing mode of file to 43 --
+bool(false)
+-- Changing mode of file to 44 --
+bool(false)
+-- Changing mode of file to 45 --
+bool(false)
+-- Changing mode of file to 46 --
+bool(false)
+-- Changing mode of file to 47 --
+bool(false)
+-- Changing mode of file to 48 --
+bool(false)
+-- Changing mode of file to 49 --
+bool(false)
+-- Changing mode of file to 50 --
+bool(false)
+-- Changing mode of file to 51 --
+bool(false)
+-- Changing mode of file to 52 --
+bool(false)
+-- Changing mode of file to 53 --
+bool(false)
+-- Changing mode of file to 54 --
+bool(false)
+-- Changing mode of file to 55 --
+bool(false)
+-- Changing mode of file to 56 --
+bool(false)
+-- Changing mode of file to 57 --
+bool(false)
+-- Changing mode of file to 58 --
+bool(false)
+-- Changing mode of file to 59 --
+bool(false)
+-- Changing mode of file to 60 --
+bool(false)
+-- Changing mode of file to 61 --
+bool(false)
+-- Changing mode of file to 62 --
+bool(false)
+-- Changing mode of file to 63 --
+bool(false)
+-- Changing mode of file to 64 --
+bool(false)
+-- Changing mode of file to 65 --
+bool(false)
+-- Changing mode of file to 66 --
+bool(false)
+-- Changing mode of file to 67 --
+bool(false)
+-- Changing mode of file to 68 --
+bool(false)
+-- Changing mode of file to 69 --
+bool(false)
+-- Changing mode of file to 70 --
+bool(false)
+-- Changing mode of file to 71 --
+bool(false)
+-- Changing mode of file to 72 --
+bool(false)
+-- Changing mode of file to 73 --
+bool(false)
+-- Changing mode of file to 74 --
+bool(false)
+-- Changing mode of file to 75 --
+bool(false)
+-- Changing mode of file to 76 --
+bool(false)
+-- Changing mode of file to 77 --
+bool(false)
+-- Changing mode of file to 78 --
+bool(false)
+-- Changing mode of file to 79 --
+bool(false)
+-- Changing mode of file to 80 --
+bool(false)
+-- Changing mode of file to 81 --
+bool(false)
+-- Changing mode of file to 82 --
+bool(false)
+-- Changing mode of file to 83 --
+bool(false)
+-- Changing mode of file to 84 --
+bool(false)
+-- Changing mode of file to 85 --
+bool(false)
+-- Changing mode of file to 86 --
+bool(false)
+-- Changing mode of file to 87 --
+bool(false)
+-- Changing mode of file to 88 --
+bool(false)
+-- Changing mode of file to 89 --
+bool(false)
+-- Changing mode of file to 90 --
+bool(false)
+-- Changing mode of file to 91 --
+bool(false)
+-- Changing mode of file to 92 --
+bool(false)
+-- Changing mode of file to 93 --
+bool(false)
+-- Changing mode of file to 94 --
+bool(false)
+-- Changing mode of file to 95 --
+bool(false)
+-- Changing mode of file to 96 --
+bool(false)
+-- Changing mode of file to 97 --
+bool(false)
+-- Changing mode of file to 98 --
+bool(false)
+-- Changing mode of file to 99 --
+bool(false)
+-- Changing mode of file to 100 --
+bool(false)
+-- Changing mode of file to 101 --
+bool(false)
+-- Changing mode of file to 102 --
+bool(false)
+-- Changing mode of file to 103 --
+bool(false)
+-- Changing mode of file to 104 --
+bool(false)
+-- Changing mode of file to 105 --
+bool(false)
+-- Changing mode of file to 106 --
+bool(false)
+-- Changing mode of file to 107 --
+bool(false)
+-- Changing mode of file to 108 --
+bool(false)
+-- Changing mode of file to 109 --
+bool(false)
+-- Changing mode of file to 110 --
+bool(false)
+-- Changing mode of file to 111 --
+bool(false)
+-- Changing mode of file to 112 --
+bool(false)
+-- Changing mode of file to 113 --
+bool(false)
+-- Changing mode of file to 114 --
+bool(false)
+-- Changing mode of file to 115 --
+bool(false)
+-- Changing mode of file to 116 --
+bool(false)
+-- Changing mode of file to 117 --
+bool(false)
+-- Changing mode of file to 118 --
+bool(false)
+-- Changing mode of file to 119 --
+bool(false)
+-- Changing mode of file to 120 --
+bool(false)
+-- Changing mode of file to 121 --
+bool(false)
+-- Changing mode of file to 122 --
+bool(false)
+-- Changing mode of file to 123 --
+bool(false)
+-- Changing mode of file to 124 --
+bool(false)
+-- Changing mode of file to 125 --
+bool(false)
+-- Changing mode of file to 126 --
+bool(false)
+-- Changing mode of file to 127 --
+bool(false)
+-- Changing mode of file to 128 --
+bool(false)
+-- Changing mode of file to 129 --
+bool(false)
+-- Changing mode of file to 130 --
+bool(false)
+-- Changing mode of file to 131 --
+bool(false)
+-- Changing mode of file to 132 --
+bool(false)
+-- Changing mode of file to 133 --
+bool(false)
+-- Changing mode of file to 134 --
+bool(false)
+-- Changing mode of file to 135 --
+bool(false)
+-- Changing mode of file to 136 --
+bool(false)
+-- Changing mode of file to 137 --
+bool(false)
+-- Changing mode of file to 138 --
+bool(false)
+-- Changing mode of file to 139 --
+bool(false)
+-- Changing mode of file to 140 --
+bool(false)
+-- Changing mode of file to 141 --
+bool(false)
+-- Changing mode of file to 142 --
+bool(false)
+-- Changing mode of file to 143 --
+bool(false)
+-- Changing mode of file to 144 --
+bool(false)
+-- Changing mode of file to 145 --
+bool(false)
+-- Changing mode of file to 146 --
+bool(false)
+-- Changing mode of file to 147 --
+bool(false)
+-- Changing mode of file to 148 --
+bool(false)
+-- Changing mode of file to 149 --
+bool(false)
+-- Changing mode of file to 150 --
+bool(false)
+-- Changing mode of file to 151 --
+bool(false)
+-- Changing mode of file to 152 --
+bool(false)
+-- Changing mode of file to 153 --
+bool(false)
+-- Changing mode of file to 154 --
+bool(false)
+-- Changing mode of file to 155 --
+bool(false)
+-- Changing mode of file to 156 --
+bool(false)
+-- Changing mode of file to 157 --
+bool(false)
+-- Changing mode of file to 158 --
+bool(false)
+-- Changing mode of file to 159 --
+bool(false)
+-- Changing mode of file to 160 --
+bool(false)
+-- Changing mode of file to 161 --
+bool(false)
+-- Changing mode of file to 162 --
+bool(false)
+-- Changing mode of file to 163 --
+bool(false)
+-- Changing mode of file to 164 --
+bool(false)
+-- Changing mode of file to 165 --
+bool(false)
+-- Changing mode of file to 166 --
+bool(false)
+-- Changing mode of file to 167 --
+bool(false)
+-- Changing mode of file to 168 --
+bool(false)
+-- Changing mode of file to 169 --
+bool(false)
+-- Changing mode of file to 170 --
+bool(false)
+-- Changing mode of file to 171 --
+bool(false)
+-- Changing mode of file to 172 --
+bool(false)
+-- Changing mode of file to 173 --
+bool(false)
+-- Changing mode of file to 174 --
+bool(false)
+-- Changing mode of file to 175 --
+bool(false)
+-- Changing mode of file to 176 --
+bool(false)
+-- Changing mode of file to 177 --
+bool(false)
+-- Changing mode of file to 178 --
+bool(false)
+-- Changing mode of file to 179 --
+bool(false)
+-- Changing mode of file to 180 --
+bool(false)
+-- Changing mode of file to 181 --
+bool(false)
+-- Changing mode of file to 182 --
+bool(false)
+-- Changing mode of file to 183 --
+bool(false)
+-- Changing mode of file to 184 --
+bool(false)
+-- Changing mode of file to 185 --
+bool(false)
+-- Changing mode of file to 186 --
+bool(false)
+-- Changing mode of file to 187 --
+bool(false)
+-- Changing mode of file to 188 --
+bool(false)
+-- Changing mode of file to 189 --
+bool(false)
+-- Changing mode of file to 190 --
+bool(false)
+-- Changing mode of file to 191 --
+bool(false)
+-- Changing mode of file to 192 --
+bool(false)
+-- Changing mode of file to 193 --
+bool(false)
+-- Changing mode of file to 194 --
+bool(false)
+-- Changing mode of file to 195 --
+bool(false)
+-- Changing mode of file to 196 --
+bool(false)
+-- Changing mode of file to 197 --
+bool(false)
+-- Changing mode of file to 198 --
+bool(false)
+-- Changing mode of file to 199 --
+bool(false)
+-- Changing mode of file to 200 --
+bool(false)
+-- Changing mode of file to 201 --
+bool(false)
+-- Changing mode of file to 202 --
+bool(false)
+-- Changing mode of file to 203 --
+bool(false)
+-- Changing mode of file to 204 --
+bool(false)
+-- Changing mode of file to 205 --
+bool(false)
+-- Changing mode of file to 206 --
+bool(false)
+-- Changing mode of file to 207 --
+bool(false)
+-- Changing mode of file to 208 --
+bool(false)
+-- Changing mode of file to 209 --
+bool(false)
+-- Changing mode of file to 210 --
+bool(false)
+-- Changing mode of file to 211 --
+bool(false)
+-- Changing mode of file to 212 --
+bool(false)
+-- Changing mode of file to 213 --
+bool(false)
+-- Changing mode of file to 214 --
+bool(false)
+-- Changing mode of file to 215 --
+bool(false)
+-- Changing mode of file to 216 --
+bool(false)
+-- Changing mode of file to 217 --
+bool(false)
+-- Changing mode of file to 218 --
+bool(false)
+-- Changing mode of file to 219 --
+bool(false)
+-- Changing mode of file to 220 --
+bool(false)
+-- Changing mode of file to 221 --
+bool(false)
+-- Changing mode of file to 222 --
+bool(false)
+-- Changing mode of file to 223 --
+bool(false)
+-- Changing mode of file to 224 --
+bool(false)
+-- Changing mode of file to 225 --
+bool(false)
+-- Changing mode of file to 226 --
+bool(false)
+-- Changing mode of file to 227 --
+bool(false)
+-- Changing mode of file to 228 --
+bool(false)
+-- Changing mode of file to 229 --
+bool(false)
+-- Changing mode of file to 230 --
+bool(false)
+-- Changing mode of file to 231 --
+bool(false)
+-- Changing mode of file to 232 --
+bool(false)
+-- Changing mode of file to 233 --
+bool(false)
+-- Changing mode of file to 234 --
+bool(false)
+-- Changing mode of file to 235 --
+bool(false)
+-- Changing mode of file to 236 --
+bool(false)
+-- Changing mode of file to 237 --
+bool(false)
+-- Changing mode of file to 238 --
+bool(false)
+-- Changing mode of file to 239 --
+bool(false)
+-- Changing mode of file to 240 --
+bool(false)
+-- Changing mode of file to 241 --
+bool(false)
+-- Changing mode of file to 242 --
+bool(false)
+-- Changing mode of file to 243 --
+bool(false)
+-- Changing mode of file to 244 --
+bool(false)
+-- Changing mode of file to 245 --
+bool(false)
+-- Changing mode of file to 246 --
+bool(false)
+-- Changing mode of file to 247 --
+bool(false)
+-- Changing mode of file to 248 --
+bool(false)
+-- Changing mode of file to 249 --
+bool(false)
+-- Changing mode of file to 250 --
+bool(false)
+-- Changing mode of file to 251 --
+bool(false)
+-- Changing mode of file to 252 --
+bool(false)
+-- Changing mode of file to 253 --
+bool(false)
+-- Changing mode of file to 254 --
+bool(false)
+-- Changing mode of file to 255 --
+bool(false)
+-- Changing mode of file to 256 --
+bool(false)
+-- Changing mode of file to 257 --
+bool(false)
+-- Changing mode of file to 258 --
+bool(false)
+-- Changing mode of file to 259 --
+bool(false)
+-- Changing mode of file to 260 --
+bool(false)
+-- Changing mode of file to 261 --
+bool(false)
+-- Changing mode of file to 262 --
+bool(false)
+-- Changing mode of file to 263 --
+bool(false)
+-- Changing mode of file to 264 --
+bool(false)
+-- Changing mode of file to 265 --
+bool(false)
+-- Changing mode of file to 266 --
+bool(false)
+-- Changing mode of file to 267 --
+bool(false)
+-- Changing mode of file to 268 --
+bool(false)
+-- Changing mode of file to 269 --
+bool(false)
+-- Changing mode of file to 270 --
+bool(false)
+-- Changing mode of file to 271 --
+bool(false)
+-- Changing mode of file to 272 --
+bool(false)
+-- Changing mode of file to 273 --
+bool(false)
+-- Changing mode of file to 274 --
+bool(false)
+-- Changing mode of file to 275 --
+bool(false)
+-- Changing mode of file to 276 --
+bool(false)
+-- Changing mode of file to 277 --
+bool(false)
+-- Changing mode of file to 278 --
+bool(false)
+-- Changing mode of file to 279 --
+bool(false)
+-- Changing mode of file to 280 --
+bool(false)
+-- Changing mode of file to 281 --
+bool(false)
+-- Changing mode of file to 282 --
+bool(false)
+-- Changing mode of file to 283 --
+bool(false)
+-- Changing mode of file to 284 --
+bool(false)
+-- Changing mode of file to 285 --
+bool(false)
+-- Changing mode of file to 286 --
+bool(false)
+-- Changing mode of file to 287 --
+bool(false)
+-- Changing mode of file to 288 --
+bool(false)
+-- Changing mode of file to 289 --
+bool(false)
+-- Changing mode of file to 290 --
+bool(false)
+-- Changing mode of file to 291 --
+bool(false)
+-- Changing mode of file to 292 --
+bool(false)
+-- Changing mode of file to 293 --
+bool(false)
+-- Changing mode of file to 294 --
+bool(false)
+-- Changing mode of file to 295 --
+bool(false)
+-- Changing mode of file to 296 --
+bool(false)
+-- Changing mode of file to 297 --
+bool(false)
+-- Changing mode of file to 298 --
+bool(false)
+-- Changing mode of file to 299 --
+bool(false)
+-- Changing mode of file to 300 --
+bool(false)
+-- Changing mode of file to 301 --
+bool(false)
+-- Changing mode of file to 302 --
+bool(false)
+-- Changing mode of file to 303 --
+bool(false)
+-- Changing mode of file to 304 --
+bool(false)
+-- Changing mode of file to 305 --
+bool(false)
+-- Changing mode of file to 306 --
+bool(false)
+-- Changing mode of file to 307 --
+bool(false)
+-- Changing mode of file to 308 --
+bool(false)
+-- Changing mode of file to 309 --
+bool(false)
+-- Changing mode of file to 310 --
+bool(false)
+-- Changing mode of file to 311 --
+bool(false)
+-- Changing mode of file to 312 --
+bool(false)
+-- Changing mode of file to 313 --
+bool(false)
+-- Changing mode of file to 314 --
+bool(false)
+-- Changing mode of file to 315 --
+bool(false)
+-- Changing mode of file to 316 --
+bool(false)
+-- Changing mode of file to 317 --
+bool(false)
+-- Changing mode of file to 318 --
+bool(false)
+-- Changing mode of file to 319 --
+bool(false)
+-- Changing mode of file to 320 --
+bool(false)
+-- Changing mode of file to 321 --
+bool(false)
+-- Changing mode of file to 322 --
+bool(false)
+-- Changing mode of file to 323 --
+bool(false)
+-- Changing mode of file to 324 --
+bool(false)
+-- Changing mode of file to 325 --
+bool(false)
+-- Changing mode of file to 326 --
+bool(false)
+-- Changing mode of file to 327 --
+bool(false)
+-- Changing mode of file to 328 --
+bool(false)
+-- Changing mode of file to 329 --
+bool(false)
+-- Changing mode of file to 330 --
+bool(false)
+-- Changing mode of file to 331 --
+bool(false)
+-- Changing mode of file to 332 --
+bool(false)
+-- Changing mode of file to 333 --
+bool(false)
+-- Changing mode of file to 334 --
+bool(false)
+-- Changing mode of file to 335 --
+bool(false)
+-- Changing mode of file to 336 --
+bool(false)
+-- Changing mode of file to 337 --
+bool(false)
+-- Changing mode of file to 338 --
+bool(false)
+-- Changing mode of file to 339 --
+bool(false)
+-- Changing mode of file to 340 --
+bool(false)
+-- Changing mode of file to 341 --
+bool(false)
+-- Changing mode of file to 342 --
+bool(false)
+-- Changing mode of file to 343 --
+bool(false)
+-- Changing mode of file to 344 --
+bool(false)
+-- Changing mode of file to 345 --
+bool(false)
+-- Changing mode of file to 346 --
+bool(false)
+-- Changing mode of file to 347 --
+bool(false)
+-- Changing mode of file to 348 --
+bool(false)
+-- Changing mode of file to 349 --
+bool(false)
+-- Changing mode of file to 350 --
+bool(false)
+-- Changing mode of file to 351 --
+bool(false)
+-- Changing mode of file to 352 --
+bool(false)
+-- Changing mode of file to 353 --
+bool(false)
+-- Changing mode of file to 354 --
+bool(false)
+-- Changing mode of file to 355 --
+bool(false)
+-- Changing mode of file to 356 --
+bool(false)
+-- Changing mode of file to 357 --
+bool(false)
+-- Changing mode of file to 358 --
+bool(false)
+-- Changing mode of file to 359 --
+bool(false)
+-- Changing mode of file to 360 --
+bool(false)
+-- Changing mode of file to 361 --
+bool(false)
+-- Changing mode of file to 362 --
+bool(false)
+-- Changing mode of file to 363 --
+bool(false)
+-- Changing mode of file to 364 --
+bool(false)
+-- Changing mode of file to 365 --
+bool(false)
+-- Changing mode of file to 366 --
+bool(false)
+-- Changing mode of file to 367 --
+bool(false)
+-- Changing mode of file to 368 --
+bool(false)
+-- Changing mode of file to 369 --
+bool(false)
+-- Changing mode of file to 370 --
+bool(false)
+-- Changing mode of file to 371 --
+bool(false)
+-- Changing mode of file to 372 --
+bool(false)
+-- Changing mode of file to 373 --
+bool(false)
+-- Changing mode of file to 374 --
+bool(false)
+-- Changing mode of file to 375 --
+bool(false)
+-- Changing mode of file to 376 --
+bool(false)
+-- Changing mode of file to 377 --
+bool(false)
+-- Changing mode of file to 378 --
+bool(false)
+-- Changing mode of file to 379 --
+bool(false)
+-- Changing mode of file to 380 --
+bool(false)
+-- Changing mode of file to 381 --
+bool(false)
+-- Changing mode of file to 382 --
+bool(false)
+-- Changing mode of file to 383 --
+bool(false)
+-- Changing mode of file to 384 --
+bool(false)
+-- Changing mode of file to 385 --
+bool(false)
+-- Changing mode of file to 386 --
+bool(false)
+-- Changing mode of file to 387 --
+bool(false)
+-- Changing mode of file to 388 --
+bool(false)
+-- Changing mode of file to 389 --
+bool(false)
+-- Changing mode of file to 390 --
+bool(false)
+-- Changing mode of file to 391 --
+bool(false)
+-- Changing mode of file to 392 --
+bool(false)
+-- Changing mode of file to 393 --
+bool(false)
+-- Changing mode of file to 394 --
+bool(false)
+-- Changing mode of file to 395 --
+bool(false)
+-- Changing mode of file to 396 --
+bool(false)
+-- Changing mode of file to 397 --
+bool(false)
+-- Changing mode of file to 398 --
+bool(false)
+-- Changing mode of file to 399 --
+bool(false)
+-- Changing mode of file to 400 --
+bool(false)
+-- Changing mode of file to 401 --
+bool(false)
+-- Changing mode of file to 402 --
+bool(false)
+-- Changing mode of file to 403 --
+bool(false)
+-- Changing mode of file to 404 --
+bool(false)
+-- Changing mode of file to 405 --
+bool(false)
+-- Changing mode of file to 406 --
+bool(false)
+-- Changing mode of file to 407 --
+bool(false)
+-- Changing mode of file to 408 --
+bool(false)
+-- Changing mode of file to 409 --
+bool(false)
+-- Changing mode of file to 410 --
+bool(false)
+-- Changing mode of file to 411 --
+bool(false)
+-- Changing mode of file to 412 --
+bool(false)
+-- Changing mode of file to 413 --
+bool(false)
+-- Changing mode of file to 414 --
+bool(false)
+-- Changing mode of file to 415 --
+bool(false)
+-- Changing mode of file to 416 --
+bool(false)
+-- Changing mode of file to 417 --
+bool(false)
+-- Changing mode of file to 418 --
+bool(false)
+-- Changing mode of file to 419 --
+bool(false)
+-- Changing mode of file to 420 --
+bool(false)
+-- Changing mode of file to 421 --
+bool(false)
+-- Changing mode of file to 422 --
+bool(false)
+-- Changing mode of file to 423 --
+bool(false)
+-- Changing mode of file to 424 --
+bool(false)
+-- Changing mode of file to 425 --
+bool(false)
+-- Changing mode of file to 426 --
+bool(false)
+-- Changing mode of file to 427 --
+bool(false)
+-- Changing mode of file to 428 --
+bool(false)
+-- Changing mode of file to 429 --
+bool(false)
+-- Changing mode of file to 430 --
+bool(false)
+-- Changing mode of file to 431 --
+bool(false)
+-- Changing mode of file to 432 --
+bool(false)
+-- Changing mode of file to 433 --
+bool(false)
+-- Changing mode of file to 434 --
+bool(false)
+-- Changing mode of file to 435 --
+bool(false)
+-- Changing mode of file to 436 --
+bool(false)
+-- Changing mode of file to 437 --
+bool(false)
+-- Changing mode of file to 438 --
+bool(false)
+-- Changing mode of file to 439 --
+bool(false)
+-- Changing mode of file to 440 --
+bool(false)
+-- Changing mode of file to 441 --
+bool(false)
+-- Changing mode of file to 442 --
+bool(false)
+-- Changing mode of file to 443 --
+bool(false)
+-- Changing mode of file to 444 --
+bool(false)
+-- Changing mode of file to 445 --
+bool(false)
+-- Changing mode of file to 446 --
+bool(false)
+-- Changing mode of file to 447 --
+bool(false)
+-- Changing mode of file to 448 --
+bool(false)
+-- Changing mode of file to 449 --
+bool(false)
+-- Changing mode of file to 450 --
+bool(false)
+-- Changing mode of file to 451 --
+bool(false)
+-- Changing mode of file to 452 --
+bool(false)
+-- Changing mode of file to 453 --
+bool(false)
+-- Changing mode of file to 454 --
+bool(false)
+-- Changing mode of file to 455 --
+bool(false)
+-- Changing mode of file to 456 --
+bool(false)
+-- Changing mode of file to 457 --
+bool(false)
+-- Changing mode of file to 458 --
+bool(false)
+-- Changing mode of file to 459 --
+bool(false)
+-- Changing mode of file to 460 --
+bool(false)
+-- Changing mode of file to 461 --
+bool(false)
+-- Changing mode of file to 462 --
+bool(false)
+-- Changing mode of file to 463 --
+bool(false)
+-- Changing mode of file to 464 --
+bool(false)
+-- Changing mode of file to 465 --
+bool(false)
+-- Changing mode of file to 466 --
+bool(false)
+-- Changing mode of file to 467 --
+bool(false)
+-- Changing mode of file to 468 --
+bool(false)
+-- Changing mode of file to 469 --
+bool(false)
+-- Changing mode of file to 470 --
+bool(false)
+-- Changing mode of file to 471 --
+bool(false)
+-- Changing mode of file to 472 --
+bool(false)
+-- Changing mode of file to 473 --
+bool(false)
+-- Changing mode of file to 474 --
+bool(false)
+-- Changing mode of file to 475 --
+bool(false)
+-- Changing mode of file to 476 --
+bool(false)
+-- Changing mode of file to 477 --
+bool(false)
+-- Changing mode of file to 478 --
+bool(false)
+-- Changing mode of file to 479 --
+bool(false)
+-- Changing mode of file to 480 --
+bool(false)
+-- Changing mode of file to 481 --
+bool(false)
+-- Changing mode of file to 482 --
+bool(false)
+-- Changing mode of file to 483 --
+bool(false)
+-- Changing mode of file to 484 --
+bool(false)
+-- Changing mode of file to 485 --
+bool(false)
+-- Changing mode of file to 486 --
+bool(false)
+-- Changing mode of file to 487 --
+bool(false)
+-- Changing mode of file to 488 --
+bool(false)
+-- Changing mode of file to 489 --
+bool(false)
+-- Changing mode of file to 490 --
+bool(false)
+-- Changing mode of file to 491 --
+bool(false)
+-- Changing mode of file to 492 --
+bool(false)
+-- Changing mode of file to 493 --
+bool(false)
+-- Changing mode of file to 494 --
+bool(false)
+-- Changing mode of file to 495 --
+bool(false)
+-- Changing mode of file to 496 --
+bool(false)
+-- Changing mode of file to 497 --
+bool(false)
+-- Changing mode of file to 498 --
+bool(false)
+-- Changing mode of file to 499 --
+bool(false)
+-- Changing mode of file to 500 --
+bool(false)
+-- Changing mode of file to 501 --
+bool(false)
+-- Changing mode of file to 502 --
+bool(false)
+-- Changing mode of file to 503 --
+bool(false)
+-- Changing mode of file to 504 --
+bool(false)
+-- Changing mode of file to 505 --
+bool(false)
+-- Changing mode of file to 506 --
+bool(false)
+-- Changing mode of file to 507 --
+bool(false)
+-- Changing mode of file to 508 --
+bool(false)
+-- Changing mode of file to 509 --
+bool(false)
+-- Changing mode of file to 510 --
+bool(false)
+-- Changing mode of file to 511 --
+bool(false)
+Done
diff --git a/ext/standard/tests/file/is_executable_basic.phpt b/ext/standard/tests/file/is_executable_basic.phpt
new file mode 100644
index 0000000..c0a04e6
--- /dev/null
+++ b/ext/standard/tests/file/is_executable_basic.phpt
@@ -0,0 +1,1076 @@
+--TEST--
+Test is_executable() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_executable ( string $filename );
+ Description: Tells whether the filename is executable
+*/
+
+// include common file test functions
+require dirname(__FILE__).'/file.inc';
+
+echo "*** Testing is_executable(): basic functionality ***\n";
+
+// create a file
+$filename = dirname(__FILE__)."/is_executable.tmp";
+create_file($filename);
+
+$counter = 1;
+/* loop to check if the file with new mode is executable
+ using is_executable() */
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of file to $mode --\n";
+ chmod($filename, $mode); // change mode of file
+ var_dump( is_executable($filename) );
+ $counter++;
+ clearstatcache();
+}
+
+// delete the temp file
+delete_file($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_executable(): basic functionality ***
+-- Changing mode of file to 0 --
+bool(false)
+-- Changing mode of file to 1 --
+bool(false)
+-- Changing mode of file to 2 --
+bool(false)
+-- Changing mode of file to 3 --
+bool(false)
+-- Changing mode of file to 4 --
+bool(false)
+-- Changing mode of file to 5 --
+bool(false)
+-- Changing mode of file to 6 --
+bool(false)
+-- Changing mode of file to 7 --
+bool(false)
+-- Changing mode of file to 8 --
+bool(false)
+-- Changing mode of file to 9 --
+bool(false)
+-- Changing mode of file to 10 --
+bool(false)
+-- Changing mode of file to 11 --
+bool(false)
+-- Changing mode of file to 12 --
+bool(false)
+-- Changing mode of file to 13 --
+bool(false)
+-- Changing mode of file to 14 --
+bool(false)
+-- Changing mode of file to 15 --
+bool(false)
+-- Changing mode of file to 16 --
+bool(false)
+-- Changing mode of file to 17 --
+bool(false)
+-- Changing mode of file to 18 --
+bool(false)
+-- Changing mode of file to 19 --
+bool(false)
+-- Changing mode of file to 20 --
+bool(false)
+-- Changing mode of file to 21 --
+bool(false)
+-- Changing mode of file to 22 --
+bool(false)
+-- Changing mode of file to 23 --
+bool(false)
+-- Changing mode of file to 24 --
+bool(false)
+-- Changing mode of file to 25 --
+bool(false)
+-- Changing mode of file to 26 --
+bool(false)
+-- Changing mode of file to 27 --
+bool(false)
+-- Changing mode of file to 28 --
+bool(false)
+-- Changing mode of file to 29 --
+bool(false)
+-- Changing mode of file to 30 --
+bool(false)
+-- Changing mode of file to 31 --
+bool(false)
+-- Changing mode of file to 32 --
+bool(false)
+-- Changing mode of file to 33 --
+bool(false)
+-- Changing mode of file to 34 --
+bool(false)
+-- Changing mode of file to 35 --
+bool(false)
+-- Changing mode of file to 36 --
+bool(false)
+-- Changing mode of file to 37 --
+bool(false)
+-- Changing mode of file to 38 --
+bool(false)
+-- Changing mode of file to 39 --
+bool(false)
+-- Changing mode of file to 40 --
+bool(false)
+-- Changing mode of file to 41 --
+bool(false)
+-- Changing mode of file to 42 --
+bool(false)
+-- Changing mode of file to 43 --
+bool(false)
+-- Changing mode of file to 44 --
+bool(false)
+-- Changing mode of file to 45 --
+bool(false)
+-- Changing mode of file to 46 --
+bool(false)
+-- Changing mode of file to 47 --
+bool(false)
+-- Changing mode of file to 48 --
+bool(false)
+-- Changing mode of file to 49 --
+bool(false)
+-- Changing mode of file to 50 --
+bool(false)
+-- Changing mode of file to 51 --
+bool(false)
+-- Changing mode of file to 52 --
+bool(false)
+-- Changing mode of file to 53 --
+bool(false)
+-- Changing mode of file to 54 --
+bool(false)
+-- Changing mode of file to 55 --
+bool(false)
+-- Changing mode of file to 56 --
+bool(false)
+-- Changing mode of file to 57 --
+bool(false)
+-- Changing mode of file to 58 --
+bool(false)
+-- Changing mode of file to 59 --
+bool(false)
+-- Changing mode of file to 60 --
+bool(false)
+-- Changing mode of file to 61 --
+bool(false)
+-- Changing mode of file to 62 --
+bool(false)
+-- Changing mode of file to 63 --
+bool(false)
+-- Changing mode of file to 64 --
+bool(true)
+-- Changing mode of file to 65 --
+bool(true)
+-- Changing mode of file to 66 --
+bool(true)
+-- Changing mode of file to 67 --
+bool(true)
+-- Changing mode of file to 68 --
+bool(true)
+-- Changing mode of file to 69 --
+bool(true)
+-- Changing mode of file to 70 --
+bool(true)
+-- Changing mode of file to 71 --
+bool(true)
+-- Changing mode of file to 72 --
+bool(true)
+-- Changing mode of file to 73 --
+bool(true)
+-- Changing mode of file to 74 --
+bool(true)
+-- Changing mode of file to 75 --
+bool(true)
+-- Changing mode of file to 76 --
+bool(true)
+-- Changing mode of file to 77 --
+bool(true)
+-- Changing mode of file to 78 --
+bool(true)
+-- Changing mode of file to 79 --
+bool(true)
+-- Changing mode of file to 80 --
+bool(true)
+-- Changing mode of file to 81 --
+bool(true)
+-- Changing mode of file to 82 --
+bool(true)
+-- Changing mode of file to 83 --
+bool(true)
+-- Changing mode of file to 84 --
+bool(true)
+-- Changing mode of file to 85 --
+bool(true)
+-- Changing mode of file to 86 --
+bool(true)
+-- Changing mode of file to 87 --
+bool(true)
+-- Changing mode of file to 88 --
+bool(true)
+-- Changing mode of file to 89 --
+bool(true)
+-- Changing mode of file to 90 --
+bool(true)
+-- Changing mode of file to 91 --
+bool(true)
+-- Changing mode of file to 92 --
+bool(true)
+-- Changing mode of file to 93 --
+bool(true)
+-- Changing mode of file to 94 --
+bool(true)
+-- Changing mode of file to 95 --
+bool(true)
+-- Changing mode of file to 96 --
+bool(true)
+-- Changing mode of file to 97 --
+bool(true)
+-- Changing mode of file to 98 --
+bool(true)
+-- Changing mode of file to 99 --
+bool(true)
+-- Changing mode of file to 100 --
+bool(true)
+-- Changing mode of file to 101 --
+bool(true)
+-- Changing mode of file to 102 --
+bool(true)
+-- Changing mode of file to 103 --
+bool(true)
+-- Changing mode of file to 104 --
+bool(true)
+-- Changing mode of file to 105 --
+bool(true)
+-- Changing mode of file to 106 --
+bool(true)
+-- Changing mode of file to 107 --
+bool(true)
+-- Changing mode of file to 108 --
+bool(true)
+-- Changing mode of file to 109 --
+bool(true)
+-- Changing mode of file to 110 --
+bool(true)
+-- Changing mode of file to 111 --
+bool(true)
+-- Changing mode of file to 112 --
+bool(true)
+-- Changing mode of file to 113 --
+bool(true)
+-- Changing mode of file to 114 --
+bool(true)
+-- Changing mode of file to 115 --
+bool(true)
+-- Changing mode of file to 116 --
+bool(true)
+-- Changing mode of file to 117 --
+bool(true)
+-- Changing mode of file to 118 --
+bool(true)
+-- Changing mode of file to 119 --
+bool(true)
+-- Changing mode of file to 120 --
+bool(true)
+-- Changing mode of file to 121 --
+bool(true)
+-- Changing mode of file to 122 --
+bool(true)
+-- Changing mode of file to 123 --
+bool(true)
+-- Changing mode of file to 124 --
+bool(true)
+-- Changing mode of file to 125 --
+bool(true)
+-- Changing mode of file to 126 --
+bool(true)
+-- Changing mode of file to 127 --
+bool(true)
+-- Changing mode of file to 128 --
+bool(false)
+-- Changing mode of file to 129 --
+bool(false)
+-- Changing mode of file to 130 --
+bool(false)
+-- Changing mode of file to 131 --
+bool(false)
+-- Changing mode of file to 132 --
+bool(false)
+-- Changing mode of file to 133 --
+bool(false)
+-- Changing mode of file to 134 --
+bool(false)
+-- Changing mode of file to 135 --
+bool(false)
+-- Changing mode of file to 136 --
+bool(false)
+-- Changing mode of file to 137 --
+bool(false)
+-- Changing mode of file to 138 --
+bool(false)
+-- Changing mode of file to 139 --
+bool(false)
+-- Changing mode of file to 140 --
+bool(false)
+-- Changing mode of file to 141 --
+bool(false)
+-- Changing mode of file to 142 --
+bool(false)
+-- Changing mode of file to 143 --
+bool(false)
+-- Changing mode of file to 144 --
+bool(false)
+-- Changing mode of file to 145 --
+bool(false)
+-- Changing mode of file to 146 --
+bool(false)
+-- Changing mode of file to 147 --
+bool(false)
+-- Changing mode of file to 148 --
+bool(false)
+-- Changing mode of file to 149 --
+bool(false)
+-- Changing mode of file to 150 --
+bool(false)
+-- Changing mode of file to 151 --
+bool(false)
+-- Changing mode of file to 152 --
+bool(false)
+-- Changing mode of file to 153 --
+bool(false)
+-- Changing mode of file to 154 --
+bool(false)
+-- Changing mode of file to 155 --
+bool(false)
+-- Changing mode of file to 156 --
+bool(false)
+-- Changing mode of file to 157 --
+bool(false)
+-- Changing mode of file to 158 --
+bool(false)
+-- Changing mode of file to 159 --
+bool(false)
+-- Changing mode of file to 160 --
+bool(false)
+-- Changing mode of file to 161 --
+bool(false)
+-- Changing mode of file to 162 --
+bool(false)
+-- Changing mode of file to 163 --
+bool(false)
+-- Changing mode of file to 164 --
+bool(false)
+-- Changing mode of file to 165 --
+bool(false)
+-- Changing mode of file to 166 --
+bool(false)
+-- Changing mode of file to 167 --
+bool(false)
+-- Changing mode of file to 168 --
+bool(false)
+-- Changing mode of file to 169 --
+bool(false)
+-- Changing mode of file to 170 --
+bool(false)
+-- Changing mode of file to 171 --
+bool(false)
+-- Changing mode of file to 172 --
+bool(false)
+-- Changing mode of file to 173 --
+bool(false)
+-- Changing mode of file to 174 --
+bool(false)
+-- Changing mode of file to 175 --
+bool(false)
+-- Changing mode of file to 176 --
+bool(false)
+-- Changing mode of file to 177 --
+bool(false)
+-- Changing mode of file to 178 --
+bool(false)
+-- Changing mode of file to 179 --
+bool(false)
+-- Changing mode of file to 180 --
+bool(false)
+-- Changing mode of file to 181 --
+bool(false)
+-- Changing mode of file to 182 --
+bool(false)
+-- Changing mode of file to 183 --
+bool(false)
+-- Changing mode of file to 184 --
+bool(false)
+-- Changing mode of file to 185 --
+bool(false)
+-- Changing mode of file to 186 --
+bool(false)
+-- Changing mode of file to 187 --
+bool(false)
+-- Changing mode of file to 188 --
+bool(false)
+-- Changing mode of file to 189 --
+bool(false)
+-- Changing mode of file to 190 --
+bool(false)
+-- Changing mode of file to 191 --
+bool(false)
+-- Changing mode of file to 192 --
+bool(true)
+-- Changing mode of file to 193 --
+bool(true)
+-- Changing mode of file to 194 --
+bool(true)
+-- Changing mode of file to 195 --
+bool(true)
+-- Changing mode of file to 196 --
+bool(true)
+-- Changing mode of file to 197 --
+bool(true)
+-- Changing mode of file to 198 --
+bool(true)
+-- Changing mode of file to 199 --
+bool(true)
+-- Changing mode of file to 200 --
+bool(true)
+-- Changing mode of file to 201 --
+bool(true)
+-- Changing mode of file to 202 --
+bool(true)
+-- Changing mode of file to 203 --
+bool(true)
+-- Changing mode of file to 204 --
+bool(true)
+-- Changing mode of file to 205 --
+bool(true)
+-- Changing mode of file to 206 --
+bool(true)
+-- Changing mode of file to 207 --
+bool(true)
+-- Changing mode of file to 208 --
+bool(true)
+-- Changing mode of file to 209 --
+bool(true)
+-- Changing mode of file to 210 --
+bool(true)
+-- Changing mode of file to 211 --
+bool(true)
+-- Changing mode of file to 212 --
+bool(true)
+-- Changing mode of file to 213 --
+bool(true)
+-- Changing mode of file to 214 --
+bool(true)
+-- Changing mode of file to 215 --
+bool(true)
+-- Changing mode of file to 216 --
+bool(true)
+-- Changing mode of file to 217 --
+bool(true)
+-- Changing mode of file to 218 --
+bool(true)
+-- Changing mode of file to 219 --
+bool(true)
+-- Changing mode of file to 220 --
+bool(true)
+-- Changing mode of file to 221 --
+bool(true)
+-- Changing mode of file to 222 --
+bool(true)
+-- Changing mode of file to 223 --
+bool(true)
+-- Changing mode of file to 224 --
+bool(true)
+-- Changing mode of file to 225 --
+bool(true)
+-- Changing mode of file to 226 --
+bool(true)
+-- Changing mode of file to 227 --
+bool(true)
+-- Changing mode of file to 228 --
+bool(true)
+-- Changing mode of file to 229 --
+bool(true)
+-- Changing mode of file to 230 --
+bool(true)
+-- Changing mode of file to 231 --
+bool(true)
+-- Changing mode of file to 232 --
+bool(true)
+-- Changing mode of file to 233 --
+bool(true)
+-- Changing mode of file to 234 --
+bool(true)
+-- Changing mode of file to 235 --
+bool(true)
+-- Changing mode of file to 236 --
+bool(true)
+-- Changing mode of file to 237 --
+bool(true)
+-- Changing mode of file to 238 --
+bool(true)
+-- Changing mode of file to 239 --
+bool(true)
+-- Changing mode of file to 240 --
+bool(true)
+-- Changing mode of file to 241 --
+bool(true)
+-- Changing mode of file to 242 --
+bool(true)
+-- Changing mode of file to 243 --
+bool(true)
+-- Changing mode of file to 244 --
+bool(true)
+-- Changing mode of file to 245 --
+bool(true)
+-- Changing mode of file to 246 --
+bool(true)
+-- Changing mode of file to 247 --
+bool(true)
+-- Changing mode of file to 248 --
+bool(true)
+-- Changing mode of file to 249 --
+bool(true)
+-- Changing mode of file to 250 --
+bool(true)
+-- Changing mode of file to 251 --
+bool(true)
+-- Changing mode of file to 252 --
+bool(true)
+-- Changing mode of file to 253 --
+bool(true)
+-- Changing mode of file to 254 --
+bool(true)
+-- Changing mode of file to 255 --
+bool(true)
+-- Changing mode of file to 256 --
+bool(false)
+-- Changing mode of file to 257 --
+bool(false)
+-- Changing mode of file to 258 --
+bool(false)
+-- Changing mode of file to 259 --
+bool(false)
+-- Changing mode of file to 260 --
+bool(false)
+-- Changing mode of file to 261 --
+bool(false)
+-- Changing mode of file to 262 --
+bool(false)
+-- Changing mode of file to 263 --
+bool(false)
+-- Changing mode of file to 264 --
+bool(false)
+-- Changing mode of file to 265 --
+bool(false)
+-- Changing mode of file to 266 --
+bool(false)
+-- Changing mode of file to 267 --
+bool(false)
+-- Changing mode of file to 268 --
+bool(false)
+-- Changing mode of file to 269 --
+bool(false)
+-- Changing mode of file to 270 --
+bool(false)
+-- Changing mode of file to 271 --
+bool(false)
+-- Changing mode of file to 272 --
+bool(false)
+-- Changing mode of file to 273 --
+bool(false)
+-- Changing mode of file to 274 --
+bool(false)
+-- Changing mode of file to 275 --
+bool(false)
+-- Changing mode of file to 276 --
+bool(false)
+-- Changing mode of file to 277 --
+bool(false)
+-- Changing mode of file to 278 --
+bool(false)
+-- Changing mode of file to 279 --
+bool(false)
+-- Changing mode of file to 280 --
+bool(false)
+-- Changing mode of file to 281 --
+bool(false)
+-- Changing mode of file to 282 --
+bool(false)
+-- Changing mode of file to 283 --
+bool(false)
+-- Changing mode of file to 284 --
+bool(false)
+-- Changing mode of file to 285 --
+bool(false)
+-- Changing mode of file to 286 --
+bool(false)
+-- Changing mode of file to 287 --
+bool(false)
+-- Changing mode of file to 288 --
+bool(false)
+-- Changing mode of file to 289 --
+bool(false)
+-- Changing mode of file to 290 --
+bool(false)
+-- Changing mode of file to 291 --
+bool(false)
+-- Changing mode of file to 292 --
+bool(false)
+-- Changing mode of file to 293 --
+bool(false)
+-- Changing mode of file to 294 --
+bool(false)
+-- Changing mode of file to 295 --
+bool(false)
+-- Changing mode of file to 296 --
+bool(false)
+-- Changing mode of file to 297 --
+bool(false)
+-- Changing mode of file to 298 --
+bool(false)
+-- Changing mode of file to 299 --
+bool(false)
+-- Changing mode of file to 300 --
+bool(false)
+-- Changing mode of file to 301 --
+bool(false)
+-- Changing mode of file to 302 --
+bool(false)
+-- Changing mode of file to 303 --
+bool(false)
+-- Changing mode of file to 304 --
+bool(false)
+-- Changing mode of file to 305 --
+bool(false)
+-- Changing mode of file to 306 --
+bool(false)
+-- Changing mode of file to 307 --
+bool(false)
+-- Changing mode of file to 308 --
+bool(false)
+-- Changing mode of file to 309 --
+bool(false)
+-- Changing mode of file to 310 --
+bool(false)
+-- Changing mode of file to 311 --
+bool(false)
+-- Changing mode of file to 312 --
+bool(false)
+-- Changing mode of file to 313 --
+bool(false)
+-- Changing mode of file to 314 --
+bool(false)
+-- Changing mode of file to 315 --
+bool(false)
+-- Changing mode of file to 316 --
+bool(false)
+-- Changing mode of file to 317 --
+bool(false)
+-- Changing mode of file to 318 --
+bool(false)
+-- Changing mode of file to 319 --
+bool(false)
+-- Changing mode of file to 320 --
+bool(true)
+-- Changing mode of file to 321 --
+bool(true)
+-- Changing mode of file to 322 --
+bool(true)
+-- Changing mode of file to 323 --
+bool(true)
+-- Changing mode of file to 324 --
+bool(true)
+-- Changing mode of file to 325 --
+bool(true)
+-- Changing mode of file to 326 --
+bool(true)
+-- Changing mode of file to 327 --
+bool(true)
+-- Changing mode of file to 328 --
+bool(true)
+-- Changing mode of file to 329 --
+bool(true)
+-- Changing mode of file to 330 --
+bool(true)
+-- Changing mode of file to 331 --
+bool(true)
+-- Changing mode of file to 332 --
+bool(true)
+-- Changing mode of file to 333 --
+bool(true)
+-- Changing mode of file to 334 --
+bool(true)
+-- Changing mode of file to 335 --
+bool(true)
+-- Changing mode of file to 336 --
+bool(true)
+-- Changing mode of file to 337 --
+bool(true)
+-- Changing mode of file to 338 --
+bool(true)
+-- Changing mode of file to 339 --
+bool(true)
+-- Changing mode of file to 340 --
+bool(true)
+-- Changing mode of file to 341 --
+bool(true)
+-- Changing mode of file to 342 --
+bool(true)
+-- Changing mode of file to 343 --
+bool(true)
+-- Changing mode of file to 344 --
+bool(true)
+-- Changing mode of file to 345 --
+bool(true)
+-- Changing mode of file to 346 --
+bool(true)
+-- Changing mode of file to 347 --
+bool(true)
+-- Changing mode of file to 348 --
+bool(true)
+-- Changing mode of file to 349 --
+bool(true)
+-- Changing mode of file to 350 --
+bool(true)
+-- Changing mode of file to 351 --
+bool(true)
+-- Changing mode of file to 352 --
+bool(true)
+-- Changing mode of file to 353 --
+bool(true)
+-- Changing mode of file to 354 --
+bool(true)
+-- Changing mode of file to 355 --
+bool(true)
+-- Changing mode of file to 356 --
+bool(true)
+-- Changing mode of file to 357 --
+bool(true)
+-- Changing mode of file to 358 --
+bool(true)
+-- Changing mode of file to 359 --
+bool(true)
+-- Changing mode of file to 360 --
+bool(true)
+-- Changing mode of file to 361 --
+bool(true)
+-- Changing mode of file to 362 --
+bool(true)
+-- Changing mode of file to 363 --
+bool(true)
+-- Changing mode of file to 364 --
+bool(true)
+-- Changing mode of file to 365 --
+bool(true)
+-- Changing mode of file to 366 --
+bool(true)
+-- Changing mode of file to 367 --
+bool(true)
+-- Changing mode of file to 368 --
+bool(true)
+-- Changing mode of file to 369 --
+bool(true)
+-- Changing mode of file to 370 --
+bool(true)
+-- Changing mode of file to 371 --
+bool(true)
+-- Changing mode of file to 372 --
+bool(true)
+-- Changing mode of file to 373 --
+bool(true)
+-- Changing mode of file to 374 --
+bool(true)
+-- Changing mode of file to 375 --
+bool(true)
+-- Changing mode of file to 376 --
+bool(true)
+-- Changing mode of file to 377 --
+bool(true)
+-- Changing mode of file to 378 --
+bool(true)
+-- Changing mode of file to 379 --
+bool(true)
+-- Changing mode of file to 380 --
+bool(true)
+-- Changing mode of file to 381 --
+bool(true)
+-- Changing mode of file to 382 --
+bool(true)
+-- Changing mode of file to 383 --
+bool(true)
+-- Changing mode of file to 384 --
+bool(false)
+-- Changing mode of file to 385 --
+bool(false)
+-- Changing mode of file to 386 --
+bool(false)
+-- Changing mode of file to 387 --
+bool(false)
+-- Changing mode of file to 388 --
+bool(false)
+-- Changing mode of file to 389 --
+bool(false)
+-- Changing mode of file to 390 --
+bool(false)
+-- Changing mode of file to 391 --
+bool(false)
+-- Changing mode of file to 392 --
+bool(false)
+-- Changing mode of file to 393 --
+bool(false)
+-- Changing mode of file to 394 --
+bool(false)
+-- Changing mode of file to 395 --
+bool(false)
+-- Changing mode of file to 396 --
+bool(false)
+-- Changing mode of file to 397 --
+bool(false)
+-- Changing mode of file to 398 --
+bool(false)
+-- Changing mode of file to 399 --
+bool(false)
+-- Changing mode of file to 400 --
+bool(false)
+-- Changing mode of file to 401 --
+bool(false)
+-- Changing mode of file to 402 --
+bool(false)
+-- Changing mode of file to 403 --
+bool(false)
+-- Changing mode of file to 404 --
+bool(false)
+-- Changing mode of file to 405 --
+bool(false)
+-- Changing mode of file to 406 --
+bool(false)
+-- Changing mode of file to 407 --
+bool(false)
+-- Changing mode of file to 408 --
+bool(false)
+-- Changing mode of file to 409 --
+bool(false)
+-- Changing mode of file to 410 --
+bool(false)
+-- Changing mode of file to 411 --
+bool(false)
+-- Changing mode of file to 412 --
+bool(false)
+-- Changing mode of file to 413 --
+bool(false)
+-- Changing mode of file to 414 --
+bool(false)
+-- Changing mode of file to 415 --
+bool(false)
+-- Changing mode of file to 416 --
+bool(false)
+-- Changing mode of file to 417 --
+bool(false)
+-- Changing mode of file to 418 --
+bool(false)
+-- Changing mode of file to 419 --
+bool(false)
+-- Changing mode of file to 420 --
+bool(false)
+-- Changing mode of file to 421 --
+bool(false)
+-- Changing mode of file to 422 --
+bool(false)
+-- Changing mode of file to 423 --
+bool(false)
+-- Changing mode of file to 424 --
+bool(false)
+-- Changing mode of file to 425 --
+bool(false)
+-- Changing mode of file to 426 --
+bool(false)
+-- Changing mode of file to 427 --
+bool(false)
+-- Changing mode of file to 428 --
+bool(false)
+-- Changing mode of file to 429 --
+bool(false)
+-- Changing mode of file to 430 --
+bool(false)
+-- Changing mode of file to 431 --
+bool(false)
+-- Changing mode of file to 432 --
+bool(false)
+-- Changing mode of file to 433 --
+bool(false)
+-- Changing mode of file to 434 --
+bool(false)
+-- Changing mode of file to 435 --
+bool(false)
+-- Changing mode of file to 436 --
+bool(false)
+-- Changing mode of file to 437 --
+bool(false)
+-- Changing mode of file to 438 --
+bool(false)
+-- Changing mode of file to 439 --
+bool(false)
+-- Changing mode of file to 440 --
+bool(false)
+-- Changing mode of file to 441 --
+bool(false)
+-- Changing mode of file to 442 --
+bool(false)
+-- Changing mode of file to 443 --
+bool(false)
+-- Changing mode of file to 444 --
+bool(false)
+-- Changing mode of file to 445 --
+bool(false)
+-- Changing mode of file to 446 --
+bool(false)
+-- Changing mode of file to 447 --
+bool(false)
+-- Changing mode of file to 448 --
+bool(true)
+-- Changing mode of file to 449 --
+bool(true)
+-- Changing mode of file to 450 --
+bool(true)
+-- Changing mode of file to 451 --
+bool(true)
+-- Changing mode of file to 452 --
+bool(true)
+-- Changing mode of file to 453 --
+bool(true)
+-- Changing mode of file to 454 --
+bool(true)
+-- Changing mode of file to 455 --
+bool(true)
+-- Changing mode of file to 456 --
+bool(true)
+-- Changing mode of file to 457 --
+bool(true)
+-- Changing mode of file to 458 --
+bool(true)
+-- Changing mode of file to 459 --
+bool(true)
+-- Changing mode of file to 460 --
+bool(true)
+-- Changing mode of file to 461 --
+bool(true)
+-- Changing mode of file to 462 --
+bool(true)
+-- Changing mode of file to 463 --
+bool(true)
+-- Changing mode of file to 464 --
+bool(true)
+-- Changing mode of file to 465 --
+bool(true)
+-- Changing mode of file to 466 --
+bool(true)
+-- Changing mode of file to 467 --
+bool(true)
+-- Changing mode of file to 468 --
+bool(true)
+-- Changing mode of file to 469 --
+bool(true)
+-- Changing mode of file to 470 --
+bool(true)
+-- Changing mode of file to 471 --
+bool(true)
+-- Changing mode of file to 472 --
+bool(true)
+-- Changing mode of file to 473 --
+bool(true)
+-- Changing mode of file to 474 --
+bool(true)
+-- Changing mode of file to 475 --
+bool(true)
+-- Changing mode of file to 476 --
+bool(true)
+-- Changing mode of file to 477 --
+bool(true)
+-- Changing mode of file to 478 --
+bool(true)
+-- Changing mode of file to 479 --
+bool(true)
+-- Changing mode of file to 480 --
+bool(true)
+-- Changing mode of file to 481 --
+bool(true)
+-- Changing mode of file to 482 --
+bool(true)
+-- Changing mode of file to 483 --
+bool(true)
+-- Changing mode of file to 484 --
+bool(true)
+-- Changing mode of file to 485 --
+bool(true)
+-- Changing mode of file to 486 --
+bool(true)
+-- Changing mode of file to 487 --
+bool(true)
+-- Changing mode of file to 488 --
+bool(true)
+-- Changing mode of file to 489 --
+bool(true)
+-- Changing mode of file to 490 --
+bool(true)
+-- Changing mode of file to 491 --
+bool(true)
+-- Changing mode of file to 492 --
+bool(true)
+-- Changing mode of file to 493 --
+bool(true)
+-- Changing mode of file to 494 --
+bool(true)
+-- Changing mode of file to 495 --
+bool(true)
+-- Changing mode of file to 496 --
+bool(true)
+-- Changing mode of file to 497 --
+bool(true)
+-- Changing mode of file to 498 --
+bool(true)
+-- Changing mode of file to 499 --
+bool(true)
+-- Changing mode of file to 500 --
+bool(true)
+-- Changing mode of file to 501 --
+bool(true)
+-- Changing mode of file to 502 --
+bool(true)
+-- Changing mode of file to 503 --
+bool(true)
+-- Changing mode of file to 504 --
+bool(true)
+-- Changing mode of file to 505 --
+bool(true)
+-- Changing mode of file to 506 --
+bool(true)
+-- Changing mode of file to 507 --
+bool(true)
+-- Changing mode of file to 508 --
+bool(true)
+-- Changing mode of file to 509 --
+bool(true)
+-- Changing mode of file to 510 --
+bool(true)
+-- Changing mode of file to 511 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt
new file mode 100644
index 0000000..4fb3dba
--- /dev/null
+++ b/ext/standard/tests/file/is_executable_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test is_executable() function: error conditions
+--FILE--
+<?php
+/* Prototype: bool is_executable ( string $filename );
+ Description: Tells whether the filename is executable
+*/
+
+echo "*** Testing is_executable(): error conditions ***\n";
+var_dump( is_executable() ); // args < expected no of arguments
+
+var_dump( is_executable(1, 2) ); // args > expected no. of arguments
+
+echo "\n*** Testing is_exceutable() on non-existent directory ***\n";
+var_dump( is_executable(dirname(__FILE__)."/is_executable") );
+
+echo "Done\n";
+--EXPECTF--
+*** Testing is_executable(): error conditions ***
+
+Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing is_exceutable() on non-existent directory ***
+bool(false)
+Done
diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt
new file mode 100644
index 0000000..231f1bf
--- /dev/null
+++ b/ext/standard/tests/file/is_executable_variation1.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test is_executable() function: usage variations - diff. path notations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_executable ( string $filename );
+ Description: Tells whether the filename is executable
+*/
+
+/* test is_executable() with file having different filepath notation */
+
+require dirname(__FILE__).'/file.inc';
+echo "*** Testing is_executable(): usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/is_executable_variation1");
+
+// create a new temporary file
+$fp = fopen("$file_path/is_executable_variation1/bar.tmp", "w");
+fclose($fp);
+
+/* array of files checked to see if they are executable files
+ using is_executable() function */
+$files_arr = array(
+ "$file_path/is_executable_variation1/bar.tmp",
+
+ /* Testing a file with trailing slash */
+ "$file_path/is_executable_variation1/bar.tmp/",
+
+ /* Testing file with double slashes */
+ "$file_path/is_executable_variation1//bar.tmp",
+ "$file_path/is_executable_variation1/*.tmp",
+ "$file_path/is_executable_variation1/b*.tmp",
+
+ /* Testing Binary safe */
+ "$file_path/is_executable_variation1".chr(0)."bar.temp",
+ "$file_path".chr(0)."is_executable_variation1/bar.temp",
+ "$file_path/is_executable_variation1x000/",
+
+ /* Testing directories */
+ ".", // current directory, exp: bool(true)
+ "$file_path/is_executable_variation1" // temp directory, exp: bool(true)
+);
+$counter = 1;
+/* loop through to test each element in the above array
+ is an executable file */
+foreach($files_arr as $file) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_executable($file) );
+ $counter++;
+ clearstatcache();
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/is_executable_variation1/bar.tmp");
+rmdir(dirname(__FILE__)."/is_executable_variation1/");
+?>
+--EXPECTF--
+*** Testing is_executable(): usage variations ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+
+Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_executable_variation2.phpt b/ext/standard/tests/file/is_executable_variation2.phpt
new file mode 100644
index 0000000..fc804d6
--- /dev/null
+++ b/ext/standard/tests/file/is_executable_variation2.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Test is_executable() function: usage variations - file/dir with diff. perms
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_executable ( string $filename );
+ Description: Tells whether the filename is executable
+*/
+
+/* test is_executable() with file/dir having different permissions */
+
+require dirname(__FILE__).'/file.inc';
+echo "*** Testing is_executable(): usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/is_executable_variation2");
+
+echo "\n*** Testing is_executable() on directory without execute permission ***\n";
+chmod("$file_path/is_executable_variation2", 0444);
+var_dump( is_executable("$file_path/is_executable_variation2") ); // exp: bool(false)
+chmod("$file_path/is_executable_variation2", 0777); // chmod to enable deletion of directory
+
+echo "\n*** Testing miscelleneous input for is_executable() function ***\n";
+$name_prefix = "is_executable_variation2";
+create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 1);
+create_files(dirname(__FILE__), 1, "text", 0755, 1, "w", $name_prefix, 2);
+create_files(dirname(__FILE__), 1, "empty", 0755, 1, "w", $name_prefix, 3);
+create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 4);
+create_files(dirname(__FILE__), 1, "text", 0222, 1, "w", $name_prefix, 5);
+create_files(dirname(__FILE__), 1, "numeric", 0711, 1, "w", $name_prefix, 6);
+create_files(dirname(__FILE__), 1, "text", 0714, 1, "w", $name_prefix, 7);
+create_files(dirname(__FILE__), 1, "numeric", 0744, 1, "w", $name_prefix, 8);
+create_files(dirname(__FILE__), 1, "text", 0421, 1, "w", $name_prefix, 9);
+create_files(dirname(__FILE__), 1, "text", 0712, 1, "w", $name_prefix, 10);
+
+$files = array (
+ "$file_path/is_executable_variation21.tmp",
+ "$file_path/is_executable_variation22.tmp",
+ "$file_path/is_executable_variation23.tmp",
+ "$file_path/is_executable_variation24.tmp",
+ "$file_path/is_executable_variation25.tmp",
+ "$file_path/is_executable_variation26.tmp",
+ "$file_path/is_executable_variation27.tmp",
+ "$file_path/is_executable_variation28.tmp",
+ "$file_path/is_executable_variation29.tmp",
+ "$file_path/is_executable_variation210.tmp",
+);
+$counter = 1;
+/* loop through to test each element in the above array
+ is an executable file */
+foreach($files as $file) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_executable($file) );
+ $counter++;
+ clearstatcache();
+}
+
+// change all file's permissions to 777 before deleting
+change_file_perms($file_path, 10, 0777, $name_prefix);
+delete_files($file_path, 10, $name_prefix);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/is_executable_variation2/");
+?>
+--EXPECTF--
+*** Testing is_executable(): usage variations ***
+
+*** Testing is_executable() on directory without execute permission ***
+bool(false)
+
+*** Testing miscelleneous input for is_executable() function ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt
new file mode 100644
index 0000000..925f996
--- /dev/null
+++ b/ext/standard/tests/file/is_executable_variation3.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test is_executable() function: usage variations - invalid file names
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/is_executable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_executable ( string $filename );
+ Description: Tells whether the filename is executable
+*/
+
+/* test is_executable() with invalid arguments */
+
+echo "*** Testing is_executable(): usage variations ***\n";
+
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle);
+
+echo "\n*** Testing is_executable() on invalid files ***\n";
+$invalid_files = array(
+ 0,
+ 1234,
+ -2.34555,
+ TRUE,
+ FALSE,
+ NULL,
+ " ",
+ @array(),
+ @$file_handle
+);
+/* loop through to test each element in the above array
+ is an executable file */
+foreach( $invalid_files as $invalid_file ) {
+ var_dump( is_executable($invalid_file) );
+ clearstatcache();
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_executable(): usage variations ***
+
+*** Testing is_executable() on invalid files ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/is_file_basic.phpt b/ext/standard/tests/file/is_file_basic.phpt
new file mode 100644
index 0000000..f8c06a0
--- /dev/null
+++ b/ext/standard/tests/file/is_file_basic.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test is_file() function: basic functionality
+--FILE--
+<?php
+/* Prototype: bool is_file ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+echo "*** Testing is_file(): basic functionality ***\n";
+
+/* Checking with current file */
+var_dump( is_file(__FILE__) );
+
+/* Checking with (current) dir */
+var_dump( is_file(dirname(__FILE__)) );
+
+$file_path = dirname(__FILE__);
+$file_name = $file_path."/is_file_basic.tmp";
+/* With non-existing file */
+var_dump( is_file($file_name) );
+/* With existing file */
+fclose( fopen($file_name, "w") );
+var_dump( is_file($file_name) );
+
+echo "*** Testing is_file() for its return value type ***\n";
+var_dump( is_bool( is_file(__FILE__) ) );
+var_dump( is_bool( is_file("/no/such/file") ) );
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$file_name = $file_path."/is_file_basic.tmp";
+unlink($file_name);
+?>
+--EXPECTF--
+*** Testing is_file(): basic functionality ***
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+*** Testing is_file() for its return value type ***
+bool(true)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_file_error.phpt b/ext/standard/tests/file/is_file_error.phpt
new file mode 100644
index 0000000..abccb72
--- /dev/null
+++ b/ext/standard/tests/file/is_file_error.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test is_file() function: error conditions
+--FILE--
+<?php
+/* Prototype: bool is_file ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+echo "*** Testing is_file() error conditions ***";
+$file_path = dirname(__FILE__);
+var_dump( is_file() ); // Zero No. of args
+
+/* no of args > expected */
+$file_handle = fopen($file_path."/is_file_error.tmp", "w");
+var_dump( is_file( $file_path."/is_file_error.tmp", $file_path."/is_file_error1.tmp") );
+
+/* Non-existing file */
+var_dump( is_file($file_path."/is_file_error1.tmp") );
+
+/* Passing resource as an argument */
+var_dump( is_file($file_handle) );
+
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+if(file_exists($file_path."/is_file_error.tmp")) {
+ unlink($file_path."/is_file_error.tmp");
+}
+if(file_exists($file_path."/is_file_error1.tmp")) {
+ unlink($file_path."/is_file_error1.tmp");
+}
+?>
+--EXPECTF--
+*** Testing is_file() error conditions ***
+Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+bool(false)
+
+Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_file_variation1.phpt b/ext/standard/tests/file/is_file_variation1.phpt
new file mode 100644
index 0000000..92bff95
--- /dev/null
+++ b/ext/standard/tests/file/is_file_variation1.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test is_file() function: usage variations - diff. files
+--FILE--
+<?php
+/* Prototype: bool is_file ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+/* Testing is_file() with file containing data, truncating its size
+ and the file created by touch() */
+
+$file_path = dirname(__FILE__);
+
+echo "-- Testing is_file() with file containing data --\n";
+$filename = $file_path."/is_file_variation1.tmp";
+$file_handle = fopen($filename, "w" );
+fwrite( $file_handle, "Hello, world....." ); // exptected true
+fclose($file_handle);
+var_dump( is_file($filename) );
+clearstatcache();
+
+echo "\n-- Testing is_file() after truncating filesize to zero bytes --\n";
+$file_handle = fopen( $file_path."/is_file_variation1.tmp", "r");
+ftruncate($file_handle, 0);
+fclose($file_handle);
+var_dump( is_file($file_path."/is_file_variation1.tmp") ); // expected true
+clearstatcache();
+unlink($file_path."/is_file_variation1.tmp");
+
+echo "\n-- Testing is_file() with an empty file --\n";
+/* created by fopen() */
+fclose( fopen($file_path."/is_file_variation1.tmp", "w") );
+var_dump( is_file($file_path."/is_file_variation1.tmp") ); //expected true
+clearstatcache();
+unlink($file_path."/is_file_variation1.tmp");
+
+/* created by touch() */
+touch($file_path."/is_file_variation1.tmp");
+var_dump( is_file($file_path."/is_file_variation1.tmp") ); // expected true
+clearstatcache();
+unlink($file_path."/is_file_variation1.tmp");
+
+echo "\n*** Done ***";
+?>
+--EXPECTF--
+-- Testing is_file() with file containing data --
+bool(true)
+
+-- Testing is_file() after truncating filesize to zero bytes --
+bool(true)
+
+-- Testing is_file() with an empty file --
+bool(true)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_file_variation2.phpt b/ext/standard/tests/file/is_file_variation2.phpt
new file mode 100644
index 0000000..dbe74da
--- /dev/null
+++ b/ext/standard/tests/file/is_file_variation2.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test is_file() function: usage variations - links
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Do not run on Windows');
+}
+--FILE--
+<?php
+/* Prototype: bool is_file ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+/* Creating soft and hard links to a file and applying is_file() on links */
+
+$file_path = dirname(__FILE__);
+fclose( fopen($file_path."/is_file_variation2.tmp", "w") );
+
+echo "*** Testing is_file() with links ***\n";
+/* With symlink */
+symlink($file_path."/is_file_variation2.tmp", $file_path."/is_file_variation2_symlink.tmp");
+var_dump( is_file($file_path."/is_file_variation2_symlink.tmp") ); //expected true
+clearstatcache();
+
+/* With hardlink */
+link($file_path."/is_file_variation2.tmp", $file_path."/is_file_variation2_link.tmp");
+var_dump( is_file($file_path."/is_file_variation2_link.tmp") ); // expected: true
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/is_file_variation2_symlink.tmp");
+unlink($file_path."/is_file_variation2_link.tmp");
+unlink($file_path."/is_file_variation2.tmp");
+?>
+
+--EXPECTF--
+*** Testing is_file() with links ***
+bool(true)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt
new file mode 100644
index 0000000..2a13e46
--- /dev/null
+++ b/ext/standard/tests/file/is_file_variation3.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_file() function: usage variations - invalid filenames
+--FILE--
+<?php
+/* Prototype: bool is_file ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+/* Testing is_file() with invalid arguments -int, float, bool, NULL, resource */
+
+$file_path = dirname(__FILE__);
+$file_handle = fopen($file_path."/is_file_variation3.tmp", "w");
+
+echo "*** Testing Invalid file types ***\n";
+$filenames = array(
+ /* Invalid filenames */
+ -2.34555,
+ " ",
+ "",
+ TRUE,
+ FALSE,
+ NULL,
+ $file_handle,
+
+ /* scalars */
+ 1234,
+ 0
+);
+
+/* loop through to test each element the above array */
+foreach( $filenames as $filename ) {
+ var_dump( is_file($filename) );
+ clearstatcache();
+}
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/is_file_variation3.tmp");
+?>
+--EXPECTF--
+*** Testing Invalid file types ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d
+NULL
+bool(false)
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt
new file mode 100644
index 0000000..b927446
--- /dev/null
+++ b/ext/standard/tests/file/is_file_variation4.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test is_file() function: usage variations - diff. path notations (Bug #42027)
+--FILE--
+<?php
+/* Prototype: bool is_file ( string $filename );
+ Description: Tells whether the filename is a regular file
+ Returns TRUE if the filename exists and is a regular file
+*/
+
+/* Passing file names with different notations, using slashes, wild-card chars */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing is_file() with different notations of file names ***\n";
+$dir_name = $file_path."/is_file_variation4";
+mkdir($dir_name);
+$file_handle = fopen($dir_name."/is_file_variation4.tmp", "w");
+fclose($file_handle);
+
+$files_arr = array(
+ "/is_file_variation4/is_file_variation4.tmp",
+
+ /* Testing a file trailing slash */
+ "/is_file_variation4/is_file_variation4.tmp/",
+
+ /* Testing file with double slashes */
+ "/is_file_variation4//is_file_variation4.tmp",
+ "//is_file_variation4//is_file_variation4.tmp",
+ "/is_file_variation4/*.tmp",
+ "is_file_variation4/is_file*.tmp",
+
+ /* Testing Binary safe */
+ "/is_file_variation4/is_file_variation4.tmp".chr(0),
+ "/is_file_variation4/is_file_variation4.tmp\0"
+);
+
+$count = 1;
+/* loop through to test each element in the above array */
+foreach($files_arr as $file) {
+ echo "- Iteration $count -\n";
+ var_dump( is_file( $file_path."/".$file ) );
+ clearstatcache();
+ $count++;
+}
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/is_file_variation4";
+unlink($dir_name."/is_file_variation4.tmp");
+rmdir($dir_name);
+?>
+--EXPECTF--
+*** Testing is_file() with different notations of file names ***
+- Iteration 1 -
+bool(true)
+- Iteration 2 -
+bool(false)
+- Iteration 3 -
+bool(true)
+- Iteration 4 -
+bool(true)
+- Iteration 5 -
+bool(false)
+- Iteration 6 -
+bool(false)
+- Iteration 7 -
+
+Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+- Iteration 8 -
+
+Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/is_readable_basic-win32.phpt b/ext/standard/tests/file/is_readable_basic-win32.phpt
new file mode 100644
index 0000000..67f5768
--- /dev/null
+++ b/ext/standard/tests/file/is_readable_basic-win32.phpt
@@ -0,0 +1,1066 @@
+--TEST--
+Test is_readable() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_readable ( string $filename );
+ Description: Tells whether the filename is readable
+*/
+
+// include common file test functions
+require dirname(__FILE__).'/file.inc';
+
+echo "*** Testing is_readable(): basic functionality ***\n";
+
+// create a file
+$filename = dirname(__FILE__)."/is_readable.tmp";
+create_file($filename);
+
+$counter = 1;
+/* loop to check if the file with new mode is readable
+ using is_readable() */
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of file to $mode --\n";
+ chmod($filename, $mode); // change mode of file
+ var_dump( is_readable($filename) );
+ $counter++;
+ clearstatcache();
+}
+
+// delete the temp file
+delete_file($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_readable(): basic functionality ***
+-- Changing mode of file to 0 --
+bool(true)
+-- Changing mode of file to 1 --
+bool(true)
+-- Changing mode of file to 2 --
+bool(true)
+-- Changing mode of file to 3 --
+bool(true)
+-- Changing mode of file to 4 --
+bool(true)
+-- Changing mode of file to 5 --
+bool(true)
+-- Changing mode of file to 6 --
+bool(true)
+-- Changing mode of file to 7 --
+bool(true)
+-- Changing mode of file to 8 --
+bool(true)
+-- Changing mode of file to 9 --
+bool(true)
+-- Changing mode of file to 10 --
+bool(true)
+-- Changing mode of file to 11 --
+bool(true)
+-- Changing mode of file to 12 --
+bool(true)
+-- Changing mode of file to 13 --
+bool(true)
+-- Changing mode of file to 14 --
+bool(true)
+-- Changing mode of file to 15 --
+bool(true)
+-- Changing mode of file to 16 --
+bool(true)
+-- Changing mode of file to 17 --
+bool(true)
+-- Changing mode of file to 18 --
+bool(true)
+-- Changing mode of file to 19 --
+bool(true)
+-- Changing mode of file to 20 --
+bool(true)
+-- Changing mode of file to 21 --
+bool(true)
+-- Changing mode of file to 22 --
+bool(true)
+-- Changing mode of file to 23 --
+bool(true)
+-- Changing mode of file to 24 --
+bool(true)
+-- Changing mode of file to 25 --
+bool(true)
+-- Changing mode of file to 26 --
+bool(true)
+-- Changing mode of file to 27 --
+bool(true)
+-- Changing mode of file to 28 --
+bool(true)
+-- Changing mode of file to 29 --
+bool(true)
+-- Changing mode of file to 30 --
+bool(true)
+-- Changing mode of file to 31 --
+bool(true)
+-- Changing mode of file to 32 --
+bool(true)
+-- Changing mode of file to 33 --
+bool(true)
+-- Changing mode of file to 34 --
+bool(true)
+-- Changing mode of file to 35 --
+bool(true)
+-- Changing mode of file to 36 --
+bool(true)
+-- Changing mode of file to 37 --
+bool(true)
+-- Changing mode of file to 38 --
+bool(true)
+-- Changing mode of file to 39 --
+bool(true)
+-- Changing mode of file to 40 --
+bool(true)
+-- Changing mode of file to 41 --
+bool(true)
+-- Changing mode of file to 42 --
+bool(true)
+-- Changing mode of file to 43 --
+bool(true)
+-- Changing mode of file to 44 --
+bool(true)
+-- Changing mode of file to 45 --
+bool(true)
+-- Changing mode of file to 46 --
+bool(true)
+-- Changing mode of file to 47 --
+bool(true)
+-- Changing mode of file to 48 --
+bool(true)
+-- Changing mode of file to 49 --
+bool(true)
+-- Changing mode of file to 50 --
+bool(true)
+-- Changing mode of file to 51 --
+bool(true)
+-- Changing mode of file to 52 --
+bool(true)
+-- Changing mode of file to 53 --
+bool(true)
+-- Changing mode of file to 54 --
+bool(true)
+-- Changing mode of file to 55 --
+bool(true)
+-- Changing mode of file to 56 --
+bool(true)
+-- Changing mode of file to 57 --
+bool(true)
+-- Changing mode of file to 58 --
+bool(true)
+-- Changing mode of file to 59 --
+bool(true)
+-- Changing mode of file to 60 --
+bool(true)
+-- Changing mode of file to 61 --
+bool(true)
+-- Changing mode of file to 62 --
+bool(true)
+-- Changing mode of file to 63 --
+bool(true)
+-- Changing mode of file to 64 --
+bool(true)
+-- Changing mode of file to 65 --
+bool(true)
+-- Changing mode of file to 66 --
+bool(true)
+-- Changing mode of file to 67 --
+bool(true)
+-- Changing mode of file to 68 --
+bool(true)
+-- Changing mode of file to 69 --
+bool(true)
+-- Changing mode of file to 70 --
+bool(true)
+-- Changing mode of file to 71 --
+bool(true)
+-- Changing mode of file to 72 --
+bool(true)
+-- Changing mode of file to 73 --
+bool(true)
+-- Changing mode of file to 74 --
+bool(true)
+-- Changing mode of file to 75 --
+bool(true)
+-- Changing mode of file to 76 --
+bool(true)
+-- Changing mode of file to 77 --
+bool(true)
+-- Changing mode of file to 78 --
+bool(true)
+-- Changing mode of file to 79 --
+bool(true)
+-- Changing mode of file to 80 --
+bool(true)
+-- Changing mode of file to 81 --
+bool(true)
+-- Changing mode of file to 82 --
+bool(true)
+-- Changing mode of file to 83 --
+bool(true)
+-- Changing mode of file to 84 --
+bool(true)
+-- Changing mode of file to 85 --
+bool(true)
+-- Changing mode of file to 86 --
+bool(true)
+-- Changing mode of file to 87 --
+bool(true)
+-- Changing mode of file to 88 --
+bool(true)
+-- Changing mode of file to 89 --
+bool(true)
+-- Changing mode of file to 90 --
+bool(true)
+-- Changing mode of file to 91 --
+bool(true)
+-- Changing mode of file to 92 --
+bool(true)
+-- Changing mode of file to 93 --
+bool(true)
+-- Changing mode of file to 94 --
+bool(true)
+-- Changing mode of file to 95 --
+bool(true)
+-- Changing mode of file to 96 --
+bool(true)
+-- Changing mode of file to 97 --
+bool(true)
+-- Changing mode of file to 98 --
+bool(true)
+-- Changing mode of file to 99 --
+bool(true)
+-- Changing mode of file to 100 --
+bool(true)
+-- Changing mode of file to 101 --
+bool(true)
+-- Changing mode of file to 102 --
+bool(true)
+-- Changing mode of file to 103 --
+bool(true)
+-- Changing mode of file to 104 --
+bool(true)
+-- Changing mode of file to 105 --
+bool(true)
+-- Changing mode of file to 106 --
+bool(true)
+-- Changing mode of file to 107 --
+bool(true)
+-- Changing mode of file to 108 --
+bool(true)
+-- Changing mode of file to 109 --
+bool(true)
+-- Changing mode of file to 110 --
+bool(true)
+-- Changing mode of file to 111 --
+bool(true)
+-- Changing mode of file to 112 --
+bool(true)
+-- Changing mode of file to 113 --
+bool(true)
+-- Changing mode of file to 114 --
+bool(true)
+-- Changing mode of file to 115 --
+bool(true)
+-- Changing mode of file to 116 --
+bool(true)
+-- Changing mode of file to 117 --
+bool(true)
+-- Changing mode of file to 118 --
+bool(true)
+-- Changing mode of file to 119 --
+bool(true)
+-- Changing mode of file to 120 --
+bool(true)
+-- Changing mode of file to 121 --
+bool(true)
+-- Changing mode of file to 122 --
+bool(true)
+-- Changing mode of file to 123 --
+bool(true)
+-- Changing mode of file to 124 --
+bool(true)
+-- Changing mode of file to 125 --
+bool(true)
+-- Changing mode of file to 126 --
+bool(true)
+-- Changing mode of file to 127 --
+bool(true)
+-- Changing mode of file to 128 --
+bool(true)
+-- Changing mode of file to 129 --
+bool(true)
+-- Changing mode of file to 130 --
+bool(true)
+-- Changing mode of file to 131 --
+bool(true)
+-- Changing mode of file to 132 --
+bool(true)
+-- Changing mode of file to 133 --
+bool(true)
+-- Changing mode of file to 134 --
+bool(true)
+-- Changing mode of file to 135 --
+bool(true)
+-- Changing mode of file to 136 --
+bool(true)
+-- Changing mode of file to 137 --
+bool(true)
+-- Changing mode of file to 138 --
+bool(true)
+-- Changing mode of file to 139 --
+bool(true)
+-- Changing mode of file to 140 --
+bool(true)
+-- Changing mode of file to 141 --
+bool(true)
+-- Changing mode of file to 142 --
+bool(true)
+-- Changing mode of file to 143 --
+bool(true)
+-- Changing mode of file to 144 --
+bool(true)
+-- Changing mode of file to 145 --
+bool(true)
+-- Changing mode of file to 146 --
+bool(true)
+-- Changing mode of file to 147 --
+bool(true)
+-- Changing mode of file to 148 --
+bool(true)
+-- Changing mode of file to 149 --
+bool(true)
+-- Changing mode of file to 150 --
+bool(true)
+-- Changing mode of file to 151 --
+bool(true)
+-- Changing mode of file to 152 --
+bool(true)
+-- Changing mode of file to 153 --
+bool(true)
+-- Changing mode of file to 154 --
+bool(true)
+-- Changing mode of file to 155 --
+bool(true)
+-- Changing mode of file to 156 --
+bool(true)
+-- Changing mode of file to 157 --
+bool(true)
+-- Changing mode of file to 158 --
+bool(true)
+-- Changing mode of file to 159 --
+bool(true)
+-- Changing mode of file to 160 --
+bool(true)
+-- Changing mode of file to 161 --
+bool(true)
+-- Changing mode of file to 162 --
+bool(true)
+-- Changing mode of file to 163 --
+bool(true)
+-- Changing mode of file to 164 --
+bool(true)
+-- Changing mode of file to 165 --
+bool(true)
+-- Changing mode of file to 166 --
+bool(true)
+-- Changing mode of file to 167 --
+bool(true)
+-- Changing mode of file to 168 --
+bool(true)
+-- Changing mode of file to 169 --
+bool(true)
+-- Changing mode of file to 170 --
+bool(true)
+-- Changing mode of file to 171 --
+bool(true)
+-- Changing mode of file to 172 --
+bool(true)
+-- Changing mode of file to 173 --
+bool(true)
+-- Changing mode of file to 174 --
+bool(true)
+-- Changing mode of file to 175 --
+bool(true)
+-- Changing mode of file to 176 --
+bool(true)
+-- Changing mode of file to 177 --
+bool(true)
+-- Changing mode of file to 178 --
+bool(true)
+-- Changing mode of file to 179 --
+bool(true)
+-- Changing mode of file to 180 --
+bool(true)
+-- Changing mode of file to 181 --
+bool(true)
+-- Changing mode of file to 182 --
+bool(true)
+-- Changing mode of file to 183 --
+bool(true)
+-- Changing mode of file to 184 --
+bool(true)
+-- Changing mode of file to 185 --
+bool(true)
+-- Changing mode of file to 186 --
+bool(true)
+-- Changing mode of file to 187 --
+bool(true)
+-- Changing mode of file to 188 --
+bool(true)
+-- Changing mode of file to 189 --
+bool(true)
+-- Changing mode of file to 190 --
+bool(true)
+-- Changing mode of file to 191 --
+bool(true)
+-- Changing mode of file to 192 --
+bool(true)
+-- Changing mode of file to 193 --
+bool(true)
+-- Changing mode of file to 194 --
+bool(true)
+-- Changing mode of file to 195 --
+bool(true)
+-- Changing mode of file to 196 --
+bool(true)
+-- Changing mode of file to 197 --
+bool(true)
+-- Changing mode of file to 198 --
+bool(true)
+-- Changing mode of file to 199 --
+bool(true)
+-- Changing mode of file to 200 --
+bool(true)
+-- Changing mode of file to 201 --
+bool(true)
+-- Changing mode of file to 202 --
+bool(true)
+-- Changing mode of file to 203 --
+bool(true)
+-- Changing mode of file to 204 --
+bool(true)
+-- Changing mode of file to 205 --
+bool(true)
+-- Changing mode of file to 206 --
+bool(true)
+-- Changing mode of file to 207 --
+bool(true)
+-- Changing mode of file to 208 --
+bool(true)
+-- Changing mode of file to 209 --
+bool(true)
+-- Changing mode of file to 210 --
+bool(true)
+-- Changing mode of file to 211 --
+bool(true)
+-- Changing mode of file to 212 --
+bool(true)
+-- Changing mode of file to 213 --
+bool(true)
+-- Changing mode of file to 214 --
+bool(true)
+-- Changing mode of file to 215 --
+bool(true)
+-- Changing mode of file to 216 --
+bool(true)
+-- Changing mode of file to 217 --
+bool(true)
+-- Changing mode of file to 218 --
+bool(true)
+-- Changing mode of file to 219 --
+bool(true)
+-- Changing mode of file to 220 --
+bool(true)
+-- Changing mode of file to 221 --
+bool(true)
+-- Changing mode of file to 222 --
+bool(true)
+-- Changing mode of file to 223 --
+bool(true)
+-- Changing mode of file to 224 --
+bool(true)
+-- Changing mode of file to 225 --
+bool(true)
+-- Changing mode of file to 226 --
+bool(true)
+-- Changing mode of file to 227 --
+bool(true)
+-- Changing mode of file to 228 --
+bool(true)
+-- Changing mode of file to 229 --
+bool(true)
+-- Changing mode of file to 230 --
+bool(true)
+-- Changing mode of file to 231 --
+bool(true)
+-- Changing mode of file to 232 --
+bool(true)
+-- Changing mode of file to 233 --
+bool(true)
+-- Changing mode of file to 234 --
+bool(true)
+-- Changing mode of file to 235 --
+bool(true)
+-- Changing mode of file to 236 --
+bool(true)
+-- Changing mode of file to 237 --
+bool(true)
+-- Changing mode of file to 238 --
+bool(true)
+-- Changing mode of file to 239 --
+bool(true)
+-- Changing mode of file to 240 --
+bool(true)
+-- Changing mode of file to 241 --
+bool(true)
+-- Changing mode of file to 242 --
+bool(true)
+-- Changing mode of file to 243 --
+bool(true)
+-- Changing mode of file to 244 --
+bool(true)
+-- Changing mode of file to 245 --
+bool(true)
+-- Changing mode of file to 246 --
+bool(true)
+-- Changing mode of file to 247 --
+bool(true)
+-- Changing mode of file to 248 --
+bool(true)
+-- Changing mode of file to 249 --
+bool(true)
+-- Changing mode of file to 250 --
+bool(true)
+-- Changing mode of file to 251 --
+bool(true)
+-- Changing mode of file to 252 --
+bool(true)
+-- Changing mode of file to 253 --
+bool(true)
+-- Changing mode of file to 254 --
+bool(true)
+-- Changing mode of file to 255 --
+bool(true)
+-- Changing mode of file to 256 --
+bool(true)
+-- Changing mode of file to 257 --
+bool(true)
+-- Changing mode of file to 258 --
+bool(true)
+-- Changing mode of file to 259 --
+bool(true)
+-- Changing mode of file to 260 --
+bool(true)
+-- Changing mode of file to 261 --
+bool(true)
+-- Changing mode of file to 262 --
+bool(true)
+-- Changing mode of file to 263 --
+bool(true)
+-- Changing mode of file to 264 --
+bool(true)
+-- Changing mode of file to 265 --
+bool(true)
+-- Changing mode of file to 266 --
+bool(true)
+-- Changing mode of file to 267 --
+bool(true)
+-- Changing mode of file to 268 --
+bool(true)
+-- Changing mode of file to 269 --
+bool(true)
+-- Changing mode of file to 270 --
+bool(true)
+-- Changing mode of file to 271 --
+bool(true)
+-- Changing mode of file to 272 --
+bool(true)
+-- Changing mode of file to 273 --
+bool(true)
+-- Changing mode of file to 274 --
+bool(true)
+-- Changing mode of file to 275 --
+bool(true)
+-- Changing mode of file to 276 --
+bool(true)
+-- Changing mode of file to 277 --
+bool(true)
+-- Changing mode of file to 278 --
+bool(true)
+-- Changing mode of file to 279 --
+bool(true)
+-- Changing mode of file to 280 --
+bool(true)
+-- Changing mode of file to 281 --
+bool(true)
+-- Changing mode of file to 282 --
+bool(true)
+-- Changing mode of file to 283 --
+bool(true)
+-- Changing mode of file to 284 --
+bool(true)
+-- Changing mode of file to 285 --
+bool(true)
+-- Changing mode of file to 286 --
+bool(true)
+-- Changing mode of file to 287 --
+bool(true)
+-- Changing mode of file to 288 --
+bool(true)
+-- Changing mode of file to 289 --
+bool(true)
+-- Changing mode of file to 290 --
+bool(true)
+-- Changing mode of file to 291 --
+bool(true)
+-- Changing mode of file to 292 --
+bool(true)
+-- Changing mode of file to 293 --
+bool(true)
+-- Changing mode of file to 294 --
+bool(true)
+-- Changing mode of file to 295 --
+bool(true)
+-- Changing mode of file to 296 --
+bool(true)
+-- Changing mode of file to 297 --
+bool(true)
+-- Changing mode of file to 298 --
+bool(true)
+-- Changing mode of file to 299 --
+bool(true)
+-- Changing mode of file to 300 --
+bool(true)
+-- Changing mode of file to 301 --
+bool(true)
+-- Changing mode of file to 302 --
+bool(true)
+-- Changing mode of file to 303 --
+bool(true)
+-- Changing mode of file to 304 --
+bool(true)
+-- Changing mode of file to 305 --
+bool(true)
+-- Changing mode of file to 306 --
+bool(true)
+-- Changing mode of file to 307 --
+bool(true)
+-- Changing mode of file to 308 --
+bool(true)
+-- Changing mode of file to 309 --
+bool(true)
+-- Changing mode of file to 310 --
+bool(true)
+-- Changing mode of file to 311 --
+bool(true)
+-- Changing mode of file to 312 --
+bool(true)
+-- Changing mode of file to 313 --
+bool(true)
+-- Changing mode of file to 314 --
+bool(true)
+-- Changing mode of file to 315 --
+bool(true)
+-- Changing mode of file to 316 --
+bool(true)
+-- Changing mode of file to 317 --
+bool(true)
+-- Changing mode of file to 318 --
+bool(true)
+-- Changing mode of file to 319 --
+bool(true)
+-- Changing mode of file to 320 --
+bool(true)
+-- Changing mode of file to 321 --
+bool(true)
+-- Changing mode of file to 322 --
+bool(true)
+-- Changing mode of file to 323 --
+bool(true)
+-- Changing mode of file to 324 --
+bool(true)
+-- Changing mode of file to 325 --
+bool(true)
+-- Changing mode of file to 326 --
+bool(true)
+-- Changing mode of file to 327 --
+bool(true)
+-- Changing mode of file to 328 --
+bool(true)
+-- Changing mode of file to 329 --
+bool(true)
+-- Changing mode of file to 330 --
+bool(true)
+-- Changing mode of file to 331 --
+bool(true)
+-- Changing mode of file to 332 --
+bool(true)
+-- Changing mode of file to 333 --
+bool(true)
+-- Changing mode of file to 334 --
+bool(true)
+-- Changing mode of file to 335 --
+bool(true)
+-- Changing mode of file to 336 --
+bool(true)
+-- Changing mode of file to 337 --
+bool(true)
+-- Changing mode of file to 338 --
+bool(true)
+-- Changing mode of file to 339 --
+bool(true)
+-- Changing mode of file to 340 --
+bool(true)
+-- Changing mode of file to 341 --
+bool(true)
+-- Changing mode of file to 342 --
+bool(true)
+-- Changing mode of file to 343 --
+bool(true)
+-- Changing mode of file to 344 --
+bool(true)
+-- Changing mode of file to 345 --
+bool(true)
+-- Changing mode of file to 346 --
+bool(true)
+-- Changing mode of file to 347 --
+bool(true)
+-- Changing mode of file to 348 --
+bool(true)
+-- Changing mode of file to 349 --
+bool(true)
+-- Changing mode of file to 350 --
+bool(true)
+-- Changing mode of file to 351 --
+bool(true)
+-- Changing mode of file to 352 --
+bool(true)
+-- Changing mode of file to 353 --
+bool(true)
+-- Changing mode of file to 354 --
+bool(true)
+-- Changing mode of file to 355 --
+bool(true)
+-- Changing mode of file to 356 --
+bool(true)
+-- Changing mode of file to 357 --
+bool(true)
+-- Changing mode of file to 358 --
+bool(true)
+-- Changing mode of file to 359 --
+bool(true)
+-- Changing mode of file to 360 --
+bool(true)
+-- Changing mode of file to 361 --
+bool(true)
+-- Changing mode of file to 362 --
+bool(true)
+-- Changing mode of file to 363 --
+bool(true)
+-- Changing mode of file to 364 --
+bool(true)
+-- Changing mode of file to 365 --
+bool(true)
+-- Changing mode of file to 366 --
+bool(true)
+-- Changing mode of file to 367 --
+bool(true)
+-- Changing mode of file to 368 --
+bool(true)
+-- Changing mode of file to 369 --
+bool(true)
+-- Changing mode of file to 370 --
+bool(true)
+-- Changing mode of file to 371 --
+bool(true)
+-- Changing mode of file to 372 --
+bool(true)
+-- Changing mode of file to 373 --
+bool(true)
+-- Changing mode of file to 374 --
+bool(true)
+-- Changing mode of file to 375 --
+bool(true)
+-- Changing mode of file to 376 --
+bool(true)
+-- Changing mode of file to 377 --
+bool(true)
+-- Changing mode of file to 378 --
+bool(true)
+-- Changing mode of file to 379 --
+bool(true)
+-- Changing mode of file to 380 --
+bool(true)
+-- Changing mode of file to 381 --
+bool(true)
+-- Changing mode of file to 382 --
+bool(true)
+-- Changing mode of file to 383 --
+bool(true)
+-- Changing mode of file to 384 --
+bool(true)
+-- Changing mode of file to 385 --
+bool(true)
+-- Changing mode of file to 386 --
+bool(true)
+-- Changing mode of file to 387 --
+bool(true)
+-- Changing mode of file to 388 --
+bool(true)
+-- Changing mode of file to 389 --
+bool(true)
+-- Changing mode of file to 390 --
+bool(true)
+-- Changing mode of file to 391 --
+bool(true)
+-- Changing mode of file to 392 --
+bool(true)
+-- Changing mode of file to 393 --
+bool(true)
+-- Changing mode of file to 394 --
+bool(true)
+-- Changing mode of file to 395 --
+bool(true)
+-- Changing mode of file to 396 --
+bool(true)
+-- Changing mode of file to 397 --
+bool(true)
+-- Changing mode of file to 398 --
+bool(true)
+-- Changing mode of file to 399 --
+bool(true)
+-- Changing mode of file to 400 --
+bool(true)
+-- Changing mode of file to 401 --
+bool(true)
+-- Changing mode of file to 402 --
+bool(true)
+-- Changing mode of file to 403 --
+bool(true)
+-- Changing mode of file to 404 --
+bool(true)
+-- Changing mode of file to 405 --
+bool(true)
+-- Changing mode of file to 406 --
+bool(true)
+-- Changing mode of file to 407 --
+bool(true)
+-- Changing mode of file to 408 --
+bool(true)
+-- Changing mode of file to 409 --
+bool(true)
+-- Changing mode of file to 410 --
+bool(true)
+-- Changing mode of file to 411 --
+bool(true)
+-- Changing mode of file to 412 --
+bool(true)
+-- Changing mode of file to 413 --
+bool(true)
+-- Changing mode of file to 414 --
+bool(true)
+-- Changing mode of file to 415 --
+bool(true)
+-- Changing mode of file to 416 --
+bool(true)
+-- Changing mode of file to 417 --
+bool(true)
+-- Changing mode of file to 418 --
+bool(true)
+-- Changing mode of file to 419 --
+bool(true)
+-- Changing mode of file to 420 --
+bool(true)
+-- Changing mode of file to 421 --
+bool(true)
+-- Changing mode of file to 422 --
+bool(true)
+-- Changing mode of file to 423 --
+bool(true)
+-- Changing mode of file to 424 --
+bool(true)
+-- Changing mode of file to 425 --
+bool(true)
+-- Changing mode of file to 426 --
+bool(true)
+-- Changing mode of file to 427 --
+bool(true)
+-- Changing mode of file to 428 --
+bool(true)
+-- Changing mode of file to 429 --
+bool(true)
+-- Changing mode of file to 430 --
+bool(true)
+-- Changing mode of file to 431 --
+bool(true)
+-- Changing mode of file to 432 --
+bool(true)
+-- Changing mode of file to 433 --
+bool(true)
+-- Changing mode of file to 434 --
+bool(true)
+-- Changing mode of file to 435 --
+bool(true)
+-- Changing mode of file to 436 --
+bool(true)
+-- Changing mode of file to 437 --
+bool(true)
+-- Changing mode of file to 438 --
+bool(true)
+-- Changing mode of file to 439 --
+bool(true)
+-- Changing mode of file to 440 --
+bool(true)
+-- Changing mode of file to 441 --
+bool(true)
+-- Changing mode of file to 442 --
+bool(true)
+-- Changing mode of file to 443 --
+bool(true)
+-- Changing mode of file to 444 --
+bool(true)
+-- Changing mode of file to 445 --
+bool(true)
+-- Changing mode of file to 446 --
+bool(true)
+-- Changing mode of file to 447 --
+bool(true)
+-- Changing mode of file to 448 --
+bool(true)
+-- Changing mode of file to 449 --
+bool(true)
+-- Changing mode of file to 450 --
+bool(true)
+-- Changing mode of file to 451 --
+bool(true)
+-- Changing mode of file to 452 --
+bool(true)
+-- Changing mode of file to 453 --
+bool(true)
+-- Changing mode of file to 454 --
+bool(true)
+-- Changing mode of file to 455 --
+bool(true)
+-- Changing mode of file to 456 --
+bool(true)
+-- Changing mode of file to 457 --
+bool(true)
+-- Changing mode of file to 458 --
+bool(true)
+-- Changing mode of file to 459 --
+bool(true)
+-- Changing mode of file to 460 --
+bool(true)
+-- Changing mode of file to 461 --
+bool(true)
+-- Changing mode of file to 462 --
+bool(true)
+-- Changing mode of file to 463 --
+bool(true)
+-- Changing mode of file to 464 --
+bool(true)
+-- Changing mode of file to 465 --
+bool(true)
+-- Changing mode of file to 466 --
+bool(true)
+-- Changing mode of file to 467 --
+bool(true)
+-- Changing mode of file to 468 --
+bool(true)
+-- Changing mode of file to 469 --
+bool(true)
+-- Changing mode of file to 470 --
+bool(true)
+-- Changing mode of file to 471 --
+bool(true)
+-- Changing mode of file to 472 --
+bool(true)
+-- Changing mode of file to 473 --
+bool(true)
+-- Changing mode of file to 474 --
+bool(true)
+-- Changing mode of file to 475 --
+bool(true)
+-- Changing mode of file to 476 --
+bool(true)
+-- Changing mode of file to 477 --
+bool(true)
+-- Changing mode of file to 478 --
+bool(true)
+-- Changing mode of file to 479 --
+bool(true)
+-- Changing mode of file to 480 --
+bool(true)
+-- Changing mode of file to 481 --
+bool(true)
+-- Changing mode of file to 482 --
+bool(true)
+-- Changing mode of file to 483 --
+bool(true)
+-- Changing mode of file to 484 --
+bool(true)
+-- Changing mode of file to 485 --
+bool(true)
+-- Changing mode of file to 486 --
+bool(true)
+-- Changing mode of file to 487 --
+bool(true)
+-- Changing mode of file to 488 --
+bool(true)
+-- Changing mode of file to 489 --
+bool(true)
+-- Changing mode of file to 490 --
+bool(true)
+-- Changing mode of file to 491 --
+bool(true)
+-- Changing mode of file to 492 --
+bool(true)
+-- Changing mode of file to 493 --
+bool(true)
+-- Changing mode of file to 494 --
+bool(true)
+-- Changing mode of file to 495 --
+bool(true)
+-- Changing mode of file to 496 --
+bool(true)
+-- Changing mode of file to 497 --
+bool(true)
+-- Changing mode of file to 498 --
+bool(true)
+-- Changing mode of file to 499 --
+bool(true)
+-- Changing mode of file to 500 --
+bool(true)
+-- Changing mode of file to 501 --
+bool(true)
+-- Changing mode of file to 502 --
+bool(true)
+-- Changing mode of file to 503 --
+bool(true)
+-- Changing mode of file to 504 --
+bool(true)
+-- Changing mode of file to 505 --
+bool(true)
+-- Changing mode of file to 506 --
+bool(true)
+-- Changing mode of file to 507 --
+bool(true)
+-- Changing mode of file to 508 --
+bool(true)
+-- Changing mode of file to 509 --
+bool(true)
+-- Changing mode of file to 510 --
+bool(true)
+-- Changing mode of file to 511 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_readable_basic.phpt b/ext/standard/tests/file/is_readable_basic.phpt
new file mode 100644
index 0000000..4d5febf
--- /dev/null
+++ b/ext/standard/tests/file/is_readable_basic.phpt
@@ -0,0 +1,1076 @@
+--TEST--
+Test is_readable() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_readable ( string $filename );
+ Description: Tells whether the filename is readable
+*/
+
+// include common file test functions
+require dirname(__FILE__).'/file.inc';
+
+echo "*** Testing is_readable(): basic functionality ***\n";
+
+// create a file
+$filename = dirname(__FILE__)."/is_readable.tmp";
+create_file($filename);
+
+$counter = 1;
+/* loop to check if the file with new mode is readable
+ using is_readable() */
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of file to $mode --\n";
+ chmod($filename, $mode); // change mode of file
+ var_dump( is_readable($filename) );
+ $counter++;
+ clearstatcache();
+}
+
+// delete the temp file
+delete_file($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_readable(): basic functionality ***
+-- Changing mode of file to 0 --
+bool(false)
+-- Changing mode of file to 1 --
+bool(false)
+-- Changing mode of file to 2 --
+bool(false)
+-- Changing mode of file to 3 --
+bool(false)
+-- Changing mode of file to 4 --
+bool(false)
+-- Changing mode of file to 5 --
+bool(false)
+-- Changing mode of file to 6 --
+bool(false)
+-- Changing mode of file to 7 --
+bool(false)
+-- Changing mode of file to 8 --
+bool(false)
+-- Changing mode of file to 9 --
+bool(false)
+-- Changing mode of file to 10 --
+bool(false)
+-- Changing mode of file to 11 --
+bool(false)
+-- Changing mode of file to 12 --
+bool(false)
+-- Changing mode of file to 13 --
+bool(false)
+-- Changing mode of file to 14 --
+bool(false)
+-- Changing mode of file to 15 --
+bool(false)
+-- Changing mode of file to 16 --
+bool(false)
+-- Changing mode of file to 17 --
+bool(false)
+-- Changing mode of file to 18 --
+bool(false)
+-- Changing mode of file to 19 --
+bool(false)
+-- Changing mode of file to 20 --
+bool(false)
+-- Changing mode of file to 21 --
+bool(false)
+-- Changing mode of file to 22 --
+bool(false)
+-- Changing mode of file to 23 --
+bool(false)
+-- Changing mode of file to 24 --
+bool(false)
+-- Changing mode of file to 25 --
+bool(false)
+-- Changing mode of file to 26 --
+bool(false)
+-- Changing mode of file to 27 --
+bool(false)
+-- Changing mode of file to 28 --
+bool(false)
+-- Changing mode of file to 29 --
+bool(false)
+-- Changing mode of file to 30 --
+bool(false)
+-- Changing mode of file to 31 --
+bool(false)
+-- Changing mode of file to 32 --
+bool(false)
+-- Changing mode of file to 33 --
+bool(false)
+-- Changing mode of file to 34 --
+bool(false)
+-- Changing mode of file to 35 --
+bool(false)
+-- Changing mode of file to 36 --
+bool(false)
+-- Changing mode of file to 37 --
+bool(false)
+-- Changing mode of file to 38 --
+bool(false)
+-- Changing mode of file to 39 --
+bool(false)
+-- Changing mode of file to 40 --
+bool(false)
+-- Changing mode of file to 41 --
+bool(false)
+-- Changing mode of file to 42 --
+bool(false)
+-- Changing mode of file to 43 --
+bool(false)
+-- Changing mode of file to 44 --
+bool(false)
+-- Changing mode of file to 45 --
+bool(false)
+-- Changing mode of file to 46 --
+bool(false)
+-- Changing mode of file to 47 --
+bool(false)
+-- Changing mode of file to 48 --
+bool(false)
+-- Changing mode of file to 49 --
+bool(false)
+-- Changing mode of file to 50 --
+bool(false)
+-- Changing mode of file to 51 --
+bool(false)
+-- Changing mode of file to 52 --
+bool(false)
+-- Changing mode of file to 53 --
+bool(false)
+-- Changing mode of file to 54 --
+bool(false)
+-- Changing mode of file to 55 --
+bool(false)
+-- Changing mode of file to 56 --
+bool(false)
+-- Changing mode of file to 57 --
+bool(false)
+-- Changing mode of file to 58 --
+bool(false)
+-- Changing mode of file to 59 --
+bool(false)
+-- Changing mode of file to 60 --
+bool(false)
+-- Changing mode of file to 61 --
+bool(false)
+-- Changing mode of file to 62 --
+bool(false)
+-- Changing mode of file to 63 --
+bool(false)
+-- Changing mode of file to 64 --
+bool(false)
+-- Changing mode of file to 65 --
+bool(false)
+-- Changing mode of file to 66 --
+bool(false)
+-- Changing mode of file to 67 --
+bool(false)
+-- Changing mode of file to 68 --
+bool(false)
+-- Changing mode of file to 69 --
+bool(false)
+-- Changing mode of file to 70 --
+bool(false)
+-- Changing mode of file to 71 --
+bool(false)
+-- Changing mode of file to 72 --
+bool(false)
+-- Changing mode of file to 73 --
+bool(false)
+-- Changing mode of file to 74 --
+bool(false)
+-- Changing mode of file to 75 --
+bool(false)
+-- Changing mode of file to 76 --
+bool(false)
+-- Changing mode of file to 77 --
+bool(false)
+-- Changing mode of file to 78 --
+bool(false)
+-- Changing mode of file to 79 --
+bool(false)
+-- Changing mode of file to 80 --
+bool(false)
+-- Changing mode of file to 81 --
+bool(false)
+-- Changing mode of file to 82 --
+bool(false)
+-- Changing mode of file to 83 --
+bool(false)
+-- Changing mode of file to 84 --
+bool(false)
+-- Changing mode of file to 85 --
+bool(false)
+-- Changing mode of file to 86 --
+bool(false)
+-- Changing mode of file to 87 --
+bool(false)
+-- Changing mode of file to 88 --
+bool(false)
+-- Changing mode of file to 89 --
+bool(false)
+-- Changing mode of file to 90 --
+bool(false)
+-- Changing mode of file to 91 --
+bool(false)
+-- Changing mode of file to 92 --
+bool(false)
+-- Changing mode of file to 93 --
+bool(false)
+-- Changing mode of file to 94 --
+bool(false)
+-- Changing mode of file to 95 --
+bool(false)
+-- Changing mode of file to 96 --
+bool(false)
+-- Changing mode of file to 97 --
+bool(false)
+-- Changing mode of file to 98 --
+bool(false)
+-- Changing mode of file to 99 --
+bool(false)
+-- Changing mode of file to 100 --
+bool(false)
+-- Changing mode of file to 101 --
+bool(false)
+-- Changing mode of file to 102 --
+bool(false)
+-- Changing mode of file to 103 --
+bool(false)
+-- Changing mode of file to 104 --
+bool(false)
+-- Changing mode of file to 105 --
+bool(false)
+-- Changing mode of file to 106 --
+bool(false)
+-- Changing mode of file to 107 --
+bool(false)
+-- Changing mode of file to 108 --
+bool(false)
+-- Changing mode of file to 109 --
+bool(false)
+-- Changing mode of file to 110 --
+bool(false)
+-- Changing mode of file to 111 --
+bool(false)
+-- Changing mode of file to 112 --
+bool(false)
+-- Changing mode of file to 113 --
+bool(false)
+-- Changing mode of file to 114 --
+bool(false)
+-- Changing mode of file to 115 --
+bool(false)
+-- Changing mode of file to 116 --
+bool(false)
+-- Changing mode of file to 117 --
+bool(false)
+-- Changing mode of file to 118 --
+bool(false)
+-- Changing mode of file to 119 --
+bool(false)
+-- Changing mode of file to 120 --
+bool(false)
+-- Changing mode of file to 121 --
+bool(false)
+-- Changing mode of file to 122 --
+bool(false)
+-- Changing mode of file to 123 --
+bool(false)
+-- Changing mode of file to 124 --
+bool(false)
+-- Changing mode of file to 125 --
+bool(false)
+-- Changing mode of file to 126 --
+bool(false)
+-- Changing mode of file to 127 --
+bool(false)
+-- Changing mode of file to 128 --
+bool(false)
+-- Changing mode of file to 129 --
+bool(false)
+-- Changing mode of file to 130 --
+bool(false)
+-- Changing mode of file to 131 --
+bool(false)
+-- Changing mode of file to 132 --
+bool(false)
+-- Changing mode of file to 133 --
+bool(false)
+-- Changing mode of file to 134 --
+bool(false)
+-- Changing mode of file to 135 --
+bool(false)
+-- Changing mode of file to 136 --
+bool(false)
+-- Changing mode of file to 137 --
+bool(false)
+-- Changing mode of file to 138 --
+bool(false)
+-- Changing mode of file to 139 --
+bool(false)
+-- Changing mode of file to 140 --
+bool(false)
+-- Changing mode of file to 141 --
+bool(false)
+-- Changing mode of file to 142 --
+bool(false)
+-- Changing mode of file to 143 --
+bool(false)
+-- Changing mode of file to 144 --
+bool(false)
+-- Changing mode of file to 145 --
+bool(false)
+-- Changing mode of file to 146 --
+bool(false)
+-- Changing mode of file to 147 --
+bool(false)
+-- Changing mode of file to 148 --
+bool(false)
+-- Changing mode of file to 149 --
+bool(false)
+-- Changing mode of file to 150 --
+bool(false)
+-- Changing mode of file to 151 --
+bool(false)
+-- Changing mode of file to 152 --
+bool(false)
+-- Changing mode of file to 153 --
+bool(false)
+-- Changing mode of file to 154 --
+bool(false)
+-- Changing mode of file to 155 --
+bool(false)
+-- Changing mode of file to 156 --
+bool(false)
+-- Changing mode of file to 157 --
+bool(false)
+-- Changing mode of file to 158 --
+bool(false)
+-- Changing mode of file to 159 --
+bool(false)
+-- Changing mode of file to 160 --
+bool(false)
+-- Changing mode of file to 161 --
+bool(false)
+-- Changing mode of file to 162 --
+bool(false)
+-- Changing mode of file to 163 --
+bool(false)
+-- Changing mode of file to 164 --
+bool(false)
+-- Changing mode of file to 165 --
+bool(false)
+-- Changing mode of file to 166 --
+bool(false)
+-- Changing mode of file to 167 --
+bool(false)
+-- Changing mode of file to 168 --
+bool(false)
+-- Changing mode of file to 169 --
+bool(false)
+-- Changing mode of file to 170 --
+bool(false)
+-- Changing mode of file to 171 --
+bool(false)
+-- Changing mode of file to 172 --
+bool(false)
+-- Changing mode of file to 173 --
+bool(false)
+-- Changing mode of file to 174 --
+bool(false)
+-- Changing mode of file to 175 --
+bool(false)
+-- Changing mode of file to 176 --
+bool(false)
+-- Changing mode of file to 177 --
+bool(false)
+-- Changing mode of file to 178 --
+bool(false)
+-- Changing mode of file to 179 --
+bool(false)
+-- Changing mode of file to 180 --
+bool(false)
+-- Changing mode of file to 181 --
+bool(false)
+-- Changing mode of file to 182 --
+bool(false)
+-- Changing mode of file to 183 --
+bool(false)
+-- Changing mode of file to 184 --
+bool(false)
+-- Changing mode of file to 185 --
+bool(false)
+-- Changing mode of file to 186 --
+bool(false)
+-- Changing mode of file to 187 --
+bool(false)
+-- Changing mode of file to 188 --
+bool(false)
+-- Changing mode of file to 189 --
+bool(false)
+-- Changing mode of file to 190 --
+bool(false)
+-- Changing mode of file to 191 --
+bool(false)
+-- Changing mode of file to 192 --
+bool(false)
+-- Changing mode of file to 193 --
+bool(false)
+-- Changing mode of file to 194 --
+bool(false)
+-- Changing mode of file to 195 --
+bool(false)
+-- Changing mode of file to 196 --
+bool(false)
+-- Changing mode of file to 197 --
+bool(false)
+-- Changing mode of file to 198 --
+bool(false)
+-- Changing mode of file to 199 --
+bool(false)
+-- Changing mode of file to 200 --
+bool(false)
+-- Changing mode of file to 201 --
+bool(false)
+-- Changing mode of file to 202 --
+bool(false)
+-- Changing mode of file to 203 --
+bool(false)
+-- Changing mode of file to 204 --
+bool(false)
+-- Changing mode of file to 205 --
+bool(false)
+-- Changing mode of file to 206 --
+bool(false)
+-- Changing mode of file to 207 --
+bool(false)
+-- Changing mode of file to 208 --
+bool(false)
+-- Changing mode of file to 209 --
+bool(false)
+-- Changing mode of file to 210 --
+bool(false)
+-- Changing mode of file to 211 --
+bool(false)
+-- Changing mode of file to 212 --
+bool(false)
+-- Changing mode of file to 213 --
+bool(false)
+-- Changing mode of file to 214 --
+bool(false)
+-- Changing mode of file to 215 --
+bool(false)
+-- Changing mode of file to 216 --
+bool(false)
+-- Changing mode of file to 217 --
+bool(false)
+-- Changing mode of file to 218 --
+bool(false)
+-- Changing mode of file to 219 --
+bool(false)
+-- Changing mode of file to 220 --
+bool(false)
+-- Changing mode of file to 221 --
+bool(false)
+-- Changing mode of file to 222 --
+bool(false)
+-- Changing mode of file to 223 --
+bool(false)
+-- Changing mode of file to 224 --
+bool(false)
+-- Changing mode of file to 225 --
+bool(false)
+-- Changing mode of file to 226 --
+bool(false)
+-- Changing mode of file to 227 --
+bool(false)
+-- Changing mode of file to 228 --
+bool(false)
+-- Changing mode of file to 229 --
+bool(false)
+-- Changing mode of file to 230 --
+bool(false)
+-- Changing mode of file to 231 --
+bool(false)
+-- Changing mode of file to 232 --
+bool(false)
+-- Changing mode of file to 233 --
+bool(false)
+-- Changing mode of file to 234 --
+bool(false)
+-- Changing mode of file to 235 --
+bool(false)
+-- Changing mode of file to 236 --
+bool(false)
+-- Changing mode of file to 237 --
+bool(false)
+-- Changing mode of file to 238 --
+bool(false)
+-- Changing mode of file to 239 --
+bool(false)
+-- Changing mode of file to 240 --
+bool(false)
+-- Changing mode of file to 241 --
+bool(false)
+-- Changing mode of file to 242 --
+bool(false)
+-- Changing mode of file to 243 --
+bool(false)
+-- Changing mode of file to 244 --
+bool(false)
+-- Changing mode of file to 245 --
+bool(false)
+-- Changing mode of file to 246 --
+bool(false)
+-- Changing mode of file to 247 --
+bool(false)
+-- Changing mode of file to 248 --
+bool(false)
+-- Changing mode of file to 249 --
+bool(false)
+-- Changing mode of file to 250 --
+bool(false)
+-- Changing mode of file to 251 --
+bool(false)
+-- Changing mode of file to 252 --
+bool(false)
+-- Changing mode of file to 253 --
+bool(false)
+-- Changing mode of file to 254 --
+bool(false)
+-- Changing mode of file to 255 --
+bool(false)
+-- Changing mode of file to 256 --
+bool(true)
+-- Changing mode of file to 257 --
+bool(true)
+-- Changing mode of file to 258 --
+bool(true)
+-- Changing mode of file to 259 --
+bool(true)
+-- Changing mode of file to 260 --
+bool(true)
+-- Changing mode of file to 261 --
+bool(true)
+-- Changing mode of file to 262 --
+bool(true)
+-- Changing mode of file to 263 --
+bool(true)
+-- Changing mode of file to 264 --
+bool(true)
+-- Changing mode of file to 265 --
+bool(true)
+-- Changing mode of file to 266 --
+bool(true)
+-- Changing mode of file to 267 --
+bool(true)
+-- Changing mode of file to 268 --
+bool(true)
+-- Changing mode of file to 269 --
+bool(true)
+-- Changing mode of file to 270 --
+bool(true)
+-- Changing mode of file to 271 --
+bool(true)
+-- Changing mode of file to 272 --
+bool(true)
+-- Changing mode of file to 273 --
+bool(true)
+-- Changing mode of file to 274 --
+bool(true)
+-- Changing mode of file to 275 --
+bool(true)
+-- Changing mode of file to 276 --
+bool(true)
+-- Changing mode of file to 277 --
+bool(true)
+-- Changing mode of file to 278 --
+bool(true)
+-- Changing mode of file to 279 --
+bool(true)
+-- Changing mode of file to 280 --
+bool(true)
+-- Changing mode of file to 281 --
+bool(true)
+-- Changing mode of file to 282 --
+bool(true)
+-- Changing mode of file to 283 --
+bool(true)
+-- Changing mode of file to 284 --
+bool(true)
+-- Changing mode of file to 285 --
+bool(true)
+-- Changing mode of file to 286 --
+bool(true)
+-- Changing mode of file to 287 --
+bool(true)
+-- Changing mode of file to 288 --
+bool(true)
+-- Changing mode of file to 289 --
+bool(true)
+-- Changing mode of file to 290 --
+bool(true)
+-- Changing mode of file to 291 --
+bool(true)
+-- Changing mode of file to 292 --
+bool(true)
+-- Changing mode of file to 293 --
+bool(true)
+-- Changing mode of file to 294 --
+bool(true)
+-- Changing mode of file to 295 --
+bool(true)
+-- Changing mode of file to 296 --
+bool(true)
+-- Changing mode of file to 297 --
+bool(true)
+-- Changing mode of file to 298 --
+bool(true)
+-- Changing mode of file to 299 --
+bool(true)
+-- Changing mode of file to 300 --
+bool(true)
+-- Changing mode of file to 301 --
+bool(true)
+-- Changing mode of file to 302 --
+bool(true)
+-- Changing mode of file to 303 --
+bool(true)
+-- Changing mode of file to 304 --
+bool(true)
+-- Changing mode of file to 305 --
+bool(true)
+-- Changing mode of file to 306 --
+bool(true)
+-- Changing mode of file to 307 --
+bool(true)
+-- Changing mode of file to 308 --
+bool(true)
+-- Changing mode of file to 309 --
+bool(true)
+-- Changing mode of file to 310 --
+bool(true)
+-- Changing mode of file to 311 --
+bool(true)
+-- Changing mode of file to 312 --
+bool(true)
+-- Changing mode of file to 313 --
+bool(true)
+-- Changing mode of file to 314 --
+bool(true)
+-- Changing mode of file to 315 --
+bool(true)
+-- Changing mode of file to 316 --
+bool(true)
+-- Changing mode of file to 317 --
+bool(true)
+-- Changing mode of file to 318 --
+bool(true)
+-- Changing mode of file to 319 --
+bool(true)
+-- Changing mode of file to 320 --
+bool(true)
+-- Changing mode of file to 321 --
+bool(true)
+-- Changing mode of file to 322 --
+bool(true)
+-- Changing mode of file to 323 --
+bool(true)
+-- Changing mode of file to 324 --
+bool(true)
+-- Changing mode of file to 325 --
+bool(true)
+-- Changing mode of file to 326 --
+bool(true)
+-- Changing mode of file to 327 --
+bool(true)
+-- Changing mode of file to 328 --
+bool(true)
+-- Changing mode of file to 329 --
+bool(true)
+-- Changing mode of file to 330 --
+bool(true)
+-- Changing mode of file to 331 --
+bool(true)
+-- Changing mode of file to 332 --
+bool(true)
+-- Changing mode of file to 333 --
+bool(true)
+-- Changing mode of file to 334 --
+bool(true)
+-- Changing mode of file to 335 --
+bool(true)
+-- Changing mode of file to 336 --
+bool(true)
+-- Changing mode of file to 337 --
+bool(true)
+-- Changing mode of file to 338 --
+bool(true)
+-- Changing mode of file to 339 --
+bool(true)
+-- Changing mode of file to 340 --
+bool(true)
+-- Changing mode of file to 341 --
+bool(true)
+-- Changing mode of file to 342 --
+bool(true)
+-- Changing mode of file to 343 --
+bool(true)
+-- Changing mode of file to 344 --
+bool(true)
+-- Changing mode of file to 345 --
+bool(true)
+-- Changing mode of file to 346 --
+bool(true)
+-- Changing mode of file to 347 --
+bool(true)
+-- Changing mode of file to 348 --
+bool(true)
+-- Changing mode of file to 349 --
+bool(true)
+-- Changing mode of file to 350 --
+bool(true)
+-- Changing mode of file to 351 --
+bool(true)
+-- Changing mode of file to 352 --
+bool(true)
+-- Changing mode of file to 353 --
+bool(true)
+-- Changing mode of file to 354 --
+bool(true)
+-- Changing mode of file to 355 --
+bool(true)
+-- Changing mode of file to 356 --
+bool(true)
+-- Changing mode of file to 357 --
+bool(true)
+-- Changing mode of file to 358 --
+bool(true)
+-- Changing mode of file to 359 --
+bool(true)
+-- Changing mode of file to 360 --
+bool(true)
+-- Changing mode of file to 361 --
+bool(true)
+-- Changing mode of file to 362 --
+bool(true)
+-- Changing mode of file to 363 --
+bool(true)
+-- Changing mode of file to 364 --
+bool(true)
+-- Changing mode of file to 365 --
+bool(true)
+-- Changing mode of file to 366 --
+bool(true)
+-- Changing mode of file to 367 --
+bool(true)
+-- Changing mode of file to 368 --
+bool(true)
+-- Changing mode of file to 369 --
+bool(true)
+-- Changing mode of file to 370 --
+bool(true)
+-- Changing mode of file to 371 --
+bool(true)
+-- Changing mode of file to 372 --
+bool(true)
+-- Changing mode of file to 373 --
+bool(true)
+-- Changing mode of file to 374 --
+bool(true)
+-- Changing mode of file to 375 --
+bool(true)
+-- Changing mode of file to 376 --
+bool(true)
+-- Changing mode of file to 377 --
+bool(true)
+-- Changing mode of file to 378 --
+bool(true)
+-- Changing mode of file to 379 --
+bool(true)
+-- Changing mode of file to 380 --
+bool(true)
+-- Changing mode of file to 381 --
+bool(true)
+-- Changing mode of file to 382 --
+bool(true)
+-- Changing mode of file to 383 --
+bool(true)
+-- Changing mode of file to 384 --
+bool(true)
+-- Changing mode of file to 385 --
+bool(true)
+-- Changing mode of file to 386 --
+bool(true)
+-- Changing mode of file to 387 --
+bool(true)
+-- Changing mode of file to 388 --
+bool(true)
+-- Changing mode of file to 389 --
+bool(true)
+-- Changing mode of file to 390 --
+bool(true)
+-- Changing mode of file to 391 --
+bool(true)
+-- Changing mode of file to 392 --
+bool(true)
+-- Changing mode of file to 393 --
+bool(true)
+-- Changing mode of file to 394 --
+bool(true)
+-- Changing mode of file to 395 --
+bool(true)
+-- Changing mode of file to 396 --
+bool(true)
+-- Changing mode of file to 397 --
+bool(true)
+-- Changing mode of file to 398 --
+bool(true)
+-- Changing mode of file to 399 --
+bool(true)
+-- Changing mode of file to 400 --
+bool(true)
+-- Changing mode of file to 401 --
+bool(true)
+-- Changing mode of file to 402 --
+bool(true)
+-- Changing mode of file to 403 --
+bool(true)
+-- Changing mode of file to 404 --
+bool(true)
+-- Changing mode of file to 405 --
+bool(true)
+-- Changing mode of file to 406 --
+bool(true)
+-- Changing mode of file to 407 --
+bool(true)
+-- Changing mode of file to 408 --
+bool(true)
+-- Changing mode of file to 409 --
+bool(true)
+-- Changing mode of file to 410 --
+bool(true)
+-- Changing mode of file to 411 --
+bool(true)
+-- Changing mode of file to 412 --
+bool(true)
+-- Changing mode of file to 413 --
+bool(true)
+-- Changing mode of file to 414 --
+bool(true)
+-- Changing mode of file to 415 --
+bool(true)
+-- Changing mode of file to 416 --
+bool(true)
+-- Changing mode of file to 417 --
+bool(true)
+-- Changing mode of file to 418 --
+bool(true)
+-- Changing mode of file to 419 --
+bool(true)
+-- Changing mode of file to 420 --
+bool(true)
+-- Changing mode of file to 421 --
+bool(true)
+-- Changing mode of file to 422 --
+bool(true)
+-- Changing mode of file to 423 --
+bool(true)
+-- Changing mode of file to 424 --
+bool(true)
+-- Changing mode of file to 425 --
+bool(true)
+-- Changing mode of file to 426 --
+bool(true)
+-- Changing mode of file to 427 --
+bool(true)
+-- Changing mode of file to 428 --
+bool(true)
+-- Changing mode of file to 429 --
+bool(true)
+-- Changing mode of file to 430 --
+bool(true)
+-- Changing mode of file to 431 --
+bool(true)
+-- Changing mode of file to 432 --
+bool(true)
+-- Changing mode of file to 433 --
+bool(true)
+-- Changing mode of file to 434 --
+bool(true)
+-- Changing mode of file to 435 --
+bool(true)
+-- Changing mode of file to 436 --
+bool(true)
+-- Changing mode of file to 437 --
+bool(true)
+-- Changing mode of file to 438 --
+bool(true)
+-- Changing mode of file to 439 --
+bool(true)
+-- Changing mode of file to 440 --
+bool(true)
+-- Changing mode of file to 441 --
+bool(true)
+-- Changing mode of file to 442 --
+bool(true)
+-- Changing mode of file to 443 --
+bool(true)
+-- Changing mode of file to 444 --
+bool(true)
+-- Changing mode of file to 445 --
+bool(true)
+-- Changing mode of file to 446 --
+bool(true)
+-- Changing mode of file to 447 --
+bool(true)
+-- Changing mode of file to 448 --
+bool(true)
+-- Changing mode of file to 449 --
+bool(true)
+-- Changing mode of file to 450 --
+bool(true)
+-- Changing mode of file to 451 --
+bool(true)
+-- Changing mode of file to 452 --
+bool(true)
+-- Changing mode of file to 453 --
+bool(true)
+-- Changing mode of file to 454 --
+bool(true)
+-- Changing mode of file to 455 --
+bool(true)
+-- Changing mode of file to 456 --
+bool(true)
+-- Changing mode of file to 457 --
+bool(true)
+-- Changing mode of file to 458 --
+bool(true)
+-- Changing mode of file to 459 --
+bool(true)
+-- Changing mode of file to 460 --
+bool(true)
+-- Changing mode of file to 461 --
+bool(true)
+-- Changing mode of file to 462 --
+bool(true)
+-- Changing mode of file to 463 --
+bool(true)
+-- Changing mode of file to 464 --
+bool(true)
+-- Changing mode of file to 465 --
+bool(true)
+-- Changing mode of file to 466 --
+bool(true)
+-- Changing mode of file to 467 --
+bool(true)
+-- Changing mode of file to 468 --
+bool(true)
+-- Changing mode of file to 469 --
+bool(true)
+-- Changing mode of file to 470 --
+bool(true)
+-- Changing mode of file to 471 --
+bool(true)
+-- Changing mode of file to 472 --
+bool(true)
+-- Changing mode of file to 473 --
+bool(true)
+-- Changing mode of file to 474 --
+bool(true)
+-- Changing mode of file to 475 --
+bool(true)
+-- Changing mode of file to 476 --
+bool(true)
+-- Changing mode of file to 477 --
+bool(true)
+-- Changing mode of file to 478 --
+bool(true)
+-- Changing mode of file to 479 --
+bool(true)
+-- Changing mode of file to 480 --
+bool(true)
+-- Changing mode of file to 481 --
+bool(true)
+-- Changing mode of file to 482 --
+bool(true)
+-- Changing mode of file to 483 --
+bool(true)
+-- Changing mode of file to 484 --
+bool(true)
+-- Changing mode of file to 485 --
+bool(true)
+-- Changing mode of file to 486 --
+bool(true)
+-- Changing mode of file to 487 --
+bool(true)
+-- Changing mode of file to 488 --
+bool(true)
+-- Changing mode of file to 489 --
+bool(true)
+-- Changing mode of file to 490 --
+bool(true)
+-- Changing mode of file to 491 --
+bool(true)
+-- Changing mode of file to 492 --
+bool(true)
+-- Changing mode of file to 493 --
+bool(true)
+-- Changing mode of file to 494 --
+bool(true)
+-- Changing mode of file to 495 --
+bool(true)
+-- Changing mode of file to 496 --
+bool(true)
+-- Changing mode of file to 497 --
+bool(true)
+-- Changing mode of file to 498 --
+bool(true)
+-- Changing mode of file to 499 --
+bool(true)
+-- Changing mode of file to 500 --
+bool(true)
+-- Changing mode of file to 501 --
+bool(true)
+-- Changing mode of file to 502 --
+bool(true)
+-- Changing mode of file to 503 --
+bool(true)
+-- Changing mode of file to 504 --
+bool(true)
+-- Changing mode of file to 505 --
+bool(true)
+-- Changing mode of file to 506 --
+bool(true)
+-- Changing mode of file to 507 --
+bool(true)
+-- Changing mode of file to 508 --
+bool(true)
+-- Changing mode of file to 509 --
+bool(true)
+-- Changing mode of file to 510 --
+bool(true)
+-- Changing mode of file to 511 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt
new file mode 100644
index 0000000..9a734cd
--- /dev/null
+++ b/ext/standard/tests/file/is_readable_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test is_readable() function: error conditions
+--FILE--
+<?php
+/* Prototype: bool is_readable ( string $filename );
+ Description: Tells whether the filename is readable
+*/
+
+echo "*** Testing is_readable(): error conditions ***\n";
+var_dump( is_readable() ); // args < expected
+var_dump( is_readable(1, 2) ); // args > expected
+
+echo "\n*** Testing is_readable() on non-existent file ***\n";
+var_dump( is_readable(dirname(__FILE__)."/is_readable.tmp") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_readable(): error conditions ***
+
+Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing is_readable() on non-existent file ***
+bool(false)
+Done
diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt
new file mode 100644
index 0000000..5becac0
--- /dev/null
+++ b/ext/standard/tests/file/is_readable_variation1.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test is_readable() function: usage variations - diff. file notations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ // Skip if being run by root (files are always readable, writeable and executable)
+ $filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+ $fp = fopen($filename, 'w');
+ fclose($fp);
+ if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+ }
+ unlink($filename);
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_readable ( string $filename );
+ Description: Tells whether the filename is readable.
+*/
+
+/* test is_readable() with file having different filepath notation */
+
+require dirname(__FILE__).'/file.inc';
+echo "*** Testing is_readable(): usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/is_readable_variation1");
+
+// create a new temporary file
+$fp = fopen("$file_path/is_readable_variation1/bar.tmp", "w");
+fclose($fp);
+
+/* array of files to be tested if they are readable by using
+ is_readable() function */
+$files_arr = array(
+ "$file_path/is_readable_variation1/bar.tmp",
+
+ /* Testing a file trailing slash */
+ "$file_path/is_readable_variation1/bar.tmp/",
+
+ /* Testing file with double slashes */
+ "$file_path/is_readable_variation1//bar.tmp",
+ "$file_path//is_readable_variation1//bar.tmp",
+ "$file_path/is_readable_variation1/*.tmp",
+ "$file_path/is_readable_variation1/b*.tmp",
+
+ /* Testing Binary safe */
+ "$file_path/is_readable_variation1".chr(0)."bar.tmp",
+ "$file_path".chr(0)."is_readable_variation1/bar.tmp",
+ "$file_path".chr(0)."is_readable_variation1/bar.tmp",
+
+ /* Testing directories */
+ ".", // current directory, exp: bool(true)
+ "$file_path/is_readable_variation1" // temp directory, exp: bool(true)
+);
+$counter = 1;
+/* loop through to test each element in the above array
+ is a writable file */
+foreach($files_arr as $file) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_readable($file) );
+ $counter++;
+ clearstatcache();
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/is_readable_variation1/bar.tmp");
+rmdir(dirname(__FILE__)."/is_readable_variation1/");
+?>
+--EXPECTF--
+*** Testing is_readable(): usage variations ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(%s)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+
+Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_readable_variation2.phpt b/ext/standard/tests/file/is_readable_variation2.phpt
new file mode 100644
index 0000000..e1faf55
--- /dev/null
+++ b/ext/standard/tests/file/is_readable_variation2.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test is_readable() function: usage variations - file/dir with diff. perms
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not for windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_readable ( string $filename );
+ Description: Tells whether the filename is readable.
+*/
+
+/* test is_executable() with file/dir having different permissions */
+
+require dirname(__FILE__).'/file.inc';
+echo "*** Testing is_readable(): usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/is_readable_variation2");
+
+echo "\n*** Testing is_readable() on directory without read permission ***\n";
+chmod("$file_path/is_readable_variation2", 0001);
+var_dump( is_readable("$file_path/is_readable_variation2") ); // exp: bool(false)
+chmod("$file_path/is_readable_variation2", 0777); // chmod to enable deletion of directory
+
+echo "\n*** Testing miscelleneous input for is_readable() function ***\n";
+$name_prefix = "is_readable_variation2";
+create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 1);
+create_files(dirname(__FILE__), 1, "text", 0755, 1, "w", $name_prefix, 2);
+create_files(dirname(__FILE__), 1, "empty", 0755, 1, "w", $name_prefix, 3);
+create_files(dirname(__FILE__), 1, "numeric", 0555, 1, "w", $name_prefix, 4);
+create_files(dirname(__FILE__), 1, "text", 0222, 1, "w", $name_prefix, 5);
+create_files(dirname(__FILE__), 1, "numeric", 0711, 1, "w", $name_prefix, 6);
+create_files(dirname(__FILE__), 1, "text", 0411, 1, "w", $name_prefix, 7);
+create_files(dirname(__FILE__), 1, "numeric", 0444, 1, "w", $name_prefix, 8);
+create_files(dirname(__FILE__), 1, "text", 0421, 1, "w", $name_prefix, 9);
+create_files(dirname(__FILE__), 1, "text", 0422, 1, "w", $name_prefix, 10);
+
+$files = array (
+ "$file_path/is_readable_variation21.tmp",
+ "$file_path/is_readable_variation22.tmp",
+ "$file_path/is_readable_variation23.tmp",
+ "$file_path/is_readable_variation24.tmp",
+ "$file_path/is_readable_variation25.tmp",
+ "$file_path/is_readable_variation26.tmp",
+ "$file_path/is_readable_variation27.tmp",
+ "$file_path/is_readable_variation28.tmp",
+ "$file_path/is_readable_variation29.tmp",
+ "$file_path/is_readable_variation210.tmp"
+);
+$counter = 1;
+/* loop through to test each element in the above array
+ is a readable file */
+foreach($files as $file) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_readable($file) );
+ $counter++;
+ clearstatcache();
+}
+
+// change all file's permissions to 777 before deleting
+change_file_perms($file_path, 10, 0777, $name_prefix);
+delete_files($file_path, 10, $name_prefix);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/is_readable_variation2/");
+?>
+--EXPECTF--
+*** Testing is_readable(): usage variations ***
+
+*** Testing is_readable() on directory without read permission ***
+bool(false)
+
+*** Testing miscelleneous input for is_readable() function ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt
new file mode 100644
index 0000000..dc4d3b1
--- /dev/null
+++ b/ext/standard/tests/file/is_readable_variation3.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test is_readable() function: usage variations - invalid file names
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+
+ // Skip if being run by root (files are always readable, writeable and executable)
+ $filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+ $fp = fopen($filename, 'w');
+ fclose($fp);
+ if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+ }
+ unlink($filename);
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_readable ( string $filename );
+ Description: Tells whether the filename is readable.
+*/
+
+/* test is_executable() with invalid arguments */
+
+echo "*** Testing is_readable(): usage variations ***\n";
+
+$file_handle = fopen(__FILE__, "r");
+unset($file_handle);
+
+echo "\n*** Testing is_readable() on miscelleneous filenames ***\n";
+$misc_files = array(
+ 0,
+ 1234,
+ -2.34555,
+ TRUE,
+ FALSE,
+ NULL,
+ " ",
+ @array(),
+ @$file_handle
+);
+/* loop through to test each element in the above array
+ is a readable file */
+foreach( $misc_files as $misc_file ) {
+ var_dump( is_readable($misc_file) );
+ clearstatcache();
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_readable(): usage variations ***
+
+*** Testing is_readable() on miscelleneous filenames ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt
new file mode 100644
index 0000000..1907d39
--- /dev/null
+++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt
@@ -0,0 +1,48 @@
+--TEST--
+is_uploaded_file() function
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--POST_RAW--
+Content-type: multipart/form-data, boundary=AaB03x
+
+--AaB03x
+content-disposition: form-data; name="field1"
+
+Joe Blow
+--AaB03x
+content-disposition: form-data; name="pics"; filename="file1.txt"
+Content-Type: text/plain
+
+abcdef123456789
+--AaB03x--
+--FILE--
+<?php
+// uploaded file
+var_dump(is_uploaded_file($_FILES['pics']['tmp_name']));
+
+// not an uploaded file
+var_dump(is_uploaded_file($_FILES['pics']['name']));
+
+// not an uploaded file
+var_dump(is_uploaded_file('random_filename.txt'));
+
+// not an uploaded file
+var_dump(is_uploaded_file('__FILE__'));
+
+// Error cases
+var_dump(is_uploaded_file());
+var_dump(is_uploaded_file('a', 'b'));
+
+?>
+--EXPECTF--
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
diff --git a/ext/standard/tests/file/is_writable_basic.phpt b/ext/standard/tests/file/is_writable_basic.phpt
new file mode 100644
index 0000000..86599b4
--- /dev/null
+++ b/ext/standard/tests/file/is_writable_basic.phpt
@@ -0,0 +1,1588 @@
+--TEST--
+Test is_writable() and its alias is_writeable() function: basic functionality
+--SKIPIF--
+<?php
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_writable ( string $filename );
+ Description: Tells whether the filename is writable.
+
+ is_writeable() is an alias of is_writable()
+*/
+
+// include common file test functions
+require dirname(__FILE__).'/file.inc';
+
+echo "*** Testing is_writable(): basic functionality ***\n";
+
+// create a file
+$filename = dirname(__FILE__)."/is_writable.tmp";
+create_file($filename);
+
+$counter = 1;
+/* loop to check if the file with new mode is writable
+ using is_writable() */
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of file to $mode --\n";
+ chmod($filename, $mode); // change mode of file
+ var_dump( is_writeable($filename) );
+ var_dump( is_writable($filename) );
+ clearstatcache();
+ $counter++;
+}
+
+// delete the temp file
+delete_file($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_writable(): basic functionality ***
+-- Changing mode of file to 0 --
+bool(false)
+bool(false)
+-- Changing mode of file to 1 --
+bool(false)
+bool(false)
+-- Changing mode of file to 2 --
+bool(false)
+bool(false)
+-- Changing mode of file to 3 --
+bool(false)
+bool(false)
+-- Changing mode of file to 4 --
+bool(false)
+bool(false)
+-- Changing mode of file to 5 --
+bool(false)
+bool(false)
+-- Changing mode of file to 6 --
+bool(false)
+bool(false)
+-- Changing mode of file to 7 --
+bool(false)
+bool(false)
+-- Changing mode of file to 8 --
+bool(false)
+bool(false)
+-- Changing mode of file to 9 --
+bool(false)
+bool(false)
+-- Changing mode of file to 10 --
+bool(false)
+bool(false)
+-- Changing mode of file to 11 --
+bool(false)
+bool(false)
+-- Changing mode of file to 12 --
+bool(false)
+bool(false)
+-- Changing mode of file to 13 --
+bool(false)
+bool(false)
+-- Changing mode of file to 14 --
+bool(false)
+bool(false)
+-- Changing mode of file to 15 --
+bool(false)
+bool(false)
+-- Changing mode of file to 16 --
+bool(false)
+bool(false)
+-- Changing mode of file to 17 --
+bool(false)
+bool(false)
+-- Changing mode of file to 18 --
+bool(false)
+bool(false)
+-- Changing mode of file to 19 --
+bool(false)
+bool(false)
+-- Changing mode of file to 20 --
+bool(false)
+bool(false)
+-- Changing mode of file to 21 --
+bool(false)
+bool(false)
+-- Changing mode of file to 22 --
+bool(false)
+bool(false)
+-- Changing mode of file to 23 --
+bool(false)
+bool(false)
+-- Changing mode of file to 24 --
+bool(false)
+bool(false)
+-- Changing mode of file to 25 --
+bool(false)
+bool(false)
+-- Changing mode of file to 26 --
+bool(false)
+bool(false)
+-- Changing mode of file to 27 --
+bool(false)
+bool(false)
+-- Changing mode of file to 28 --
+bool(false)
+bool(false)
+-- Changing mode of file to 29 --
+bool(false)
+bool(false)
+-- Changing mode of file to 30 --
+bool(false)
+bool(false)
+-- Changing mode of file to 31 --
+bool(false)
+bool(false)
+-- Changing mode of file to 32 --
+bool(false)
+bool(false)
+-- Changing mode of file to 33 --
+bool(false)
+bool(false)
+-- Changing mode of file to 34 --
+bool(false)
+bool(false)
+-- Changing mode of file to 35 --
+bool(false)
+bool(false)
+-- Changing mode of file to 36 --
+bool(false)
+bool(false)
+-- Changing mode of file to 37 --
+bool(false)
+bool(false)
+-- Changing mode of file to 38 --
+bool(false)
+bool(false)
+-- Changing mode of file to 39 --
+bool(false)
+bool(false)
+-- Changing mode of file to 40 --
+bool(false)
+bool(false)
+-- Changing mode of file to 41 --
+bool(false)
+bool(false)
+-- Changing mode of file to 42 --
+bool(false)
+bool(false)
+-- Changing mode of file to 43 --
+bool(false)
+bool(false)
+-- Changing mode of file to 44 --
+bool(false)
+bool(false)
+-- Changing mode of file to 45 --
+bool(false)
+bool(false)
+-- Changing mode of file to 46 --
+bool(false)
+bool(false)
+-- Changing mode of file to 47 --
+bool(false)
+bool(false)
+-- Changing mode of file to 48 --
+bool(false)
+bool(false)
+-- Changing mode of file to 49 --
+bool(false)
+bool(false)
+-- Changing mode of file to 50 --
+bool(false)
+bool(false)
+-- Changing mode of file to 51 --
+bool(false)
+bool(false)
+-- Changing mode of file to 52 --
+bool(false)
+bool(false)
+-- Changing mode of file to 53 --
+bool(false)
+bool(false)
+-- Changing mode of file to 54 --
+bool(false)
+bool(false)
+-- Changing mode of file to 55 --
+bool(false)
+bool(false)
+-- Changing mode of file to 56 --
+bool(false)
+bool(false)
+-- Changing mode of file to 57 --
+bool(false)
+bool(false)
+-- Changing mode of file to 58 --
+bool(false)
+bool(false)
+-- Changing mode of file to 59 --
+bool(false)
+bool(false)
+-- Changing mode of file to 60 --
+bool(false)
+bool(false)
+-- Changing mode of file to 61 --
+bool(false)
+bool(false)
+-- Changing mode of file to 62 --
+bool(false)
+bool(false)
+-- Changing mode of file to 63 --
+bool(false)
+bool(false)
+-- Changing mode of file to 64 --
+bool(false)
+bool(false)
+-- Changing mode of file to 65 --
+bool(false)
+bool(false)
+-- Changing mode of file to 66 --
+bool(false)
+bool(false)
+-- Changing mode of file to 67 --
+bool(false)
+bool(false)
+-- Changing mode of file to 68 --
+bool(false)
+bool(false)
+-- Changing mode of file to 69 --
+bool(false)
+bool(false)
+-- Changing mode of file to 70 --
+bool(false)
+bool(false)
+-- Changing mode of file to 71 --
+bool(false)
+bool(false)
+-- Changing mode of file to 72 --
+bool(false)
+bool(false)
+-- Changing mode of file to 73 --
+bool(false)
+bool(false)
+-- Changing mode of file to 74 --
+bool(false)
+bool(false)
+-- Changing mode of file to 75 --
+bool(false)
+bool(false)
+-- Changing mode of file to 76 --
+bool(false)
+bool(false)
+-- Changing mode of file to 77 --
+bool(false)
+bool(false)
+-- Changing mode of file to 78 --
+bool(false)
+bool(false)
+-- Changing mode of file to 79 --
+bool(false)
+bool(false)
+-- Changing mode of file to 80 --
+bool(false)
+bool(false)
+-- Changing mode of file to 81 --
+bool(false)
+bool(false)
+-- Changing mode of file to 82 --
+bool(false)
+bool(false)
+-- Changing mode of file to 83 --
+bool(false)
+bool(false)
+-- Changing mode of file to 84 --
+bool(false)
+bool(false)
+-- Changing mode of file to 85 --
+bool(false)
+bool(false)
+-- Changing mode of file to 86 --
+bool(false)
+bool(false)
+-- Changing mode of file to 87 --
+bool(false)
+bool(false)
+-- Changing mode of file to 88 --
+bool(false)
+bool(false)
+-- Changing mode of file to 89 --
+bool(false)
+bool(false)
+-- Changing mode of file to 90 --
+bool(false)
+bool(false)
+-- Changing mode of file to 91 --
+bool(false)
+bool(false)
+-- Changing mode of file to 92 --
+bool(false)
+bool(false)
+-- Changing mode of file to 93 --
+bool(false)
+bool(false)
+-- Changing mode of file to 94 --
+bool(false)
+bool(false)
+-- Changing mode of file to 95 --
+bool(false)
+bool(false)
+-- Changing mode of file to 96 --
+bool(false)
+bool(false)
+-- Changing mode of file to 97 --
+bool(false)
+bool(false)
+-- Changing mode of file to 98 --
+bool(false)
+bool(false)
+-- Changing mode of file to 99 --
+bool(false)
+bool(false)
+-- Changing mode of file to 100 --
+bool(false)
+bool(false)
+-- Changing mode of file to 101 --
+bool(false)
+bool(false)
+-- Changing mode of file to 102 --
+bool(false)
+bool(false)
+-- Changing mode of file to 103 --
+bool(false)
+bool(false)
+-- Changing mode of file to 104 --
+bool(false)
+bool(false)
+-- Changing mode of file to 105 --
+bool(false)
+bool(false)
+-- Changing mode of file to 106 --
+bool(false)
+bool(false)
+-- Changing mode of file to 107 --
+bool(false)
+bool(false)
+-- Changing mode of file to 108 --
+bool(false)
+bool(false)
+-- Changing mode of file to 109 --
+bool(false)
+bool(false)
+-- Changing mode of file to 110 --
+bool(false)
+bool(false)
+-- Changing mode of file to 111 --
+bool(false)
+bool(false)
+-- Changing mode of file to 112 --
+bool(false)
+bool(false)
+-- Changing mode of file to 113 --
+bool(false)
+bool(false)
+-- Changing mode of file to 114 --
+bool(false)
+bool(false)
+-- Changing mode of file to 115 --
+bool(false)
+bool(false)
+-- Changing mode of file to 116 --
+bool(false)
+bool(false)
+-- Changing mode of file to 117 --
+bool(false)
+bool(false)
+-- Changing mode of file to 118 --
+bool(false)
+bool(false)
+-- Changing mode of file to 119 --
+bool(false)
+bool(false)
+-- Changing mode of file to 120 --
+bool(false)
+bool(false)
+-- Changing mode of file to 121 --
+bool(false)
+bool(false)
+-- Changing mode of file to 122 --
+bool(false)
+bool(false)
+-- Changing mode of file to 123 --
+bool(false)
+bool(false)
+-- Changing mode of file to 124 --
+bool(false)
+bool(false)
+-- Changing mode of file to 125 --
+bool(false)
+bool(false)
+-- Changing mode of file to 126 --
+bool(false)
+bool(false)
+-- Changing mode of file to 127 --
+bool(false)
+bool(false)
+-- Changing mode of file to 128 --
+bool(true)
+bool(true)
+-- Changing mode of file to 129 --
+bool(true)
+bool(true)
+-- Changing mode of file to 130 --
+bool(true)
+bool(true)
+-- Changing mode of file to 131 --
+bool(true)
+bool(true)
+-- Changing mode of file to 132 --
+bool(true)
+bool(true)
+-- Changing mode of file to 133 --
+bool(true)
+bool(true)
+-- Changing mode of file to 134 --
+bool(true)
+bool(true)
+-- Changing mode of file to 135 --
+bool(true)
+bool(true)
+-- Changing mode of file to 136 --
+bool(true)
+bool(true)
+-- Changing mode of file to 137 --
+bool(true)
+bool(true)
+-- Changing mode of file to 138 --
+bool(true)
+bool(true)
+-- Changing mode of file to 139 --
+bool(true)
+bool(true)
+-- Changing mode of file to 140 --
+bool(true)
+bool(true)
+-- Changing mode of file to 141 --
+bool(true)
+bool(true)
+-- Changing mode of file to 142 --
+bool(true)
+bool(true)
+-- Changing mode of file to 143 --
+bool(true)
+bool(true)
+-- Changing mode of file to 144 --
+bool(true)
+bool(true)
+-- Changing mode of file to 145 --
+bool(true)
+bool(true)
+-- Changing mode of file to 146 --
+bool(true)
+bool(true)
+-- Changing mode of file to 147 --
+bool(true)
+bool(true)
+-- Changing mode of file to 148 --
+bool(true)
+bool(true)
+-- Changing mode of file to 149 --
+bool(true)
+bool(true)
+-- Changing mode of file to 150 --
+bool(true)
+bool(true)
+-- Changing mode of file to 151 --
+bool(true)
+bool(true)
+-- Changing mode of file to 152 --
+bool(true)
+bool(true)
+-- Changing mode of file to 153 --
+bool(true)
+bool(true)
+-- Changing mode of file to 154 --
+bool(true)
+bool(true)
+-- Changing mode of file to 155 --
+bool(true)
+bool(true)
+-- Changing mode of file to 156 --
+bool(true)
+bool(true)
+-- Changing mode of file to 157 --
+bool(true)
+bool(true)
+-- Changing mode of file to 158 --
+bool(true)
+bool(true)
+-- Changing mode of file to 159 --
+bool(true)
+bool(true)
+-- Changing mode of file to 160 --
+bool(true)
+bool(true)
+-- Changing mode of file to 161 --
+bool(true)
+bool(true)
+-- Changing mode of file to 162 --
+bool(true)
+bool(true)
+-- Changing mode of file to 163 --
+bool(true)
+bool(true)
+-- Changing mode of file to 164 --
+bool(true)
+bool(true)
+-- Changing mode of file to 165 --
+bool(true)
+bool(true)
+-- Changing mode of file to 166 --
+bool(true)
+bool(true)
+-- Changing mode of file to 167 --
+bool(true)
+bool(true)
+-- Changing mode of file to 168 --
+bool(true)
+bool(true)
+-- Changing mode of file to 169 --
+bool(true)
+bool(true)
+-- Changing mode of file to 170 --
+bool(true)
+bool(true)
+-- Changing mode of file to 171 --
+bool(true)
+bool(true)
+-- Changing mode of file to 172 --
+bool(true)
+bool(true)
+-- Changing mode of file to 173 --
+bool(true)
+bool(true)
+-- Changing mode of file to 174 --
+bool(true)
+bool(true)
+-- Changing mode of file to 175 --
+bool(true)
+bool(true)
+-- Changing mode of file to 176 --
+bool(true)
+bool(true)
+-- Changing mode of file to 177 --
+bool(true)
+bool(true)
+-- Changing mode of file to 178 --
+bool(true)
+bool(true)
+-- Changing mode of file to 179 --
+bool(true)
+bool(true)
+-- Changing mode of file to 180 --
+bool(true)
+bool(true)
+-- Changing mode of file to 181 --
+bool(true)
+bool(true)
+-- Changing mode of file to 182 --
+bool(true)
+bool(true)
+-- Changing mode of file to 183 --
+bool(true)
+bool(true)
+-- Changing mode of file to 184 --
+bool(true)
+bool(true)
+-- Changing mode of file to 185 --
+bool(true)
+bool(true)
+-- Changing mode of file to 186 --
+bool(true)
+bool(true)
+-- Changing mode of file to 187 --
+bool(true)
+bool(true)
+-- Changing mode of file to 188 --
+bool(true)
+bool(true)
+-- Changing mode of file to 189 --
+bool(true)
+bool(true)
+-- Changing mode of file to 190 --
+bool(true)
+bool(true)
+-- Changing mode of file to 191 --
+bool(true)
+bool(true)
+-- Changing mode of file to 192 --
+bool(true)
+bool(true)
+-- Changing mode of file to 193 --
+bool(true)
+bool(true)
+-- Changing mode of file to 194 --
+bool(true)
+bool(true)
+-- Changing mode of file to 195 --
+bool(true)
+bool(true)
+-- Changing mode of file to 196 --
+bool(true)
+bool(true)
+-- Changing mode of file to 197 --
+bool(true)
+bool(true)
+-- Changing mode of file to 198 --
+bool(true)
+bool(true)
+-- Changing mode of file to 199 --
+bool(true)
+bool(true)
+-- Changing mode of file to 200 --
+bool(true)
+bool(true)
+-- Changing mode of file to 201 --
+bool(true)
+bool(true)
+-- Changing mode of file to 202 --
+bool(true)
+bool(true)
+-- Changing mode of file to 203 --
+bool(true)
+bool(true)
+-- Changing mode of file to 204 --
+bool(true)
+bool(true)
+-- Changing mode of file to 205 --
+bool(true)
+bool(true)
+-- Changing mode of file to 206 --
+bool(true)
+bool(true)
+-- Changing mode of file to 207 --
+bool(true)
+bool(true)
+-- Changing mode of file to 208 --
+bool(true)
+bool(true)
+-- Changing mode of file to 209 --
+bool(true)
+bool(true)
+-- Changing mode of file to 210 --
+bool(true)
+bool(true)
+-- Changing mode of file to 211 --
+bool(true)
+bool(true)
+-- Changing mode of file to 212 --
+bool(true)
+bool(true)
+-- Changing mode of file to 213 --
+bool(true)
+bool(true)
+-- Changing mode of file to 214 --
+bool(true)
+bool(true)
+-- Changing mode of file to 215 --
+bool(true)
+bool(true)
+-- Changing mode of file to 216 --
+bool(true)
+bool(true)
+-- Changing mode of file to 217 --
+bool(true)
+bool(true)
+-- Changing mode of file to 218 --
+bool(true)
+bool(true)
+-- Changing mode of file to 219 --
+bool(true)
+bool(true)
+-- Changing mode of file to 220 --
+bool(true)
+bool(true)
+-- Changing mode of file to 221 --
+bool(true)
+bool(true)
+-- Changing mode of file to 222 --
+bool(true)
+bool(true)
+-- Changing mode of file to 223 --
+bool(true)
+bool(true)
+-- Changing mode of file to 224 --
+bool(true)
+bool(true)
+-- Changing mode of file to 225 --
+bool(true)
+bool(true)
+-- Changing mode of file to 226 --
+bool(true)
+bool(true)
+-- Changing mode of file to 227 --
+bool(true)
+bool(true)
+-- Changing mode of file to 228 --
+bool(true)
+bool(true)
+-- Changing mode of file to 229 --
+bool(true)
+bool(true)
+-- Changing mode of file to 230 --
+bool(true)
+bool(true)
+-- Changing mode of file to 231 --
+bool(true)
+bool(true)
+-- Changing mode of file to 232 --
+bool(true)
+bool(true)
+-- Changing mode of file to 233 --
+bool(true)
+bool(true)
+-- Changing mode of file to 234 --
+bool(true)
+bool(true)
+-- Changing mode of file to 235 --
+bool(true)
+bool(true)
+-- Changing mode of file to 236 --
+bool(true)
+bool(true)
+-- Changing mode of file to 237 --
+bool(true)
+bool(true)
+-- Changing mode of file to 238 --
+bool(true)
+bool(true)
+-- Changing mode of file to 239 --
+bool(true)
+bool(true)
+-- Changing mode of file to 240 --
+bool(true)
+bool(true)
+-- Changing mode of file to 241 --
+bool(true)
+bool(true)
+-- Changing mode of file to 242 --
+bool(true)
+bool(true)
+-- Changing mode of file to 243 --
+bool(true)
+bool(true)
+-- Changing mode of file to 244 --
+bool(true)
+bool(true)
+-- Changing mode of file to 245 --
+bool(true)
+bool(true)
+-- Changing mode of file to 246 --
+bool(true)
+bool(true)
+-- Changing mode of file to 247 --
+bool(true)
+bool(true)
+-- Changing mode of file to 248 --
+bool(true)
+bool(true)
+-- Changing mode of file to 249 --
+bool(true)
+bool(true)
+-- Changing mode of file to 250 --
+bool(true)
+bool(true)
+-- Changing mode of file to 251 --
+bool(true)
+bool(true)
+-- Changing mode of file to 252 --
+bool(true)
+bool(true)
+-- Changing mode of file to 253 --
+bool(true)
+bool(true)
+-- Changing mode of file to 254 --
+bool(true)
+bool(true)
+-- Changing mode of file to 255 --
+bool(true)
+bool(true)
+-- Changing mode of file to 256 --
+bool(false)
+bool(false)
+-- Changing mode of file to 257 --
+bool(false)
+bool(false)
+-- Changing mode of file to 258 --
+bool(false)
+bool(false)
+-- Changing mode of file to 259 --
+bool(false)
+bool(false)
+-- Changing mode of file to 260 --
+bool(false)
+bool(false)
+-- Changing mode of file to 261 --
+bool(false)
+bool(false)
+-- Changing mode of file to 262 --
+bool(false)
+bool(false)
+-- Changing mode of file to 263 --
+bool(false)
+bool(false)
+-- Changing mode of file to 264 --
+bool(false)
+bool(false)
+-- Changing mode of file to 265 --
+bool(false)
+bool(false)
+-- Changing mode of file to 266 --
+bool(false)
+bool(false)
+-- Changing mode of file to 267 --
+bool(false)
+bool(false)
+-- Changing mode of file to 268 --
+bool(false)
+bool(false)
+-- Changing mode of file to 269 --
+bool(false)
+bool(false)
+-- Changing mode of file to 270 --
+bool(false)
+bool(false)
+-- Changing mode of file to 271 --
+bool(false)
+bool(false)
+-- Changing mode of file to 272 --
+bool(false)
+bool(false)
+-- Changing mode of file to 273 --
+bool(false)
+bool(false)
+-- Changing mode of file to 274 --
+bool(false)
+bool(false)
+-- Changing mode of file to 275 --
+bool(false)
+bool(false)
+-- Changing mode of file to 276 --
+bool(false)
+bool(false)
+-- Changing mode of file to 277 --
+bool(false)
+bool(false)
+-- Changing mode of file to 278 --
+bool(false)
+bool(false)
+-- Changing mode of file to 279 --
+bool(false)
+bool(false)
+-- Changing mode of file to 280 --
+bool(false)
+bool(false)
+-- Changing mode of file to 281 --
+bool(false)
+bool(false)
+-- Changing mode of file to 282 --
+bool(false)
+bool(false)
+-- Changing mode of file to 283 --
+bool(false)
+bool(false)
+-- Changing mode of file to 284 --
+bool(false)
+bool(false)
+-- Changing mode of file to 285 --
+bool(false)
+bool(false)
+-- Changing mode of file to 286 --
+bool(false)
+bool(false)
+-- Changing mode of file to 287 --
+bool(false)
+bool(false)
+-- Changing mode of file to 288 --
+bool(false)
+bool(false)
+-- Changing mode of file to 289 --
+bool(false)
+bool(false)
+-- Changing mode of file to 290 --
+bool(false)
+bool(false)
+-- Changing mode of file to 291 --
+bool(false)
+bool(false)
+-- Changing mode of file to 292 --
+bool(false)
+bool(false)
+-- Changing mode of file to 293 --
+bool(false)
+bool(false)
+-- Changing mode of file to 294 --
+bool(false)
+bool(false)
+-- Changing mode of file to 295 --
+bool(false)
+bool(false)
+-- Changing mode of file to 296 --
+bool(false)
+bool(false)
+-- Changing mode of file to 297 --
+bool(false)
+bool(false)
+-- Changing mode of file to 298 --
+bool(false)
+bool(false)
+-- Changing mode of file to 299 --
+bool(false)
+bool(false)
+-- Changing mode of file to 300 --
+bool(false)
+bool(false)
+-- Changing mode of file to 301 --
+bool(false)
+bool(false)
+-- Changing mode of file to 302 --
+bool(false)
+bool(false)
+-- Changing mode of file to 303 --
+bool(false)
+bool(false)
+-- Changing mode of file to 304 --
+bool(false)
+bool(false)
+-- Changing mode of file to 305 --
+bool(false)
+bool(false)
+-- Changing mode of file to 306 --
+bool(false)
+bool(false)
+-- Changing mode of file to 307 --
+bool(false)
+bool(false)
+-- Changing mode of file to 308 --
+bool(false)
+bool(false)
+-- Changing mode of file to 309 --
+bool(false)
+bool(false)
+-- Changing mode of file to 310 --
+bool(false)
+bool(false)
+-- Changing mode of file to 311 --
+bool(false)
+bool(false)
+-- Changing mode of file to 312 --
+bool(false)
+bool(false)
+-- Changing mode of file to 313 --
+bool(false)
+bool(false)
+-- Changing mode of file to 314 --
+bool(false)
+bool(false)
+-- Changing mode of file to 315 --
+bool(false)
+bool(false)
+-- Changing mode of file to 316 --
+bool(false)
+bool(false)
+-- Changing mode of file to 317 --
+bool(false)
+bool(false)
+-- Changing mode of file to 318 --
+bool(false)
+bool(false)
+-- Changing mode of file to 319 --
+bool(false)
+bool(false)
+-- Changing mode of file to 320 --
+bool(false)
+bool(false)
+-- Changing mode of file to 321 --
+bool(false)
+bool(false)
+-- Changing mode of file to 322 --
+bool(false)
+bool(false)
+-- Changing mode of file to 323 --
+bool(false)
+bool(false)
+-- Changing mode of file to 324 --
+bool(false)
+bool(false)
+-- Changing mode of file to 325 --
+bool(false)
+bool(false)
+-- Changing mode of file to 326 --
+bool(false)
+bool(false)
+-- Changing mode of file to 327 --
+bool(false)
+bool(false)
+-- Changing mode of file to 328 --
+bool(false)
+bool(false)
+-- Changing mode of file to 329 --
+bool(false)
+bool(false)
+-- Changing mode of file to 330 --
+bool(false)
+bool(false)
+-- Changing mode of file to 331 --
+bool(false)
+bool(false)
+-- Changing mode of file to 332 --
+bool(false)
+bool(false)
+-- Changing mode of file to 333 --
+bool(false)
+bool(false)
+-- Changing mode of file to 334 --
+bool(false)
+bool(false)
+-- Changing mode of file to 335 --
+bool(false)
+bool(false)
+-- Changing mode of file to 336 --
+bool(false)
+bool(false)
+-- Changing mode of file to 337 --
+bool(false)
+bool(false)
+-- Changing mode of file to 338 --
+bool(false)
+bool(false)
+-- Changing mode of file to 339 --
+bool(false)
+bool(false)
+-- Changing mode of file to 340 --
+bool(false)
+bool(false)
+-- Changing mode of file to 341 --
+bool(false)
+bool(false)
+-- Changing mode of file to 342 --
+bool(false)
+bool(false)
+-- Changing mode of file to 343 --
+bool(false)
+bool(false)
+-- Changing mode of file to 344 --
+bool(false)
+bool(false)
+-- Changing mode of file to 345 --
+bool(false)
+bool(false)
+-- Changing mode of file to 346 --
+bool(false)
+bool(false)
+-- Changing mode of file to 347 --
+bool(false)
+bool(false)
+-- Changing mode of file to 348 --
+bool(false)
+bool(false)
+-- Changing mode of file to 349 --
+bool(false)
+bool(false)
+-- Changing mode of file to 350 --
+bool(false)
+bool(false)
+-- Changing mode of file to 351 --
+bool(false)
+bool(false)
+-- Changing mode of file to 352 --
+bool(false)
+bool(false)
+-- Changing mode of file to 353 --
+bool(false)
+bool(false)
+-- Changing mode of file to 354 --
+bool(false)
+bool(false)
+-- Changing mode of file to 355 --
+bool(false)
+bool(false)
+-- Changing mode of file to 356 --
+bool(false)
+bool(false)
+-- Changing mode of file to 357 --
+bool(false)
+bool(false)
+-- Changing mode of file to 358 --
+bool(false)
+bool(false)
+-- Changing mode of file to 359 --
+bool(false)
+bool(false)
+-- Changing mode of file to 360 --
+bool(false)
+bool(false)
+-- Changing mode of file to 361 --
+bool(false)
+bool(false)
+-- Changing mode of file to 362 --
+bool(false)
+bool(false)
+-- Changing mode of file to 363 --
+bool(false)
+bool(false)
+-- Changing mode of file to 364 --
+bool(false)
+bool(false)
+-- Changing mode of file to 365 --
+bool(false)
+bool(false)
+-- Changing mode of file to 366 --
+bool(false)
+bool(false)
+-- Changing mode of file to 367 --
+bool(false)
+bool(false)
+-- Changing mode of file to 368 --
+bool(false)
+bool(false)
+-- Changing mode of file to 369 --
+bool(false)
+bool(false)
+-- Changing mode of file to 370 --
+bool(false)
+bool(false)
+-- Changing mode of file to 371 --
+bool(false)
+bool(false)
+-- Changing mode of file to 372 --
+bool(false)
+bool(false)
+-- Changing mode of file to 373 --
+bool(false)
+bool(false)
+-- Changing mode of file to 374 --
+bool(false)
+bool(false)
+-- Changing mode of file to 375 --
+bool(false)
+bool(false)
+-- Changing mode of file to 376 --
+bool(false)
+bool(false)
+-- Changing mode of file to 377 --
+bool(false)
+bool(false)
+-- Changing mode of file to 378 --
+bool(false)
+bool(false)
+-- Changing mode of file to 379 --
+bool(false)
+bool(false)
+-- Changing mode of file to 380 --
+bool(false)
+bool(false)
+-- Changing mode of file to 381 --
+bool(false)
+bool(false)
+-- Changing mode of file to 382 --
+bool(false)
+bool(false)
+-- Changing mode of file to 383 --
+bool(false)
+bool(false)
+-- Changing mode of file to 384 --
+bool(true)
+bool(true)
+-- Changing mode of file to 385 --
+bool(true)
+bool(true)
+-- Changing mode of file to 386 --
+bool(true)
+bool(true)
+-- Changing mode of file to 387 --
+bool(true)
+bool(true)
+-- Changing mode of file to 388 --
+bool(true)
+bool(true)
+-- Changing mode of file to 389 --
+bool(true)
+bool(true)
+-- Changing mode of file to 390 --
+bool(true)
+bool(true)
+-- Changing mode of file to 391 --
+bool(true)
+bool(true)
+-- Changing mode of file to 392 --
+bool(true)
+bool(true)
+-- Changing mode of file to 393 --
+bool(true)
+bool(true)
+-- Changing mode of file to 394 --
+bool(true)
+bool(true)
+-- Changing mode of file to 395 --
+bool(true)
+bool(true)
+-- Changing mode of file to 396 --
+bool(true)
+bool(true)
+-- Changing mode of file to 397 --
+bool(true)
+bool(true)
+-- Changing mode of file to 398 --
+bool(true)
+bool(true)
+-- Changing mode of file to 399 --
+bool(true)
+bool(true)
+-- Changing mode of file to 400 --
+bool(true)
+bool(true)
+-- Changing mode of file to 401 --
+bool(true)
+bool(true)
+-- Changing mode of file to 402 --
+bool(true)
+bool(true)
+-- Changing mode of file to 403 --
+bool(true)
+bool(true)
+-- Changing mode of file to 404 --
+bool(true)
+bool(true)
+-- Changing mode of file to 405 --
+bool(true)
+bool(true)
+-- Changing mode of file to 406 --
+bool(true)
+bool(true)
+-- Changing mode of file to 407 --
+bool(true)
+bool(true)
+-- Changing mode of file to 408 --
+bool(true)
+bool(true)
+-- Changing mode of file to 409 --
+bool(true)
+bool(true)
+-- Changing mode of file to 410 --
+bool(true)
+bool(true)
+-- Changing mode of file to 411 --
+bool(true)
+bool(true)
+-- Changing mode of file to 412 --
+bool(true)
+bool(true)
+-- Changing mode of file to 413 --
+bool(true)
+bool(true)
+-- Changing mode of file to 414 --
+bool(true)
+bool(true)
+-- Changing mode of file to 415 --
+bool(true)
+bool(true)
+-- Changing mode of file to 416 --
+bool(true)
+bool(true)
+-- Changing mode of file to 417 --
+bool(true)
+bool(true)
+-- Changing mode of file to 418 --
+bool(true)
+bool(true)
+-- Changing mode of file to 419 --
+bool(true)
+bool(true)
+-- Changing mode of file to 420 --
+bool(true)
+bool(true)
+-- Changing mode of file to 421 --
+bool(true)
+bool(true)
+-- Changing mode of file to 422 --
+bool(true)
+bool(true)
+-- Changing mode of file to 423 --
+bool(true)
+bool(true)
+-- Changing mode of file to 424 --
+bool(true)
+bool(true)
+-- Changing mode of file to 425 --
+bool(true)
+bool(true)
+-- Changing mode of file to 426 --
+bool(true)
+bool(true)
+-- Changing mode of file to 427 --
+bool(true)
+bool(true)
+-- Changing mode of file to 428 --
+bool(true)
+bool(true)
+-- Changing mode of file to 429 --
+bool(true)
+bool(true)
+-- Changing mode of file to 430 --
+bool(true)
+bool(true)
+-- Changing mode of file to 431 --
+bool(true)
+bool(true)
+-- Changing mode of file to 432 --
+bool(true)
+bool(true)
+-- Changing mode of file to 433 --
+bool(true)
+bool(true)
+-- Changing mode of file to 434 --
+bool(true)
+bool(true)
+-- Changing mode of file to 435 --
+bool(true)
+bool(true)
+-- Changing mode of file to 436 --
+bool(true)
+bool(true)
+-- Changing mode of file to 437 --
+bool(true)
+bool(true)
+-- Changing mode of file to 438 --
+bool(true)
+bool(true)
+-- Changing mode of file to 439 --
+bool(true)
+bool(true)
+-- Changing mode of file to 440 --
+bool(true)
+bool(true)
+-- Changing mode of file to 441 --
+bool(true)
+bool(true)
+-- Changing mode of file to 442 --
+bool(true)
+bool(true)
+-- Changing mode of file to 443 --
+bool(true)
+bool(true)
+-- Changing mode of file to 444 --
+bool(true)
+bool(true)
+-- Changing mode of file to 445 --
+bool(true)
+bool(true)
+-- Changing mode of file to 446 --
+bool(true)
+bool(true)
+-- Changing mode of file to 447 --
+bool(true)
+bool(true)
+-- Changing mode of file to 448 --
+bool(true)
+bool(true)
+-- Changing mode of file to 449 --
+bool(true)
+bool(true)
+-- Changing mode of file to 450 --
+bool(true)
+bool(true)
+-- Changing mode of file to 451 --
+bool(true)
+bool(true)
+-- Changing mode of file to 452 --
+bool(true)
+bool(true)
+-- Changing mode of file to 453 --
+bool(true)
+bool(true)
+-- Changing mode of file to 454 --
+bool(true)
+bool(true)
+-- Changing mode of file to 455 --
+bool(true)
+bool(true)
+-- Changing mode of file to 456 --
+bool(true)
+bool(true)
+-- Changing mode of file to 457 --
+bool(true)
+bool(true)
+-- Changing mode of file to 458 --
+bool(true)
+bool(true)
+-- Changing mode of file to 459 --
+bool(true)
+bool(true)
+-- Changing mode of file to 460 --
+bool(true)
+bool(true)
+-- Changing mode of file to 461 --
+bool(true)
+bool(true)
+-- Changing mode of file to 462 --
+bool(true)
+bool(true)
+-- Changing mode of file to 463 --
+bool(true)
+bool(true)
+-- Changing mode of file to 464 --
+bool(true)
+bool(true)
+-- Changing mode of file to 465 --
+bool(true)
+bool(true)
+-- Changing mode of file to 466 --
+bool(true)
+bool(true)
+-- Changing mode of file to 467 --
+bool(true)
+bool(true)
+-- Changing mode of file to 468 --
+bool(true)
+bool(true)
+-- Changing mode of file to 469 --
+bool(true)
+bool(true)
+-- Changing mode of file to 470 --
+bool(true)
+bool(true)
+-- Changing mode of file to 471 --
+bool(true)
+bool(true)
+-- Changing mode of file to 472 --
+bool(true)
+bool(true)
+-- Changing mode of file to 473 --
+bool(true)
+bool(true)
+-- Changing mode of file to 474 --
+bool(true)
+bool(true)
+-- Changing mode of file to 475 --
+bool(true)
+bool(true)
+-- Changing mode of file to 476 --
+bool(true)
+bool(true)
+-- Changing mode of file to 477 --
+bool(true)
+bool(true)
+-- Changing mode of file to 478 --
+bool(true)
+bool(true)
+-- Changing mode of file to 479 --
+bool(true)
+bool(true)
+-- Changing mode of file to 480 --
+bool(true)
+bool(true)
+-- Changing mode of file to 481 --
+bool(true)
+bool(true)
+-- Changing mode of file to 482 --
+bool(true)
+bool(true)
+-- Changing mode of file to 483 --
+bool(true)
+bool(true)
+-- Changing mode of file to 484 --
+bool(true)
+bool(true)
+-- Changing mode of file to 485 --
+bool(true)
+bool(true)
+-- Changing mode of file to 486 --
+bool(true)
+bool(true)
+-- Changing mode of file to 487 --
+bool(true)
+bool(true)
+-- Changing mode of file to 488 --
+bool(true)
+bool(true)
+-- Changing mode of file to 489 --
+bool(true)
+bool(true)
+-- Changing mode of file to 490 --
+bool(true)
+bool(true)
+-- Changing mode of file to 491 --
+bool(true)
+bool(true)
+-- Changing mode of file to 492 --
+bool(true)
+bool(true)
+-- Changing mode of file to 493 --
+bool(true)
+bool(true)
+-- Changing mode of file to 494 --
+bool(true)
+bool(true)
+-- Changing mode of file to 495 --
+bool(true)
+bool(true)
+-- Changing mode of file to 496 --
+bool(true)
+bool(true)
+-- Changing mode of file to 497 --
+bool(true)
+bool(true)
+-- Changing mode of file to 498 --
+bool(true)
+bool(true)
+-- Changing mode of file to 499 --
+bool(true)
+bool(true)
+-- Changing mode of file to 500 --
+bool(true)
+bool(true)
+-- Changing mode of file to 501 --
+bool(true)
+bool(true)
+-- Changing mode of file to 502 --
+bool(true)
+bool(true)
+-- Changing mode of file to 503 --
+bool(true)
+bool(true)
+-- Changing mode of file to 504 --
+bool(true)
+bool(true)
+-- Changing mode of file to 505 --
+bool(true)
+bool(true)
+-- Changing mode of file to 506 --
+bool(true)
+bool(true)
+-- Changing mode of file to 507 --
+bool(true)
+bool(true)
+-- Changing mode of file to 508 --
+bool(true)
+bool(true)
+-- Changing mode of file to 509 --
+bool(true)
+bool(true)
+-- Changing mode of file to 510 --
+bool(true)
+bool(true)
+-- Changing mode of file to 511 --
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt
new file mode 100644
index 0000000..e3755bc
--- /dev/null
+++ b/ext/standard/tests/file/is_writable_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test is_writable() and its alias is_writeable() function: error conditions
+--FILE--
+<?php
+/* Prototype: bool is_writable ( string $filename );
+ Description: Tells whether the filename is writable.
+
+ is_writeable() is an alias of is_writable()
+*/
+
+echo "*** Testing is_writable(): error conditions ***\n";
+var_dump( is_writable() ); // args < expected
+var_dump( is_writeable() );
+
+echo "\n*** Testing is_writeable(): error conditions ***\n";
+var_dump( is_writable(1, 2) ); // args > expected
+var_dump( is_writeable(1, 2) );
+
+echo "\n*** Testing is_writable() on non-existent file ***\n";
+var_dump( is_writable(dirname(__FILE__)."/is_writable") );
+var_dump( is_writeable(dirname(__FILE__)."/is_writable") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_writable(): error conditions ***
+
+Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+*** Testing is_writeable(): error conditions ***
+
+Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing is_writable() on non-existent file ***
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt
new file mode 100644
index 0000000..718c7fb
--- /dev/null
+++ b/ext/standard/tests/file/is_writable_variation1.phpt
@@ -0,0 +1,125 @@
+--TEST--
+Test is_writable() and its alias is_writeable() function: usage variations - diff. path notations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+
+ // Skip if being run by root (files are always readable, writeable and executable)
+ $filename = dirname(__FILE__)."/is_writable_root_check.tmp";
+ $fp = fopen($filename, 'w');
+ fclose($fp);
+ if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+ }
+
+ unlink($filename);
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_writable ( string $filename );
+ Description: Tells whether the filename is writable.
+
+ is_writeable() is an alias of is_writable()
+*/
+/* test is_writable() & is_writeable() with file having different filepath notation */
+require dirname(__FILE__).'/file.inc';
+echo "*** Testing is_writable(): usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/is_writable_variation1");
+
+// create a new temporary file
+$fp = fopen("$file_path/is_writable_variation1/bar.tmp", "w");
+fclose($fp);
+
+/* array of files to be tested to check if they are writable
+ using is_writable() function */
+$files_arr = array(
+ "$file_path/is_writable_variation1/bar.tmp",
+
+ /* Testing a file trailing slash */
+ "$file_path/is_writable_variation1/bar.tmp/",
+
+ /* Testing file with double slashes */
+ "$file_path/is_writable_variation1//bar.tmp",
+ "$file_path//is_writable_variation1//bar.tmp",
+ "$file_path/is_writable_variation1/*.tmp",
+ "$file_path/is_writable_variation1/b*.tmp",
+
+ /* Testing Binary safe */
+ "$file_path/is_writable_variation1".chr(0)."bar.tmp",
+ "$file_path".chr(0)."is_writable_variation1/bar.tmp",
+ "$file_path".chr(0)."is_writable_variation1/bar.tmp",
+
+ /* Testing directories */
+ ".", // current directory, exp: bool(true)
+ "$file_path/is_writable_variation1" // temp directory, exp: bool(true)
+);
+$counter = 1;
+/* loop through to test each element in the above array
+ is a writable file */
+foreach($files_arr as $file) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_writable($file) );
+ var_dump( is_writeable($file) );
+ $counter++;
+ clearstatcache();
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/is_writable_variation1/bar.tmp");
+rmdir(dirname(__FILE__)."/is_writable_variation1/");
+?>
+--EXPECTF--
+*** Testing is_writable(): usage variations ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(%s)
+bool(%s)
+-- Iteration 3 --
+bool(true)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+-- Iteration 7 --
+
+Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+
+Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
+NULL
+-- Iteration 10 --
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/is_writable_variation2.phpt b/ext/standard/tests/file/is_writable_variation2.phpt
new file mode 100644
index 0000000..f56219c
--- /dev/null
+++ b/ext/standard/tests/file/is_writable_variation2.phpt
@@ -0,0 +1,126 @@
+--TEST--
+Test is_writable() and its alias is_writeable() function: usage variations - file/dir with diff. perms
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on LINUX');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink ($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool is_writable ( string $filename );
+ Description: Tells whether the filename is writable.
+
+ is_writeable() is an alias of is_writable()
+*/
+
+/* test is_executable() with file/dir having different permissions */
+
+require dirname(__FILE__).'/file.inc';
+echo "*** Testing is_writable(): usage variations ***\n";
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/is_writable_variation2");
+
+echo "\n*** Testing is_writable() on directory without write permission ***\n";
+chmod("$file_path/is_writable_variation2", 0004);
+var_dump( is_writable("$file_path/is_writable_variation2") ); // exp: bool(false)
+var_dump( is_writeable("$file_path/is_writable_variation2") ); // exp: bool(false)
+chmod("$file_path/is_writable_variation2", 0777); // chmod to enable deletion of directory
+
+echo "\n*** Testing miscelleneous input for is_writable() function ***\n";
+$name_prefix = "is_writable_variation2";
+create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 1);
+create_files(dirname(__FILE__), 1, "text", 0755, 1, "w", $name_prefix, 2);
+create_files(dirname(__FILE__), 1, "empty", 0755, 1, "w", $name_prefix, 3);
+create_files(dirname(__FILE__), 1, "numeric", 0555, 1, "w", $name_prefix, 4);
+create_files(dirname(__FILE__), 1, "text", 0222, 1, "w", $name_prefix, 5);
+create_files(dirname(__FILE__), 1, "numeric", 0711, 1, "w", $name_prefix, 6);
+create_files(dirname(__FILE__), 1, "text", 0114, 1, "w", $name_prefix, 7);
+create_files(dirname(__FILE__), 1, "numeric", 0244, 1, "w", $name_prefix, 8);
+create_files(dirname(__FILE__), 1, "text", 0421, 1, "w", $name_prefix, 9);
+create_files(dirname(__FILE__), 1, "text", 0422, 1, "w", $name_prefix, 10);
+
+$misc_files = array (
+ "$file_path/is_writable_variation21.tmp",
+ "$file_path/is_writable_variation22.tmp",
+ "$file_path/is_writable_variation23.tmp",
+ "$file_path/is_writable_variation24.tmp",
+ "$file_path/is_writable_variation25.tmp",
+ "$file_path/is_writable_variation26.tmp",
+ "$file_path/is_writable_variation27.tmp",
+ "$file_path/is_writable_variation28.tmp",
+ "$file_path/is_writable_variation29.tmp",
+ "$file_path/is_writable_variation210.tmp"
+);
+
+$counter = 1;
+/* loop through to test each element in the above array
+ is a writable file */
+foreach($misc_files as $misc_file) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_writable($misc_file) );
+ var_dump( is_writeable($misc_file) );
+ $counter++;
+ clearstatcache();
+}
+
+// change all file's permissions to 777 before deleting
+change_file_perms($file_path, 10, 0777, $name_prefix);
+delete_files($file_path, 10, $name_prefix);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/is_writable_variation2/");
+?>
+--EXPECTF--
+*** Testing is_writable(): usage variations ***
+
+*** Testing is_writable() on directory without write permission ***
+bool(false)
+bool(false)
+
+*** Testing miscelleneous input for is_writable() function ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(true)
+-- Iteration 4 --
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(true)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(true)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(false)
+bool(false)
+-- Iteration 10 --
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt
new file mode 100644
index 0000000..66a80ab
--- /dev/null
+++ b/ext/standard/tests/file/is_writable_variation3.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test is_writable() and its alias is_writeable() function: usage variations - invalid file names
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ // Skip if being run by root (files are always readable, writeable and executable)
+ $filename = dirname(__FILE__)."/is_writable_root_check.tmp";
+ $fp = fopen($filename, 'w');
+ fclose($fp);
+ if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+ }
+ unlink($filename);
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool is_writable ( string $filename );
+ Description: Tells whether the filename is writable.
+
+ is_writeable() is an alias of is_writable()
+*/
+
+/* test is_writable() & is_writeable() with invalid arguments */
+
+echo "*** Testing is_writable(): usage variations ***\n";
+
+echo "\n*** Testing is_writable() with invalid filenames ***\n";
+$misc_files = array(
+ 0,
+ 1234,
+ -2.34555,
+ TRUE,
+ FALSE,
+ NULL,
+ " ",
+ @array(),
+ @$file_handle
+);
+/* loop through to test each element in the above array
+ is a writable file */
+foreach( $misc_files as $misc_file ) {
+ var_dump( is_writable($misc_file) );
+ var_dump( is_writeable($misc_file) );
+ clearstatcache();
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_writable(): usage variations ***
+
+*** Testing is_writable() with invalid filenames ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+
+Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+bool(false)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/lchgrp_basic.phpt b/ext/standard/tests/file/lchgrp_basic.phpt
new file mode 100644
index 0000000..1713bef
--- /dev/null
+++ b/ext/standard/tests/file/lchgrp_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test lchgrp() function : basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
+if (!function_exists("posix_getgid")) die("skip no posix_getgid()");
+?>
+--FILE--
+<?php
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchgrp.txt';
+$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt';
+
+$gid = posix_getgid();
+
+var_dump( touch( $filename ) );
+var_dump( symlink( $filename, $symlink ) );
+var_dump( lchgrp( $filename, $gid ) );
+var_dump( filegroup( $symlink ) === $gid );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchgrp.txt';
+$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt';
+unlink($filename);
+unlink($symlink);
+
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/file/lchown_basic.phpt b/ext/standard/tests/file/lchown_basic.phpt
new file mode 100644
index 0000000..9675d3a
--- /dev/null
+++ b/ext/standard/tests/file/lchown_basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test lchown() function : basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
+if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
+?>
+--FILE--
+<?php
+/* Prototype : bool lchown (string filename, mixed user)
+ * Description: Change file owner of a symlink
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing lchown() : basic functionality ***\n";
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt';
+$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt';
+
+$uid = posix_getuid();
+
+var_dump( touch( $filename ) );
+var_dump( symlink( $filename, $symlink ) );
+var_dump( lchown( $filename, $uid ) );
+var_dump( fileowner( $symlink ) === $uid );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt';
+$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'symlink.txt';
+unlink($filename);
+unlink($symlink);
+
+?>
+--EXPECTF--
+*** Testing lchown() : basic functionality ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt
new file mode 100644
index 0000000..979959e
--- /dev/null
+++ b/ext/standard/tests/file/lchown_error.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test lchown() function : error functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
+if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : bool lchown (string filename, mixed user)
+ * Description: Change file owner of a symlink
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing lchown() : error functionality ***\n";
+
+// Set up
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt';
+touch( $filename );
+$uid = posix_getuid();
+
+
+// Less than expected arguments
+var_dump( lchown( $filename ) );
+
+// More than expected arguments
+var_dump( lchown( $filename, $uid, 'foobar' ) );
+
+// Non-existant filename
+var_dump( lchown( 'foobar_lchown.txt', $uid ) );
+
+// Wrong argument types
+var_dump( lchown( new StdClass(), $uid ) );
+var_dump( lchown( array(), $uid ) );
+
+// Bad user
+var_dump( lchown( $filename, -5 ) );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt';
+unlink($filename);
+
+?>
+--EXPECTF--
+*** Testing lchown() : error functionality ***
+
+Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d
+bool(true)
+
+Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d
+bool(true)
+
+Warning: lchown(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d
+bool(true)
+
+Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d
+bool(true)
+
+Warning: lchown(): Operation not permitted in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/file/link_win32.phpt b/ext/standard/tests/file/link_win32.phpt
new file mode 100644
index 0000000..2bba546
--- /dev/null
+++ b/ext/standard/tests/file/link_win32.phpt
@@ -0,0 +1,26 @@
+--TEST--
+link not working properly on Windows
+--CREDITS--
+Venkat Raman Don
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+$filename = __DIR__ . '\\a.php';
+$content = '<?php echo "Dummy Content.\n" ?>';
+file_put_contents($filename, $content);
+$linkname = __DIR__ . '\\a_link.php';
+link("$filename", "$linkname");
+var_dump(file_exists("$linkname"));
+$linkcontent = file_get_contents($linkname);
+var_dump($content == $linkcontent);
+unlink($filename);
+unlink($linkname);
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/lstat_stat_basic.phpt b/ext/standard/tests/file/lstat_stat_basic.phpt
new file mode 100644
index 0000000..0d1476d
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_basic.phpt
@@ -0,0 +1,317 @@
+--TEST--
+Test lstat() & stat() functions: basic functionality
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. lstat() not available on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+require("$file_path/file.inc");
+
+echo "*** Testing lstat() & stat() : basic functionality ***\n";
+
+/* creating temp directory and file */
+
+// creating dir
+$dirname = "$file_path/lstat_stat_basic";
+@rmdir($dirname);
+mkdir($dirname);
+// stat of the dir created
+$dir_stat = stat($dirname);
+clearstatcache();
+sleep(2);
+
+// creating file
+$filename = "$dirname/lstat_stat_basic.tmp";
+$file_handle = fopen($filename, "w");
+fclose($file_handle);
+// stat of the file created
+$file_stat = stat($filename);
+sleep(2);
+
+// now new stat of the dir after file is created
+$new_dir_stat = stat($dirname);
+clearstatcache();
+
+// create soft link and record stat
+$sym_linkname = "$file_path/lstat_stat_basic_link.tmp";
+symlink($filename, $sym_linkname);
+// stat of the link created
+$link_stat = lstat($sym_linkname);
+sleep(2);
+// new stat of the file, after a softlink to this file is created
+$new_file_stat = stat($filename);
+clearstatcache();
+
+// stat contains 13 different values stored twice, can be accessed using
+// numeric and named keys, compare them to see they are same
+echo "*** Testing stat() and lstat() : validating the values stored in stat ***\n";
+// Initial stat values
+var_dump( compare_self_stat($file_stat) ); //expect true
+var_dump( compare_self_stat($dir_stat) ); //expect true
+var_dump( compare_self_stat($link_stat) ); // expect true
+
+// New stat values taken after creation of file & link
+var_dump( compare_self_stat($new_file_stat) ); //expect true
+var_dump( compare_self_stat($new_dir_stat) ); // expect true
+
+// compare the two stat values, initial stat and stat recorded after
+// creating files and link, also dump the value of stats
+echo "*** Testing stat() and lstat() : comparing stats (recorded before and after file/link creation) ***\n";
+echo "-- comparing difference in dir stats before and after creating file in it --\n";
+$affected_elements = array( 9, 10, 'mtime', 'ctime' );
+var_dump( compare_stats($dir_stat, $new_dir_stat, $affected_elements, '!=', true) ); // expect true
+
+echo "-- comparing difference in file stats before and after creating link to it --\n";
+var_dump( compare_stats($file_stat, $new_file_stat, $all_stat_keys, "==", true) ); // expect true
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_basic_link.tmp");
+unlink("$file_path/lstat_stat_basic/lstat_stat_basic.tmp");
+rmdir("$file_path/lstat_stat_basic");
+?>
+--EXPECTF--
+*** Testing lstat() & stat() : basic functionality ***
+*** Testing stat() and lstat() : validating the values stored in stat ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Testing stat() and lstat() : comparing stats (recorded before and after file/link creation) ***
+-- comparing difference in dir stats before and after creating file in it --
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+bool(true)
+-- comparing difference in file stats before and after creating link to it --
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+array(26) {
+ [0]=>
+ int(%i)
+ [1]=>
+ int(%i)
+ [2]=>
+ int(%i)
+ [3]=>
+ int(%i)
+ [4]=>
+ int(%i)
+ [5]=>
+ int(%i)
+ [6]=>
+ int(%i)
+ [7]=>
+ int(%i)
+ [8]=>
+ int(%i)
+ [9]=>
+ int(%i)
+ [10]=>
+ int(%i)
+ [11]=>
+ int(%i)
+ [12]=>
+ int(%i)
+ ["dev"]=>
+ int(%i)
+ ["ino"]=>
+ int(%i)
+ ["mode"]=>
+ int(%i)
+ ["nlink"]=>
+ int(%i)
+ ["uid"]=>
+ int(%i)
+ ["gid"]=>
+ int(%i)
+ ["rdev"]=>
+ int(%i)
+ ["size"]=>
+ int(%i)
+ ["atime"]=>
+ int(%i)
+ ["mtime"]=>
+ int(%i)
+ ["ctime"]=>
+ int(%i)
+ ["blksize"]=>
+ int(%i)
+ ["blocks"]=>
+ int(%i)
+}
+bool(true)
+Done
diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt
new file mode 100644
index 0000000..385167f
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_error.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test lstat() and stat() functions: error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. lstat() not available on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+echo "*** Testing lstat() for error conditions ***\n";
+$file_path = dirname(__FILE__);
+var_dump( lstat() ); // args < expected
+var_dump( lstat(__FILE__, 2) ); // args > expected
+var_dump( lstat("$file_path/temp.tmp") ); // non existing file
+var_dump( lstat(22) ); // scalar argument
+$arr = array(__FILE__);
+var_dump( lstat($arr) ); // array argument
+
+echo "\n*** Testing stat() for error conditions ***\n";
+var_dump( stat() ); // args < expected
+var_dump( stat(__FILE__, 2) ); // file, args > expected
+var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected
+
+var_dump( stat("$file_path/temp.tmp") ); // non existing file
+var_dump( stat("$file_path/temp/") ); // non existing dir
+var_dump( stat(22) ); // scalar argument
+var_dump( stat($arr) ); // array argument
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing lstat() for error conditions ***
+
+Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: lstat(): Lstat failed for %s in %s on line %d
+bool(false)
+
+Warning: lstat(): Lstat failed for 22 in %s on line %d
+bool(false)
+
+Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+
+*** Testing stat() for error conditions ***
+
+Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: stat(): stat failed for %s in %s on line %d
+bool(false)
+
+Warning: stat(): stat failed for %s in %s on line %d
+bool(false)
+
+Warning: stat(): stat failed for 22 in %s on line %d
+bool(false)
+
+Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/file/lstat_stat_variation1.phpt b/ext/standard/tests/file/lstat_stat_variation1.phpt
new file mode 100644
index 0000000..30ce9b7
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation1.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of rename() on file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of rename() on stats of file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+/* create temp file */
+$fp = fopen("$file_path/lstat_stat_variation1.tmp", "w"); // temp file
+fclose($fp);
+
+// renaming a file and check stat
+echo "*** Testing stat() for files after being renamed ***\n";
+$file_path = dirname(__FILE__);
+$old_filename = "$file_path/lstat_stat_variation1.tmp";
+$new_filename = "$file_path/lstat_stat_variation1a.tmp";
+$old_stat = stat($old_filename);
+clearstatcache();
+var_dump( rename($old_filename, $new_filename) );
+$new_stat = stat($new_filename);
+
+// compare the self stat
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the two stats
+var_dump( compare_stats($old_stat, $old_stat, $all_stat_keys) );
+// clear the cache
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation1a.tmp");
+?>
+--EXPECTF--
+*** Testing stat() for files after being renamed ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation10.phpt b/ext/standard/tests/file/lstat_stat_variation10.phpt
new file mode 100644
index 0000000..51ebc25
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation10.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of is_dir()
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of is_dir() on stats of a dir */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file, link and directory */
+$dirname = "$file_path/lstat_stat_variation10";
+mkdir($dirname); // temp dir
+
+// is_dir() on a directory
+echo "*** Testing stat() on directory after using is_dir() on it ***\n";
+$old_stat = stat($dirname);
+// clear the cache
+clearstatcache();
+sleep(2);
+var_dump( is_dir($dirname) );
+$new_stat = stat($dirname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/lstat_stat_variation10");
+?>
+--EXPECTF--
+*** Testing stat() on directory after using is_dir() on it ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation11.phpt b/ext/standard/tests/file/lstat_stat_variation11.phpt
new file mode 100644
index 0000000..a75504b
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation11.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effect of is_file()
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+/* test the effects of is_file() on stats of a file */
+
+/* create temp file */
+$filename = "$file_path/lstat_stat_variation11.tmp";
+$fp = fopen($filename, "w"); // temp file
+fclose($fp);
+
+// is_file() on a file
+echo "*** Testing stat() on a file after using is_file() on it ***\n";
+$old_stat = stat($filename);
+// clear the stat
+clearstatcache();
+sleep(2);
+var_dump( is_file($filename) );
+$new_stat = stat($filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
+// clear the stat
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation11.tmp");
+?>
+--EXPECTF--
+*** Testing stat() on a file after using is_file() on it ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation12.phpt b/ext/standard/tests/file/lstat_stat_variation12.phpt
new file mode 100644
index 0000000..8e1edd6
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation12.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of is_link()
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. lstat() not available on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of is_link() on stats of link */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file, link */
+$filename = "$file_path/lstat_stat_variation12.tmp";
+$fp = fopen($filename, "w"); // temp file
+fclose($fp);
+
+$linkname = "$file_path/lstat_stat_variation12_link.tmp";
+symlink($filename, $linkname); // temp link
+
+// is_link() on a link
+echo "*** Testing stat() on a link after using is_link() on it ***\n";
+$linkname = "$file_path/lstat_stat_variation12_link.tmp";
+$old_stat = lstat($linkname);
+// clear the stat
+clearstatcache();
+sleep(2);
+var_dump( is_link($linkname) );
+$new_stat = lstat($linkname);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
+// clear the stat
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation12_link.tmp");
+unlink("$file_path/lstat_stat_variation12.tmp");
+?>
+--EXPECTF--
+*** Testing stat() on a link after using is_link() on it ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation13.phpt b/ext/standard/tests/file/lstat_stat_variation13.phpt
new file mode 100644
index 0000000..288e0b5
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation13.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - file opened using w and r mode
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* use stat on file created using "w" and "r" mode of fopen */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+$filename = "$file_path/lstat_stat_variation13.tmp";
+
+echo "*** Checking stat() on a file opened using read/write mode ***\n";
+$file_handle = fopen($filename, "w"); // create file
+fclose($file_handle);
+$old_stat = stat($filename);
+// clear the stat
+clearstatcache();
+sleep(2);
+// opening file again in read mode
+$file_handle = fopen($filename, "r"); // read file
+fclose($file_handle);
+$new_stat = stat($filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation13.tmp");
+?>
+--EXPECTF--
+*** Checking stat() on a file opened using read/write mode ***
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation14.phpt b/ext/standard/tests/file/lstat_stat_variation14.phpt
new file mode 100644
index 0000000..517f77e
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation14.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - hardlink
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. lstat() not available on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of is_link() on stats of hard link */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file & link */
+$filename = "$file_path/lstat_stat_variation14.tmp";
+$fp = fopen($filename, "w"); // temp file
+fclose($fp);
+
+echo "*** Checking lstat() and stat() on hard link ***\n";
+$linkname = "$file_path/lstat_stat_variation14_hard.tmp";
+//ensure that link doesn't exists
+@unlink($linkname);
+
+// create the link
+var_dump( link($filename, $linkname) );
+$file_stat = stat($filename);
+$link_stat = lstat($linkname);
+// compare self stats
+var_dump( compare_self_stat($file_stat) );
+var_dump( compare_self_stat($link_stat) );
+// compare the stat
+var_dump( compare_stats($file_stat, $link_stat, $all_stat_keys) );
+// clear the stat
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation14_hard.tmp");
+unlink("$file_path/lstat_stat_variation14.tmp");
+?>
+--EXPECTF--
+*** Checking lstat() and stat() on hard link ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation15.phpt b/ext/standard/tests/file/lstat_stat_variation15.phpt
new file mode 100644
index 0000000..8b67338
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation15.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects changing permissions of link
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. lstat() not available on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects on stats by changing permissions of link */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+$filename = "$file_path/lstat_stat_variation15.tmp";
+$fp = fopen($filename, "w"); // temp file
+fclose($fp);
+
+// temp link
+$linkname = "$file_path/lstat_stat_variation15_link.tmp";
+symlink($filename, $linkname);
+
+// checking lstat() and stat() on links
+echo "*** Testing lstat() on a link after changing its access permission ***\n";
+clearstatcache();
+$old_stat = lstat($linkname);
+var_dump( chmod($linkname, 0777) );
+// clear the stat
+clearstatcache();
+sleep(2);
+$new_stat = lstat($linkname);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation15_link.tmp");
+unlink("$file_path/lstat_stat_variation15.tmp");
+?>
+--EXPECTF--
+*** Testing lstat() on a link after changing its access permission ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation16.phpt b/ext/standard/tests/file/lstat_stat_variation16.phpt
new file mode 100644
index 0000000..9f12765
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation16.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects changing permissions of file
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects on stats with changing permissions of file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+$filename = "$file_path/lstat_stat_variation16.tmp";
+$fp = fopen($filename, "w"); // temp file
+fclose($fp);
+
+// checking stat() on file after changing its permission
+echo "*** Testing lstat() on a file after changing its access permission ***\n";
+$old_stat = stat($filename);
+sleep(2);
+var_dump( chmod($filename, 0777) );
+// clear the stat
+clearstatcache();
+$new_stat = stat($filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+$affected_members = array(10, 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation16.tmp");
+?>
+--EXPECTF--
+*** Testing lstat() on a file after changing its access permission ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation17.phpt b/ext/standard/tests/file/lstat_stat_variation17.phpt
new file mode 100644
index 0000000..f2306de
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation17.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects changing permissions of dir
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects on stats by changing permissions of a dir */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+// checking stat() on directory
+echo "*** Testing lstat() on a dir after changing its access permission ***\n";
+$dirname = "$file_path/lstat_stat_variation17";
+mkdir($dirname);
+
+$old_stat = stat($dirname);
+sleep(2);
+var_dump( chmod($dirname, 0777) );
+// clear the stat
+clearstatcache();
+$new_stat = stat($dirname);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+$affected_members = array(2, 10, 'mode', 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/lstat_stat_variation17");
+?>
+--EXPECTF--
+*** Testing lstat() on a dir after changing its access permission ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation18.phpt b/ext/standard/tests/file/lstat_stat_variation18.phpt
new file mode 100644
index 0000000..fc98739
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation18.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - dir/file name stored in object
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test for stats of dir/file when their names are stored in objects */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+mkdir("$file_path/lstat_stat_variation18/"); // temp dir
+$fp = fopen("$file_path/lstat_stat_variation18.tmp", "w"); // temp file
+fclose($fp);
+
+echo "*** Testing stat() with filename & directory name stored inside an object ***\n";
+
+class names {
+ public $var_name;
+ public function names($name) {
+ $this->var_name = $name;
+ }
+}
+
+// directory name stored in an object
+$dir_name = new names("$file_path/lstat_stat_variation18");
+
+// file name stored in an object
+$file_name = new names("$file_path/lstat_stat_variation18.tmp");
+
+echo "\n-- Testing stat() on filename stored inside an object --\n";
+// dump the stat returned value
+var_dump( stat($file_name->var_name) );
+
+echo "\n-- Testing stat() on directory name stored inside an object --\n";
+// dump the stat returned value
+var_dump( stat($dir_name->var_name) );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation18.tmp");
+rmdir("$file_path/lstat_stat_variation18");
+?>
+--EXPECTF--
+*** Testing stat() with filename & directory name stored inside an object ***
+
+-- Testing stat() on filename stored inside an object --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+
+-- Testing stat() on directory name stored inside an object --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation19.phpt b/ext/standard/tests/file/lstat_stat_variation19.phpt
new file mode 100644
index 0000000..c481575
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation19.phpt
@@ -0,0 +1,285 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - dir/file names in array
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test for stats of dir/file when their names are stored in an array */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file, link and directory */
+@rmdir("$file_path/lstat_stat_variation19"); // ensure that dir doesn't exists
+mkdir("$file_path/lstat_stat_variation19"); // temp dir
+
+$fp = fopen("$file_path/lstat_stat_variation19.tmp", "w"); // temp file
+fclose($fp);
+
+echo "*** Testing stat() with filename & directory name stored inside an array ***\n";
+
+// array with default numeric index
+$names = array(
+ "$file_path/lstat_stat_variation19.tmp",
+ "$file_path/lstat_stat_variation19"
+);
+
+//array with string key index
+$names_with_key = array (
+ 'file' => "$file_path/lstat_stat_variation19.tmp",
+ "dir" => "$file_path/lstat_stat_variation19"
+);
+
+echo "\n-- Testing stat() on filename stored inside an array --\n";
+var_dump( stat($names[0]) ); // values stored with numeric index
+var_dump( stat($names_with_key['file']) ); // value stored with string key
+
+echo "\n-- Testing stat() on dir name stored inside an array --\n";
+var_dump( stat($names[1]) ); // values stored with numeric index
+var_dump( stat($names_with_key["dir"]) ); // value stored with string key
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation19.tmp");
+rmdir("$file_path/lstat_stat_variation19");
+?>
+--EXPECTF--
+*** Testing stat() with filename & directory name stored inside an array ***
+
+-- Testing stat() on filename stored inside an array --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+
+-- Testing stat() on dir name stored inside an array --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation2.phpt b/ext/standard/tests/file/lstat_stat_variation2.phpt
new file mode 100644
index 0000000..e7d704a
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation2.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of rename() on dir
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of rename() on stats of dir */
+
+$file_path = dirname(__FILE__);
+require("file.inc");
+
+/* create temp directory */
+mkdir("$file_path/lstat_stat_variation1/"); // temp dir
+
+// renaming a directory and check stat
+echo "*** Testing stat() for directory after being renamed ***\n";
+$old_dirname = "$file_path/lstat_stat_variation1";
+$new_dirname = "$file_path/lstat_stat_variation1a";
+$old_stat = stat($old_dirname);
+clearstatcache();
+var_dump( rename($old_dirname, $new_dirname) );
+$new_stat = stat($new_dirname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the two stats - all except ctime
+$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
+ "dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "blksize", "blocks");
+var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
+// clear the cache
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/lstat_stat_variation1a");
+?>
+--EXPECTF--
+*** Testing stat() for directory after being renamed ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation20.phpt b/ext/standard/tests/file/lstat_stat_variation20.phpt
new file mode 100644
index 0000000..30b81ad
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation20.phpt
@@ -0,0 +1,287 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - link names stored in array/object
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. lstat() not available on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test for stats of link when their names are stored in object and array */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+$fp = fopen("$file_path/lstat_stat_variation20.tmp", "w"); // temp file
+fclose($fp);
+
+// temp link
+symlink("$file_path/lstat_stat_variation20.tmp", "$file_path/lstat_stat_variation20_link.tmp");
+
+echo "*** Testing lstat() with linkname stored inside an object/array ***\n";
+class names {
+ public $var_name;
+ public function names($name) {
+ $this->var_name = $name;
+ }
+}
+
+// link name stored in an object
+$link_object = new names("$file_path/lstat_stat_variation20_link.tmp");
+
+// link name stored in side an array
+// with default numeric key
+$link_array = array("$file_path/lstat_stat_variation20_link.tmp");
+
+// with string key index
+$link_array_with_key = array("linkname" => "$file_path/lstat_stat_variation20_link.tmp");
+
+echo "\n-- Testing lstat() on link name stored inside an object --\n";
+var_dump( lstat($link_object->var_name) );
+
+echo "\n-- Testing stat() on link name stored inside an array --\n";
+var_dump( stat($link_array[0]) ); // with default numeric index
+var_dump( stat($link_array_with_key["linkname"]) ); // with string key
+var_dump( stat($link_array_with_key['linkname']) );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation20_link.tmp");
+unlink("$file_path/lstat_stat_variation20.tmp");
+?>
+--EXPECTF--
+*** Testing lstat() with linkname stored inside an object/array ***
+
+-- Testing lstat() on link name stored inside an object --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+
+-- Testing stat() on link name stored inside an array --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(%d)
+ [12]=>
+ int(%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(%d)
+ ["blocks"]=>
+ int(%d)
+}
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation21.phpt b/ext/standard/tests/file/lstat_stat_variation21.phpt
new file mode 100644
index 0000000..8620ab0
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation21.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of truncate()
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of truncate() on stats of a file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file */
+$filename = "$file_path/lstat_stat_variation21.tmp";
+$fp = fopen($filename, "w"); // temp file
+fclose($fp);
+
+/* ftruncate the current file and check stat() on the file */
+
+echo "*** Testing stat() on file by truncating it to given size ***\n";
+$old_stat = stat($filename);
+// clear the cache
+clearstatcache();
+sleep(2);
+// opening file in r/w mode
+$file_handle = fopen($filename, "r+");
+var_dump( ftruncate($file_handle, 512) ); // truncate it
+fclose($file_handle);
+
+$new_stat = stat($filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+$affected_members = array(7, 9, 10, 'size', 'mtime', 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, '!=') );
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation21.tmp");
+?>
+--EXPECTF--
+*** Testing stat() on file by truncating it to given size ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation22.phpt b/ext/standard/tests/file/lstat_stat_variation22.phpt
new file mode 100644
index 0000000..f9d9047
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation22.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip ... not for Windows');
+}
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+echo "*** testing stat ***\n";
+var_dump(stat(NULL));
+var_dump(stat(false));
+var_dump(stat(''));
+var_dump(stat(' '));
+var_dump(stat('|'));
+
+echo "*** testing lstat ***\n";
+var_dump(lstat(NULL));
+var_dump(lstat(false));
+var_dump(lstat(''));
+var_dump(lstat(' '));
+var_dump(lstat('|'));
+echo "Done";
+?>
+--EXPECTF--
+*** testing stat ***
+bool(false)
+bool(false)
+bool(false)
+
+Warning: stat(): stat failed for in %s on line %d
+bool(false)
+
+Warning: stat(): stat failed for | in %s on line %d
+bool(false)
+*** testing lstat ***
+bool(false)
+bool(false)
+bool(false)
+
+Warning: lstat(): Lstat failed for in %s on line %d
+bool(false)
+
+Warning: lstat(): Lstat failed for | in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/lstat_stat_variation3.phpt b/ext/standard/tests/file/lstat_stat_variation3.phpt
new file mode 100644
index 0000000..e7bae3a
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation3.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of rename() on link
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of rename() on stats of link */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+/* create temp file & link */
+$fp = fopen("$file_path/lstat_stat_variation3.tmp", "w"); // temp file
+fclose($fp);
+
+// temp link
+symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp");
+
+// renaming a link
+echo "*** Testing lstat() for link after being renamed ***\n";
+$old_linkname = "$file_path/lstat_stat_variation_link3.tmp";
+$new_linkname = "$file_path/lstat_stat_variation_link3a.tmp";
+$old_stat = lstat($old_linkname);
+clearstatcache();
+var_dump( rename($old_linkname, $new_linkname) );
+$new_stat = lstat($new_linkname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the two stats - all except ctime
+$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
+ "dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "blksize", "blocks");
+var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
+?>
+===Done===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation3.tmp");
+unlink("$file_path/lstat_stat_variation_link3a.tmp");
+?>
+--EXPECT--
+*** Testing lstat() for link after being renamed ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===Done===
diff --git a/ext/standard/tests/file/lstat_stat_variation4.phpt b/ext/standard/tests/file/lstat_stat_variation4.phpt
new file mode 100644
index 0000000..259beca
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation4.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of touch() on file
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of touch() on stats of file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file */
+
+$file_name = "$file_path/lstat_stat_variation4.tmp";
+$fp = fopen($file_name, "w"); // temp file
+fclose($fp);
+
+// touch a file check stat, there should be difference in atime
+echo "*** Testing stat() for file after using touch() on the file ***\n";
+$old_stat = stat($file_name);
+// clear the cache
+clearstatcache();
+sleep(2);
+var_dump( touch($file_name) );
+$new_stat = stat($file_name);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the stat
+$affected_members = array(8, 'atime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") );
+// clear the cache
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation4.tmp");
+?>
+--EXPECTF--
+*** Testing stat() for file after using touch() on the file ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation5.phpt b/ext/standard/tests/file/lstat_stat_variation5.phpt
new file mode 100644
index 0000000..d0c096e
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation5.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of touch() on dir
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of touch() on stats of dir */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp directory */
+
+$dir_name = "$file_path/lstat_stat_variation5";
+@rmdir($dir_name); //ensure that dir doesn't exists
+mkdir($dir_name); // temp dir
+
+// touch a directory and check stat, there should be difference in atime
+echo "*** Testing stat() for directory after using touch() on the directory ***\n";
+$old_stat = stat($dir_name);
+// clear the cache
+clearstatcache();
+sleep(2);
+var_dump( touch($dir_name) );
+$new_stat = stat($dir_name);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the stat
+$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") );
+// clear the cache
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/lstat_stat_variation5");
+?>
+--EXPECTF--
+*** Testing stat() for directory after using touch() on the directory ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation6.phpt b/ext/standard/tests/file/lstat_stat_variation6.phpt
new file mode 100644
index 0000000..7e557d0
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation6.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - effects of touch() on link
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (!(stristr(PHP_OS, 'linux'))) {
+ die('skip.. test valid for linux only');
+}
+
+// checking for atime update whether it is enabled or disabled
+exec("mount", $mount_output);
+foreach( $mount_output as $out ) {
+ if( stristr($out, "noatime") )
+ die('skip.. atime update is disabled, hence skip the test');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+/* test the effects of touch() on stats of link */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file, link and directory */
+
+$file_name = "$file_path/lstat_stat_variation6.tmp";
+$fp = fopen($file_name, "w"); // temp file
+fclose($fp);
+$link_name = "$file_path/lstat_stat_variation_link6.tmp";
+symlink($file_name, $link_name); // temp link
+
+// touch a link, check stat, there should be difference in atime
+echo "*** Testing lstat() for link after using touch() on the link ***\n";
+$old_stat = lstat($link_name);
+sleep(2);
+
+// clear the cache
+clearstatcache();
+
+var_dump( touch($link_name) );
+
+$new_stat = stat($file_name);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the stat
+$affected_members = array(8, 'atime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") );
+// clear the stat
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation6.tmp");
+unlink("$file_path/lstat_stat_variation_link6.tmp");
+?>
+--EXPECTF--
+*** Testing lstat() for link after using touch() on the link ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation7.phpt b/ext/standard/tests/file/lstat_stat_variation7.phpt
new file mode 100644
index 0000000..2296193
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation7.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - writing data into file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+/* test the effects on stats with writing data into a file */
+
+$file_name = "$file_path/lstat_stat_variation7.tmp";
+$fp = fopen($file_name, "w"); // temp file
+fclose($fp);
+
+// writing to an empty file
+echo "*** Testing stat() on file after data is written in it ***\n";
+$fh = fopen($file_name,"w");
+$old_stat = stat($file_name);
+clearstatcache();
+fwrite($fh, str_repeat((binary)"Hello World", $old_stat['blksize']));
+$new_stat = stat($file_name);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stats
+$comp_arr = array(7, 12, 'size', 'blocks');
+var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<"));
+clearstatcache();
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation7.tmp");
+?>
+--EXPECTF--
+*** Testing stat() on file after data is written in it ***
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation8.phpt b/ext/standard/tests/file/lstat_stat_variation8.phpt
new file mode 100644
index 0000000..b0f170d
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation8.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - creating file/subdir
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+/* test the effects on stats with creating file/subdir in a dir
+*/
+
+/* create temp file */
+mkdir("$file_path/lstat_stat_variation8/"); // temp dir
+
+// creating and deleting subdir and files in the dir
+echo "*** Testing stat() on dir after subdir and file is created in it ***\n";
+$dirname = "$file_path/lstat_stat_variation8";
+$old_stat = stat($dirname);
+clearstatcache();
+sleep(2);
+mkdir("$dirname/lstat_stat_variation8_subdir");
+$file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w");
+fclose($file_handle);
+$new_stat = stat($dirname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stats
+$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime');
+clearstatcache();
+var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
+
+echo "\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/lstat_stat_variation8/lstat_stat_variation8a.tmp");
+rmdir("$file_path/lstat_stat_variation8/lstat_stat_variation8_subdir/");
+rmdir("$file_path/lstat_stat_variation8");
+?>
+--EXPECTF--
+*** Testing stat() on dir after subdir and file is created in it ***
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/lstat_stat_variation9.phpt b/ext/standard/tests/file/lstat_stat_variation9.phpt
new file mode 100644
index 0000000..63c6ff8
--- /dev/null
+++ b/ext/standard/tests/file/lstat_stat_variation9.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test lstat() and stat() functions: usage variations - deleting file/subdir
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: array lstat ( string $filename );
+ Description: Gives information about a file or symbolic link
+
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+/* test the effects on stats by deleting file/subdir from a dir
+*/
+
+echo "*** Testing stat() for comparing stats after the deletion of subdir and file ***\n";
+
+/* first create the dir/subdir and files, record the stat */
+@rmdir("$file_path/lstat_stat_variation9/"); // ensure that dir doesn't exists
+mkdir("$file_path/lstat_stat_variation9/"); // temp dir
+
+// creating and deleting subdir and files in the dir
+$dirname = "$file_path/lstat_stat_variation9";
+@rmdir("$dirname/lstat_stat_variation9_subdir"); // ensure that dir doesn't exists
+mkdir("$dirname/lstat_stat_variation9_subdir");
+$file_handle = fopen("$dirname/lstat_stat_variation9a.tmp", "w");
+fclose($file_handle);
+
+$old_stat = stat($dirname);
+
+/* now delete the surdir and file and record the stat */
+unlink("$dirname/lstat_stat_variation9a.tmp");
+rmdir("$dirname/lstat_stat_variation9_subdir");
+
+// comparing stats after the deletion of subdir and file
+$new_stat = stat($dirname);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the stats
+$affected_members = array(3, 'nlink');
+var_dump(compare_stats($old_stat, $new_stat, $affected_members, ">"));
+
+echo "\n--- Done ---";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/lstat_stat_variation9";
+rmdir($dirname);
+?>
+--EXPECTF--
+*** Testing stat() for comparing stats after the deletion of subdir and file ***
+bool(true)
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/mkdir-001.phpt b/ext/standard/tests/file/mkdir-001.phpt
new file mode 100644
index 0000000..be653da
--- /dev/null
+++ b/ext/standard/tests/file/mkdir-001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+mkdir() tests
+--FILE--
+<?php
+
+var_dump(mkdir("testdir"));
+var_dump(mkdir("testdir/subdir"));
+var_dump(rmdir("testdir/subdir"));
+var_dump(rmdir("testdir"));
+
+var_dump(mkdir("./testdir"));
+var_dump(mkdir("./testdir/subdir"));
+var_dump(rmdir("./testdir/subdir"));
+var_dump(rmdir("./testdir"));
+
+var_dump(mkdir(dirname(__FILE__)."/testdir"));
+var_dump(mkdir(dirname(__FILE__)."/testdir/subdir"));
+var_dump(rmdir(dirname(__FILE__)."/testdir/subdir"));
+var_dump(rmdir(dirname(__FILE__)."/testdir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir-002.phpt b/ext/standard/tests/file/mkdir-002.phpt
new file mode 100644
index 0000000..ccfd6c3
--- /dev/null
+++ b/ext/standard/tests/file/mkdir-002.phpt
@@ -0,0 +1,55 @@
+--TEST--
+mkdir(dir, 0777) tests
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+
+var_dump(mkdir("testdir", 0777));
+var_dump(mkdir("testdir/subdir", 0777));
+var_dump(`ls -l testdir`);
+var_dump(rmdir("testdir/subdir"));
+var_dump(rmdir("testdir"));
+
+var_dump(mkdir("./testdir", 0777));
+var_dump(mkdir("./testdir/subdir", 0777));
+var_dump(`ls -l ./testdir`);
+var_dump(rmdir("./testdir/subdir"));
+var_dump(rmdir("./testdir"));
+
+var_dump(mkdir(dirname(__FILE__)."/testdir", 0777));
+var_dump(mkdir(dirname(__FILE__)."/testdir/subdir", 0777));
+$dirname = dirname(__FILE__)."/testdir";
+var_dump(`ls -l $dirname`);
+var_dump(rmdir(dirname(__FILE__)."/testdir/subdir"));
+var_dump(rmdir(dirname(__FILE__)."/testdir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+string(%d) "%s
+d%s subdir
+"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+string(%d) "%s
+d%s subdir
+"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+string(%d) "%s
+d%s subdir
+"
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir-003.phpt b/ext/standard/tests/file/mkdir-003.phpt
new file mode 100644
index 0000000..50ad5e6
--- /dev/null
+++ b/ext/standard/tests/file/mkdir-003.phpt
@@ -0,0 +1,30 @@
+--TEST--
+recursive mkdir() tests
+--FILE--
+<?php
+
+var_dump(mkdir("testdir/subdir", 0777, true));
+var_dump(rmdir("testdir/subdir"));
+var_dump(rmdir("testdir"));
+
+var_dump(mkdir("./testdir/subdir", 0777, true));
+var_dump(rmdir("./testdir/subdir"));
+var_dump(rmdir("./testdir"));
+
+var_dump(mkdir(dirname(__FILE__)."/testdir/subdir", 0777, true));
+var_dump(rmdir(dirname(__FILE__)."/testdir/subdir"));
+var_dump(rmdir(dirname(__FILE__)."/testdir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir-004.phpt b/ext/standard/tests/file/mkdir-004.phpt
new file mode 100644
index 0000000..45c2751
--- /dev/null
+++ b/ext/standard/tests/file/mkdir-004.phpt
@@ -0,0 +1,24 @@
+--TEST--
+recursive mkdir() tests
+--SKIPIF--
+<?php
+chdir("/");
+if (!@mkdir("testtmpskipifdir")) {
+ die("skip for root only");
+}
+rmdir("testtmpskipifdir");
+?>
+--FILE--
+<?php
+
+var_dump(mkdir("/testdir/subdir", 0777, true));
+var_dump(rmdir("/testdir/subdir"));
+var_dump(rmdir("/testdir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir-005.phpt b/ext/standard/tests/file/mkdir-005.phpt
new file mode 100644
index 0000000..af2387c
--- /dev/null
+++ b/ext/standard/tests/file/mkdir-005.phpt
@@ -0,0 +1,25 @@
+--TEST--
+recursive mkdir() tests
+--SKIPIF--
+<?php
+chdir("/");
+if (!@mkdir("testtmpskipifdir")) {
+ die("skip for root only");
+}
+rmdir("testtmpskipifdir");
+?>
+--FILE--
+<?php
+
+chdir("/");
+var_dump(mkdir("./testdir/subdir", 0777, true));
+var_dump(rmdir("./testdir/subdir"));
+var_dump(rmdir("./testdir"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir-006.phpt b/ext/standard/tests/file/mkdir-006.phpt
new file mode 100644
index 0000000..9fcb928
--- /dev/null
+++ b/ext/standard/tests/file/mkdir-006.phpt
@@ -0,0 +1,20 @@
+--TEST--
+recursive mkdir() with unclean paths
+--FILE--
+<?php
+chdir(dirname(__FILE__));
+$dirpath = "./tmp/foo//bar/logs";
+mkdir($dirpath, 0777, true);
+
+if (is_dir($dirpath)) {
+ echo "Ok.\n";
+} else {
+ echo "Failed.\n";
+}
+rmdir("./tmp/foo/bar/logs");
+rmdir("./tmp/foo/bar/");
+rmdir("./tmp/foo/");
+rmdir("./tmp/");
+?>
+--EXPECT--
+Ok.
diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt
new file mode 100644
index 0000000..17f908c
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test mkdir() and rmdir() functions : error conditions
+--FILE--
+<?php
+/* Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] );
+ Description: Makes directory
+
+ Prototype: bool rmdir ( string $dirname [, resource $context] );
+ Description: Removes directory
+*/
+
+echo "*** Testing mkdir(): error conditions ***\n";
+var_dump( mkdir() ); // args < expected
+var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected
+var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected
+
+echo "\n*** Testing rmdir(): error conditions ***\n";
+var_dump( rmdir() ); // args < expected
+var_dump( rmdir(1, 2, 3) ); // args > expected
+var_dump( rmdir("testdir", $context, "test") ); // args > expected
+
+echo "\n*** Testing rmdir() on non-existent directory ***\n";
+var_dump( rmdir("temp") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing mkdir(): error conditions ***
+
+Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: context in %s on line %d
+
+Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+*** Testing rmdir(): error conditions ***
+
+Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: context in %s on line %d
+
+Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+*** Testing rmdir() on non-existent directory ***
+
+Warning: rmdir(temp): No such file or directory in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt b/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt
new file mode 100644
index 0000000..f9d41d5
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt
@@ -0,0 +1,1613 @@
+--TEST--
+Test mkdir() and rmdir() functions: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] );
+ Description: Makes directory
+*/
+
+echo "*** Testing mkdir() and rmdir() for different permissions ***\n";
+
+$context = stream_context_create();
+
+$file_path = dirname(__FILE__);
+$counter = 1;
+
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of directory to $mode --\n";
+ var_dump( mkdir("$file_path/mkdir/", $mode, true) );
+ var_dump( rmdir("$file_path/mkdir/") );
+ $counter++;
+}
+
+echo "\n*** Testing mkdir() and rmdir() by giving stream context as fourth argument ***\n";
+var_dump( mkdir("$file_path/mkdir/test/", 0777, true, $context) );
+var_dump( rmdir("$file_path/mkdir/test/", $context) );
+
+echo "\n*** Testing rmdir() on a non-empty directory ***\n";
+var_dump( mkdir("$file_path/mkdir/test/", 0777, true) );
+var_dump( rmdir("$file_path/mkdir/") );
+
+echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
+var_dump( mkdir("$file_path/tempx000/") );
+var_dump( rmdir("$file_path/tempx000/") );
+
+echo "\n*** Testing mkdir() with miscelleneous input ***\n";
+/* changing mode of mkdir to prevent creating sub-directory under it */
+var_dump( chmod("$file_path/mkdir/", 0000) );
+/* creating sub-directory test1 under mkdir, expected: false */
+var_dump( mkdir("$file_path/mkdir/test1", 0777, true) );
+var_dump( chmod("$file_path/mkdir/", 0777) ); // chmod to enable removing test1 directory
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/mkdir/test/");
+rmdir(dirname(__FILE__)."/mkdir/test1/");
+rmdir(dirname(__FILE__)."/mkdir/");
+?>
+--EXPECTF--
+*** Testing mkdir() and rmdir() for different permissions ***
+-- Changing mode of directory to 0 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 1 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 2 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 3 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 4 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 5 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 6 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 7 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 8 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 9 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 10 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 11 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 12 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 13 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 14 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 15 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 16 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 17 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 18 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 19 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 20 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 21 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 22 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 23 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 24 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 25 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 26 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 27 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 28 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 29 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 30 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 31 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 32 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 33 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 34 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 35 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 36 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 37 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 38 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 39 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 40 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 41 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 42 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 43 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 44 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 45 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 46 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 47 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 48 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 49 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 50 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 51 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 52 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 53 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 54 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 55 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 56 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 57 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 58 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 59 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 60 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 61 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 62 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 63 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 64 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 65 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 66 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 67 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 68 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 69 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 70 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 71 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 72 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 73 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 74 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 75 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 76 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 77 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 78 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 79 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 80 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 81 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 82 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 83 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 84 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 85 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 86 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 87 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 88 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 89 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 90 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 91 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 92 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 93 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 94 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 95 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 96 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 97 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 98 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 99 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 100 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 101 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 102 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 103 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 104 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 105 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 106 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 107 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 108 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 109 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 110 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 111 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 112 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 113 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 114 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 115 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 116 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 117 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 118 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 119 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 120 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 121 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 122 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 123 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 124 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 125 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 126 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 127 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 128 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 129 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 130 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 131 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 132 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 133 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 134 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 135 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 136 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 137 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 138 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 139 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 140 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 141 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 142 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 143 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 144 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 145 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 146 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 147 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 148 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 149 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 150 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 151 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 152 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 153 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 154 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 155 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 156 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 157 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 158 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 159 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 160 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 161 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 162 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 163 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 164 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 165 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 166 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 167 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 168 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 169 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 170 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 171 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 172 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 173 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 174 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 175 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 176 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 177 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 178 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 179 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 180 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 181 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 182 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 183 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 184 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 185 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 186 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 187 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 188 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 189 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 190 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 191 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 192 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 193 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 194 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 195 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 196 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 197 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 198 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 199 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 200 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 201 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 202 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 203 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 204 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 205 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 206 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 207 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 208 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 209 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 210 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 211 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 212 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 213 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 214 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 215 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 216 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 217 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 218 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 219 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 220 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 221 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 222 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 223 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 224 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 225 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 226 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 227 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 228 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 229 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 230 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 231 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 232 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 233 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 234 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 235 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 236 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 237 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 238 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 239 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 240 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 241 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 242 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 243 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 244 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 245 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 246 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 247 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 248 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 249 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 250 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 251 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 252 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 253 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 254 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 255 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 256 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 257 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 258 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 259 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 260 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 261 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 262 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 263 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 264 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 265 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 266 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 267 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 268 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 269 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 270 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 271 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 272 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 273 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 274 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 275 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 276 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 277 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 278 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 279 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 280 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 281 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 282 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 283 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 284 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 285 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 286 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 287 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 288 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 289 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 290 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 291 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 292 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 293 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 294 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 295 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 296 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 297 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 298 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 299 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 300 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 301 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 302 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 303 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 304 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 305 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 306 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 307 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 308 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 309 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 310 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 311 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 312 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 313 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 314 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 315 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 316 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 317 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 318 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 319 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 320 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 321 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 322 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 323 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 324 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 325 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 326 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 327 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 328 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 329 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 330 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 331 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 332 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 333 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 334 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 335 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 336 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 337 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 338 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 339 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 340 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 341 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 342 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 343 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 344 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 345 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 346 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 347 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 348 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 349 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 350 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 351 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 352 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 353 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 354 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 355 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 356 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 357 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 358 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 359 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 360 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 361 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 362 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 363 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 364 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 365 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 366 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 367 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 368 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 369 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 370 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 371 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 372 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 373 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 374 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 375 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 376 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 377 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 378 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 379 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 380 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 381 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 382 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 383 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 384 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 385 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 386 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 387 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 388 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 389 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 390 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 391 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 392 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 393 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 394 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 395 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 396 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 397 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 398 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 399 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 400 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 401 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 402 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 403 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 404 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 405 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 406 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 407 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 408 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 409 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 410 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 411 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 412 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 413 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 414 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 415 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 416 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 417 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 418 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 419 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 420 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 421 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 422 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 423 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 424 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 425 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 426 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 427 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 428 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 429 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 430 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 431 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 432 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 433 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 434 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 435 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 436 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 437 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 438 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 439 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 440 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 441 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 442 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 443 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 444 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 445 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 446 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 447 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 448 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 449 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 450 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 451 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 452 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 453 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 454 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 455 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 456 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 457 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 458 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 459 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 460 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 461 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 462 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 463 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 464 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 465 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 466 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 467 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 468 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 469 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 470 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 471 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 472 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 473 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 474 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 475 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 476 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 477 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 478 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 479 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 480 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 481 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 482 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 483 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 484 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 485 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 486 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 487 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 488 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 489 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 490 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 491 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 492 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 493 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 494 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 495 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 496 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 497 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 498 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 499 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 500 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 501 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 502 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 503 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 504 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 505 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 506 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 507 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 508 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 509 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 510 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 511 --
+bool(true)
+bool(true)
+
+*** Testing mkdir() and rmdir() by giving stream context as fourth argument ***
+bool(true)
+bool(true)
+
+*** Testing rmdir() on a non-empty directory ***
+bool(true)
+
+Warning: rmdir(%s/mkdir/): Directory not empty in %s on line %d
+bool(false)
+
+*** Testing mkdir() and rmdir() for binary safe functionality ***
+bool(true)
+bool(true)
+
+*** Testing mkdir() with miscelleneous input ***
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation1.phpt b/ext/standard/tests/file/mkdir_rmdir_variation1.phpt
new file mode 100644
index 0000000..5dc7a7a
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_rmdir_variation1.phpt
@@ -0,0 +1,1579 @@
+--TEST--
+Test mkdir() and rmdir() functions: usage variations - perms(0000-0777)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on LINUX');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] );
+ Description: Makes directory
+*/
+
+echo "*** Testing mkdir() and rmdir() for different permissions ***\n";
+
+$context = stream_context_create();
+
+$file_path = dirname(__FILE__);
+$counter = 1;
+
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- Changing mode of directory to $mode --\n";
+ var_dump( mkdir("$file_path/mkdir_variation1/", $mode, true) );
+ var_dump( rmdir("$file_path/mkdir_variation1/") );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing mkdir() and rmdir() for different permissions ***
+-- Changing mode of directory to 0 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 1 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 2 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 3 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 4 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 5 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 6 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 7 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 8 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 9 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 10 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 11 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 12 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 13 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 14 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 15 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 16 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 17 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 18 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 19 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 20 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 21 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 22 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 23 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 24 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 25 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 26 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 27 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 28 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 29 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 30 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 31 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 32 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 33 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 34 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 35 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 36 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 37 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 38 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 39 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 40 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 41 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 42 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 43 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 44 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 45 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 46 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 47 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 48 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 49 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 50 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 51 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 52 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 53 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 54 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 55 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 56 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 57 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 58 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 59 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 60 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 61 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 62 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 63 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 64 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 65 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 66 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 67 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 68 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 69 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 70 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 71 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 72 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 73 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 74 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 75 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 76 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 77 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 78 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 79 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 80 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 81 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 82 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 83 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 84 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 85 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 86 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 87 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 88 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 89 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 90 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 91 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 92 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 93 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 94 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 95 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 96 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 97 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 98 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 99 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 100 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 101 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 102 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 103 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 104 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 105 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 106 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 107 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 108 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 109 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 110 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 111 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 112 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 113 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 114 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 115 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 116 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 117 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 118 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 119 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 120 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 121 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 122 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 123 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 124 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 125 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 126 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 127 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 128 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 129 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 130 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 131 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 132 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 133 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 134 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 135 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 136 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 137 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 138 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 139 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 140 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 141 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 142 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 143 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 144 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 145 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 146 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 147 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 148 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 149 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 150 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 151 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 152 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 153 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 154 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 155 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 156 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 157 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 158 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 159 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 160 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 161 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 162 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 163 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 164 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 165 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 166 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 167 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 168 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 169 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 170 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 171 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 172 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 173 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 174 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 175 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 176 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 177 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 178 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 179 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 180 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 181 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 182 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 183 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 184 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 185 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 186 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 187 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 188 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 189 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 190 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 191 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 192 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 193 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 194 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 195 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 196 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 197 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 198 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 199 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 200 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 201 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 202 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 203 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 204 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 205 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 206 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 207 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 208 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 209 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 210 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 211 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 212 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 213 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 214 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 215 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 216 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 217 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 218 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 219 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 220 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 221 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 222 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 223 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 224 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 225 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 226 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 227 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 228 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 229 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 230 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 231 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 232 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 233 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 234 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 235 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 236 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 237 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 238 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 239 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 240 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 241 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 242 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 243 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 244 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 245 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 246 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 247 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 248 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 249 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 250 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 251 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 252 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 253 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 254 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 255 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 256 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 257 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 258 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 259 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 260 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 261 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 262 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 263 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 264 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 265 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 266 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 267 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 268 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 269 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 270 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 271 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 272 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 273 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 274 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 275 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 276 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 277 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 278 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 279 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 280 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 281 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 282 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 283 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 284 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 285 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 286 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 287 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 288 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 289 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 290 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 291 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 292 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 293 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 294 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 295 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 296 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 297 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 298 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 299 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 300 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 301 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 302 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 303 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 304 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 305 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 306 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 307 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 308 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 309 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 310 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 311 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 312 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 313 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 314 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 315 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 316 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 317 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 318 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 319 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 320 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 321 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 322 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 323 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 324 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 325 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 326 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 327 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 328 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 329 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 330 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 331 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 332 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 333 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 334 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 335 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 336 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 337 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 338 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 339 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 340 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 341 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 342 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 343 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 344 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 345 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 346 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 347 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 348 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 349 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 350 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 351 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 352 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 353 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 354 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 355 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 356 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 357 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 358 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 359 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 360 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 361 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 362 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 363 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 364 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 365 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 366 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 367 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 368 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 369 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 370 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 371 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 372 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 373 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 374 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 375 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 376 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 377 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 378 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 379 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 380 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 381 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 382 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 383 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 384 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 385 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 386 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 387 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 388 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 389 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 390 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 391 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 392 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 393 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 394 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 395 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 396 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 397 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 398 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 399 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 400 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 401 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 402 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 403 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 404 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 405 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 406 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 407 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 408 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 409 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 410 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 411 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 412 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 413 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 414 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 415 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 416 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 417 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 418 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 419 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 420 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 421 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 422 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 423 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 424 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 425 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 426 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 427 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 428 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 429 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 430 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 431 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 432 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 433 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 434 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 435 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 436 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 437 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 438 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 439 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 440 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 441 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 442 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 443 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 444 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 445 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 446 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 447 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 448 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 449 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 450 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 451 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 452 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 453 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 454 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 455 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 456 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 457 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 458 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 459 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 460 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 461 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 462 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 463 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 464 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 465 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 466 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 467 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 468 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 469 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 470 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 471 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 472 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 473 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 474 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 475 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 476 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 477 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 478 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 479 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 480 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 481 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 482 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 483 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 484 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 485 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 486 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 487 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 488 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 489 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 490 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 491 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 492 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 493 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 494 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 495 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 496 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 497 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 498 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 499 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 500 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 501 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 502 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 503 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 504 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 505 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 506 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 507 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 508 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 509 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 510 --
+bool(true)
+bool(true)
+-- Changing mode of directory to 511 --
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
new file mode 100644
index 0000000..14dd361
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test mkdir() and rmdir() functions: usage variations - misc.
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on LINUX');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] );
+ Description: Makes directory
+*/
+
+$context = stream_context_create();
+
+$file_path = dirname(__FILE__);
+
+echo "\n*** Testing mkdir() and rmdir() by giving stream context as fourth argument ***\n";
+var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true, $context) );
+var_dump( rmdir("$file_path/mkdir_variation2/test/", $context) );
+
+echo "\n*** Testing rmdir() on a non-empty directory ***\n";
+var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) );
+var_dump( rmdir("$file_path/mkdir_variation2/") );
+
+echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
+var_dump( mkdir("$file_path/temp".chr(0)."/") );
+var_dump( rmdir("$file_path/temp".chr(0)."/") );
+
+echo "\n*** Testing mkdir() with miscelleneous input ***\n";
+/* changing mode of mkdir to prevent creating sub-directory under it */
+var_dump( chmod("$file_path/mkdir_variation2/", 0000) );
+/* creating sub-directory test1 under mkdir, expected: false */
+var_dump( mkdir("$file_path/mkdir_variation2/test1", 0777, true) );
+var_dump( chmod("$file_path/mkdir_variation2/", 0777) ); // chmod to enable removing test1 directory
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/mkdir_variation2/test/");
+rmdir(dirname(__FILE__)."/mkdir_variation2/");
+?>
+--EXPECTF--
+*** Testing mkdir() and rmdir() by giving stream context as fourth argument ***
+bool(true)
+bool(true)
+
+*** Testing rmdir() on a non-empty directory ***
+bool(true)
+
+Warning: rmdir(%s/mkdir_variation2/): %s on line %d
+bool(false)
+
+*** Testing mkdir() and rmdir() for binary safe functionality ***
+
+Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d
+bool(false)
+
+Warning: rmdir(%s): No such file or directory in %s on line %d
+bool(false)
+
+*** Testing mkdir() with miscelleneous input ***
+bool(true)
+
+Warning: mkdir(): Permission denied in %s on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/mkdir_variation1-win32.phpt b/ext/standard/tests/file/mkdir_variation1-win32.phpt
new file mode 100644
index 0000000..17f5492
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation1-win32.phpt
@@ -0,0 +1,122 @@
+--TEST--
+Test mkdir() function : usage variation: try invalid pathname
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : usage variation ***\n";
+
+// 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');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase false' =>false,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // other
+ // php.net bug outputs message File Exists
+ 'single space' => ' ',
+);
+
+// loop through each element of the array for pathname
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = mkdir($value);
+ if ($res == true) {
+ echo "directory created\n";
+ rmdir($value);
+ }
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : usage variation ***
+
+--uppercase NULL--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--lowercase null--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--lowercase false--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--uppercase FALSE--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--empty string DQ--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--empty string SQ--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--undefined var--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--unset var--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--single space--
+Error: 2 - mkdir(): %s, %s(%d)
+===DONE===
diff --git a/ext/standard/tests/file/mkdir_variation1.phpt b/ext/standard/tests/file/mkdir_variation1.phpt
new file mode 100644
index 0000000..b525403
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation1.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test mkdir() function : usage variation: try invalid pathname
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : usage variation ***\n";
+
+// 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');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase false' =>false,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // other
+ 'single space' => ' ',
+);
+
+// loop through each element of the array for pathname
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = mkdir($value);
+ if ($res == true) {
+ echo "directory created\n";
+ rmdir($value);
+ }
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : usage variation ***
+
+--uppercase NULL--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--lowercase null--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--lowercase false--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--uppercase FALSE--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--empty string DQ--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--empty string SQ--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--undefined var--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--unset var--
+Error: 2 - mkdir(): %s, %s(%d)
+
+--single space--
+directory created
+===DONE===
diff --git a/ext/standard/tests/file/mkdir_variation2.phpt b/ext/standard/tests/file/mkdir_variation2.phpt
new file mode 100644
index 0000000..ab9a676
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation2.phpt
@@ -0,0 +1,189 @@
+--TEST--
+Test mkdir() function : usage variation: different types for mode
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$pathname = 'mkdirVar2.tmp';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 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";
+ $h = mkdir($pathname, $value);
+ if ($h === true) {
+ echo "Directory created\n";
+ rmdir($pathname);
+ }
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : usage variation ***
+
+--float 10.5--
+Directory created
+
+--float -10.5--
+Directory created
+
+--float 12.3456789000e10--
+Directory created
+
+--float -12.3456789000e10--
+Directory created
+
+--float .5--
+Directory created
+
+--empty array--
+Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d)
+
+--int indexed array--
+Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d)
+
+--associative array--
+Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d)
+
+--nested arrays--
+Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d)
+
+--uppercase NULL--
+Directory created
+
+--lowercase null--
+Directory created
+
+--lowercase true--
+Directory created
+
+--lowercase false--
+Directory created
+
+--uppercase TRUE--
+Directory created
+
+--uppercase FALSE--
+Directory created
+
+--empty string DQ--
+Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d)
+
+--empty string SQ--
+Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d)
+
+--string DQ--
+Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d)
+
+--string SQ--
+Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d)
+
+--mixed case string--
+Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d)
+
+--heredoc--
+Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d)
+
+--instance of classWithToString--
+Error: 2 - mkdir() expects parameter 2 to be long, object given, %s(%d)
+
+--instance of classWithoutToString--
+Error: 2 - mkdir() expects parameter 2 to be long, object given, %s(%d)
+
+--undefined var--
+Directory created
+
+--unset var--
+Directory created
+===DONE===
diff --git a/ext/standard/tests/file/mkdir_variation3.phpt b/ext/standard/tests/file/mkdir_variation3.phpt
new file mode 100644
index 0000000..7622e5f
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation3.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test mkdir() function : usage variation: different types for recursive
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$pathname = 'mkdirVar3.tmp';
+$mode = 0777;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 recursive
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $h = mkdir($pathname, $mode, $value);
+ if ($h === true) {
+ echo "Directory created\n";
+ rmdir($pathname);
+ }
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : usage variation ***
+
+--int 0--
+Directory created
+
+--int 1--
+Directory created
+
+--int 12345--
+Directory created
+
+--int -12345--
+Directory created
+
+--float 10.5--
+Directory created
+
+--float -10.5--
+Directory created
+
+--float 12.3456789000e10--
+Directory created
+
+--float -12.3456789000e10--
+Directory created
+
+--float .5--
+Directory created
+
+--empty array--
+Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d)
+
+--int indexed array--
+Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d)
+
+--associative array--
+Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d)
+
+--nested arrays--
+Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d)
+
+--uppercase NULL--
+Directory created
+
+--lowercase null--
+Directory created
+
+--lowercase true--
+Directory created
+
+--lowercase false--
+Directory created
+
+--uppercase TRUE--
+Directory created
+
+--uppercase FALSE--
+Directory created
+
+--empty string DQ--
+Directory created
+
+--empty string SQ--
+Directory created
+
+--string DQ--
+Directory created
+
+--string SQ--
+Directory created
+
+--mixed case string--
+Directory created
+
+--heredoc--
+Directory created
+
+--instance of classWithToString--
+Error: 2 - mkdir() expects parameter 3 to be boolean, object given, %s(%d)
+
+--instance of classWithoutToString--
+Error: 2 - mkdir() expects parameter 3 to be boolean, object given, %s(%d)
+
+--undefined var--
+Directory created
+
+--unset var--
+Directory created
+===DONE===
diff --git a/ext/standard/tests/file/mkdir_variation4.phpt b/ext/standard/tests/file/mkdir_variation4.phpt
new file mode 100644
index 0000000..b97d4eb
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation4.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test mkdir() function : usage variation: different types for context
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$pathname = 'mkdirVar4.tmp';
+$mode = 0777;
+$recursive = false;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+$fileRes = fopen(__FILE__,'r');
+
+//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,
+
+ // non stream context resource
+ 'file resource' => $fileRes,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $h = mkdir($pathname, $mode, $recursive, $value);
+ if ($h === true) {
+ echo "Directory created\n";
+ rmdir($pathname);
+ }
+};
+
+fclose($fileRes);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : usage variation ***
+
+--int 0--
+Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d)
+
+--int 1--
+Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d)
+
+--int 12345--
+Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d)
+
+--int -12345--
+Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d)
+
+--float 10.5--
+Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d)
+
+--float -10.5--
+Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d)
+
+--float 12.3456789000e10--
+Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d)
+
+--float -12.3456789000e10--
+Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d)
+
+--float .5--
+Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d)
+
+--empty array--
+Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d)
+
+--int indexed array--
+Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d)
+
+--associative array--
+Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d)
+
+--nested arrays--
+Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d)
+
+--uppercase NULL--
+Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d)
+
+--lowercase null--
+Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d)
+
+--lowercase true--
+Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d)
+
+--lowercase false--
+Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d)
+
+--uppercase TRUE--
+Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d)
+
+--uppercase FALSE--
+Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d)
+
+--empty string DQ--
+Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d)
+
+--empty string SQ--
+Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d)
+
+--string DQ--
+Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d)
+
+--string SQ--
+Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d)
+
+--mixed case string--
+Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d)
+
+--heredoc--
+Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d)
+
+--instance of classWithToString--
+Error: 2 - mkdir() expects parameter 4 to be resource, object given, %s(%d)
+
+--instance of classWithoutToString--
+Error: 2 - mkdir() expects parameter 4 to be resource, object given, %s(%d)
+
+--undefined var--
+Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d)
+
+--unset var--
+Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d)
+
+--file resource--
+Error: 2 - mkdir(): supplied resource is not a valid Stream-Context resource, %s(%d)
+Directory created
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/mkdir_variation5-win32.phpt b/ext/standard/tests/file/mkdir_variation5-win32.phpt
new file mode 100644
index 0000000..c7ebd51
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation5-win32.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test mkdir() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : variation ***\n";
+
+$workDir = "mkdirVar5.tmp";
+$subDir = "aSubDir";
+mkdir($workDir);
+$cwd = getcwd();
+
+$unixifiedDir = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDir, 3);
+
+$dirs = array(
+ // relative
+ $workDir.'\\'.$subDir,
+ '.\\'.$workDir.'\\'.$subDir,
+ $workDir.'\\..\\'.$workDir.'\\'.$subDir,
+
+ // relative bad path
+ $workDir.'\\..\\BADDIR\\'.$subDir,
+ 'BADDIR\\'.$subDir,
+
+ //absolute
+ $cwd.'\\'.$workDir.'\\'.$subDir,
+ $cwd.'\\.\\'.$workDir.'\\'.$subDir,
+ $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDir,
+
+ //absolute bad path
+ $cwd.'\\BADDIR\\'.$subDir,
+
+ //trailing separators
+ $workDir.'\\'.$subDir.'\\',
+ $cwd.'\\'.$workDir.'\\'.$subDir.'\\',
+
+ // multiple separators
+ $workDir.'\\\\'.$subDir,
+ $cwd.'\\\\'.$workDir.'\\\\'.$subDir,
+
+ // Unixified Dir
+ $unixifiedDir,
+
+ );
+
+
+foreach($dirs as $dir) {
+ echo "-- creating $dir --\n";
+ $res = mkdir($dir);
+ if ($res === true) {
+ echo "Directory created\n";
+ rmdir($workDir.'\\'.$subDir);
+ }
+}
+
+rmdir($workDir);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : variation ***
+-- creating mkdirVar5.tmp\aSubDir --
+Directory created
+-- creating .\mkdirVar5.tmp\aSubDir --
+Directory created
+-- creating mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
+Directory created
+-- creating mkdirVar5.tmp\..\BADDIR\aSubDir --
+
+Warning: mkdir(): No such file or directory in %s on line %d
+-- creating BADDIR\aSubDir --
+
+Warning: mkdir(): No such file or directory in %s on line %d
+-- creating %s\mkdirVar5.tmp\aSubDir --
+Directory created
+-- creating %s\.\mkdirVar5.tmp\aSubDir --
+Directory created
+-- creating %s\mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
+Directory created
+-- creating %s\BADDIR\aSubDir --
+
+Warning: mkdir(): No such file or directory in %s on line %d
+-- creating mkdirVar5.tmp\aSubDir\ --
+Directory created
+-- creating %s\mkdirVar5.tmp\aSubDir\ --
+Directory created
+-- creating mkdirVar5.tmp\\aSubDir --
+Directory created
+-- creating %s\\mkdirVar5.tmp\\aSubDir --
+Directory created
+-- creating /%s/mkdirVar5.tmp/aSubDir --
+Directory created
+===DONE===
diff --git a/ext/standard/tests/file/mkdir_variation5.phpt b/ext/standard/tests/file/mkdir_variation5.phpt
new file mode 100644
index 0000000..8a02fe1
--- /dev/null
+++ b/ext/standard/tests/file/mkdir_variation5.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test mkdir() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
+ * Description: Create a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mkdir() : variation ***\n";
+
+$workDir = "mkdirVar5.tmp";
+$subDir = "aSubDir";
+mkdir($workDir);
+$cwd = getcwd();
+
+$dirs = array(
+ // relative
+ $workDir.'/'.$subDir,
+ './'.$workDir.'/'.$subDir,
+ $workDir.'/../'.$workDir.'/'.$subDir,
+
+ // relative bad path
+ $workDir.'/../BADDIR/'.$subDir,
+ 'BADDIR/'.$subDir,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$subDir,
+ $cwd.'/./'.$workDir.'/'.$subDir,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$subDir,
+
+ //absolute bad path
+ $cwd.'/BADDIR/'.$subDir,
+
+ //trailing separators
+ $workDir.'/'.$subDir.'/',
+ $cwd.'/'.$workDir.'/'.$subDir.'/',
+
+ // multiple separators
+ $workDir.'//'.$subDir,
+ $cwd.'//'.$workDir.'//'.$subDir,
+
+ );
+
+
+foreach($dirs as $dir) {
+ echo "-- creating $dir --\n";
+ $res = mkdir($dir);
+ if ($res === true) {
+ echo "Directory created\n";
+ rmdir($dir);
+ }
+}
+
+rmdir($workDir);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mkdir() : variation ***
+-- creating mkdirVar5.tmp/aSubDir --
+Directory created
+-- creating ./mkdirVar5.tmp/aSubDir --
+Directory created
+-- creating mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir --
+Directory created
+-- creating mkdirVar5.tmp/../BADDIR/aSubDir --
+
+Warning: mkdir(): No such file or directory in %s on line %d
+-- creating BADDIR/aSubDir --
+
+Warning: mkdir(): No such file or directory in %s on line %d
+-- creating %s/mkdirVar5.tmp/aSubDir --
+Directory created
+-- creating %s/./mkdirVar5.tmp/aSubDir --
+Directory created
+-- creating %s/mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir --
+Directory created
+-- creating %s/BADDIR/aSubDir --
+
+Warning: mkdir(): No such file or directory in %s on line %d
+-- creating mkdirVar5.tmp/aSubDir/ --
+Directory created
+-- creating %s/mkdirVar5.tmp/aSubDir/ --
+Directory created
+-- creating mkdirVar5.tmp//aSubDir --
+Directory created
+-- creating %s//mkdirVar5.tmp//aSubDir --
+Directory created
+===DONE===
diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt
new file mode 100644
index 0000000..00bbcf6
--- /dev/null
+++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt
@@ -0,0 +1,76 @@
+--TEST--
+move_uploaded_file() function
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--POST_RAW--
+Content-type: multipart/form-data, boundary=AaB03x
+
+--AaB03x
+content-disposition: form-data; name="field1"
+
+Joe Blow
+--AaB03x
+content-disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain
+
+abcdef123456789xxxDDDxxxDDDxxxDDD
+--AaB03x
+content-disposition: form-data; name="file2"; filename="file2.txt"
+Content-Type: text/plain
+
+abcdef123456789
+--AaB03x--
+--FILE--
+<?php
+
+echo "Valid move\n";
+$destination1 = __FILE__ . ".tmp";
+
+var_dump(move_uploaded_file($_FILES['file1']['tmp_name'], $destination1));
+$file_contents = file_get_contents($destination1);
+$contents_matches = ($file_contents == b"abcdef123456789xxxDDDxxxDDDxxxDDD");
+var_dump($contents_matches);
+unlink($destination1);
+echo "\n";
+
+echo "Original name of uploaded file\n";
+$destination2 = __FILE__ . ".tmp2";
+var_dump(move_uploaded_file($_FILES['file1']['name'], $destination2));
+
+echo "Non-uploaded source file\n";
+$source = __FILE__;
+$destination3 = __FILE__ . ".tmp3";
+var_dump(move_uploaded_file($source, $destination3));
+
+echo "Valid move to existing file\n";
+$destination4 = __FILE__ . ".tmp4";
+$fd = fopen($destination4, "w");
+fclose($fd);
+var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4));
+unlink($destination4);
+
+echo "Wrong parameters\n";
+var_dump(move_uploaded_file());
+var_dump(move_uploaded_file(1, 2, 3));
+
+
+?>
+--EXPECTF--
+Valid move
+bool(true)
+bool(true)
+
+Original name of uploaded file
+bool(false)
+Non-uploaded source file
+bool(false)
+Valid move to existing file
+bool(true)
+Wrong parameters
+
+Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
diff --git a/ext/standard/tests/file/parse_ini_file.phpt b/ext/standard/tests/file/parse_ini_file.phpt
new file mode 100644
index 0000000..dab07e5
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file.phpt
@@ -0,0 +1,489 @@
+--TEST--
+Test parse_ini_file() function
+--FILE--
+<?php
+/* Prototype: array parse_ini_file(string $filename [,bool $process_sections]);
+ Description: parse_ini_file() loads in the ini file specified in filename,
+ and returns the settings in it in an associative array.
+*/
+
+$file_path = dirname(__FILE__);
+
+$parse_string = <<<EOD
+; Comment starts with semi-colon(;)
+; Section starts with [<section name>]
+
+; start of ini file
+
+[Constans]
+one = 1
+five = 5
+animal = BIRD
+Language = PHP
+PHP_CONSTANT = 1.2345678
+10 = Ten
+HELLO = HELLO
+
+[date]
+date =
+time =
+
+[paths]
+path = /usr/local/bin
+URL = http://www.php.net
+
+[Decimal]
+Decimal_value1 = 100
+Decimal_value2 = -100
+Decimal_value3 = -2147483647
+Decimal_value4 = 2147483647
+Decimal_value5 = -2147483648
+Decimal_value6 = 2147483648
+
+[Octal]
+Octal_value = 0100
+
+[Hex]
+Hex_value1 = 0x101
+Hex_Value2 = 0x102
+Hex_Value2 = 0x103
+
+[Non-alphanumerics_as_values]
+;Non-alpha numeric chars without quotes
+Non_alpha1 = ;
+Non_alpha2 = +
+Non_alpha3 = *
+Non_alpha4 = %
+Non_alpha5 = <>
+Non_alpha6 = @
+Non_alpha7 = #
+Non_alpha8 = ^
+Non_alpha9 = -
+Non_alpha10 = :
+Non_alpha11 = ?
+Non_alpha12 = /
+Non_alpha13 = \
+;These chars have a special meaning when used in the value,
+; hence parser throws an error
+;Non_alpha14 = &
+;Non_alpha15 = {}
+;Non_alpha16 = |
+;Non_alpha17 = ~
+;Non_alpha18 = !
+;Non_alpha19 = $
+;Non_alpha20 = ()
+
+Non_alpha1_quotes = ";"
+Non_alpha2_quotes = "+"
+Non_alpha3_quotes = "*"
+Non_alpha4_quotes = "%"
+Non_alpha5_quotes = "<>"
+Non_alpha6_quotes = "@"
+Non_alpha7_quotes = "#"
+Non_alpha8_quotes = "^"
+Non_alpha9_quotes = "-"
+Non_alpha10_quotes = "="
+Non_alpha11_quotes = ":"
+Non_alpha12_quotes = "?"
+Non_alpha13_quotes = "/"
+;Non_alpha14_quotes = "\"
+Non_alpha15_quotes = "&"
+Non_alpha16_quotes = "{}"
+Non_alpha17_quotes = "|"
+Non_alpha18_quotes = "~"
+Non_alpha19_quotes = "!"
+;Non_alpha20_quotes = "$"
+Non_alpha21_quotes = "()"
+
+[Non-alpha numerics in strings]
+;expected error, as the non-alphanumeric chars not enclosed in double quotes("")
+Non_alpha_string1 = Hello@world
+;Non_alpha_string2 = Hello!world
+;Non_alpha_string3 = Hello#world
+;Non_alpha_string4 = Hello%world
+;Non_alpha_string5 = Hello&world
+;Non_alpha_string6 = Hello*world
+;Non_alpha_string7 = Hello+world
+;Non_alpha_string8 = Hello-world
+;Non_alpha_string9 = Hello'world
+;Non_alpha_string10 = Hello:world
+;Non_alpha_string11 = Hello;world
+;Non_alpha_string12 = Hello<world
+;Non_alpha_string13 = Hello>world
+;Non_alpha_string14 = Hello>world
+;Non_alpha_string15 = Hello?world
+;Non_alpha_string16 = Hello\world
+;Non_alpha_string17 = Hello^world
+;Non_alpha_string18 = Hello_world
+;Non_alpha_string19 = Hello|world
+;Non_alpha_string20 = Hello~world
+;Non_alpha_string21 = Hello`world
+;Non_alpha_string22 = Hello(world)
+
+[Non-alpha numerics in strings -with quotes]
+Non_alpha_string1_quotes = "Hello@world"
+Non_alpha_string2_quotes = "Hello!world"
+Non_alpha_string3_quotes = "Hello#world"
+Non_alpha_string4_quotes = "Hello&world"
+Non_alpha_string5_quotes = "Hello*world"
+Non_alpha_string6_quotes = "Hello+world"
+Non_alpha_string7_quotes = "Hello-world"
+Non_alpha_string8_quotes = "Hello'world"
+Non_alpha_string9_quotes = "Hello:world"
+Non_alpha_string10_quotes = "Hello;world"
+Non_alpha_string11_quotes = "Hello<world"
+Non_alpha_string12_quotes = "Hello>world"
+Non_alpha_string13_quotes = "Hello>world"
+Non_alpha_string14_quotes = "Hello?world"
+Non_alpha_string15_quotes = "Hello\world"
+Non_alpha_string16_quotes = "Hello^world"
+Non_alpha_string17_quotes = "Hello_world"
+Non_alpha_string18_quotes = "Hello|world"
+Non_alpha_string19_quotes = "Hello~world"
+Non_alpha_string20_quotes = "Hello`world"
+Non_alpha_string21_quotes = "Hello(world)"
+
+[Newlines_in_Values]
+String1 = "Hello, world\nGood Morning"
+String2 = "\nHello, world
+ Good Morning\n"
+String3 = 'Hello, world\tGood Morning'
+String4 = "\n"
+String5 = "\n\n"
+String6 = Hello, world\tGood Morning
+
+[ReservedKeys_as_Values]
+Key1 = YES
+Key2 = Yes
+Key3 = yEs
+Key4 = NO
+Key5 = No
+Key6 = nO
+Key7 = TRUE
+Key8 = True
+Key9 = tRUE
+Key10 = true
+Key11 = FALSE
+Key12 = False
+Key13 = false
+Key14 = fAlSE
+Key15 = NULL
+Key16 = Null
+Key17 = nuLL
+Key18 = null
+
+[ReservedKeys_as_Keys]
+; Expected:error, reserved key words must not be used as keys for ini file
+;YES = 1
+;Yes = 2
+;yEs = 1.2
+;YES = YES
+;NO = ""
+;No = "string"
+;nO = "\0"
+;TRUE = 1.1
+;True = 1
+;tRUE = 5
+;true = TRUE
+;FALSE = FALSE
+;False = ""
+;false = "hello"
+;fAlSE = ""
+;NULL = ""
+;Null = 0
+;nuLL = "\0"
+;null = NULL
+
+; end of ini file
+EOD;
+/* creating parse.ini file */
+$file_handle = fopen($file_path."/parse.ini", "w");
+fwrite($file_handle, $parse_string);
+fclose($file_handle);
+
+echo "*** Test parse_ini_file() function: with various keys and values given in parse.ini file ***\n";
+echo "-- ini file without process_sections optional arg --\n";
+define('BIRD', 'Humming bird');
+$ini_array = parse_ini_file($file_path."/parse.ini");
+print_r($ini_array);
+
+echo "\n-- ini file with process_sections as TRUE --\n";
+$ini_array = parse_ini_file($file_path."/parse.ini", TRUE);
+print_r($ini_array);
+
+echo "*** Done **\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/parse.ini");
+?>
+--EXPECTF--
+*** Test parse_ini_file() function: with various keys and values given in parse.ini file ***
+-- ini file without process_sections optional arg --
+Array
+(
+ [one] => 1
+ [five] => 5
+ [animal] => Humming bird
+ [Language] => PHP
+ [PHP_CONSTANT] => 1.2345678
+ [10] => Ten
+ [HELLO] => HELLO
+ [date] =>
+ [time] =>
+ [path] => /usr/local/bin
+ [URL] => http://www.php.net
+ [Decimal_value1] => 100
+ [Decimal_value2] => -100
+ [Decimal_value3] => -2147483647
+ [Decimal_value4] => 2147483647
+ [Decimal_value5] => -2147483648
+ [Decimal_value6] => 2147483648
+ [Octal_value] => 0100
+ [Hex_value1] => 0x101
+ [Hex_Value2] => 0x103
+ [Non_alpha1] =>
+ [Non_alpha2] => +
+ [Non_alpha3] => *
+ [Non_alpha4] => %
+ [Non_alpha5] => <>
+ [Non_alpha6] => @
+ [Non_alpha7] => #
+ [Non_alpha8] => ^
+ [Non_alpha9] => -
+ [Non_alpha10] => :
+ [Non_alpha11] => ?
+ [Non_alpha12] => /
+ [Non_alpha13] => \
+ [Non_alpha1_quotes] => ;
+ [Non_alpha2_quotes] => +
+ [Non_alpha3_quotes] => *
+ [Non_alpha4_quotes] => %
+ [Non_alpha5_quotes] => <>
+ [Non_alpha6_quotes] => @
+ [Non_alpha7_quotes] => #
+ [Non_alpha8_quotes] => ^
+ [Non_alpha9_quotes] => -
+ [Non_alpha10_quotes] => =
+ [Non_alpha11_quotes] => :
+ [Non_alpha12_quotes] => ?
+ [Non_alpha13_quotes] => /
+ [Non_alpha15_quotes] => &
+ [Non_alpha16_quotes] => {}
+ [Non_alpha17_quotes] => |
+ [Non_alpha18_quotes] => ~
+ [Non_alpha19_quotes] => !
+ [Non_alpha21_quotes] => ()
+ [Non_alpha_string1] => Hello@world
+ [Non_alpha_string1_quotes] => Hello@world
+ [Non_alpha_string2_quotes] => Hello!world
+ [Non_alpha_string3_quotes] => Hello#world
+ [Non_alpha_string4_quotes] => Hello&world
+ [Non_alpha_string5_quotes] => Hello*world
+ [Non_alpha_string6_quotes] => Hello+world
+ [Non_alpha_string7_quotes] => Hello-world
+ [Non_alpha_string8_quotes] => Hello'world
+ [Non_alpha_string9_quotes] => Hello:world
+ [Non_alpha_string10_quotes] => Hello;world
+ [Non_alpha_string11_quotes] => Hello<world
+ [Non_alpha_string12_quotes] => Hello>world
+ [Non_alpha_string13_quotes] => Hello>world
+ [Non_alpha_string14_quotes] => Hello?world
+ [Non_alpha_string15_quotes] => Hello\world
+ [Non_alpha_string16_quotes] => Hello^world
+ [Non_alpha_string17_quotes] => Hello_world
+ [Non_alpha_string18_quotes] => Hello|world
+ [Non_alpha_string19_quotes] => Hello~world
+ [Non_alpha_string20_quotes] => Hello`world
+ [Non_alpha_string21_quotes] => Hello(world)
+ [String1] => Hello, world
+Good Morning
+ [String2] =>
+Hello, world
+ Good Morning
+
+ [String3] => Hello, world Good Morning
+ [String4] =>
+
+ [String5] =>
+
+
+ [String6] => Hello, world Good Morning
+ [Key1] => 1
+ [Key2] => 1
+ [Key3] => 1
+ [Key4] =>
+ [Key5] =>
+ [Key6] =>
+ [Key7] => 1
+ [Key8] => 1
+ [Key9] => 1
+ [Key10] => 1
+ [Key11] =>
+ [Key12] =>
+ [Key13] =>
+ [Key14] =>
+ [Key15] =>
+ [Key16] =>
+ [Key17] =>
+ [Key18] =>
+)
+
+-- ini file with process_sections as TRUE --
+Array
+(
+ [Constans] => Array
+ (
+ [one] => 1
+ [five] => 5
+ [animal] => Humming bird
+ [Language] => PHP
+ [PHP_CONSTANT] => 1.2345678
+ [10] => Ten
+ [HELLO] => HELLO
+ )
+
+ [date] => Array
+ (
+ [date] =>
+ [time] =>
+ )
+
+ [paths] => Array
+ (
+ [path] => /usr/local/bin
+ [URL] => http://www.php.net
+ )
+
+ [Decimal] => Array
+ (
+ [Decimal_value1] => 100
+ [Decimal_value2] => -100
+ [Decimal_value3] => -2147483647
+ [Decimal_value4] => 2147483647
+ [Decimal_value5] => -2147483648
+ [Decimal_value6] => 2147483648
+ )
+
+ [Octal] => Array
+ (
+ [Octal_value] => 0100
+ )
+
+ [Hex] => Array
+ (
+ [Hex_value1] => 0x101
+ [Hex_Value2] => 0x103
+ )
+
+ [Non-alphanumerics_as_values] => Array
+ (
+ [Non_alpha1] =>
+ [Non_alpha2] => +
+ [Non_alpha3] => *
+ [Non_alpha4] => %
+ [Non_alpha5] => <>
+ [Non_alpha6] => @
+ [Non_alpha7] => #
+ [Non_alpha8] => ^
+ [Non_alpha9] => -
+ [Non_alpha10] => :
+ [Non_alpha11] => ?
+ [Non_alpha12] => /
+ [Non_alpha13] => \
+ [Non_alpha1_quotes] => ;
+ [Non_alpha2_quotes] => +
+ [Non_alpha3_quotes] => *
+ [Non_alpha4_quotes] => %
+ [Non_alpha5_quotes] => <>
+ [Non_alpha6_quotes] => @
+ [Non_alpha7_quotes] => #
+ [Non_alpha8_quotes] => ^
+ [Non_alpha9_quotes] => -
+ [Non_alpha10_quotes] => =
+ [Non_alpha11_quotes] => :
+ [Non_alpha12_quotes] => ?
+ [Non_alpha13_quotes] => /
+ [Non_alpha15_quotes] => &
+ [Non_alpha16_quotes] => {}
+ [Non_alpha17_quotes] => |
+ [Non_alpha18_quotes] => ~
+ [Non_alpha19_quotes] => !
+ [Non_alpha21_quotes] => ()
+ )
+
+ [Non-alpha numerics in strings] => Array
+ (
+ [Non_alpha_string1] => Hello@world
+ )
+
+ [Non-alpha numerics in strings -with quotes] => Array
+ (
+ [Non_alpha_string1_quotes] => Hello@world
+ [Non_alpha_string2_quotes] => Hello!world
+ [Non_alpha_string3_quotes] => Hello#world
+ [Non_alpha_string4_quotes] => Hello&world
+ [Non_alpha_string5_quotes] => Hello*world
+ [Non_alpha_string6_quotes] => Hello+world
+ [Non_alpha_string7_quotes] => Hello-world
+ [Non_alpha_string8_quotes] => Hello'world
+ [Non_alpha_string9_quotes] => Hello:world
+ [Non_alpha_string10_quotes] => Hello;world
+ [Non_alpha_string11_quotes] => Hello<world
+ [Non_alpha_string12_quotes] => Hello>world
+ [Non_alpha_string13_quotes] => Hello>world
+ [Non_alpha_string14_quotes] => Hello?world
+ [Non_alpha_string15_quotes] => Hello\world
+ [Non_alpha_string16_quotes] => Hello^world
+ [Non_alpha_string17_quotes] => Hello_world
+ [Non_alpha_string18_quotes] => Hello|world
+ [Non_alpha_string19_quotes] => Hello~world
+ [Non_alpha_string20_quotes] => Hello`world
+ [Non_alpha_string21_quotes] => Hello(world)
+ )
+
+ [Newlines_in_Values] => Array
+ (
+ [String1] => Hello, world
+Good Morning
+ [String2] =>
+Hello, world
+ Good Morning
+
+ [String3] => Hello, world Good Morning
+ [String4] =>
+
+ [String5] =>
+
+
+ [String6] => Hello, world Good Morning
+ )
+
+ [ReservedKeys_as_Values] => Array
+ (
+ [Key1] => 1
+ [Key2] => 1
+ [Key3] => 1
+ [Key4] =>
+ [Key5] =>
+ [Key6] =>
+ [Key7] => 1
+ [Key8] => 1
+ [Key9] => 1
+ [Key10] => 1
+ [Key11] =>
+ [Key12] =>
+ [Key13] =>
+ [Key14] =>
+ [Key15] =>
+ [Key16] =>
+ [Key17] =>
+ [Key18] =>
+ )
+
+ [ReservedKeys_as_Keys] => Array
+ (
+ )
+
+)
+*** Done **
diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt
new file mode 100644
index 0000000..14990b2
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_error.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test parse_ini_file() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing parse_ini_file() function with Zero arguments --\n";
+var_dump( parse_ini_file() );
+
+//Test parse_ini_file with one more than the expected number of arguments
+echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n";
+$filename = 'string_val';
+$process_sections = true;
+$extra_arg = 10;
+var_dump( parse_ini_file($filename, $process_sections, $extra_arg) );
+
+echo "\n-- Testing parse_ini_file() function with a non-existent file --\n";
+$filename = __FILE__ . 'invalidfilename';
+var_dump( parse_ini_file($filename, $process_sections) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_ini_file() : error conditions ***
+
+-- Testing parse_ini_file() function with Zero arguments --
+
+Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing parse_ini_file() function with more than expected no. of arguments --
+
+Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Testing parse_ini_file() function with a non-existent file --
+
+Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/parse_ini_file_variation1.phpt b/ext/standard/tests/file/parse_ini_file_variation1.phpt
new file mode 100644
index 0000000..a24bc1c
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation1.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test parse_ini_file() function : variation: identical properties and values are not referenced.
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : variation ***\n";
+$output_file = __FILE__.".ini";
+$iniFile = <<<FILE
+[section1]
+value1=original
+value2=original
+[section2]
+value1=original
+value2=different
+FILE;
+
+file_put_contents($output_file, $iniFile);
+
+$a = parse_ini_file($output_file, true);
+var_dump($a);
+$a['section1']['value1'] = 'changed';
+var_dump($a);
+
+unlink($output_file);
+?>
+===DONE===
+--EXPECT--
+*** Testing parse_ini_file() : variation ***
+array(2) {
+ ["section1"]=>
+ array(2) {
+ ["value1"]=>
+ string(8) "original"
+ ["value2"]=>
+ string(8) "original"
+ }
+ ["section2"]=>
+ array(2) {
+ ["value1"]=>
+ string(8) "original"
+ ["value2"]=>
+ string(9) "different"
+ }
+}
+array(2) {
+ ["section1"]=>
+ array(2) {
+ ["value1"]=>
+ string(7) "changed"
+ ["value2"]=>
+ string(8) "original"
+ }
+ ["section2"]=>
+ array(2) {
+ ["value1"]=>
+ string(8) "original"
+ ["value2"]=>
+ string(9) "different"
+ }
+}
+===DONE===
diff --git a/ext/standard/tests/file/parse_ini_file_variation2.phpt b/ext/standard/tests/file/parse_ini_file_variation2.phpt
new file mode 100644
index 0000000..20ad6bb
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation2.phpt
@@ -0,0 +1,111 @@
+--TEST--
+Test parse_ini_file() function : variation: handling different boolean values
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : variation ***\n";
+$output_file = __FILE__.".ini";
+$iniFile = <<<FILE
+[section1]
+value1=on
+value2=off
+[section2]
+value1=true
+value2=false
+[section3]
+value1=yes
+value2=no
+[section4]
+value1=null
+value2=
+
+[section5]
+value1="on"
+value2="off"
+[section6]
+value1="true"
+value2="false"
+[section7]
+value1="yes"
+value2="no"
+[section8]
+value1="null"
+value2=""
+
+FILE;
+
+file_put_contents($output_file, $iniFile);
+
+$a = parse_ini_file($output_file, true);
+var_dump($a);
+unlink($output_file);
+?>
+===DONE===
+--EXPECT--
+*** Testing parse_ini_file() : variation ***
+array(8) {
+ ["section1"]=>
+ array(2) {
+ ["value1"]=>
+ string(1) "1"
+ ["value2"]=>
+ string(0) ""
+ }
+ ["section2"]=>
+ array(2) {
+ ["value1"]=>
+ string(1) "1"
+ ["value2"]=>
+ string(0) ""
+ }
+ ["section3"]=>
+ array(2) {
+ ["value1"]=>
+ string(1) "1"
+ ["value2"]=>
+ string(0) ""
+ }
+ ["section4"]=>
+ array(2) {
+ ["value1"]=>
+ string(0) ""
+ ["value2"]=>
+ string(0) ""
+ }
+ ["section5"]=>
+ array(2) {
+ ["value1"]=>
+ string(2) "on"
+ ["value2"]=>
+ string(3) "off"
+ }
+ ["section6"]=>
+ array(2) {
+ ["value1"]=>
+ string(4) "true"
+ ["value2"]=>
+ string(5) "false"
+ }
+ ["section7"]=>
+ array(2) {
+ ["value1"]=>
+ string(3) "yes"
+ ["value2"]=>
+ string(2) "no"
+ }
+ ["section8"]=>
+ array(2) {
+ ["value1"]=>
+ string(4) "null"
+ ["value2"]=>
+ string(0) ""
+ }
+}
+===DONE===
diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt
new file mode 100644
index 0000000..43b0274
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test parse_ini_file() function : variation: include path searching
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : variation ***\n";
+$pwd = getcwd();
+$f = "parse_ini_file_variation3";
+$dir1 = $pwd."/".$f.".dir1";
+$dir2 = $pwd."/".$f.".dir2";
+$dir3 = $pwd."/".$f.".dir3";
+$iniFile = "php.ini";
+
+$newdirs = array($dir1, $dir2, $dir3);
+$pathSep = ":";
+$newIncludePath = "";
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+}
+foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+}
+
+set_include_path($newIncludePath);
+$path = get_include_path();
+echo "New include path is : " . $path . "\n";
+
+$output_file = $dir2."/".$iniFile;
+$iniContent = <<<FILE
+error_reporting = E_ALL
+display_errors = On
+display_startup_errors = Off
+log_errors = Off
+log_errors_max_len = 1024
+ignore_repeated_errors = Off
+ignore_repeated_source = Off
+report_memleaks = On
+track_errors = Off
+docref_root = "/phpmanual/"
+docref_ext = .html
+
+FILE;
+
+file_put_contents($output_file, $iniContent);
+var_dump(parse_ini_file($iniFile));
+
+?>
+===Done===
+--CLEAN--
+<?php
+
+$pwd = getcwd();
+$f = "parse_ini_file_variation3";
+$iniFile = "php.ini";
+
+$dir1 = $pwd."/".$f.".dir1";
+$dir2 = $pwd."/".$f.".dir2";
+$dir3 = $pwd."/".$f.".dir3";
+$newdirs = array($dir1, $dir2, $dir3);
+$output_file = $dir2."/".$iniFile;
+
+// Tidy up after test
+unlink($output_file);
+foreach($newdirs as $newdir) {
+ rmdir($newdir);
+}
+
+?>
+--EXPECTF--
+*** Testing parse_ini_file() : variation ***
+New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
+array(11) {
+ ["error_reporting"]=>
+ string(5) "32767"
+ ["display_errors"]=>
+ string(1) "1"
+ ["display_startup_errors"]=>
+ string(0) ""
+ ["log_errors"]=>
+ string(0) ""
+ ["log_errors_max_len"]=>
+ string(4) "1024"
+ ["ignore_repeated_errors"]=>
+ string(0) ""
+ ["ignore_repeated_source"]=>
+ string(0) ""
+ ["report_memleaks"]=>
+ string(1) "1"
+ ["track_errors"]=>
+ string(0) ""
+ ["docref_root"]=>
+ string(11) "/phpmanual/"
+ ["docref_ext"]=>
+ string(5) ".html"
+}
+===Done===
diff --git a/ext/standard/tests/file/parse_ini_file_variation4.phpt b/ext/standard/tests/file/parse_ini_file_variation4.phpt
new file mode 100644
index 0000000..66cab3b
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation4.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test parse_ini_file() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$process_sections = false;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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( parse_ini_file($value, $process_sections) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing parse_ini_file() : usage variation ***
+
+--int 0--
+Error: 2 - parse_ini_file(0): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - parse_ini_file(12345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - parse_ini_file(-2345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - parse_ini_file(10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - parse_ini_file(-10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - parse_ini_file(123456789000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - parse_ini_file(-123456789000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - parse_ini_file(0.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - parse_ini_file(Class A object): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d)
+bool(false)
+===DONE===
+
diff --git a/ext/standard/tests/file/parse_ini_file_variation5.phpt b/ext/standard/tests/file/parse_ini_file_variation5.phpt
new file mode 100644
index 0000000..eea7b7d
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation5.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test parse_ini_file() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = __FILE__."ParseIniFileVar5.ini";
+$contents = "a=test";
+@unlink($filename);
+file_put_contents($filename, $contents);
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ // 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 process_sections
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( parse_ini_file($filename, $value) );
+};
+
+unlink($filename);
+?>
+===DONE===
+--EXPECTF--
+*** Testing parse_ini_file() : usage variation ***
+
+--int 0--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--int 1--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--int 12345--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--int -12345--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--float 10.5--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--float -10.5--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--float 12.3456789000e10--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--float -12.3456789000e10--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--float .5--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--empty array--
+Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--lowercase null--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--empty string DQ--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--empty string SQ--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--string DQ--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--string SQ--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--mixed case string--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--heredoc--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--instance of classWithToString--
+Error: 2 - parse_ini_file() expects parameter 2 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - parse_ini_file() expects parameter 2 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+--unset var--
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+===DONE===
+
diff --git a/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt b/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt
new file mode 100644
index 0000000..6dfbee9
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt
@@ -0,0 +1,143 @@
+--TEST--
+Test parse_ini_file() function : variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : variation ***\n";
+$mainDir = "parseIniFileVar6.dir";
+$subDir = "parseIniFileVar6Sub";
+$absMainDir = dirname(__FILE__)."\\".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."\\".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3);
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir\\",
+ "$absSubDir\\..\\".$subDir,
+ "$absSubDir\\\\..\\.\\".$subDir,
+ "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir,
+ "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir,
+ "$absSubDir\\BADDIR",
+
+ // relative paths
+ $mainDir."\\".$subDir,
+ $mainDir."\\\\".$subDir,
+ $mainDir."\\\\\\".$subDir,
+ ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir,
+ "BADDIR",
+
+ // unixifed path
+ $unixifiedDir,
+);
+
+$filename = 'ParseIniFileVar6.ini';
+$content="a=test";
+$absFile = $absSubDir.'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, $content);
+fclose($h);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ var_dump(parse_ini_file($dir."\\".$filename));
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing parse_ini_file() : variation ***
+
+-- Iteration 1 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 2 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 3 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 4 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 5 --
+
+Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\..\\\parseIniFileVar6Sub\\..\\..\parseIniFileVar6Sub\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\BADDIR\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 8 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 9 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 10 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 11 --
+
+Warning: parse_ini_file(BADDIR\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/parse_ini_file_variation6.phpt b/ext/standard/tests/file/parse_ini_file_variation6.phpt
new file mode 100644
index 0000000..e9844e9
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_variation6.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test parse_ini_file() function : variation - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_ini_file() : variation ***\n";
+$mainDir = "parseIniFileVar6.dir";
+$subDir = "parseIniFileVar6Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+
+);
+
+$filename = 'ParseIniFileVar6.ini';
+$content="a=test";
+$absFile = $absSubDir.'/'.$filename;
+$h = fopen($absFile,"w");
+fwrite($h, $content);
+fclose($h);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ var_dump(parse_ini_file($dir."/".$filename));
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing parse_ini_file() : variation ***
+
+-- Iteration 1 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 2 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 3 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 4 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 5 --
+
+Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/..///parseIniFileVar6Sub//..//../parseIniFileVar6Sub/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/BADDIR/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 8 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 9 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 10 --
+array(1) {
+ ["a"]=>
+ string(4) "test"
+}
+
+-- Iteration 11 --
+
+Warning: parse_ini_file(BADDIR/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/pathinfo_basic.phpt b/ext/standard/tests/file/pathinfo_basic.phpt
new file mode 100644
index 0000000..53eda5a
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_basic.phpt
@@ -0,0 +1,401 @@
+--TEST--
+Test pathinfo() function: basic functionality
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing basic functions of pathinfo() ***\n";
+
+$file_path = dirname(__FILE__);
+
+$paths = array (
+ /* Testing basic file notation */
+ "$file_path/foo/symlink.link",
+ "www.example.co.in",
+ "/var/www/html/example.html",
+ "/dir/test.tar.gz",
+
+ /* Testing a file with trailing slash */
+ "$file_path/foo/symlink.link/",
+
+ /* Testing file with double slashes */
+ "$file_path/foo//symlink.link",
+ "$file_path/foo//symlink.link",
+ "$file_path/foo//symlink.link//",
+
+ /* Testing file with trailing double slashes */
+ "$file_path/foo/symlink.link//",
+
+ /* Testing Binary safe files */
+ "$file_path/foo".chr(47)."symlink.link",
+ "$file_path".chr(47)."foo/symlink.link",
+ "$file_path".chr(47)."foo".chr(47)."symlink.link",
+ b"$file_path/foo/symlink.link",
+
+ /* Testing directories */
+ ".", // current directory
+ "$file_path/foo/",
+ "$file_path/foo//",
+ "$file_path/../foo/",
+ "../foo/bar",
+ "./foo/bar",
+ "//foo//bar//",
+
+ /* Testing with homedir notation */
+ "~/PHP/php5.2.0/",
+
+ /* Testing normal directory notation */
+ "/home/example/test/",
+ "http://httpd.apache.org/core.html#acceptpathinfo"
+);
+
+$counter = 1;
+/* loop through $paths to test each $path in the above array */
+foreach($paths as $path) {
+ echo "-- Iteration $counter --\n";
+ var_dump( pathinfo($path, PATHINFO_DIRNAME) );
+ var_dump( pathinfo($path, PATHINFO_BASENAME) );
+ var_dump( pathinfo($path, PATHINFO_EXTENSION) );
+ var_dump( pathinfo($path, PATHINFO_FILENAME) );
+ var_dump( pathinfo($path) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic functions of pathinfo() ***
+-- Iteration 1 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 2 --
+%unicode|string%(1) "."
+%unicode|string%(17) "www.example.co.in"
+%unicode|string%(2) "in"
+%unicode|string%(14) "www.example.co"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(17) "www.example.co.in"
+ [%u|b%"extension"]=>
+ %unicode|string%(2) "in"
+ [%u|b%"filename"]=>
+ %unicode|string%(14) "www.example.co"
+}
+-- Iteration 3 --
+%unicode|string%(13) "/var/www/html"
+%unicode|string%(12) "example.html"
+%unicode|string%(4) "html"
+%unicode|string%(7) "example"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(13) "/var/www/html"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "example.html"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "html"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "example"
+}
+-- Iteration 4 --
+%unicode|string%(4) "/dir"
+%unicode|string%(11) "test.tar.gz"
+%unicode|string%(2) "gz"
+%unicode|string%(8) "test.tar"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(4) "/dir"
+ [%u|b%"basename"]=>
+ %unicode|string%(11) "test.tar.gz"
+ [%u|b%"extension"]=>
+ %unicode|string%(2) "gz"
+ [%u|b%"filename"]=>
+ %unicode|string%(8) "test.tar"
+}
+-- Iteration 5 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 6 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 7 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 8 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 9 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 10 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 11 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 12 --
+%unicode|string%(%d) "%s/foo"
+%unicode|string%(12) "symlink.link"
+%unicode|string%(4) "link"
+%unicode|string%(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "symlink.link"
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "link"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "symlink"
+}
+-- Iteration 13 --
+string(%d) "%s/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
+array(4) {
+ [%u|b%"dirname"]=>
+ string(%d) "%s/foo"
+ [%u|b%"basename"]=>
+ string(12) "symlink.link"
+ [%u|b%"extension"]=>
+ string(4) "link"
+ [%u|b%"filename"]=>
+ string(7) "symlink"
+}
+-- Iteration 14 --
+%unicode|string%(1) "."
+%unicode|string%(1) "."
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(1) "."
+ [%u|b%"extension"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(0) ""
+}
+-- Iteration 15 --
+%unicode|string%(%d) "%s"
+%unicode|string%(3) "foo"
+%unicode|string%(0) ""
+%unicode|string%(3) "foo"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "foo"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "foo"
+}
+-- Iteration 16 --
+%unicode|string%(%d) "%s"
+%unicode|string%(3) "foo"
+%unicode|string%(0) ""
+%unicode|string%(3) "foo"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "foo"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "foo"
+}
+-- Iteration 17 --
+%unicode|string%(%d) "%s/.."
+%unicode|string%(3) "foo"
+%unicode|string%(0) ""
+%unicode|string%(3) "foo"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(%d) "%s/.."
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "foo"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "foo"
+}
+-- Iteration 18 --
+%unicode|string%(6) "../foo"
+%unicode|string%(3) "bar"
+%unicode|string%(0) ""
+%unicode|string%(3) "bar"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(6) "../foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "bar"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "bar"
+}
+-- Iteration 19 --
+%unicode|string%(5) "./foo"
+%unicode|string%(3) "bar"
+%unicode|string%(0) ""
+%unicode|string%(3) "bar"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(5) "./foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "bar"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "bar"
+}
+-- Iteration 20 --
+%unicode|string%(5) "//foo"
+%unicode|string%(3) "bar"
+%unicode|string%(0) ""
+%unicode|string%(3) "bar"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(5) "//foo"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "bar"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "bar"
+}
+-- Iteration 21 --
+%unicode|string%(5) "~/PHP"
+%unicode|string%(8) "php5.2.0"
+%unicode|string%(1) "0"
+%unicode|string%(6) "php5.2"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(5) "~/PHP"
+ [%u|b%"basename"]=>
+ %unicode|string%(8) "php5.2.0"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "0"
+ [%u|b%"filename"]=>
+ %unicode|string%(6) "php5.2"
+}
+-- Iteration 22 --
+%unicode|string%(13) "/home/example"
+%unicode|string%(4) "test"
+%unicode|string%(0) ""
+%unicode|string%(4) "test"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(13) "/home/example"
+ [%u|b%"basename"]=>
+ %unicode|string%(4) "test"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "test"
+}
+-- Iteration 23 --
+%unicode|string%(23) "http://httpd.apache.org"
+%unicode|string%(24) "core.html#acceptpathinfo"
+%unicode|string%(19) "html#acceptpathinfo"
+%unicode|string%(4) "core"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(23) "http://httpd.apache.org"
+ [%u|b%"basename"]=>
+ %unicode|string%(24) "core.html#acceptpathinfo"
+ [%u|b%"extension"]=>
+ %unicode|string%(19) "html#acceptpathinfo"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "core"
+}
+Done
diff --git a/ext/standard/tests/file/pathinfo_basic1-win32.phpt b/ext/standard/tests/file/pathinfo_basic1-win32.phpt
new file mode 100644
index 0000000..9e84b99
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_basic1-win32.phpt
@@ -0,0 +1,609 @@
+--TEST--
+Test pathinfo() function: basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing basic functions of pathinfo() ***\n";
+
+$paths = array (
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\adir',
+ 'c:\test\adir\\',
+ '/usr/include/arpa',
+ '/usr/include/arpa/',
+ 'usr/include/arpa',
+ 'usr/include/arpa/',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ 'c:\test\prog.exe',
+ 'c:\\test\\prog.exe',
+ 'c:/test/prog.exe',
+ '/usr/include/arpa/inet.h',
+ '//usr/include//arpa/inet.h',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/include/arpa/inet.h',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\include/arpa\inet.h',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/include/arpa/inet.h',
+ '/usr/include/arpa/inet.h ',
+ ' /usr/include/arpa/inet.h ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/'
+);
+
+$counter = 1;
+/* loop through $paths to test each $path in the above array */
+foreach($paths as $path) {
+ echo "-- Iteration $counter --\n";
+ var_dump( pathinfo($path, PATHINFO_DIRNAME) );
+ var_dump( pathinfo($path, PATHINFO_BASENAME) );
+ var_dump( pathinfo($path, PATHINFO_EXTENSION) );
+ var_dump( pathinfo($path, PATHINFO_FILENAME) );
+ var_dump( pathinfo($path) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic functions of pathinfo() ***
+-- Iteration 1 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 2 --
+string(1) "."
+string(1) " "
+string(0) ""
+string(1) " "
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) " "
+ ["filename"]=>
+ string(1) " "
+}
+-- Iteration 3 --
+string(2) "c:"
+string(2) "c:"
+string(0) ""
+string(2) "c:"
+array(3) {
+ ["dirname"]=>
+ string(2) "c:"
+ ["basename"]=>
+ string(2) "c:"
+ ["filename"]=>
+ string(2) "c:"
+}
+-- Iteration 4 --
+string(3) "c:\"
+string(2) "c:"
+string(0) ""
+string(2) "c:"
+array(3) {
+ ["dirname"]=>
+ string(3) "c:\"
+ ["basename"]=>
+ string(2) "c:"
+ ["filename"]=>
+ string(2) "c:"
+}
+-- Iteration 5 --
+string(3) "c:\"
+string(2) "c:"
+string(0) ""
+string(2) "c:"
+array(3) {
+ ["dirname"]=>
+ string(3) "c:\"
+ ["basename"]=>
+ string(2) "c:"
+ ["filename"]=>
+ string(2) "c:"
+}
+-- Iteration 6 --
+string(1) "."
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 7 --
+string(7) "c:\test"
+string(4) "adir"
+string(0) ""
+string(4) "adir"
+array(3) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(4) "adir"
+ ["filename"]=>
+ string(4) "adir"
+}
+-- Iteration 8 --
+string(7) "c:\test"
+string(4) "adir"
+string(0) ""
+string(4) "adir"
+array(3) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(4) "adir"
+ ["filename"]=>
+ string(4) "adir"
+}
+-- Iteration 9 --
+string(12) "/usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
+array(3) {
+ ["dirname"]=>
+ string(12) "/usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
+}
+-- Iteration 10 --
+string(12) "/usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
+array(3) {
+ ["dirname"]=>
+ string(12) "/usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
+}
+-- Iteration 11 --
+string(11) "usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
+array(3) {
+ ["dirname"]=>
+ string(11) "usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
+}
+-- Iteration 12 --
+string(11) "usr/include"
+string(4) "arpa"
+string(0) ""
+string(4) "arpa"
+array(3) {
+ ["dirname"]=>
+ string(11) "usr/include"
+ ["basename"]=>
+ string(4) "arpa"
+ ["filename"]=>
+ string(4) "arpa"
+}
+-- Iteration 13 --
+string(7) "c:\test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 14 --
+string(7) "c:\test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 15 --
+string(8) "c://test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(8) "c://test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 16 --
+string(7) "c:\test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 17 --
+string(7) "c:\test"
+string(8) "prog.exe"
+string(3) "exe"
+string(4) "prog"
+array(4) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(8) "prog.exe"
+ ["extension"]=>
+ string(3) "exe"
+ ["filename"]=>
+ string(4) "prog"
+}
+-- Iteration 18 --
+string(7) "c:\test"
+string(8) "prog.exe"
+string(3) "exe"
+string(4) "prog"
+array(4) {
+ ["dirname"]=>
+ string(7) "c:\test"
+ ["basename"]=>
+ string(8) "prog.exe"
+ ["extension"]=>
+ string(3) "exe"
+ ["filename"]=>
+ string(4) "prog"
+}
+-- Iteration 19 --
+string(7) "c:/test"
+string(8) "prog.exe"
+string(3) "exe"
+string(4) "prog"
+array(4) {
+ ["dirname"]=>
+ string(7) "c:/test"
+ ["basename"]=>
+ string(8) "prog.exe"
+ ["extension"]=>
+ string(3) "exe"
+ ["filename"]=>
+ string(4) "prog"
+}
+-- Iteration 20 --
+string(17) "/usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 21 --
+string(19) "//usr/include//arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(19) "//usr/include//arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 22 --
+string(1) "\"
+string(0) ""
+string(0) ""
+string(0) ""
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 23 --
+string(1) "\"
+string(0) ""
+string(0) ""
+string(0) ""
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 24 --
+string(1) "\"
+string(0) ""
+string(0) ""
+string(0) ""
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 25 --
+string(1) "\"
+string(0) ""
+string(0) ""
+string(0) ""
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 26 --
+string(1) "\"
+string(0) ""
+string(0) ""
+string(0) ""
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 27 --
+string(17) "/usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 28 --
+string(31) "c:\windows/system32\drivers/etc"
+string(5) "hosts"
+string(0) ""
+string(5) "hosts"
+array(3) {
+ ["dirname"]=>
+ string(31) "c:\windows/system32\drivers/etc"
+ ["basename"]=>
+ string(5) "hosts"
+ ["filename"]=>
+ string(5) "hosts"
+}
+-- Iteration 29 --
+string(17) "/usr\include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(17) "/usr\include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 30 --
+string(15) " c:\test\adir"
+string(9) "afile.txt"
+string(3) "txt"
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(15) " c:\test\adir"
+ ["basename"]=>
+ string(9) "afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 31 --
+string(12) "c:\test\adir"
+string(12) "afile.txt "
+string(6) "txt "
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(12) "c:\test\adir"
+ ["basename"]=>
+ string(12) "afile.txt "
+ ["extension"]=>
+ string(6) "txt "
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 32 --
+string(15) " c:\test\adir"
+string(12) "afile.txt "
+string(6) "txt "
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(15) " c:\test\adir"
+ ["basename"]=>
+ string(12) "afile.txt "
+ ["extension"]=>
+ string(6) "txt "
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 33 --
+string(20) " /usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(20) " /usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 34 --
+string(17) "/usr/include/arpa"
+string(9) "inet.h "
+string(4) "h "
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(9) "inet.h "
+ ["extension"]=>
+ string(4) "h "
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 35 --
+string(20) " /usr/include/arpa"
+string(9) "inet.h "
+string(4) "h "
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(20) " /usr/include/arpa"
+ ["basename"]=>
+ string(9) "inet.h "
+ ["extension"]=>
+ string(4) "h "
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 36 --
+string(1) "."
+string(3) " c:"
+string(0) ""
+string(3) " c:"
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(3) " c:"
+ ["filename"]=>
+ string(3) " c:"
+}
+-- Iteration 37 --
+string(14) " c:\test\adir"
+string(9) "afile.txt"
+string(3) "txt"
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(14) " c:\test\adir"
+ ["basename"]=>
+ string(9) "afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 38 --
+string(1) "\"
+string(3) "usr"
+string(0) ""
+string(3) "usr"
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(3) "usr"
+ ["filename"]=>
+ string(3) "usr"
+}
+-- Iteration 39 --
+string(1) "\"
+string(3) "usr"
+string(0) ""
+string(3) "usr"
+array(3) {
+ ["dirname"]=>
+ string(1) "\"
+ ["basename"]=>
+ string(3) "usr"
+ ["filename"]=>
+ string(3) "usr"
+}
+Done
diff --git a/ext/standard/tests/file/pathinfo_basic1.phpt b/ext/standard/tests/file/pathinfo_basic1.phpt
new file mode 100644
index 0000000..92f0524
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_basic1.phpt
@@ -0,0 +1,610 @@
+--TEST--
+Test pathinfo() function: basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing basic functions of pathinfo() ***\n";
+
+$paths = array (
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\adir',
+ 'c:\test\adir\\',
+ '/usr/include/arpa',
+ '/usr/include/arpa/',
+ 'usr/include/arpa',
+ 'usr/include/arpa/',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ 'c:\test\prog.exe',
+ 'c:\\test\\prog.exe',
+ 'c:/test/prog.exe',
+ '/usr/include/arpa/inet.h',
+ '//usr/include//arpa/inet.h',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/include/arpa/inet.h',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\include/arpa\inet.h',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/include/arpa/inet.h',
+ '/usr/include/arpa/inet.h ',
+ ' /usr/include/arpa/inet.h ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/'
+);
+
+$counter = 1;
+/* loop through $paths to test each $path in the above array */
+foreach($paths as $path) {
+ echo "-- Iteration $counter --\n";
+ var_dump( pathinfo($path, PATHINFO_DIRNAME) );
+ var_dump( pathinfo($path, PATHINFO_BASENAME) );
+ var_dump( pathinfo($path, PATHINFO_EXTENSION) );
+ var_dump( pathinfo($path, PATHINFO_FILENAME) );
+ var_dump( pathinfo($path) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic functions of pathinfo() ***
+-- Iteration 1 --
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+array(2) {
+ [%u|b%"basename"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(0) ""
+}
+-- Iteration 2 --
+%unicode|string%(1) "."
+%unicode|string%(1) " "
+%unicode|string%(0) ""
+%unicode|string%(1) " "
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(1) " "
+ [%u|b%"filename"]=>
+ %unicode|string%(1) " "
+}
+-- Iteration 3 --
+%unicode|string%(1) "."
+%unicode|string%(2) "c:"
+%unicode|string%(0) ""
+%unicode|string%(2) "c:"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(2) "c:"
+ [%u|b%"filename"]=>
+ %unicode|string%(2) "c:"
+}
+-- Iteration 4 --
+%unicode|string%(1) "."
+%unicode|string%(3) "c:\"
+%unicode|string%(0) ""
+%unicode|string%(3) "c:\"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "c:\"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "c:\"
+}
+-- Iteration 5 --
+%unicode|string%(1) "."
+%unicode|string%(2) "c:"
+%unicode|string%(0) ""
+%unicode|string%(2) "c:"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(2) "c:"
+ [%u|b%"filename"]=>
+ %unicode|string%(2) "c:"
+}
+-- Iteration 6 --
+%unicode|string%(1) "."
+%unicode|string%(5) "afile"
+%unicode|string%(0) ""
+%unicode|string%(5) "afile"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(5) "afile"
+ [%u|b%"filename"]=>
+ %unicode|string%(5) "afile"
+}
+-- Iteration 7 --
+%unicode|string%(1) "."
+%unicode|string%(12) "c:\test\adir"
+%unicode|string%(0) ""
+%unicode|string%(12) "c:\test\adir"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(12) "c:\test\adir"
+ [%u|b%"filename"]=>
+ %unicode|string%(12) "c:\test\adir"
+}
+-- Iteration 8 --
+%unicode|string%(1) "."
+%unicode|string%(13) "c:\test\adir\"
+%unicode|string%(0) ""
+%unicode|string%(13) "c:\test\adir\"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(13) "c:\test\adir\"
+ [%u|b%"filename"]=>
+ %unicode|string%(13) "c:\test\adir\"
+}
+-- Iteration 9 --
+%unicode|string%(12) "/usr/include"
+%unicode|string%(4) "arpa"
+%unicode|string%(0) ""
+%unicode|string%(4) "arpa"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(12) "/usr/include"
+ [%u|b%"basename"]=>
+ %unicode|string%(4) "arpa"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "arpa"
+}
+-- Iteration 10 --
+%unicode|string%(12) "/usr/include"
+%unicode|string%(4) "arpa"
+%unicode|string%(0) ""
+%unicode|string%(4) "arpa"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(12) "/usr/include"
+ [%u|b%"basename"]=>
+ %unicode|string%(4) "arpa"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "arpa"
+}
+-- Iteration 11 --
+%unicode|string%(11) "usr/include"
+%unicode|string%(4) "arpa"
+%unicode|string%(0) ""
+%unicode|string%(4) "arpa"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(11) "usr/include"
+ [%u|b%"basename"]=>
+ %unicode|string%(4) "arpa"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "arpa"
+}
+-- Iteration 12 --
+%unicode|string%(11) "usr/include"
+%unicode|string%(4) "arpa"
+%unicode|string%(0) ""
+%unicode|string%(4) "arpa"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(11) "usr/include"
+ [%u|b%"basename"]=>
+ %unicode|string%(4) "arpa"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "arpa"
+}
+-- Iteration 13 --
+%unicode|string%(1) "."
+%unicode|string%(13) "c:\test\afile"
+%unicode|string%(0) ""
+%unicode|string%(13) "c:\test\afile"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(13) "c:\test\afile"
+ [%u|b%"filename"]=>
+ %unicode|string%(13) "c:\test\afile"
+}
+-- Iteration 14 --
+%unicode|string%(1) "."
+%unicode|string%(13) "c:\test\afile"
+%unicode|string%(0) ""
+%unicode|string%(13) "c:\test\afile"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(13) "c:\test\afile"
+ [%u|b%"filename"]=>
+ %unicode|string%(13) "c:\test\afile"
+}
+-- Iteration 15 --
+%unicode|string%(8) "c://test"
+%unicode|string%(5) "afile"
+%unicode|string%(0) ""
+%unicode|string%(5) "afile"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(8) "c://test"
+ [%u|b%"basename"]=>
+ %unicode|string%(5) "afile"
+ [%u|b%"filename"]=>
+ %unicode|string%(5) "afile"
+}
+-- Iteration 16 --
+%unicode|string%(1) "."
+%unicode|string%(14) "c:\test\afile\"
+%unicode|string%(0) ""
+%unicode|string%(14) "c:\test\afile\"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(14) "c:\test\afile\"
+ [%u|b%"filename"]=>
+ %unicode|string%(14) "c:\test\afile\"
+}
+-- Iteration 17 --
+%unicode|string%(1) "."
+%unicode|string%(16) "c:\test\prog.exe"
+%unicode|string%(3) "exe"
+%unicode|string%(12) "c:\test\prog"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(16) "c:\test\prog.exe"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "exe"
+ [%u|b%"filename"]=>
+ %unicode|string%(12) "c:\test\prog"
+}
+-- Iteration 18 --
+%unicode|string%(1) "."
+%unicode|string%(16) "c:\test\prog.exe"
+%unicode|string%(3) "exe"
+%unicode|string%(12) "c:\test\prog"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(16) "c:\test\prog.exe"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "exe"
+ [%u|b%"filename"]=>
+ %unicode|string%(12) "c:\test\prog"
+}
+-- Iteration 19 --
+%unicode|string%(7) "c:/test"
+%unicode|string%(8) "prog.exe"
+%unicode|string%(3) "exe"
+%unicode|string%(4) "prog"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(7) "c:/test"
+ [%u|b%"basename"]=>
+ %unicode|string%(8) "prog.exe"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "exe"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "prog"
+}
+-- Iteration 20 --
+%unicode|string%(17) "/usr/include/arpa"
+%unicode|string%(6) "inet.h"
+%unicode|string%(1) "h"
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(17) "/usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(6) "inet.h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 21 --
+%unicode|string%(19) "//usr/include//arpa"
+%unicode|string%(6) "inet.h"
+%unicode|string%(1) "h"
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(19) "//usr/include//arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(6) "inet.h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 22 --
+%unicode|string%(1) "."
+%unicode|string%(1) "\"
+%unicode|string%(0) ""
+%unicode|string%(1) "\"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(1) "\"
+ [%u|b%"filename"]=>
+ %unicode|string%(1) "\"
+}
+-- Iteration 23 --
+%unicode|string%(1) "."
+%unicode|string%(2) "\\"
+%unicode|string%(0) ""
+%unicode|string%(2) "\\"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(2) "\\"
+ [%u|b%"filename"]=>
+ %unicode|string%(2) "\\"
+}
+-- Iteration 24 --
+%unicode|string%(1) "/"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "/"
+ [%u|b%"basename"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(0) ""
+}
+-- Iteration 25 --
+%unicode|string%(1) "/"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "/"
+ [%u|b%"basename"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(0) ""
+}
+-- Iteration 26 --
+%unicode|string%(1) "/"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "/"
+ [%u|b%"basename"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(0) ""
+}
+-- Iteration 27 --
+%unicode|string%(17) "/usr/include/arpa"
+%unicode|string%(6) "inet.h"
+%unicode|string%(1) "h"
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(17) "/usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(6) "inet.h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 28 --
+%unicode|string%(27) "c:\windows/system32\drivers"
+%unicode|string%(9) "etc\hosts"
+%unicode|string%(0) ""
+%unicode|string%(9) "etc\hosts"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(27) "c:\windows/system32\drivers"
+ [%u|b%"basename"]=>
+ %unicode|string%(9) "etc\hosts"
+ [%u|b%"filename"]=>
+ %unicode|string%(9) "etc\hosts"
+}
+-- Iteration 29 --
+%unicode|string%(12) "/usr\include"
+%unicode|string%(11) "arpa\inet.h"
+%unicode|string%(1) "h"
+%unicode|string%(9) "arpa\inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(12) "/usr\include"
+ [%u|b%"basename"]=>
+ %unicode|string%(11) "arpa\inet.h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(9) "arpa\inet"
+}
+-- Iteration 30 --
+%unicode|string%(1) "."
+%unicode|string%(25) " c:\test\adir\afile.txt"
+%unicode|string%(3) "txt"
+%unicode|string%(21) " c:\test\adir\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(25) " c:\test\adir\afile.txt"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "txt"
+ [%u|b%"filename"]=>
+ %unicode|string%(21) " c:\test\adir\afile"
+}
+-- Iteration 31 --
+%unicode|string%(1) "."
+%unicode|string%(25) "c:\test\adir\afile.txt "
+%unicode|string%(6) "txt "
+%unicode|string%(18) "c:\test\adir\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(25) "c:\test\adir\afile.txt "
+ [%u|b%"extension"]=>
+ %unicode|string%(6) "txt "
+ [%u|b%"filename"]=>
+ %unicode|string%(18) "c:\test\adir\afile"
+}
+-- Iteration 32 --
+%unicode|string%(1) "."
+%unicode|string%(28) " c:\test\adir\afile.txt "
+%unicode|string%(6) "txt "
+%unicode|string%(21) " c:\test\adir\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(28) " c:\test\adir\afile.txt "
+ [%u|b%"extension"]=>
+ %unicode|string%(6) "txt "
+ [%u|b%"filename"]=>
+ %unicode|string%(21) " c:\test\adir\afile"
+}
+-- Iteration 33 --
+%unicode|string%(20) " /usr/include/arpa"
+%unicode|string%(6) "inet.h"
+%unicode|string%(1) "h"
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(20) " /usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(6) "inet.h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 34 --
+%unicode|string%(17) "/usr/include/arpa"
+%unicode|string%(9) "inet.h "
+%unicode|string%(4) "h "
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(17) "/usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(9) "inet.h "
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "h "
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 35 --
+%unicode|string%(20) " /usr/include/arpa"
+%unicode|string%(9) "inet.h "
+%unicode|string%(4) "h "
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(20) " /usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(9) "inet.h "
+ [%u|b%"extension"]=>
+ %unicode|string%(4) "h "
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 36 --
+%unicode|string%(1) "."
+%unicode|string%(3) " c:"
+%unicode|string%(0) ""
+%unicode|string%(3) " c:"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(3) " c:"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) " c:"
+}
+-- Iteration 37 --
+%unicode|string%(1) "."
+%unicode|string%(24) " c:\test\adir\afile.txt"
+%unicode|string%(3) "txt"
+%unicode|string%(20) " c:\test\adir\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(24) " c:\test\adir\afile.txt"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "txt"
+ [%u|b%"filename"]=>
+ %unicode|string%(20) " c:\test\adir\afile"
+}
+-- Iteration 38 --
+%unicode|string%(1) "/"
+%unicode|string%(3) "usr"
+%unicode|string%(0) ""
+%unicode|string%(3) "usr"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "/"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "usr"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "usr"
+}
+-- Iteration 39 --
+%unicode|string%(1) "/"
+%unicode|string%(3) "usr"
+%unicode|string%(0) ""
+%unicode|string%(3) "usr"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "/"
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "usr"
+ [%u|b%"filename"]=>
+ %unicode|string%(3) "usr"
+}
+Done
+
diff --git a/ext/standard/tests/file/pathinfo_basic2-win32.phpt b/ext/standard/tests/file/pathinfo_basic2-win32.phpt
new file mode 100644
index 0000000..c88bc25
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_basic2-win32.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test pathinfo() function: basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing basic functions of pathinfo() ***\n";
+
+$paths = array (
+ 'c:\..\dir1',
+ 'c:\test\..\test2\.\adir\afile.txt',
+ '/usr/include/../arpa/./inet.h',
+ 'c:\test\adir\afile..txt',
+ '/usr/include/arpa/inet..h',
+ 'c:\test\adir\afile.',
+ '/usr/include/arpa/inet.',
+ '/usr/include/arpa/inet,h',
+ 'c:afile.txt',
+ '..\.\..\test\afile.txt',
+ '.././../test/afile',
+ '.',
+ '..',
+ '...',
+ '/usr/lib/.../afile'
+
+);
+
+$counter = 1;
+/* loop through $paths to test each $path in the above array */
+foreach($paths as $path) {
+ echo "-- Iteration $counter --\n";
+ var_dump( pathinfo($path, PATHINFO_DIRNAME) );
+ var_dump( pathinfo($path, PATHINFO_BASENAME) );
+ var_dump( pathinfo($path, PATHINFO_EXTENSION) );
+ var_dump( pathinfo($path, PATHINFO_FILENAME) );
+ var_dump( pathinfo($path) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing basic functions of pathinfo() ***
+-- Iteration 1 --
+string(5) "c:\.."
+string(4) "dir1"
+string(0) ""
+string(4) "dir1"
+array(3) {
+ ["dirname"]=>
+ string(5) "c:\.."
+ ["basename"]=>
+ string(4) "dir1"
+ ["filename"]=>
+ string(4) "dir1"
+}
+-- Iteration 2 --
+string(23) "c:\test\..\test2\.\adir"
+string(9) "afile.txt"
+string(3) "txt"
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(23) "c:\test\..\test2\.\adir"
+ ["basename"]=>
+ string(9) "afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 3 --
+string(22) "/usr/include/../arpa/."
+string(6) "inet.h"
+string(1) "h"
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(22) "/usr/include/../arpa/."
+ ["basename"]=>
+ string(6) "inet.h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 4 --
+string(12) "c:\test\adir"
+string(10) "afile..txt"
+string(3) "txt"
+string(6) "afile."
+array(4) {
+ ["dirname"]=>
+ string(12) "c:\test\adir"
+ ["basename"]=>
+ string(10) "afile..txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(6) "afile."
+}
+-- Iteration 5 --
+string(17) "/usr/include/arpa"
+string(7) "inet..h"
+string(1) "h"
+string(5) "inet."
+array(4) {
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(7) "inet..h"
+ ["extension"]=>
+ string(1) "h"
+ ["filename"]=>
+ string(5) "inet."
+}
+-- Iteration 6 --
+string(12) "c:\test\adir"
+string(6) "afile."
+string(0) ""
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(12) "c:\test\adir"
+ ["basename"]=>
+ string(6) "afile."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 7 --
+string(17) "/usr/include/arpa"
+string(5) "inet."
+string(0) ""
+string(4) "inet"
+array(4) {
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(5) "inet."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(4) "inet"
+}
+-- Iteration 8 --
+string(17) "/usr/include/arpa"
+string(6) "inet,h"
+string(0) ""
+string(6) "inet,h"
+array(3) {
+ ["dirname"]=>
+ string(17) "/usr/include/arpa"
+ ["basename"]=>
+ string(6) "inet,h"
+ ["filename"]=>
+ string(6) "inet,h"
+}
+-- Iteration 9 --
+string(3) "c:."
+string(11) "c:afile.txt"
+string(3) "txt"
+string(7) "c:afile"
+array(4) {
+ ["dirname"]=>
+ string(3) "c:."
+ ["basename"]=>
+ string(11) "c:afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(7) "c:afile"
+}
+-- Iteration 10 --
+string(12) "..\.\..\test"
+string(9) "afile.txt"
+string(3) "txt"
+string(5) "afile"
+array(4) {
+ ["dirname"]=>
+ string(12) "..\.\..\test"
+ ["basename"]=>
+ string(9) "afile.txt"
+ ["extension"]=>
+ string(3) "txt"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 11 --
+string(12) ".././../test"
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(12) ".././../test"
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+-- Iteration 12 --
+string(1) "."
+string(1) "."
+string(0) ""
+string(0) ""
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+-- Iteration 13 --
+string(1) "."
+string(2) ".."
+string(0) ""
+string(1) "."
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(2) ".."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(1) "."
+}
+-- Iteration 14 --
+string(1) "."
+string(3) "..."
+string(0) ""
+string(2) ".."
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(3) "..."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(2) ".."
+}
+-- Iteration 15 --
+string(12) "/usr/lib/..."
+string(5) "afile"
+string(0) ""
+string(5) "afile"
+array(3) {
+ ["dirname"]=>
+ string(12) "/usr/lib/..."
+ ["basename"]=>
+ string(5) "afile"
+ ["filename"]=>
+ string(5) "afile"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/pathinfo_basic2.phpt b/ext/standard/tests/file/pathinfo_basic2.phpt
new file mode 100644
index 0000000..23c0768
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_basic2.phpt
@@ -0,0 +1,273 @@
+--TEST--
+Test pathinfo() function: basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing basic functions of pathinfo() ***\n";
+
+$paths = array (
+ 'c:\..\dir1',
+ 'c:\test\..\test2\.\adir\afile.txt',
+ '/usr/include/../arpa/./inet.h',
+ 'c:\test\adir\afile..txt',
+ '/usr/include/arpa/inet..h',
+ 'c:\test\adir\afile.',
+ '/usr/include/arpa/inet.',
+ '/usr/include/arpa/inet,h',
+ 'c:afile.txt',
+ '..\.\..\test\afile.txt',
+ '.././../test/afile',
+ '.',
+ '..',
+ '...',
+ '/usr/lib/.../afile'
+
+);
+
+$counter = 1;
+/* loop through $paths to test each $path in the above array */
+foreach($paths as $path) {
+ echo "-- Iteration $counter --\n";
+ var_dump( pathinfo($path, PATHINFO_DIRNAME) );
+ var_dump( pathinfo($path, PATHINFO_BASENAME) );
+ var_dump( pathinfo($path, PATHINFO_EXTENSION) );
+ var_dump( pathinfo($path, PATHINFO_FILENAME) );
+ var_dump( pathinfo($path) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic functions of pathinfo() ***
+-- Iteration 1 --
+%unicode|string%(1) "."
+%unicode|string%(10) "c:\..\dir1"
+%unicode|string%(5) "\dir1"
+%unicode|string%(4) "c:\."
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(10) "c:\..\dir1"
+ [%u|b%"extension"]=>
+ %unicode|string%(5) "\dir1"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "c:\."
+}
+-- Iteration 2 --
+%unicode|string%(1) "."
+%unicode|string%(33) "c:\test\..\test2\.\adir\afile.txt"
+%unicode|string%(3) "txt"
+%unicode|string%(29) "c:\test\..\test2\.\adir\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(33) "c:\test\..\test2\.\adir\afile.txt"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "txt"
+ [%u|b%"filename"]=>
+ %unicode|string%(29) "c:\test\..\test2\.\adir\afile"
+}
+-- Iteration 3 --
+%unicode|string%(22) "/usr/include/../arpa/."
+%unicode|string%(6) "inet.h"
+%unicode|string%(1) "h"
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(22) "/usr/include/../arpa/."
+ [%u|b%"basename"]=>
+ %unicode|string%(6) "inet.h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 4 --
+%unicode|string%(1) "."
+%unicode|string%(23) "c:\test\adir\afile..txt"
+%unicode|string%(3) "txt"
+%unicode|string%(19) "c:\test\adir\afile."
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(23) "c:\test\adir\afile..txt"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "txt"
+ [%u|b%"filename"]=>
+ %unicode|string%(19) "c:\test\adir\afile."
+}
+-- Iteration 5 --
+%unicode|string%(17) "/usr/include/arpa"
+%unicode|string%(7) "inet..h"
+%unicode|string%(1) "h"
+%unicode|string%(5) "inet."
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(17) "/usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(7) "inet..h"
+ [%u|b%"extension"]=>
+ %unicode|string%(1) "h"
+ [%u|b%"filename"]=>
+ %unicode|string%(5) "inet."
+}
+-- Iteration 6 --
+%unicode|string%(1) "."
+%unicode|string%(19) "c:\test\adir\afile."
+%unicode|string%(0) ""
+%unicode|string%(18) "c:\test\adir\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(19) "c:\test\adir\afile."
+ [%u|b%"extension"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(18) "c:\test\adir\afile"
+}
+-- Iteration 7 --
+%unicode|string%(17) "/usr/include/arpa"
+%unicode|string%(5) "inet."
+%unicode|string%(0) ""
+%unicode|string%(4) "inet"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(17) "/usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(5) "inet."
+ [%u|b%"extension"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(4) "inet"
+}
+-- Iteration 8 --
+%unicode|string%(17) "/usr/include/arpa"
+%unicode|string%(6) "inet,h"
+%unicode|string%(0) ""
+%unicode|string%(6) "inet,h"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(17) "/usr/include/arpa"
+ [%u|b%"basename"]=>
+ %unicode|string%(6) "inet,h"
+ [%u|b%"filename"]=>
+ %unicode|string%(6) "inet,h"
+}
+-- Iteration 9 --
+%unicode|string%(1) "."
+%unicode|string%(11) "c:afile.txt"
+%unicode|string%(3) "txt"
+%unicode|string%(7) "c:afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(11) "c:afile.txt"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "txt"
+ [%u|b%"filename"]=>
+ %unicode|string%(7) "c:afile"
+}
+-- Iteration 10 --
+%unicode|string%(1) "."
+%unicode|string%(22) "..\.\..\test\afile.txt"
+%unicode|string%(3) "txt"
+%unicode|string%(18) "..\.\..\test\afile"
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(22) "..\.\..\test\afile.txt"
+ [%u|b%"extension"]=>
+ %unicode|string%(3) "txt"
+ [%u|b%"filename"]=>
+ %unicode|string%(18) "..\.\..\test\afile"
+}
+-- Iteration 11 --
+%unicode|string%(12) ".././../test"
+%unicode|string%(5) "afile"
+%unicode|string%(0) ""
+%unicode|string%(5) "afile"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(12) ".././../test"
+ [%u|b%"basename"]=>
+ %unicode|string%(5) "afile"
+ [%u|b%"filename"]=>
+ %unicode|string%(5) "afile"
+}
+-- Iteration 12 --
+%unicode|string%(1) "."
+%unicode|string%(1) "."
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(1) "."
+ [%u|b%"extension"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(0) ""
+}
+-- Iteration 13 --
+%unicode|string%(1) "."
+%unicode|string%(2) ".."
+%unicode|string%(0) ""
+%unicode|string%(1) "."
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(2) ".."
+ [%u|b%"extension"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(1) "."
+}
+-- Iteration 14 --
+%unicode|string%(1) "."
+%unicode|string%(3) "..."
+%unicode|string%(0) ""
+%unicode|string%(2) ".."
+array(4) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(1) "."
+ [%u|b%"basename"]=>
+ %unicode|string%(3) "..."
+ [%u|b%"extension"]=>
+ %unicode|string%(0) ""
+ [%u|b%"filename"]=>
+ %unicode|string%(2) ".."
+}
+-- Iteration 15 --
+%unicode|string%(12) "/usr/lib/..."
+%unicode|string%(5) "afile"
+%unicode|string%(0) ""
+%unicode|string%(5) "afile"
+array(3) {
+ [%u|b%"dirname"]=>
+ %unicode|string%(12) "/usr/lib/..."
+ [%u|b%"basename"]=>
+ %unicode|string%(5) "afile"
+ [%u|b%"filename"]=>
+ %unicode|string%(5) "afile"
+}
+Done
+
diff --git a/ext/standard/tests/file/pathinfo_error.phpt b/ext/standard/tests/file/pathinfo_error.phpt
new file mode 100644
index 0000000..903fc5b
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_error.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test pathinfo() function: error conditions
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing pathinfo() for error conditions ***\n";
+/* unexpected no. of arguments */
+var_dump( pathinfo() ); /* args < expected */
+var_dump( pathinfo("/home/1.html", 1, 3) ); /* args > expected */
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing pathinfo() for error conditions ***
+
+Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: pathinfo() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/file/pathinfo_variation1.phpt b/ext/standard/tests/file/pathinfo_variation1.phpt
new file mode 100644
index 0000000..ff4c1eb
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_variation1.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test pathinfo() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array pathinfo(string path[, int options])
+ * Description: Returns information about a certain string
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing pathinfo() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$options = PATHINFO_DIRNAME;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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( pathinfo($value, $options) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing pathinfo() : 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 - pathinfo() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - pathinfo() 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 - pathinfo() 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/pathinfo_variation2.phpt b/ext/standard/tests/file/pathinfo_variation2.phpt
new file mode 100644
index 0000000..9d18a4b
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_variation2.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test pathinfo() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array pathinfo(string path[, int options])
+ * Description: Returns information about a certain string
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing pathinfo() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$path = '/usr/include/arpa/inet.h';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 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 options
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( pathinfo($path, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing pathinfo() : usage variation ***
+
+--float 10.5--
+string(6) "inet.h"
+
+--float -10.5--
+string(6) "inet.h"
+
+--float 12.3456789000e10--
+string(%d) %s
+
+--float -12.3456789000e10--
+string(%d) %s
+
+--float .5--
+string(%d) %s
+
+--empty array--
+Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(0) ""
+
+--lowercase null--
+string(0) ""
+
+--lowercase true--
+string(17) "/usr/include/arpa"
+
+--lowercase false--
+string(0) ""
+
+--uppercase TRUE--
+string(17) "/usr/include/arpa"
+
+--uppercase FALSE--
+string(0) ""
+
+--empty string DQ--
+Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - pathinfo() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - pathinfo() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+string(0) ""
+
+--unset var--
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/file/pathinfo_variation3.phpt b/ext/standard/tests/file/pathinfo_variation3.phpt
new file mode 100644
index 0000000..333aa56
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_variation3.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test pathinfo() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : array pathinfo(string path[, int options])
+ * Description: Returns information about a certain string
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing pathinfo() : usage variation ***\n";
+
+$testfile = "/usr/include/arpa/inet.h";
+
+var_dump(pathinfo("./"));
+var_dump(pathinfo("/."));
+var_dump(pathinfo(".cvsignore"));
+var_dump(pathinfo($testfile, PATHINFO_BASENAME));
+var_dump(pathinfo($testfile, PATHINFO_FILENAME));
+var_dump(pathinfo($testfile, PATHINFO_EXTENSION));
+var_dump(pathinfo($testfile, PATHINFO_DIRNAME));
+var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_DIRNAME));
+var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_BASENAME));
+var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME));
+var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_BASENAME));
+var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_DIRNAME));
+var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_BASENAME));
+var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_EXTENSION));
+var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_BASENAME));
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing pathinfo() : usage variation ***
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "%s"
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(10) ".cvsignore"
+ ["extension"]=>
+ string(9) "cvsignore"
+ ["filename"]=>
+ string(0) ""
+}
+string(6) "inet.h"
+string(4) "inet"
+string(1) "h"
+string(17) "/usr/include/arpa"
+string(17) "/usr/include/arpa"
+string(6) "inet.h"
+string(1) "h"
+string(6) "inet.h"
+string(17) "/usr/include/arpa"
+string(6) "inet.h"
+string(17) "/usr/include/arpa"
+string(17) "/usr/include/arpa"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt
new file mode 100644
index 0000000..d6c6c77
--- /dev/null
+++ b/ext/standard/tests/file/pathinfo_variaton.phpt
@@ -0,0 +1,442 @@
+--TEST--
+Test pathinfo() function: usage variations
+--FILE--
+<?php
+/* Prototype: mixed pathinfo ( string $path [, int $options] );
+ Description: Returns information about a file path
+*/
+
+echo "*** Testing pathinfo() with miscelleneous input arguments ***\n";
+
+$fp = fopen(__FILE__, "r");
+unset($fp);
+
+class object_temp {
+ public $url_var = "www.foo.com";
+ var $html_var = "/var/html/testdir/example.html";
+ var $dir_var = "/testdir/foo/test/";
+ public $file_var = "/foo//symlink.link";
+ var $number = 12345;
+}
+$obj = new object_temp();
+
+$path_arr = array (
+ "www.example.com",
+ "/testdir/foo//test/",
+ "../foo/test.link",
+ "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6/test.tmp",
+ 2.345
+);
+
+$paths = array (
+ /* pathname containing numeric string */
+ 0,
+ 1234,
+ -1234,
+ 2.3456,
+
+ /* pathname as boolean */
+ TRUE,
+ FALSE,
+
+ /* pathname as an array */
+ "./array(1, 2)",
+ "array( array(), null)",
+
+ /* pathname as object */
+ $obj,
+
+ /* pathname as spaces */
+ " ",
+ ' ',
+
+ /* empty pathname */
+ "",
+ '',
+
+ /* pathname as NULL */
+ NULL,
+ null,
+
+ /* filename as resource */
+ $fp,
+
+ /* pathname as members of object */
+ $obj->url_var,
+ $obj->html_var,
+ $obj->dir_var,
+ $obj->file_var,
+ $obj->number,
+
+ /* pathname as member of array */
+ $path_arr[0],
+ $path_arr[1],
+ $path_arr[2],
+ $path_arr[3],
+ $path_arr[4]
+);
+
+$counter = 1;
+/* loop through $paths to test each $path in the above array */
+foreach($paths as $path) {
+ echo "-- Iteration $counter --\n";
+ var_dump( pathinfo($path) );
+ var_dump( pathinfo($path, PATHINFO_DIRNAME) );
+ var_dump( pathinfo($path, PATHINFO_BASENAME) );
+ var_dump( pathinfo($path, PATHINFO_EXTENSION) );
+ var_dump( pathinfo($path, PATHINFO_FILENAME) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing pathinfo() with miscelleneous input arguments ***
+
+Notice: Undefined variable: fp in %s on line %d
+-- Iteration 1 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "0"
+ ["filename"]=>
+ string(1) "0"
+}
+string(1) "."
+string(1) "0"
+string(0) ""
+string(1) "0"
+-- Iteration 2 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(4) "1234"
+ ["filename"]=>
+ string(4) "1234"
+}
+string(1) "."
+string(4) "1234"
+string(0) ""
+string(4) "1234"
+-- Iteration 3 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(5) "-1234"
+ ["filename"]=>
+ string(5) "-1234"
+}
+string(1) "."
+string(5) "-1234"
+string(0) ""
+string(5) "-1234"
+-- Iteration 4 --
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(6) "2.3456"
+ ["extension"]=>
+ string(4) "3456"
+ ["filename"]=>
+ string(1) "2"
+}
+string(1) "."
+string(6) "2.3456"
+string(4) "3456"
+string(1) "2"
+-- Iteration 5 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "1"
+ ["filename"]=>
+ string(1) "1"
+}
+string(1) "."
+string(1) "1"
+string(0) ""
+string(1) "1"
+-- Iteration 6 --
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 7 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(11) "array(1, 2)"
+ ["filename"]=>
+ string(11) "array(1, 2)"
+}
+string(1) "."
+string(11) "array(1, 2)"
+string(0) ""
+string(11) "array(1, 2)"
+-- Iteration 8 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(21) "array( array(), null)"
+ ["filename"]=>
+ string(21) "array( array(), null)"
+}
+string(1) "."
+string(21) "array( array(), null)"
+string(0) ""
+string(21) "array( array(), null)"
+-- Iteration 9 --
+
+Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
+NULL
+-- Iteration 10 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) " "
+ ["filename"]=>
+ string(1) " "
+}
+string(1) "."
+string(1) " "
+string(0) ""
+string(1) " "
+-- Iteration 11 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) " "
+ ["filename"]=>
+ string(1) " "
+}
+string(1) "."
+string(1) " "
+string(0) ""
+string(1) " "
+-- Iteration 12 --
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 13 --
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 14 --
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 15 --
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 16 --
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 17 --
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(11) "www.foo.com"
+ ["extension"]=>
+ string(3) "com"
+ ["filename"]=>
+ string(7) "www.foo"
+}
+string(1) "."
+string(11) "www.foo.com"
+string(3) "com"
+string(7) "www.foo"
+-- Iteration 18 --
+array(4) {
+ ["dirname"]=>
+ string(17) "/var/html/testdir"
+ ["basename"]=>
+ string(12) "example.html"
+ ["extension"]=>
+ string(4) "html"
+ ["filename"]=>
+ string(7) "example"
+}
+string(17) "/var/html/testdir"
+string(12) "example.html"
+string(4) "html"
+string(7) "example"
+-- Iteration 19 --
+array(3) {
+ ["dirname"]=>
+ string(12) "/testdir/foo"
+ ["basename"]=>
+ string(4) "test"
+ ["filename"]=>
+ string(4) "test"
+}
+string(12) "/testdir/foo"
+string(4) "test"
+string(0) ""
+string(4) "test"
+-- Iteration 20 --
+array(4) {
+ ["dirname"]=>
+ string(4) "/foo"
+ ["basename"]=>
+ string(12) "symlink.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(7) "symlink"
+}
+string(4) "/foo"
+string(12) "symlink.link"
+string(4) "link"
+string(7) "symlink"
+-- Iteration 21 --
+array(3) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(5) "12345"
+ ["filename"]=>
+ string(5) "12345"
+}
+string(1) "."
+string(5) "12345"
+string(0) ""
+string(5) "12345"
+-- Iteration 22 --
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(15) "www.example.com"
+ ["extension"]=>
+ string(3) "com"
+ ["filename"]=>
+ string(11) "www.example"
+}
+string(1) "."
+string(15) "www.example.com"
+string(3) "com"
+string(11) "www.example"
+-- Iteration 23 --
+array(3) {
+ ["dirname"]=>
+ string(12) "/testdir/foo"
+ ["basename"]=>
+ string(4) "test"
+ ["filename"]=>
+ string(4) "test"
+}
+string(12) "/testdir/foo"
+string(4) "test"
+string(0) ""
+string(4) "test"
+-- Iteration 24 --
+array(4) {
+ ["dirname"]=>
+ string(6) "../foo"
+ ["basename"]=>
+ string(9) "test.link"
+ ["extension"]=>
+ string(4) "link"
+ ["filename"]=>
+ string(4) "test"
+}
+string(6) "../foo"
+string(9) "test.link"
+string(4) "link"
+string(4) "test"
+-- Iteration 25 --
+array(4) {
+ ["dirname"]=>
+ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6"
+ ["basename"]=>
+ string(8) "test.tmp"
+ ["extension"]=>
+ string(3) "tmp"
+ ["filename"]=>
+ string(4) "test"
+}
+string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6"
+string(8) "test.tmp"
+string(3) "tmp"
+string(4) "test"
+-- Iteration 26 --
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(5) "2.345"
+ ["extension"]=>
+ string(3) "345"
+ ["filename"]=>
+ string(1) "2"
+}
+string(1) "."
+string(5) "2.345"
+string(3) "345"
+string(1) "2"
+Done
diff --git a/ext/standard/tests/file/pclose_variation1.phpt b/ext/standard/tests/file/pclose_variation1.phpt
new file mode 100644
index 0000000..07b5f3f
--- /dev/null
+++ b/ext/standard/tests/file/pclose_variation1.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test pclose() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int pclose(resource fp)
+ * Description: Close a file pointer opened by popen()
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing pclose() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 fp
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( pclose($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing pclose() : usage variation ***
+
+--int 0--
+Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d)
+bool(false)
+
+--string DQ--
+Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d)
+bool(false)
+
+--string SQ--
+Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d)
+bool(false)
+
+--mixed case string--
+Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d)
+bool(false)
+
+--heredoc--
+Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - pclose() expects parameter 1 to be resource, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - pclose() expects parameter 1 to be resource, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d)
+bool(false)
+===DONE===
+
diff --git a/ext/standard/tests/file/php_fd_wrapper_01.phpt b/ext/standard/tests/file/php_fd_wrapper_01.phpt
new file mode 100644
index 0000000..037edd7
--- /dev/null
+++ b/ext/standard/tests/file/php_fd_wrapper_01.phpt
@@ -0,0 +1,11 @@
+--TEST--
+php://fd wrapper: basic test
+--FILE--
+<?php
+$f = fopen("php://fd/1", "wb");
+fwrite($f, "hi!");
+
+echo "\nDone.\n";
+--EXPECT--
+hi!
+Done.
diff --git a/ext/standard/tests/file/php_fd_wrapper_02.phpt b/ext/standard/tests/file/php_fd_wrapper_02.phpt
new file mode 100644
index 0000000..6d40dc9
--- /dev/null
+++ b/ext/standard/tests/file/php_fd_wrapper_02.phpt
@@ -0,0 +1,11 @@
+--TEST--
+php://fd wrapper: mode is ignored
+--FILE--
+<?php
+$f = fopen("php://fd/1", "rkkk");
+fwrite($f, "hi!");
+
+echo "\nDone.\n";
+--EXPECT--
+hi!
+Done.
diff --git a/ext/standard/tests/file/php_fd_wrapper_03.phpt b/ext/standard/tests/file/php_fd_wrapper_03.phpt
new file mode 100644
index 0000000..c004a43
--- /dev/null
+++ b/ext/standard/tests/file/php_fd_wrapper_03.phpt
@@ -0,0 +1,22 @@
+--TEST--
+php://fd wrapper: bad syntax
+--FILE--
+<?php
+fopen("php://fd", "w");
+fopen("php://fd/", "w");
+fopen("php://fd/-2", "w");
+fopen("php://fd/1/", "w");
+
+echo "\nDone.\n";
+--EXPECTF--
+Warning: fopen(): Invalid php:// URL specified in %s on line %d
+
+Warning: fopen(php://fd): failed to open stream: operation failed in %s on line 2
+
+Warning: fopen(php://fd/): failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d
+
+Warning: fopen(php://fd/-2): failed to open stream: The file descriptors must be non-negative numbers smaller than %d in %s on line %d
+
+Warning: fopen(php://fd/1/): failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d
+
+Done.
diff --git a/ext/standard/tests/file/php_fd_wrapper_04.phpt b/ext/standard/tests/file/php_fd_wrapper_04.phpt
new file mode 100644
index 0000000..51f4d9f
--- /dev/null
+++ b/ext/standard/tests/file/php_fd_wrapper_04.phpt
@@ -0,0 +1,20 @@
+--TEST--
+php://fd wrapper: invalid file descriptor
+--SKIPIF--
+<?php include('skipif.inc');
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not for Windows");
+
+//we'd need a release and a test variation for windows, because in debug builds we get this message:
+//Warning: Invalid parameter detected in CRT function '_dup' (f:\dd\vctools\crt_bld\self_x86\crt\src\dup.c:52)
+//I greped the CRT sources and found no function capable of validating a file descriptor
+
+--FILE--
+<?php
+fopen("php://fd/12", "w");
+
+echo "\nDone.\n";
+--EXPECTF--
+Warning: fopen(php://fd/12): failed to open stream: Error duping file descriptor 12; possibly it doesn't exist: [9]: %s in %s on line %d
+
+Done.
diff --git a/ext/standard/tests/file/popen_pclose_basic-win32.phpt b/ext/standard/tests/file/popen_pclose_basic-win32.phpt
new file mode 100644
index 0000000..6351d86
--- /dev/null
+++ b/ext/standard/tests/file/popen_pclose_basic-win32.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test popen() and pclose function: basic functionality
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' )
+ die("skip Not Valid for Linux");
+?>
+
+--FILE--
+<?php
+/*
+ * Prototype: resource popen ( string command, string mode )
+ * Description: Opens process file pointer.
+
+ * Prototype: int pclose ( resource handle );
+ * Description: Closes process file pointer.
+ */
+
+echo "*** Testing popen(): reading from the pipe ***\n";
+
+$file_path = dirname(__FILE__);
+
+$string = "Sample String";
+$file_handle = popen(" echo $string", "r");
+fpassthru($file_handle);
+pclose($file_handle);
+
+echo "*** Testing popen(): writing to the pipe ***\n";
+$arr = array("ggg", "ddd", "aaa", "sss");
+// popen("sort", "w") fails if variables_order="GPCS"
+// this is set in the default INI file
+// it doesn't seem to be changeable in the --INI-- section
+// also, doing: ini_set('variables_order', ''); doesn't work!
+//
+// the only solution is to either put the absolute path here, or
+// remove variables_order= from PHP.ini (setting it in run-test's
+// default INI will fail too)
+//
+// since we can't depend on PHP.ini being set a certain way,
+// have to put the absolute path here.
+
+$sysroot = exec('echo %SYSTEMROOT%');
+
+$file_handle = popen("$sysroot/system32/sort", "w");
+$newline = "\n";
+foreach($arr as $str) {
+ fwrite($file_handle, (binary)$str);
+ fwrite($file_handle, (binary)(binary)(binary)(binary)(binary)(binary)(binary)(binary)(binary)$newline);
+}
+pclose($file_handle);
+
+echo "*** Testing popen() and pclose(): return type ***\n";
+$return_value_popen = popen("echo $string", "r");
+fpassthru($return_value_popen);
+var_dump( is_resource($return_value_popen) );
+$return_value_pclose = pclose($return_value_popen);
+var_dump( is_int($return_value_pclose) );
+
+echo "\n--- Done ---";
+?>
+--EXPECTF--
+*** Testing popen(): reading from the pipe ***
+Sample String
+*** Testing popen(): writing to the pipe ***
+aaa
+ddd
+ggg
+sss
+*** Testing popen() and pclose(): return type ***
+Sample String
+bool(true)
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/popen_pclose_basic.phpt b/ext/standard/tests/file/popen_pclose_basic.phpt
new file mode 100644
index 0000000..9812193
--- /dev/null
+++ b/ext/standard/tests/file/popen_pclose_basic.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test popen() and pclose function: basic functionality
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN' )
+ die("skip Not Valid for Windows");
+?>
+
+--FILE--
+<?php
+/*
+ * Prototype: resource popen ( string command, string mode )
+ * Description: Opens process file pointer.
+ *
+ * Prototype: int pclose ( resource handle );
+ * Description: Closes process file pointer.
+ */
+
+$file_path = dirname(__FILE__);
+require($file_path."/file.inc");
+
+echo "*** Testing popen() and pclose() with different processes ***\n";
+
+echo "-- Testing popen(): reading from the pipe --\n";
+$dirpath = $file_path."/popen_basic";
+mkdir($dirpath);
+touch($dirpath."/popen_basic.tmp");
+define('CMD', "ls $dirpath");
+$file_handle = popen(CMD, 'r');
+fpassthru($file_handle);
+pclose($file_handle);
+
+echo "-- Testing popen(): reading from a file using 'cat' command --\n";
+create_files($dirpath, 1, "text_with_new_line", 0755, 100, "w", "popen_basic", 1, "bytes");
+$filename = $dirpath."/popen_basic1.tmp";
+$command = "cat $filename";
+$file_handle = popen($command, "r");
+$return_value = fpassthru($file_handle);
+echo "\n";
+var_dump($return_value);
+pclose($file_handle);
+delete_files($dirpath, 1);
+
+echo "*** Testing popen(): writing to the pipe ***\n";
+$arr = array("ggg", "ddd", "aaa", "sss");
+$file_handle = popen("sort", "w");
+$counter = 0;
+$newline = "\n";
+foreach($arr as $str) {
+ fwrite($file_handle, (binary)$str);
+ fwrite($file_handle, (binary)$newline);
+}
+pclose($file_handle);
+
+
+echo "*** Testing for return type of popen() and pclose() functions ***\n";
+$string = "Test String";
+$return_value_popen = popen("echo $string", "r");
+var_dump( is_resource($return_value_popen) );
+fpassthru($return_value_popen);
+$return_value_pclose = pclose($return_value_popen);
+var_dump( is_int($return_value_pclose) );
+
+echo "\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dirpath = $file_path."/popen_basic";
+unlink($dirpath."/popen_basic.tmp");
+unlink($dirpath."/popen_basic1.tmp");
+rmdir($dirpath);
+?>
+
+--EXPECTF--
+*** Testing popen() and pclose() with different processes ***
+-- Testing popen(): reading from the pipe --
+popen_basic.tmp
+-- Testing popen(): reading from a file using 'cat' command --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+*** Testing popen(): writing to the pipe ***
+aaa
+ddd
+ggg
+sss
+*** Testing for return type of popen() and pclose() functions ***
+bool(true)
+Test String
+bool(true)
+
+--- Done ---
diff --git a/ext/standard/tests/file/popen_pclose_error-sunos.phpt b/ext/standard/tests/file/popen_pclose_error-sunos.phpt
new file mode 100644
index 0000000..b63dbeb
--- /dev/null
+++ b/ext/standard/tests/file/popen_pclose_error-sunos.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test popen() and pclose function: error conditions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'Sun')
+ die("skip Only valid for Sun Solaris");
+?>
+
+--FILE--
+<?php
+/*
+ * Prototype: resource popen ( string command, string mode )
+ * Description: Opens process file pointer.
+
+ * Prototype: int pclose ( resource handle );
+ * Description: Closes process file pointer.
+ */
+$file_path = dirname(__FILE__);
+echo "*** Testing for error conditions ***\n";
+var_dump( popen() ); // Zero Arguments
+var_dump( popen("abc.txt") ); // Single Argument
+var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument
+var_dump( pclose() );
+$file_handle = fopen($file_path."/popen.tmp", "w");
+var_dump( pclose($file_handle, $file_handle) );
+fclose($file_handle);
+var_dump( pclose(1) );
+echo "\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/popen.tmp");
+?>
+--EXPECTF--
+*** Testing for error conditions ***
+
+Warning: Wrong parameter count for popen() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for popen() in %s on line %d
+NULL
+sh: abc.txt: not found
+resource(%d) of type (stream)
+
+Warning: Wrong parameter count for pclose() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for pclose() in %s on line %d
+NULL
+
+Warning: pclose(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+
+--- Done ---
diff --git a/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt b/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt
new file mode 100644
index 0000000..e41d6b1
--- /dev/null
+++ b/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test popen() and pclose function: error conditions
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' && PHP_DEBUG) die("skip Valid only on Windows");
+if(!PHP_DEBUG) die("skip Not Valid for release builds");
+
+ob_start();phpinfo(INFO_GENERAL);$inf=ob_get_contents(); ob_end_clean();
+if (!(strpos($inf, 'MSVC9') || strpos($inf, 'MSVC8'))) die("skip Not Valid for build done with VC < 8");
+?>
+
+--FILE--
+<?php
+/*
+ * Prototype: resource popen ( string command, string mode )
+ * Description: Opens process file pointer.
+
+ * Prototype: int pclose ( resource handle );
+ * Description: Closes process file pointer.
+ */
+$file_path = dirname(__FILE__);
+echo "*** Testing for error conditions ***\n";
+var_dump( popen() ); // Zero Arguments
+var_dump( popen("abc.txt") ); // Single Argument
+var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument
+var_dump( pclose() );
+$file_handle = fopen($file_path."/popen.tmp", "w");
+var_dump( pclose($file_handle, $file_handle) );
+pclose($file_handle);
+var_dump( pclose(1) );
+echo "\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/popen.tmp");
+?>
+--EXPECTF--
+*** Testing for error conditions ***
+
+Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: Invalid parameter detected in CRT function '_fdopen' (%s:%d) in %s on line %d
+
+Warning: popen(abc.txt,rw): Invalid argument in %s on line %d
+bool(false)
+
+Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: pclose() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+--- Done ---'abc.txt' is not recognized as an internal or external command,
+operable program or batch file.
diff --git a/ext/standard/tests/file/popen_pclose_error-win32.phpt b/ext/standard/tests/file/popen_pclose_error-win32.phpt
new file mode 100644
index 0000000..9f9593c
--- /dev/null
+++ b/ext/standard/tests/file/popen_pclose_error-win32.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test popen() and pclose function: error conditions
+
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die("skip Valid only on Windows");
+if (PHP_DEBUG) die("skip Not Valid for debug builds");
+?>
+
+--FILE--
+<?php
+/*
+ * Prototype: resource popen ( string command, string mode )
+ * Description: Opens process file pointer.
+
+ * Prototype: int pclose ( resource handle );
+ * Description: Closes process file pointer.
+ */
+$file_path = dirname(__FILE__);
+echo "*** Testing for error conditions ***" . PHP_EOL;
+var_dump( popen() ); // Zero Arguments
+var_dump( popen("abc.txt") ); // Single Argument
+var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument
+var_dump( pclose() );
+$file_handle = fopen($file_path."/popen.tmp", "w");
+var_dump( pclose($file_handle, $file_handle) );
+pclose($file_handle);
+var_dump( pclose(1) );
+echo PHP_EOL . PHP_EOL . "--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/popen.tmp");
+?>
+--EXPECTF--
+*** Testing for error conditions ***
+
+Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: popen(abc.txt,rw): Invalid argument in %s on line %d
+bool(false)
+
+Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: pclose() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+
+--- Done ---'abc.txt' is not recognized as an internal or external command,
+operable program or batch file.
diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt
new file mode 100644
index 0000000..72ce734
--- /dev/null
+++ b/ext/standard/tests/file/popen_pclose_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test popen() and pclose function: error conditions
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN' || strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN')
+ die("skip Not Valid for Windows & Sun Solaris");
+?>
+
+--FILE--
+<?php
+/*
+ * Prototype: resource popen ( string command, string mode )
+ * Description: Opens process file pointer.
+
+ * Prototype: int pclose ( resource handle );
+ * Description: Closes process file pointer.
+ */
+$file_path = dirname(__FILE__);
+echo "*** Testing for error conditions ***\n";
+var_dump( popen() ); // Zero Arguments
+var_dump( popen("abc.txt") ); // Single Argument
+var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument
+var_dump( pclose() );
+$file_handle = fopen($file_path."/popen.tmp", "w");
+var_dump( pclose($file_handle, $file_handle) );
+fclose($file_handle);
+var_dump( pclose(1) );
+echo "\n--- Done ---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/popen.tmp");
+?>
+--EXPECTF--
+*** Testing for error conditions ***
+
+Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: popen(abc.txt,rw): %s on line %d
+bool(false)
+
+Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: pclose() expects parameter 1 to be resource, integer given in %s on line %d
+bool(false)
+
+--- Done ---
diff --git a/ext/standard/tests/file/proc_open01.phpt b/ext/standard/tests/file/proc_open01.phpt
new file mode 100644
index 0000000..3348403
--- /dev/null
+++ b/ext/standard/tests/file/proc_open01.phpt
@@ -0,0 +1,69 @@
+--TEST--
+proc_open() regression test 1 (proc_open() leak)
+--FILE--
+<?php
+$pipes = array(1, 2, 3);
+$orig_pipes = $pipes;
+$php = getenv('TEST_PHP_EXECUTABLE');
+if ($php === false) {
+ die("no php executable defined");
+}
+$proc = proc_open(
+ "$php -n",
+ array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')),
+ $pipes, getcwd(), array(), array('binary_pipes' => true)
+);
+if ($proc === false) {
+ print "something went wrong.\n";
+}
+var_dump($pipes);
+stream_set_blocking($pipes[1], FALSE);
+$test_string = b"yay!\n";
+fwrite($pipes[0], $test_string);
+fflush($pipes[0]);
+fclose($pipes[0]);
+$cnt = '';
+$n=0;
+for ($left = strlen($test_string); $left > 0;) {
+ if (++$n >1000) {
+ print "terminated after 1000 iterations\n";
+ break;
+ }
+ $read_fds = array($pipes[1]);
+ $write_fds = NULL;
+ $exp_fds = NULL;
+ $retval = stream_select($read_fds, $write_fds, $exp_fds, 5);
+ if ($retval === false) {
+ print "select() failed\n";
+ break;
+ }
+ if ($retval === 0) {
+ print "timed out\n";
+ break;
+ }
+ $buf = fread($pipes[1], 1024);
+ $cnt .= $buf;
+ $left -= strlen($buf);
+}
+var_dump($cnt);
+fclose($pipes[1]);
+proc_close($proc);
+var_dump($orig_pipes);
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+}
+%unicode|string%(5) "yay!
+"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/ext/standard/tests/file/readfile_basic-win32.phpt b/ext/standard/tests/file/readfile_basic-win32.phpt
new file mode 100644
index 0000000..05e18a2
--- /dev/null
+++ b/ext/standard/tests/file/readfile_basic-win32.phpt
@@ -0,0 +1,530 @@
+--TEST--
+Test readfile() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
+ Description: Outputs a file
+*/
+// common file used
+require(dirname(__FILE__) . '/file.inc');
+
+echo "*** Testing readfile() : basic functionality ***\n";
+$file_path = dirname(__FILE__);
+$file_prefix = "readfile_basic"; // temp files created with this prefix
+
+// the content that is filled into the temp files as created
+$filetypes = array("numeric", "text", "empty", "alphanumeric", "text_with_new_line");
+// different file modes
+$filemodes = array("w", "wt", "wb", "w+", "w+b", "w+t",
+ "a", "at", "ab", "a+", "a+b", "a+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t");
+
+// create file, read the file content, delete file
+foreach($filetypes as $type) {
+ echo "\n-- File filled with content type: $type --\n";
+ foreach($filemodes as $mode) {
+ echo "-- File opened with mode: $mode --\n";
+ if ( strstr($mode, "x") ) {
+ $fp = fopen($file_path."/".$file_prefix."1.tmp", $mode);
+ fill_file($fp, $type, 100);
+ fclose($fp);
+ } else {
+ // creating file in write mode
+ create_files($file_path, 1, $type, 0755, 100, $mode, $file_prefix, 1, "byte");
+ }
+ $count = readfile($file_path."/".$file_prefix."1.tmp");
+ echo "\n";
+ var_dump($count);
+ // delete files created
+ delete_files($file_path, 1, $file_prefix, 1);
+ }
+}
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing readfile() : basic functionality ***
+
+-- File filled with content type: numeric --
+-- File opened with mode: w --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: wt --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: wb --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: w+ --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: w+b --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: w+t --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: at --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: ab --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a+ --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a+b --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a+t --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: xb --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: xt --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x+ --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x+b --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x+t --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+
+-- File filled with content type: text --
+-- File opened with mode: w --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: wt --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: wb --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: w+ --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: w+b --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: w+t --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: at --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: ab --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a+ --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a+b --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a+t --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: xb --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: xt --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x+ --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x+b --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x+t --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+
+-- File filled with content type: empty --
+-- File opened with mode: w --
+
+int(0)
+-- File opened with mode: wt --
+
+int(0)
+-- File opened with mode: wb --
+
+int(0)
+-- File opened with mode: w+ --
+
+int(0)
+-- File opened with mode: w+b --
+
+int(0)
+-- File opened with mode: w+t --
+
+int(0)
+-- File opened with mode: a --
+
+int(0)
+-- File opened with mode: at --
+
+int(0)
+-- File opened with mode: ab --
+
+int(0)
+-- File opened with mode: a+ --
+
+int(0)
+-- File opened with mode: a+b --
+
+int(0)
+-- File opened with mode: a+t --
+
+int(0)
+-- File opened with mode: x --
+
+int(0)
+-- File opened with mode: xb --
+
+int(0)
+-- File opened with mode: xt --
+
+int(0)
+-- File opened with mode: x+ --
+
+int(0)
+-- File opened with mode: x+b --
+
+int(0)
+-- File opened with mode: x+t --
+
+int(0)
+
+-- File filled with content type: alphanumeric --
+-- File opened with mode: w --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: wt --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: wb --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: w+ --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: w+b --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: w+t --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: at --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: ab --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a+ --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a+b --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a+t --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: xb --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: xt --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x+ --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x+b --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x+t --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+
+-- File filled with content type: text_with_new_line --
+-- File opened with mode: w --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: wt --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(111)
+-- File opened with mode: wb --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: w+ --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: w+b --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: w+t --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(111)
+-- File opened with mode: a --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: at --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(111)
+-- File opened with mode: ab --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a+ --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a+b --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a+t --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(111)
+-- File opened with mode: x --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: xb --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: xt --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(111)
+-- File opened with mode: x+ --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: x+b --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: x+t --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(111)
+Done
diff --git a/ext/standard/tests/file/readfile_basic.phpt b/ext/standard/tests/file/readfile_basic.phpt
new file mode 100644
index 0000000..e67fd58
--- /dev/null
+++ b/ext/standard/tests/file/readfile_basic.phpt
@@ -0,0 +1,530 @@
+--TEST--
+Test readfile() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
+ Description: Outputs a file
+*/
+// common file used
+require(dirname(__FILE__) . '/file.inc');
+
+echo "*** Testing readfile() : basic functionality ***\n";
+$file_path = dirname(__FILE__);
+$file_prefix = "readfile_basic"; // temp files created with this prefix
+
+// the content that is filled into the temp files as created
+$filetypes = array("numeric", "text", "empty", "alphanumeric", "text_with_new_line");
+// different file modes
+$filemodes = array("w", "wt", "wb", "w+", "w+b", "w+t",
+ "a", "at", "ab", "a+", "a+b", "a+t",
+ "x", "xb", "xt", "x+", "x+b", "x+t");
+
+// create file, read the file content, delete file
+foreach($filetypes as $type) {
+ echo "\n-- File filled with content type: $type --\n";
+ foreach($filemodes as $mode) {
+ echo "-- File opened with mode: $mode --\n";
+ if ( strstr($mode, "x") ) {
+ $fp = fopen($file_path."/".$file_prefix."1.tmp", $mode);
+ fill_file($fp, $type, 100);
+ fclose($fp);
+ } else {
+ // creating file in write mode
+ create_files($file_path, 1, $type, 0755, 100, $mode, $file_prefix, 1, "byte");
+ }
+ $count = readfile($file_path."/".$file_prefix."1.tmp");
+ echo "\n";
+ var_dump($count);
+ // delete files created
+ delete_files($file_path, 1, $file_prefix, 1);
+ }
+}
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing readfile() : basic functionality ***
+
+-- File filled with content type: numeric --
+-- File opened with mode: w --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: wt --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: wb --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: w+ --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: w+b --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: w+t --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: at --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: ab --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a+ --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a+b --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: a+t --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: xb --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: xt --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x+ --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x+b --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+-- File opened with mode: x+t --
+2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
+int(100)
+
+-- File filled with content type: text --
+-- File opened with mode: w --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: wt --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: wb --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: w+ --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: w+b --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: w+t --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: at --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: ab --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a+ --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a+b --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: a+t --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: xb --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: xt --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x+ --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x+b --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+-- File opened with mode: x+t --
+text text text text text text text text text text text text text text text text text text text text
+int(100)
+
+-- File filled with content type: empty --
+-- File opened with mode: w --
+
+int(0)
+-- File opened with mode: wt --
+
+int(0)
+-- File opened with mode: wb --
+
+int(0)
+-- File opened with mode: w+ --
+
+int(0)
+-- File opened with mode: w+b --
+
+int(0)
+-- File opened with mode: w+t --
+
+int(0)
+-- File opened with mode: a --
+
+int(0)
+-- File opened with mode: at --
+
+int(0)
+-- File opened with mode: ab --
+
+int(0)
+-- File opened with mode: a+ --
+
+int(0)
+-- File opened with mode: a+b --
+
+int(0)
+-- File opened with mode: a+t --
+
+int(0)
+-- File opened with mode: x --
+
+int(0)
+-- File opened with mode: xb --
+
+int(0)
+-- File opened with mode: xt --
+
+int(0)
+-- File opened with mode: x+ --
+
+int(0)
+-- File opened with mode: x+b --
+
+int(0)
+-- File opened with mode: x+t --
+
+int(0)
+
+-- File filled with content type: alphanumeric --
+-- File opened with mode: w --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: wt --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: wb --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: w+ --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: w+b --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: w+t --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: at --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: ab --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a+ --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a+b --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: a+t --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: xb --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: xt --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x+ --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x+b --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+-- File opened with mode: x+t --
+ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12
+int(100)
+
+-- File filled with content type: text_with_new_line --
+-- File opened with mode: w --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: wt --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: wb --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: w+ --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: w+b --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: w+t --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: at --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: ab --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a+ --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a+b --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: a+t --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: x --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: xb --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: xt --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: x+ --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: x+b --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+-- File opened with mode: x+t --
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line of text
+line
+line
+int(100)
+Done
diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt
new file mode 100644
index 0000000..2d5d377
--- /dev/null
+++ b/ext/standard/tests/file/readfile_error.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test readfile() function: error conditions
+--FILE--
+<?php
+/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
+ Description: Outputs a file
+*/
+
+$context = stream_context_create();
+
+echo "*** Test readfile(): error conditions ***\n";
+echo "-- Testing readfile() with unexpected no. of arguments --\n";
+var_dump( readfile() ); // args < expected
+var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected
+
+echo "\n-- Testing readfile() with invalid arguments --\n";
+// invalid arguments
+var_dump( readfile(NULL) ); // NULL as $filename
+var_dump( readfile('') ); // empty string as $filename
+var_dump( readfile(false) ); // boolean false as $filename
+var_dump( readfile(__FILE__, false, '') ); // empty string as $context
+var_dump( readfile(__FILE__, true, false) ); // boolean false as $context
+
+echo "\n-- Testing readfile() with non-existent file --\n";
+$non_existent_file = dirname(__FILE__)."/non_existent_file.tmp";
+var_dump( readfile($non_existent_file) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Test readfile(): error conditions ***
+-- Testing readfile() with unexpected no. of arguments --
+
+Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+-- Testing readfile() with invalid arguments --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: readfile() expects parameter 3 to be resource, boolean given in %s on line %d
+bool(false)
+
+-- Testing readfile() with non-existent file --
+
+Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/readfile_variation1.phpt b/ext/standard/tests/file/readfile_variation1.phpt
new file mode 100644
index 0000000..6bfe7dd
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test readfile() function: usage variation - stream_context
+--FILE--
+<?php
+/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
+ Description: Outputs a file
+*/
+
+/* test readfile() with third argument : context */
+
+// include file.inc
+require("file.inc");
+$file_path = dirname(__FILE__);
+
+/* Variation 1 : Check working of third argument of readfile() */
+
+echo "*** Testing readfile(): checking third argument ***\n";
+// creating a context
+$context = stream_context_create();
+// temp file name used here
+$filename = "$file_path/readfile_variation1.tmp";
+
+// create file
+$fp = fopen($filename, "w");
+fill_file($fp, "text_with_new_line", 50);
+fclose($fp);
+$count = readfile($filename, true, $context);
+echo "\n";
+var_dump($count);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/readfile_variation1.tmp");
+?>
+--EXPECT--
+*** Testing readfile(): checking third argument ***
+line
+line of text
+line
+line of text
+line
+line of t
+int(50)
+Done
diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt
new file mode 100644
index 0000000..61f6aba
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation10-win32.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Test readfile() function : variation - various invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip run only on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing readfile() : variation ***\n";
+
+/* An array of files */
+$names_arr = array(
+ /* Invalid args */
+ "-1" => -1,
+ "TRUE" => TRUE,
+ "FALSE" => FALSE,
+ "NULL" => NULL,
+ "\"\"" => "",
+ "\" \"" => " ",
+ "\\0" => "\0",
+ "array()" => array(),
+
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir" => "/no/such/file/dir",
+ "php/php"=> "php/php"
+
+);
+
+foreach($names_arr as $key => $value) {
+ echo "\n-- Filename: $key --\n";
+ readfile($value);
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing readfile() : variation ***
+
+-- Filename: -1 --
+
+Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d
+
+-- Filename: TRUE --
+
+Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d
+
+-- Filename: FALSE --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: NULL --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: "" --
+
+Warning: readfile(): Filename cannot be empty in %s on line %d
+
+-- Filename: " " --
+
+Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
+
+-- Filename: \0 --
+
+Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d
+
+-- Filename: array() --
+
+Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d
+
+-- Filename: /no/such/file/dir --
+
+Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
+
+-- Filename: php/php --
+
+Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
+===Done===
diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt
new file mode 100644
index 0000000..3bbc329
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation10.phpt
Binary files differ
diff --git a/ext/standard/tests/file/readfile_variation2.phpt b/ext/standard/tests/file/readfile_variation2.phpt
new file mode 100644
index 0000000..0c43bf5
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation2.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Test readfile() function: usage variations - links
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
+ Description: Outputs a file
+*/
+
+/* Variation 2 : Create file
+ Create soft/hard link to it
+ Read link using readfile()
+ Delete file and its link
+*/
+
+// include file.inc
+require("file.inc");
+
+$file_path = dirname(__FILE__);
+
+// temp file used here
+$filename = "$file_path/readfile_variation2.tmp";
+
+// create temp file and insert data into it
+$fp = fopen($filename, "w");
+fill_file($fp, "text_with_new_line", 50);
+fclose($fp);
+
+// temp link name used
+$linkname = "$file_path/readfile_variation2_link.tmp";
+
+/* Checking readfile() operation on soft link */
+echo "*** Testing readfile() on soft link ***\n";
+
+// create soft link to $filename
+var_dump( symlink($filename, $linkname) );
+// readfile() on soft link
+$count = readfile($linkname); // with default args
+echo "\n";
+var_dump($count);
+// delete link
+unlink($linkname);
+
+/* Checking readfile() operation on hard link */
+echo "\n*** Testing readfile() on hard link ***\n";
+// create hard link to $filename
+var_dump( link($filename, $linkname) );
+// readfile() on hard link
+$count = readfile($linkname); // default args
+echo "\n";
+var_dump($count);
+// delete link
+unlink($linkname);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/readfile_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing readfile() on soft link ***
+bool(true)
+line
+line of text
+line
+line of text
+line
+line of t
+int(50)
+
+*** Testing readfile() on hard link ***
+bool(true)
+line
+line of text
+line
+line of text
+line
+line of t
+int(50)
+Done
diff --git a/ext/standard/tests/file/readfile_variation3.phpt b/ext/standard/tests/file/readfile_variation3.phpt
new file mode 100644
index 0000000..854642a
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation3.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test readfile() function: usage variation - include path
+--FILE--
+<?php
+/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
+ Description: Outputs a file
+*/
+/* test readfile() by providing an include path, second argument */
+
+// include file.inc
+require("file.inc");
+
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/readfile_variation3";
+
+echo "*** Testing readfile(): checking second argument, include path ***\n";
+// temp dir created
+mkdir($dirname);
+// temp file name used here
+$filename = "$dirname/readfile_variation3.tmp";
+// create file
+$fp = fopen($filename, "w");
+fill_file($fp, "text_with_new_line", 50);
+fclose($fp);
+
+// including $dirname in 'include_path'
+ini_set('include_path',$dirname);
+// 'include_path' set to true
+$count = readfile("readfile_variation3.tmp", true);
+echo "\n";
+var_dump($count);
+// use the context argument with include path
+echo "*** Testing readfile(): checking second argument, include path with context specified ***\n";
+$context = stream_context_create();
+$count = readfile("readfile_variation3.tmp", true, $context);
+echo "\n";
+var_dump($count);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/readfile_variation3/readfile_variation3.tmp");
+rmdir(dirname(__FILE__)."/readfile_variation3");
+?>
+--EXPECT--
+*** Testing readfile(): checking second argument, include path ***
+line
+line of text
+line
+line of text
+line
+line of t
+int(50)
+*** Testing readfile(): checking second argument, include path with context specified ***
+line
+line of text
+line
+line of text
+line
+line of t
+int(50)
+Done
diff --git a/ext/standard/tests/file/readfile_variation4.phpt b/ext/standard/tests/file/readfile_variation4.phpt
new file mode 100644
index 0000000..94b3326
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation4.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test readfile() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing readfile() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'readFileVar4.tmp';
+$use_include_path = false;
+$h = fopen($filename,'wb');
+fwrite($h, "testing readfile");
+fclose($h);
+
+
+$fileRes = fopen(__FILE__, 'r');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ // file resource
+ 'file resource' => $fileRes,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $h = readfile($filename, $use_include_path, $value);
+ if ($h == false) {
+ echo "file not read\n";
+ }
+ else {
+ echo "\n";
+ }
+};
+
+unlink($filename);
+fclose($fileRes);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing readfile() : usage variation ***
+
+--int 0--
+Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d)
+file not read
+
+--int 1--
+Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d)
+file not read
+
+--int 12345--
+Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d)
+file not read
+
+--int -12345--
+Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d)
+file not read
+
+--float 10.5--
+Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d)
+file not read
+
+--float -10.5--
+Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d)
+file not read
+
+--float 12.3456789000e10--
+Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d)
+file not read
+
+--float -12.3456789000e10--
+Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d)
+file not read
+
+--float .5--
+Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d)
+file not read
+
+--empty array--
+Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d)
+file not read
+
+--int indexed array--
+Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d)
+file not read
+
+--associative array--
+Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d)
+file not read
+
+--nested arrays--
+Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d)
+file not read
+
+--uppercase NULL--
+testing readfile
+
+--lowercase null--
+testing readfile
+
+--lowercase true--
+Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d)
+file not read
+
+--lowercase false--
+Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d)
+file not read
+
+--uppercase TRUE--
+Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d)
+file not read
+
+--uppercase FALSE--
+Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d)
+file not read
+
+--empty string DQ--
+Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d)
+file not read
+
+--empty string SQ--
+Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d)
+file not read
+
+--string DQ--
+Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d)
+file not read
+
+--string SQ--
+Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d)
+file not read
+
+--mixed case string--
+Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d)
+file not read
+
+--heredoc--
+Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d)
+file not read
+
+--instance of classWithToString--
+Error: 2 - readfile() expects parameter 3 to be resource, object given, %s(%d)
+file not read
+
+--instance of classWithoutToString--
+Error: 2 - readfile() expects parameter 3 to be resource, object given, %s(%d)
+file not read
+
+--undefined var--
+testing readfile
+
+--unset var--
+testing readfile
+
+--file resource--
+Error: 2 - readfile(): supplied resource is not a valid Stream-Context resource, %s(%d)
+testing readfile
+===DONE===
diff --git a/ext/standard/tests/file/readfile_variation5.phpt b/ext/standard/tests/file/readfile_variation5.phpt
new file mode 100644
index 0000000..21856f8
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation5.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test readfile() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing readfile() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'readFileVar5.tmp';
+$use_include_path = false;
+$h = fopen($filename,'wb');
+fwrite($h, "testing readfile");
+fclose($h);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 use_include_path
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = readfile($filename, $value);
+ if ($res == false) {
+ echo "File not read\n";
+ }
+ else {
+ echo "\n";
+ }
+};
+
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing readfile() : usage variation ***
+
+--int 0--
+testing readfile
+
+--int 1--
+testing readfile
+
+--int 12345--
+testing readfile
+
+--int -12345--
+testing readfile
+
+--float 10.5--
+testing readfile
+
+--float -10.5--
+testing readfile
+
+--float 12.3456789000e10--
+testing readfile
+
+--float -12.3456789000e10--
+testing readfile
+
+--float .5--
+testing readfile
+
+--empty array--
+Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d)
+File not read
+
+--int indexed array--
+Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d)
+File not read
+
+--associative array--
+Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d)
+File not read
+
+--nested arrays--
+Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d)
+File not read
+
+--uppercase NULL--
+testing readfile
+
+--lowercase null--
+testing readfile
+
+--lowercase true--
+testing readfile
+
+--lowercase false--
+testing readfile
+
+--uppercase TRUE--
+testing readfile
+
+--uppercase FALSE--
+testing readfile
+
+--empty string DQ--
+testing readfile
+
+--empty string SQ--
+testing readfile
+
+--string DQ--
+testing readfile
+
+--string SQ--
+testing readfile
+
+--mixed case string--
+testing readfile
+
+--heredoc--
+testing readfile
+
+--instance of classWithToString--
+Error: 2 - readfile() expects parameter 2 to be boolean, object given, %s(%d)
+File not read
+
+--instance of classWithoutToString--
+Error: 2 - readfile() expects parameter 2 to be boolean, object given, %s(%d)
+File not read
+
+--undefined var--
+testing readfile
+
+--unset var--
+testing readfile
+===DONE===
diff --git a/ext/standard/tests/file/readfile_variation6.phpt b/ext/standard/tests/file/readfile_variation6.phpt
new file mode 100644
index 0000000..02e7082
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation6.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test readfile() function : variation - test include path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+echo "*** Testing readfile() : variation ***\n";
+// this doesn't create the include dirs in this directory
+// we change to this to ensure we are not part of the
+// include paths.
+$thisTestDir = "readfileVar6.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = "afile.txt";
+$secondFile = $dir2."/".$filename;
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $secondFile, $filename;
+ $h = fopen($secondFile, "w");
+ fwrite($h, "File in include path");
+ fclose($h);
+ readfile($filename, true);
+ echo "\n";
+ unlink($secondFile);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing readfile() : variation ***
+File in include path
+===DONE===
diff --git a/ext/standard/tests/file/readfile_variation7.phpt b/ext/standard/tests/file/readfile_variation7.phpt
new file mode 100644
index 0000000..d26f52f
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation7.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test readfile() function : variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+require_once('fopen_include_path.inc');
+
+echo "*** Testing readfile() : variation ***\n";
+// this doesn't create the include dirs in this directory
+// we change to this to ensure we are not part of the
+// include paths.
+$thisTestDir = "readfileVar7.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$filename = "readFileVar7.tmp";
+$scriptLocFile = dirname(__FILE__)."/".$filename;
+
+$newpath = create_include_path();
+set_include_path($newpath);
+runtest();
+teardown_include_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+
+function runtest() {
+ global $scriptLocFile, $filename;
+ $h = fopen($scriptLocFile, "w");
+ fwrite($h, "File in script location");
+ fclose($h);
+ readfile($filename, true);
+ echo "\n";
+ unlink($scriptLocFile);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing readfile() : variation ***
+File in script location
+===DONE===
diff --git a/ext/standard/tests/file/readfile_variation8-win32.phpt b/ext/standard/tests/file/readfile_variation8-win32.phpt
new file mode 100644
index 0000000..a66af5d
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation8-win32.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test readfile() function : variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing readfile() : variation ***\n";
+$mainDir = "readfileVar8";
+$subDir = "readfileVar8Sub";
+$absMainDir = dirname(__FILE__)."\\".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."\\".$subDir;
+mkdir($absSubDir);
+
+$theFile = "fileToRead.tmp";
+$absFile = $absSubDir.'/'.$theFile;
+
+// create the file
+$h = fopen($absFile,"w");
+fwrite($h, "The File Contents");
+fclose($h);
+
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3);
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir\\",
+ "$absSubDir\\..\\".$subDir,
+ "$absSubDir\\\\..\\.\\".$subDir,
+ "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir,
+ "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir,
+ "$absSubDir\\BADDIR",
+
+ // relative paths
+ $mainDir."\\".$subDir,
+ $mainDir."\\\\".$subDir,
+ $mainDir."\\\\\\".$subDir,
+ ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir,
+ "BADDIR",
+
+ // unixifed path
+ $unixifiedDir,
+);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- $dir --\n";
+ $ok = readfile($dir.'\\'.$theFile);
+ if ($ok === 1) {
+ echo "\n";
+ }
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing readfile() : variation ***
+
+-- %s\readfileVar8\readfileVar8Sub\ --
+The File Contents
+-- %s\readfileVar8\readfileVar8Sub\..\readfileVar8Sub --
+The File Contents
+-- %s\readfileVar8\readfileVar8Sub\\..\.\readfileVar8Sub --
+The File Contents
+-- %s\readfileVar8\readfileVar8Sub\..\..\readfileVar8\.\readfileVar8Sub --
+The File Contents
+-- %s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub --
+
+Warning: readfile(%s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+
+-- %s\readfileVar8\readfileVar8Sub\BADDIR --
+
+Warning: readfile(%s\readfileVar8\readfileVar8Sub\BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+
+-- readfileVar8\readfileVar8Sub --
+The File Contents
+-- readfileVar8\\readfileVar8Sub --
+The File Contents
+-- readfileVar8\\\readfileVar8Sub --
+The File Contents
+-- .\readfileVar8\..\readfileVar8\readfileVar8Sub --
+The File Contents
+-- BADDIR --
+
+Warning: readfile(BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+
+-- /%s/readfileVar8/readfileVar8Sub --
+The File Contents
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/readfile_variation9.phpt b/ext/standard/tests/file/readfile_variation9.phpt
new file mode 100644
index 0000000..c802f40
--- /dev/null
+++ b/ext/standard/tests/file/readfile_variation9.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test readfile() function : variation - variable types of path
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
+ * Description: Output a file or a URL
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing readfile() : variation ***\n";
+$mainDir = "readfileVar8";
+$subDir = "readfileVar8Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$theFile = "fileToRead.tmp";
+$absFile = $absSubDir.'/'.$theFile;
+
+// create the file
+$h = fopen($absFile,"w");
+fwrite($h, "The File Contents");
+fclose($h);
+
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ $ok = readfile($dir.'/'.$theFile);
+ if ($ok === 1) {
+ echo "\n";
+ }
+}
+
+unlink($absFile);
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing readfile() : variation ***
+
+-- Iteration 1 --
+The File Contents
+-- Iteration 2 --
+The File Contents
+-- Iteration 3 --
+The File Contents
+-- Iteration 4 --
+The File Contents
+-- Iteration 5 --
+
+Warning: readfile(%sreadfileVar8Sub/..///readfileVar8Sub//..//../readfileVar8Sub/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+
+-- Iteration 6 --
+
+Warning: readfile(%sreadfileVar8Sub/BADDIR/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+
+-- Iteration 7 --
+The File Contents
+-- Iteration 8 --
+The File Contents
+-- Iteration 9 --
+The File Contents
+-- Iteration 10 --
+The File Contents
+-- Iteration 11 --
+
+Warning: readfile(BADDIR/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/readlink_realpath_basic1.phpt b/ext/standard/tests/file/readlink_realpath_basic1.phpt
new file mode 100644
index 0000000..99195e2
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_basic1.phpt
@@ -0,0 +1,111 @@
+--TEST--
+Test readlink() and realpath functions: basic functionality - diff. path notation for links(Bug #42038)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+/* creating directories, symbolic links and files */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/readlink_realpath_basic1/home/test/", 0777, true);
+
+$file_handle1 = fopen("$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp", "w");
+$file_handle2 = fopen("$file_path/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp", "w");
+$file_handle3 = fopen("$file_path/readlink_realpath_basic1/readlink_realpath_basic1.tmp", "w");
+fclose($file_handle1);
+fclose($file_handle2);
+fclose($file_handle3);
+
+symlink("$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp",
+ "$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1_link.tmp");
+symlink("$file_path/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp",
+ "$file_path/readlink_realpath_basic1/home/readlink_realpath_basic1_link.tmp");
+
+
+echo "*** Testing readlink() and realpath(): with valid and invalid path ***\n";
+$linknames = array (
+ /* linknames resulting in valid paths */
+ "$file_path/readlink_realpath_basic1/home/readlink_realpath_basic1_link.tmp",
+ "$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1_link.tmp",
+ "$file_path/readlink_realpath_basic1//home/test//../test/./readlink_realpath_basic1_link.tmp",
+
+ /* linknames with invalid linkpath */
+ "$file_path///readlink_realpath_basic1/home//..//././test//readlink_realpath_basic1_link.tmp",
+ "$file_path/readlink_realpath_basic1/home/../home/../test/../readlink_realpath_basic1_link.tmp",
+ "$file_path/readlink_realpath_basic1/..readlink_realpath_basic1_link.tmp",
+ "$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1_link.tmp/"
+);
+
+$counter = 1;
+/* loop through $files to read the linkpath of
+ the link created from each $file in the above array */
+foreach($linknames as $link) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( readlink($link) );
+ var_dump( realpath($link) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/readlink_realpath_basic1";
+unlink("$name_prefix/home/test/readlink_realpath_basic1.tmp");
+unlink("$name_prefix/home/readlink_realpath_basic1.tmp");
+unlink("$name_prefix/readlink_realpath_basic1.tmp");
+unlink("$name_prefix/home/test/readlink_realpath_basic1_link.tmp");
+unlink("$name_prefix/home/readlink_realpath_basic1_link.tmp");
+rmdir("$name_prefix/home/test/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing readlink() and realpath(): with valid and invalid path ***
+
+-- Iteration 1 --
+string(%d) "%s/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp"
+string(%d) "%s/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp"
+
+-- Iteration 2 --
+string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp"
+string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp"
+
+-- Iteration 3 --
+string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp"
+string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp"
+
+-- Iteration 4 --
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+
+-- Iteration 5 --
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+
+-- Iteration 6 --
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+%s
+
+-- Iteration 7 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+%s
+Done
diff --git a/ext/standard/tests/file/readlink_realpath_basic2.phpt b/ext/standard/tests/file/readlink_realpath_basic2.phpt
new file mode 100644
index 0000000..91955cd
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_basic2.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test readlink() and realpath functions: basic functionality - diff. path notation for files
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+/* creating directories, symbolic links and files */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/readlink_realpath_basic2/home/test/", 0777, true);
+
+$file_handle1 = fopen("$file_path/readlink_realpath_basic2/home/test/readlink_realpath_basic2.tmp", "w");
+$file_handle2 = fopen("$file_path/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp", "w");
+$file_handle3 = fopen("$file_path/readlink_realpath_basic2/readlink_realpath_basic2.tmp", "w");
+fclose($file_handle1);
+fclose($file_handle2);
+fclose($file_handle3);
+
+echo "\n*** Testing realpath() on filenames ***\n";
+$filenames = array (
+ /* filenames resulting in valid paths */
+ "$file_path/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp",
+ "$file_path/readlink_realpath_basic2/readlink_realpath_basic2.tmp",
+ "$file_path/readlink_realpath_basic2//home/test//../test/./readlink_realpath_basic2.tmp",
+ "$file_path/readlink_realpath_basic2/home//../././readlink_realpath_basic2.tmp",
+
+ /* filenames with invalid path */
+ "$file_path///readlink_realpath_basic2/home//..//././test//readlink_realpath_basic2.tmp",
+ "$file_path/readlink_realpath_basic2/home/../home/../test/../readlink_realpath_basic2.tmp",
+ "$file_path/readlink_realpath_basic2/readlink_realpath_basic2.tmp/"
+);
+
+$counter = 1;
+/* loop through $files to read the filepath of $file in the above array */
+foreach($filenames as $file) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( realpath($file) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/readlink_realpath_basic2";
+unlink("$name_prefix/home/test/readlink_realpath_basic2.tmp");
+unlink("$name_prefix/home/readlink_realpath_basic2.tmp");
+unlink("$name_prefix/readlink_realpath_basic2.tmp");
+rmdir("$name_prefix/home/test/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing realpath() on filenames ***
+
+-- Iteration 1 --
+string(%d) "%s/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp"
+
+-- Iteration 2 --
+string(%d) "%s/readlink_realpath_basic2/readlink_realpath_basic2.tmp"
+
+-- Iteration 3 --
+string(%d) "%s/readlink_realpath_basic2/home/test/readlink_realpath_basic2.tmp"
+
+-- Iteration 4 --
+string(%d) "%s/readlink_realpath_basic2/readlink_realpath_basic2.tmp"
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+%s
+Done
diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt
new file mode 100644
index 0000000..dc042bf
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test readlink() and realpath() functions: error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "*** Testing readlink(): error conditions ***\n";
+var_dump( readlink() ); // args < expected
+var_dump( readlink(__FILE__, 2) ); // args > expected
+
+echo "\n*** Testing readlink() on a non-existent link ***\n";
+var_dump( readlink(dirname(__FILE__)."/readlink_error.tmp") );
+
+echo "\n*** Testing readlink() on existing file ***\n";
+var_dump( readlink(__FILE__) );
+
+echo "\n*** Testing readlink() on existing directory ***\n";
+var_dump( readlink(dirname(__FILE__)) );
+
+echo "*** Testing realpath(): error conditions ***\n";
+var_dump( realpath() ); // args < expected
+var_dump( realpath(1, 2) ); // args > expected
+
+echo "\n*** Testing realpath() on a non-existent file ***\n";
+var_dump( realpath(dirname(__FILE__)."/realpath_error.tmp") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing readlink(): error conditions ***
+
+Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing readlink() on a non-existent link ***
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+
+*** Testing readlink() on existing file ***
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+
+*** Testing readlink() on existing directory ***
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+*** Testing realpath(): error conditions ***
+
+Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing realpath() on a non-existent file ***
+%s
+Done
diff --git a/ext/standard/tests/file/readlink_realpath_variation1.phpt b/ext/standard/tests/file/readlink_realpath_variation1.phpt
new file mode 100644
index 0000000..9c795e9
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_variation1.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test readlink() and realpath() functions: usage variation - linkname/filename stored in object(Bug #42038)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "*** Testing readlink() and realpath() : usage variations ***\n";
+$name_prefix = dirname(__FILE__);
+$filename = "$name_prefix/readlink_realpath_variation1/home/tests/link/readlink_realpath_variation1.tmp";
+mkdir("$name_prefix/readlink_realpath_variation1/home/tests/link/", 0777, true);
+
+echo "\n*** Testing readlink() and realpath() with linkname stored inside a object ***\n";
+// create a temp file
+$file_handle = fopen($filename, "w");
+fclose($file_handle);
+
+// creating object with members as linkname
+class object_temp {
+ public $linkname;
+ function object_temp($link) {
+ $this->linkname = $link;
+ }
+}
+$obj1 = new object_temp("$name_prefix/readlink_realpath_variation1/../././readlink_realpath_variation1/home/readlink_realpath_variation1_link.tmp");
+$obj2 = new object_temp("$name_prefix/readlink_realpath_variation1/home/../..///readlink_realpath_variation1_link.tmp");
+
+echo "\n-- Testing readlink() and realpath() with softlink, linkname stored inside an object --\n";
+// creating the links
+var_dump( symlink($filename, $obj1->linkname) );
+var_dump( readlink($obj1->linkname) );
+var_dump( realpath($obj1->linkname) );
+var_dump( symlink($filename, $obj2->linkname) );
+var_dump( readlink($obj2->linkname) );
+var_dump( realpath($obj2->linkname) );
+
+// deleting the link
+unlink($obj1->linkname);
+unlink($obj2->linkname);
+
+echo "\n-- Testing readlink() and realpath() with hardlink, linkname stored inside an object --\n";
+// creating hard links
+var_dump( link($filename, $obj1->linkname) );
+var_dump( readlink($obj1->linkname) ); // invalid because readlink doesn't work with hardlink
+var_dump( realpath($obj1->linkname) );
+var_dump( link($filename, $obj2->linkname) );
+var_dump( readlink($obj2->linkname) ); // invalid because readlink doesn't work with hardlink
+var_dump( realpath($obj2->linkname) );
+
+// delete the links
+unlink($obj1->linkname);
+unlink($obj2->linkname);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/readlink_realpath_variation1";
+unlink("$name_prefix/home/tests/link/readlink_realpath_variation1.tmp");
+rmdir("$name_prefix/home/tests/link/");
+rmdir("$name_prefix/home/tests/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing readlink() and realpath() : usage variations ***
+
+*** Testing readlink() and realpath() with linkname stored inside a object ***
+
+-- Testing readlink() and realpath() with softlink, linkname stored inside an object --
+bool(true)
+string(%d) "%s/readlink_realpath_variation1/home/tests/link/readlink_realpath_variation1.tmp"
+string(%d) "%s/readlink_realpath_variation1/home/tests/link/readlink_realpath_variation1.tmp"
+bool(true)
+string(%d) "%s/readlink_realpath_variation1/home/tests/link/readlink_realpath_variation1.tmp"
+string(%d) "%s/readlink_realpath_variation1/home/tests/link/readlink_realpath_variation1.tmp"
+
+-- Testing readlink() and realpath() with hardlink, linkname stored inside an object --
+bool(true)
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+string(%d) "%s/readlink_realpath_variation1/home/readlink_realpath_variation1_link.tmp"
+bool(true)
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+string(%d) "%s/readlink_realpath_variation1_link.tmp"
+Done
diff --git a/ext/standard/tests/file/readlink_realpath_variation2.phpt b/ext/standard/tests/file/readlink_realpath_variation2.phpt
new file mode 100644
index 0000000..0e74857
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_variation2.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test readlink() and realpath() functions: usage variation - linkname/filename stored in array(Bug #42038)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "*** Testing readlink() and realpath() : usage variations ***\n";
+$name_prefix = dirname(__FILE__);
+// create temp dir
+mkdir("$name_prefix/readlink_realpath_variation2/home/tests/link/", 0777, true);
+// create the file
+$filename = "$name_prefix/readlink_realpath_variation2/home/tests/link/readlink_realpath_variation2.tmp";
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "\n*** Testing readlink() and realpath() with linkname stored in an array ***\n";
+$link_arr = array (
+ "$name_prefix////readlink_realpath_variation2/home/tests/link/readlink_realpath_variation2_link.tmp",
+ "$name_prefix/./readlink_realpath_variation2/home/../home//tests//..//..//..//home//readlink_realpath_variation2_link.tmp/"
+);
+
+echo "\n-- Testing readlink() and realpath() with softlink, linkname stored inside an array --\n";
+// creating the links
+var_dump( symlink($filename, $link_arr[0]) );
+var_dump( readlink($link_arr[0]) );
+var_dump( realpath($link_arr[0]) );
+var_dump( symlink($filename, $link_arr[1]) );
+var_dump( readlink($link_arr[1]) );
+var_dump( realpath($link_arr[1]) );
+
+// deleting the link
+unlink($link_arr[0]);
+unlink($link_arr[1]);
+
+echo "\n-- Testing readlink() and realpath() with hardlink, linkname stored inside an array --\n";
+// creating hard links
+var_dump( link($filename, $link_arr[0]) );
+var_dump( readlink($link_arr[0]) ); // invalid because readlink doesn't work with hardlink
+var_dump( realpath($link_arr[0]) );
+var_dump( link($filename, $link_arr[1]) );
+var_dump( readlink($link_arr[1]) ); // invalid because readlink doesn't work with hardlink
+var_dump( realpath($link_arr[1]) );
+
+// delete the links
+unlink($link_arr[0]);
+unlink($link_arr[1]);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/readlink_realpath_variation2";
+unlink("$name_prefix/home/tests/link/readlink_realpath_variation2.tmp");
+rmdir("$name_prefix/home/tests/link/");
+rmdir("$name_prefix/home/tests/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing readlink() and realpath() : usage variations ***
+
+*** Testing readlink() and realpath() with linkname stored in an array ***
+
+-- Testing readlink() and realpath() with softlink, linkname stored inside an array --
+bool(true)
+string(%d) "%s/readlink_realpath_variation2/home/tests/link/readlink_realpath_variation2.tmp"
+string(%d) "%s/readlink_realpath_variation2/home/tests/link/readlink_realpath_variation2.tmp"
+
+Warning: symlink(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink(%s/./readlink_realpath_variation2/home/../home//tests//..//..//..//home//readlink_realpath_variation2_link.tmp/): No such file or directory in %s on line %d
+
+-- Testing readlink() and realpath() with hardlink, linkname stored inside an array --
+bool(true)
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+string(%d) "%s/readlink_realpath_variation2/home/tests/link/readlink_realpath_variation2_link.tmp"
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink(%s/./readlink_realpath_variation2/home/../home//tests//..//..//..//home//readlink_realpath_variation2_link.tmp/): No such file or directory in %s on line %d
+Done
diff --git a/ext/standard/tests/file/readlink_realpath_variation3.phpt b/ext/standard/tests/file/readlink_realpath_variation3.phpt
new file mode 100644
index 0000000..3766a5b
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_variation3.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test readlink() and realpath() functions: usage variation - invalid args
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "*** Testing readlink() and realpath() : usage variations ***\n";
+
+echo "\n*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***\n";
+$link_string = array (
+ /* linkname as spaces */
+ " ",
+ ' ',
+
+ /* empty linkname */
+ "",
+ '',
+ NULL,
+ null
+ );
+for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) {
+ echo "-- Iteration";
+ echo $loop_counter + 1;
+ echo " --\n";
+
+ var_dump( readlink($link_string[$loop_counter]) );
+ var_dump( realpath($link_string[$loop_counter]) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing readlink() and realpath() : usage variations ***
+
+*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***
+-- Iteration1 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+%s
+-- Iteration2 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+%s
+-- Iteration3 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+-- Iteration4 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+-- Iteration5 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+-- Iteration6 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt
new file mode 100644
index 0000000..1dae17c
--- /dev/null
+++ b/ext/standard/tests/file/readlink_variation1.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test readlink() function: usage variations - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no links on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link */
+
+/* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
+
+$file_path = dirname(__FILE__);
+$file_handle = fopen($file_path."/readlink_variation2.tmp", "w");
+
+echo "*** Testing Invalid file types ***\n";
+$filenames = array(
+ /* Invalid filenames */
+ -2.34555,
+ "",
+ TRUE,
+ FALSE,
+ NULL,
+ $file_handle,
+
+ /* scalars */
+ 1234,
+ 0
+);
+
+/* loop through to test each element the above array */
+foreach( $filenames as $filename ) {
+ var_dump( readlink($filename) );
+ clearstatcache();
+}
+fclose($file_handle);
+
+echo "\n*** Done ***";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/readlink_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing Invalid file types ***
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/realpath_basic-win32.phpt b/ext/standard/tests/file/realpath_basic-win32.phpt
new file mode 100644
index 0000000..5ebfcff
--- /dev/null
+++ b/ext/standard/tests/file/realpath_basic-win32.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Test realpath() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "\n*** Testing basic functions of realpath() with files ***\n";
+
+/* creating directories and files */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/realpath_basic/home/test/", 0777, true);
+
+$file_handle1 = fopen("$file_path/realpath_basic/home/test/realpath_basic.tmp", "w");
+$file_handle2 = fopen("$file_path/realpath_basic/home/realpath_basic.tmp", "w");
+$file_handle3 = fopen("$file_path/realpath_basic/realpath_basic.tmp", "w");
+fclose($file_handle1);
+fclose($file_handle2);
+fclose($file_handle3);
+
+echo "\n*** Testing realpath() on filenames ***\n";
+$filenames = array (
+ /* filenames resulting in valid paths */
+ "$file_path/realpath_basic/home/realpath_basic.tmp",
+ "$file_path/realpath_basic/realpath_basic.tmp/",
+ "$file_path/realpath_basic//home/test//../test/./realpath_basic.tmp",
+ "$file_path/realpath_basic/home//../././realpath_basic.tmp//",
+
+ // checking for binary safe
+ b"$file_path/realpath_basic/home/realpath_basic.tmp",
+
+ /* filenames with invalid path */
+ "$file_path///realpath_basic/home//..//././test//realpath_basic.tmp",
+ "$file_path/realpath_basic/home/../home/../test/../..realpath_basic.tmp"
+);
+
+$counter = 1;
+/* loop through $files to read the filepath of $file in the above array */
+foreach($filenames as $file) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( realpath($file) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/realpath_basic";
+unlink("$name_prefix/home/test/realpath_basic.tmp");
+unlink("$name_prefix/home/realpath_basic.tmp");
+unlink("$name_prefix/realpath_basic.tmp");
+rmdir("$name_prefix/home/test/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing basic functions of realpath() with files ***
+
+*** Testing realpath() on filenames ***
+
+-- Iteration 1 --
+string(%d) "%s\realpath_basic\home\realpath_basic.tmp"
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+string(%d) "%s\realpath_basic\home\test\realpath_basic.tmp"
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+string(%d) "%s\realpath_basic\home\realpath_basic.tmp"
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+Done
diff --git a/ext/standard/tests/file/realpath_basic2.phpt b/ext/standard/tests/file/realpath_basic2.phpt
new file mode 100644
index 0000000..87fc8ba
--- /dev/null
+++ b/ext/standard/tests/file/realpath_basic2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+realpath() with relative directory
+--FILE--
+<?php
+
+var_dump(realpath('.') == realpath(getcwd()));
+chdir('..');
+var_dump(realpath('.') == realpath(getcwd()));
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/realpath_basic3.phpt b/ext/standard/tests/file/realpath_basic3.phpt
new file mode 100644
index 0000000..ce93855
--- /dev/null
+++ b/ext/standard/tests/file/realpath_basic3.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test realpath() with relative paths
+--FILE--
+<?php
+/* Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "\n*** Testing basic functions of realpath() with files ***\n";
+
+/* creating directories and files */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/realpath_basic/home/test/", 0777, true);
+
+$file_handle1 = fopen("$file_path/realpath_basic/home/test/realpath_basic.tmp", "w");
+$file_handle2 = fopen("$file_path/realpath_basic/home/realpath_basic.tmp", "w");
+$file_handle3 = fopen("$file_path/realpath_basic/realpath_basic.tmp", "w");
+fclose($file_handle1);
+fclose($file_handle2);
+fclose($file_handle3);
+
+echo "\n*** Testing realpath() on filenames ***\n";
+$filenames = array (
+ /* filenames resulting in valid paths */
+ "./realpath_basic/home/realpath_basic.tmp",
+ "./realpath_basic/realpath_basic.tmp",
+ "./realpath_basic//home/test//../test/./realpath_basic.tmp",
+ "./realpath_basic/home//../././realpath_basic.tmp",
+
+ /* filenames with invalid path */
+ // checking for binary safe
+ "./realpath_basicx000/home/realpath_basic.tmp",
+
+ ".///realpath_basic/home//..//././test//realpath_basic.tmp",
+ "./realpath_basic/home/../home/../test/..realpath_basic.tmp"
+);
+
+chdir("$file_path/..");
+chdir($file_path);
+
+$counter = 1;
+/* loop through $files to read the filepath of $file in the above array */
+foreach($filenames as $file) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( realpath($file) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/realpath_basic";
+unlink("$name_prefix/home/test/realpath_basic.tmp");
+unlink("$name_prefix/home/realpath_basic.tmp");
+unlink("$name_prefix/realpath_basic.tmp");
+rmdir("$name_prefix/home/test/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing basic functions of realpath() with files ***
+
+*** Testing realpath() on filenames ***
+
+-- Iteration 1 --
+string(%d) "%srealpath_basic%shome%srealpath_basic.tmp"
+
+-- Iteration 2 --
+string(%d) "%srealpath_basic%srealpath_basic.tmp"
+
+-- Iteration 3 --
+string(%d) "%srealpath_basic%shome%stest%srealpath_basic.tmp"
+
+-- Iteration 4 --
+string(%d) "%srealpath_basic%srealpath_basic.tmp"
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+Done
diff --git a/ext/standard/tests/file/realpath_basic4.phpt b/ext/standard/tests/file/realpath_basic4.phpt
new file mode 100644
index 0000000..d782b6d
--- /dev/null
+++ b/ext/standard/tests/file/realpath_basic4.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test realpath() with relative paths
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+$file_path = dirname(__FILE__);
+@mkdir("$file_path/realpath_basic/home/test", 0777, true);
+@symlink("$file_path/realpath_basic/home", "$file_path/realpath_basic/link1");
+@symlink("$file_path/realpath_basic/link1", "$file_path/realpath_basic/link2");
+echo "1. " . realpath("$file_path/realpath_basic/link2") . "\n";
+echo "2. " . realpath("$file_path/realpath_basic/link2/test") . "\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/realpath_basic/link2");
+unlink("$file_path/realpath_basic/link1");
+rmdir("$file_path/realpath_basic/home/test");
+rmdir("$file_path/realpath_basic/home");
+rmdir("$file_path/realpath_basic");
+?>
+--EXPECTF--
+1. %s%erealpath_basic%ehome
+2. %s%erealpath_basic%ehome%etest
diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt
new file mode 100644
index 0000000..0eb9dc5
--- /dev/null
+++ b/ext/standard/tests/file/realpath_cache.phpt
@@ -0,0 +1,30 @@
+--TEST--
+realpath_cache_size() and realpath_cache_get()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip not on Windows');
+}
+?>
+--FILE--
+<?php
+
+var_dump(realpath_cache_size());
+$data = realpath_cache_get();
+var_dump($data[__DIR__]);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+array(4) {
+ ["key"]=>
+ %s(%f)
+ ["is_dir"]=>
+ bool(true)
+ ["realpath"]=>
+ string(%d) "%sfile"
+ ["expires"]=>
+ int(%d)
+}
+Done
diff --git a/ext/standard/tests/file/realpath_cache_win32.phpt b/ext/standard/tests/file/realpath_cache_win32.phpt
new file mode 100644
index 0000000..a4c663f
--- /dev/null
+++ b/ext/standard/tests/file/realpath_cache_win32.phpt
@@ -0,0 +1,38 @@
+--TEST--
+realpath_cache_size() and realpath_cache_get()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only on Windows');
+}
+?>
+--FILE--
+<?php
+
+var_dump(realpath_cache_size());
+$data = realpath_cache_get();
+var_dump($data[__DIR__]);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+array(8) {
+ ["key"]=>
+ %s(%d)
+ ["is_dir"]=>
+ bool(true)
+ ["realpath"]=>
+ string(%d) "%sfile"
+ ["expires"]=>
+ int(%d)
+ ["is_rvalid"]=>
+ bool(%s)
+ ["is_wvalid"]=>
+ bool(%s)
+ ["is_readable"]=>
+ bool(%s)
+ ["is_writable"]=>
+ bool(%s)
+}
+Done
diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt
new file mode 100644
index 0000000..2fd221e
--- /dev/null
+++ b/ext/standard/tests/file/realpath_error-win32.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test realpath() function: error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "*** Testing realpath() for error conditions ***\n";
+var_dump( realpath() ); // args < expected
+var_dump( realpath(1, 2) ); // args > expected
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing realpath() for error conditions ***
+
+Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/file/realpath_variation-win32.phpt b/ext/standard/tests/file/realpath_variation-win32.phpt
new file mode 100644
index 0000000..59db125
--- /dev/null
+++ b/ext/standard/tests/file/realpath_variation-win32.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test realpath() function: usage variation
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+echo "*** Testing realpath(): usage variations ***\n";
+$name_prefix = dirname(__FILE__);
+$filename = "$name_prefix/realpath_variation/home/tests/realpath_variation.tmp";
+mkdir("$name_prefix/realpath_variation/home/tests/", 0777, true);
+
+echo "\n*** Testing realpath() with filename stored inside a object ***\n";
+// create a temp file
+$file_handle = fopen($filename, "w");
+fclose($file_handle);
+
+// creating object with members as filename
+class object_temp {
+ public $filename;
+ function object_temp($file) {
+ $this->filename = $file;
+ }
+}
+$obj1 = new object_temp("$name_prefix/realpath_variation/../././realpath_variation/home/tests/realpath_variation.tmp");
+$obj2 = new object_temp("$name_prefix/realpath_variation/home/..///realpath_variation.tmp");
+
+var_dump( realpath($obj1->filename) );
+var_dump( realpath($obj2->filename) );
+
+echo "\n*** Testing realpath() with filename stored in an array ***\n";
+$file_arr = array (
+ "$name_prefix////realpath_variation/home/tests/realpath_variation.tmp",
+ "$name_prefix/./realpath_variation/home/../home//tests//..//..//..//home//realpath_variation.tmp/"
+);
+
+var_dump( realpath($file_arr[0]) );
+var_dump( realpath($file_arr[1]) );
+
+echo "\n*** Testing realpath() with filename as empty string, NULL and single space ***\n";
+$file_string = array (
+ /* filename as spaces */
+ " ",
+ ' ',
+
+ /* empty filename */
+ "",
+ '',
+ NULL,
+ null
+ );
+for($loop_counter = 0; $loop_counter < count($file_string); $loop_counter++) {
+ echo "-- Iteration";
+ echo $loop_counter + 1;
+ echo " --\n";
+ var_dump( realpath($file_string[$loop_counter]) );
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/realpath_variation";
+unlink("$name_prefix/home/tests/realpath_variation.tmp");
+rmdir("$name_prefix/home/tests/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing realpath(): usage variations ***
+
+*** Testing realpath() with filename stored inside a object ***
+string(%d) "%s\realpath_variation\home\tests\realpath_variation.tmp"
+bool(false)
+
+*** Testing realpath() with filename stored in an array ***
+string(%d) "%s\realpath_variation\home\tests\realpath_variation.tmp"
+bool(false)
+
+*** Testing realpath() with filename as empty string, NULL and single space ***
+-- Iteration1 --
+bool(false)
+-- Iteration2 --
+bool(false)
+-- Iteration3 --
+string(%d) "%s"
+-- Iteration4 --
+string(%d) "%s"
+-- Iteration5 --
+string(%d) "%s"
+-- Iteration6 --
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/file/realpath_variation2.phpt b/ext/standard/tests/file/realpath_variation2.phpt
new file mode 100644
index 0000000..a5031aa
--- /dev/null
+++ b/ext/standard/tests/file/realpath_variation2.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test realpath() function : variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN' )
+ die("skip Not Valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string realpath(string path)
+ * Description: Return the resolved path
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing realpath() : variation ***\n";
+
+$paths = array('c:\\',
+ 'c:',
+ 'c' ,
+ '\\' ,
+ '/',
+ 'c:temp',
+ 'c:\\/',
+ '/tmp/',
+ '/tmp/\\',
+ '\\tmp',
+ '\\tmp\\');
+
+foreach($paths as $path) {
+ echo "\n--$path--\n";
+ var_dump( realpath($path) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing realpath() : variation ***
+
+--c:\--
+bool(false)
+
+--c:--
+bool(false)
+
+--c--
+bool(false)
+
+--\--
+bool(false)
+
+--/--
+string(1) "/"
+
+--c:temp--
+bool(false)
+
+--c:\/--
+bool(false)
+
+--/tmp/--
+string(%d) %s/tmp"
+
+--/tmp/\--
+bool(false)
+
+--\tmp--
+bool(false)
+
+--\tmp\--
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/rename_basic.phpt b/ext/standard/tests/file/rename_basic.phpt
new file mode 100644
index 0000000..c589c51
--- /dev/null
+++ b/ext/standard/tests/file/rename_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test rename() function: basic functionality
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "*** Testing rename() on non-existing file ***\n";
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+$src_name = "$file_path/rename_basic.tmp";
+$dest_name = "$file_path/rename_basic_new.tmp";
+
+// create the file
+$fp = fopen($src_name, "w");
+$old_stat = stat($src_name);
+fclose($fp);
+
+var_dump( rename($src_name, $dest_name) ); // expecting true
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting true
+
+$new_stat = stat("$file_path/rename_basic_new.tmp");
+
+// checking statistics of old and renamed file - both should be same except ctime
+$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
+ "dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "blksize", "blocks");
+var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
+
+?>
+===Done===
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/rename_basic_new.tmp");
+?>
+--EXPECT--
+*** Testing rename() on non-existing file ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+===Done===
diff --git a/ext/standard/tests/file/rename_error.phpt b/ext/standard/tests/file/rename_error.phpt
new file mode 100644
index 0000000..fae2b4f
--- /dev/null
+++ b/ext/standard/tests/file/rename_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test rename() function: error conditions
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "*** Testing rename() for error conditions ***\n";
+//Zero argument
+var_dump( rename() );
+
+// less than expected,1 argument
+var_dump( rename(__FILE__) );
+
+// more than expected no. of arguments
+$context = stream_context_create();
+$filename = __FILE__;
+$new_filename = __FILE__.".tmp";
+var_dump( rename($filename, $new_filename, $context, "extra_args") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing rename() for error conditions ***
+
+Warning: rename() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: rename() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: rename() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/rename_variation-win32.phpt b/ext/standard/tests/file/rename_variation-win32.phpt
new file mode 100644
index 0000000..a10c6df
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation-win32.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+/* create directory */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/rename_variation");
+
+/* rename files across directories */
+echo "*** Testing rename() : rename files across directories ***\n";
+$src_filenames = array(
+ "$file_path/rename_variation/rename_variation.tmp",
+
+ /* Testing a file trailing slash */
+ "$file_path/rename_variation/rename_variation.tmp/",
+
+ /* Testing file with double slashes */
+ "$file_path/rename_variation//rename_variation.tmp",
+ "$file_path//rename_variation//rename_variation.tmp",
+);
+
+$counter = 1;
+
+/* loop through each $file and rename it to rename_variation2.tmp */
+foreach($src_filenames as $src_filename) {
+ echo "-- Iteration $counter --\n";
+ $fp = fopen("$file_path/rename_variation/rename_variation.tmp", "w");
+ fclose($fp);
+ $dest_filename = "$file_path/rename_variation2.tmp";
+ var_dump( rename($src_filename, $dest_filename) );
+
+ // ensure that file got renamed to new name
+ var_dump( file_exists($src_filename) ); // expecting false
+ var_dump( file_exists($dest_filename) ); // expecting true
+ $counter++;
+
+ // unlink the file
+ unlink($dest_filename);
+}
+
+rmdir("$file_path/rename_variation");
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() : rename files across directories ***
+-- Iteration 1 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 2 --
+
+Warning: rename(%s/rename_variation/rename_variation.tmp/,%s/rename_variation2.tmp): The filename, directory name, or volume label syntax is incorrect. (code: 123) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+Warning: unlink(%s/rename_variation2.tmp): No such file or directory in %s on line %d
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation.phpt b/ext/standard/tests/file/rename_variation.phpt
new file mode 100644
index 0000000..00dc309
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test rename() function: usage variations-1 (Bug#42638)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+
+/* creating directory */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/rename_variation");
+
+/* rename files across directories */
+echo "*** Testing rename() : rename files across directories ***\n";
+$src_filenames = array(
+ "$file_path/rename_variation/rename_variation.tmp",
+
+ /* Testing a file trailing slash */
+ "$file_path/rename_variation/rename_variation.tmp/",
+
+ /* Testing file with double slashes */
+ "$file_path/rename_variation//rename_variation.tmp",
+ "$file_path//rename_variation//rename_variation.tmp",
+);
+$counter = 1;
+/* loop through each $file and rename it to rename_variation2.tmp */
+foreach($src_filenames as $src_filename) {
+ echo "-- Iteration $counter --\n";
+ $fp = fopen("$file_path/rename_variation/rename_variation.tmp", "w");
+ fclose($fp);
+ $dest_filename = "$file_path/rename_variation2.tmp";
+ var_dump( rename($src_filename, $dest_filename) );
+ // ensure that file got renamed to new name
+ var_dump( file_exists($src_filename) ); // expecting false
+ var_dump( file_exists($dest_filename) ); // expecting true
+ $counter++;
+
+ // unlink the file
+ unlink($dest_filename);
+}
+
+// clean the temp dir and file
+rmdir("$file_path/rename_variation");
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing rename() : rename files across directories ***
+-- Iteration 1 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 2 --
+
+Warning: rename(%s,%s): Not a directory in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+Warning: unlink(%s): No such file or directory in %s on line %d
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation1-win32.phpt b/ext/standard/tests/file/rename_variation1-win32.phpt
new file mode 100644
index 0000000..0955096
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation1-win32.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+/* creating directory */
+$file_path = dirname(__FILE__);
+
+// rename dirs across directories
+echo "\n*** Testing rename() : renaming directory across directories ***\n";
+$src_dirs = array (
+ /* Testing simple directory tree */
+ "$file_path/rename_variation/",
+
+ /* Testing a dir with trailing slash */
+ "$file_path/rename_variation/",
+
+ /* Testing dir with double trailing slashes */
+ "$file_path//rename_variation//",
+);
+
+$dest_dir = "$file_path/rename_variation_dir";
+
+// create the $dest_dir
+mkdir($dest_dir);
+
+$counter = 1;
+
+/* loop through each $src_dirs and rename it to $dest_dir */
+foreach($src_dirs as $src_dir) {
+ echo "-- Iteration $counter --\n";
+
+ // create the src dir
+ mkdir("$file_path/rename_variation/");
+ // rename the src dir to a new dir in dest dir
+ var_dump( rename($src_dir, $dest_dir."/new_dir") );
+ // ensure that dir was renamed
+ var_dump( file_exists($src_dir) ); // expecting false
+ var_dump( file_exists($dest_dir."/new_dir") ); // expecting true
+
+ // remove the new dir
+ rmdir($dest_dir."/new_dir");
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() : renaming directory across directories ***
+-- Iteration 1 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation1.phpt b/ext/standard/tests/file/rename_variation1.phpt
new file mode 100644
index 0000000..0f7321e
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation1.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test rename() function: usage variations-2
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+
+/* creating directory */
+$file_path = dirname(__FILE__);
+
+// rename dirs across directories
+echo "\n*** Testing rename() : renaming directory across directories ***\n";
+$src_dirs = array (
+ /* Testing simple directory tree */
+ "$file_path/rename_variation/",
+
+ /* Testing a dir with trailing slash */
+ "$file_path/rename_variation/",
+
+ /* Testing dir with double trailing slashes */
+ "$file_path//rename_variation//",
+);
+
+$dest_dir = "$file_path/rename_variation_dir";
+// create the $dest_dir
+mkdir($dest_dir);
+
+$counter = 1;
+/* loop through each $src_dirs and rename it to $dest_dir */
+foreach($src_dirs as $src_dir) {
+ echo "-- Iteration $counter --\n";
+
+ // create the src dir
+ mkdir("$file_path/rename_variation/");
+ // rename the src dir to a new dir in dest dir
+ var_dump( rename($src_dir, $dest_dir."/new_dir") );
+ // ensure that dir was renamed
+ var_dump( file_exists($src_dir) ); // expecting false
+ var_dump( file_exists($dest_dir."/new_dir") ); // expecting true
+
+ // remove the new dir
+ rmdir($dest_dir."/new_dir");
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() : renaming directory across directories ***
+-- Iteration 1 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation10.phpt b/ext/standard/tests/file/rename_variation10.phpt
new file mode 100644
index 0000000..fbb109c
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation10.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test rename() function : usage variation - different types for context
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool rename(string old_name, string new_name[, resource context])
+ * Description: Rename a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rename() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$old_name = __FILE__.'.tmp';
+$new_name = __FILE__.'.renamed';
+
+//file resource
+$fileRes = fopen(__FILE__, 'r');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ // file resource
+ 'file resource' => $fileRes,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ touch($old_name);
+ $res = rename($old_name, $new_name, $value);
+ var_dump($res);
+ if ($res == true) {
+ unlink($new_name);
+ }
+ else {
+ unlink($old_name);
+ }
+};
+
+fclose($fileRes);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rename() : usage variation ***
+
+--int 0--
+Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d)
+bool(false)
+
+--string DQ--
+Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d)
+bool(false)
+
+--string SQ--
+Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d)
+bool(false)
+
+--mixed case string--
+Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d)
+bool(false)
+
+--heredoc--
+Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - rename() expects parameter 3 to be resource, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - rename() expects parameter 3 to be resource, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d)
+bool(false)
+
+--file resource--
+Error: 2 - rename(): supplied resource is not a valid Stream-Context resource, %s(%d)
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/file/rename_variation11-win32.phpt b/ext/standard/tests/file/rename_variation11-win32.phpt
new file mode 100644
index 0000000..c13a09a
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation11-win32.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test rename() function : variation - various relative, absolute paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool rename(string old_name, string new_name[, resource context])
+ * Description: Rename a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rename() with absolute and relative paths ***\n";
+$mainDir = "renameVar11";
+$subDir = "renameVar11Sub";
+$absMainDir = dirname(__FILE__)."\\".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."\\".$subDir;
+mkdir($absSubDir);
+
+$fromFile = "renameMe.tmp";
+$toFile = "IwasRenamed.tmp";
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3);
+
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir\\",
+ "$absSubDir\\..\\".$subDir,
+ "$absSubDir\\\\..\\.\\".$subDir,
+ "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir,
+ "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir,
+ "$absSubDir\\BADDIR",
+
+ // relative paths
+ $mainDir."\\".$subDir,
+ $mainDir."\\\\".$subDir,
+ $mainDir."\\\\\\".$subDir,
+ ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir,
+ "BADDIR",
+
+ // unixifed path
+ $unixifiedDir,
+);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ touch($absSubDir."\\".$fromFile);
+ $res = rename($dir."\\".$fromFile, $dir."\\".$toFile);
+ var_dump($res);
+ if ($res == true) {
+ $res = rename($dir."\\".$toFile, $dir."\\".$fromFile);
+ var_dump($res);
+ }
+ unlink($absSubDir."\\".$fromFile);
+}
+
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing rename() with absolute and relative paths ***
+
+-- Iteration 1 --
+bool(true)
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+bool(true)
+
+-- Iteration 5 --
+
+Warning: rename(%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\renameMe.tmp,%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: rename(%s\renameVar11\renameVar11Sub\BADDIR\renameMe.tmp,%s\renameVar11\renameVar11Sub\BADDIR\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+bool(true)
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+bool(true)
+
+-- Iteration 11 --
+
+Warning: rename(BADDIR\renameMe.tmp,BADDIR\IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+bool(true)
+bool(true)
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/rename_variation12-win32.phpt b/ext/standard/tests/file/rename_variation12-win32.phpt
new file mode 100644
index 0000000..de5fc14
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation12-win32.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test rename() function : variation - various relative, absolute paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
+?>
+--FILE--
+<?php
+/* Prototype : bool rename(string old_name, string new_name[, resource context])
+ * Description: Rename a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+/* Creating unique files in various dirs by passing relative paths to $dir arg */
+
+echo "*** Testing rename() with absolute and relative paths ***\n";
+$mainDir = "renameVar11";
+$subDir = "renameVar11Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$fromFile = "renameMe.tmp";
+$toFile = "IwasRenamed.tmp";
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ touch($absSubDir."/".$fromFile);
+ $res = rename($dir."/".$fromFile, $dir."/".$toFile);
+ var_dump($res);
+ if ($res == true) {
+ $res = rename($dir."/".$toFile, $dir."/".$fromFile);
+ var_dump($res);
+ }
+ unlink($absSubDir."/".$fromFile);
+}
+
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing rename() with absolute and relative paths ***
+
+-- Iteration 1 --
+bool(true)
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+bool(true)
+
+-- Iteration 5 --
+
+Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+bool(true)
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+bool(true)
+
+-- Iteration 11 --
+
+Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d
+bool(false)
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/rename_variation12.phpt b/ext/standard/tests/file/rename_variation12.phpt
new file mode 100644
index 0000000..168beef
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation12.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test rename() function : variation - various relative, absolute paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows');
+?>
+--FILE--
+<?php
+/* Prototype : bool rename(string old_name, string new_name[, resource context])
+ * Description: Rename a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+/* Creating unique files in various dirs by passing relative paths to $dir arg */
+
+echo "*** Testing rename() with absolute and relative paths ***\n";
+$mainDir = "renameVar11";
+$subDir = "renameVar11Sub";
+$absMainDir = dirname(__FILE__)."/".$mainDir;
+mkdir($absMainDir);
+$absSubDir = $absMainDir."/".$subDir;
+mkdir($absSubDir);
+
+$fromFile = "renameMe.tmp";
+$toFile = "IwasRenamed.tmp";
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$allDirs = array(
+ // absolute paths
+ "$absSubDir/",
+ "$absSubDir/../".$subDir,
+ "$absSubDir//.././".$subDir,
+ "$absSubDir/../../".$mainDir."/./".$subDir,
+ "$absSubDir/..///".$subDir."//..//../".$subDir,
+ "$absSubDir/BADDIR",
+
+
+ // relative paths
+ $mainDir."/".$subDir,
+ $mainDir."//".$subDir,
+ $mainDir."///".$subDir,
+ "./".$mainDir."/../".$mainDir."/".$subDir,
+ "BADDIR",
+);
+
+for($i = 0; $i<count($allDirs); $i++) {
+ $j = $i+1;
+ $dir = $allDirs[$i];
+ echo "\n-- Iteration $j --\n";
+ touch($absSubDir."/".$fromFile);
+ $res = rename($dir."/".$fromFile, $dir."/".$toFile);
+ var_dump($res);
+ if ($res == true) {
+ $res = rename($dir."/".$toFile, $dir."/".$fromFile);
+ var_dump($res);
+ }
+ unlink($absSubDir."/".$fromFile);
+}
+
+chdir($old_dir_path);
+rmdir($absSubDir);
+rmdir($absMainDir);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing rename() with absolute and relative paths ***
+
+-- Iteration 1 --
+bool(true)
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+bool(true)
+
+-- Iteration 5 --
+
+Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): %s in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): %s in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+bool(true)
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+bool(true)
+
+-- Iteration 11 --
+
+Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): %s in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt
new file mode 100644
index 0000000..a503076
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation13-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt
new file mode 100644
index 0000000..ec1ee7c
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation13.phpt
@@ -0,0 +1,133 @@
+--TEST--
+Test rename() function : variation - various invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip. Not for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool rename(string old_name, string new_name[, resource context])
+ * Description: Rename a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rename() with obscure files ***\n";
+$file_path = dirname(__FILE__)."/renameVar13";
+$aFile = $file_path.'/afile.tmp';
+
+mkdir($file_path);
+
+/* An array of files */
+$names_arr = array(
+ /* Invalid args */
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ array(),
+
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir",
+ "php/php"
+
+);
+
+for( $i=0; $i<count($names_arr); $i++ ) {
+ $name = $names_arr[$i];
+ echo @"-- testing '$name' --\n";
+ touch($aFile);
+ var_dump(rename($aFile, $name));
+ if (file_exists($name)) {
+ unlink($name);
+ }
+ if (file_exists($aFile)) {
+ unlink($aFile);
+ }
+ var_dump(rename($name, $aFile));
+ if (file_exists($aFile)) {
+ unlink($aFile);
+ }
+}
+
+rmdir($file_path);
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing rename() with obscure files ***
+-- testing '-1' --
+bool(true)
+
+Warning: rename(-1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d
+bool(false)
+-- testing '1' --
+bool(true)
+
+Warning: rename(1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d
+bool(false)
+-- testing '' --
+
+Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d
+bool(false)
+
+Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d
+bool(false)
+-- testing '' --
+
+Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d
+bool(false)
+
+Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d
+bool(false)
+-- testing '' --
+
+Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d
+bool(false)
+
+Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d
+bool(false)
+-- testing ' ' --
+bool(true)
+
+Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d
+bool(false)
+-- testing '%s' --
+
+Warning: rename() %s in %s on line %d
+bool(false)
+
+Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d
+
+Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d
+bool(false)
+-- testing 'Array' --
+
+Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d
+bool(false)
+
+Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d
+
+Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d
+bool(false)
+-- testing '/no/such/file/dir' --
+
+Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d
+bool(false)
+
+Warning: rename(/no/such/file/dir,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d
+bool(false)
+-- testing 'php/php' --
+
+Warning: rename(%s/renameVar13/afile.tmp,php/php): %s directory in %s on line %d
+bool(false)
+
+Warning: rename(php/php,%s/renameVar13/afile.tmp): %s directory in %s on line %d
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/rename_variation2-win32.phpt b/ext/standard/tests/file/rename_variation2-win32.phpt
new file mode 100644
index 0000000..87f4e7d
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation2-win32.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/rename_variation_dir");
+
+/* Renaming a file and directory to numeric name */
+echo "\n*** Testing rename() by renaming a file and directory to numeric name ***\n";
+$fp = fopen($file_path."/rename_variation.tmp", "w");
+fclose($fp);
+
+// renaming existing file to numeric name
+var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
+
+// ensure that rename worked fine
+var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false
+var_dump( file_exists($file_path."/12345" ) ); // expecting true
+
+unlink($file_path."/12345");
+
+// renaming a directory to numeric name
+var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
+
+// ensure that rename worked fine
+var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false
+var_dump( file_exists($file_path."/12345" ) ); // expecting true
+
+rmdir($file_path."/12345");
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() by renaming a file and directory to numeric name ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation2.phpt b/ext/standard/tests/file/rename_variation2.phpt
new file mode 100644
index 0000000..fa3ee1e
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation2.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test rename() function: usage variations-3
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+
+$file_path = dirname(__FILE__);
+
+$dest_dir = "$file_path/rename_variation_dir";
+// create the $dest_dir
+mkdir($dest_dir);
+
+/* Testing rename() on soft and hard links with different permissions */
+echo "\n*** Testing rename() on soft links ***\n";
+// create the file
+$filename = $file_path."/rename_variation2.tmp";
+@unlink($filename);
+var_dump(touch($filename));
+
+// create the soft links to the file
+$linkname = $file_path."/rename_variation_soft_link1.tmp";
+var_dump(symlink($filename, $linkname));
+
+//rename the link to a new name in the same dir
+$dest_linkname = $file_path."/rename_variation_soft_link2.tmp";
+var_dump( rename( $linkname, $dest_linkname) );
+//ensure that link was renamed
+clearstatcache();
+var_dump( file_exists($linkname) ); // expecting false
+var_dump( file_exists($dest_linkname) ); // expecting true
+
+// rename a link across dir
+var_dump( rename($dest_linkname, $dest_dir."/rename_variation_soft_link2.tmp"));
+//ensure that link got renamed
+clearstatcache();
+var_dump( file_exists($dest_linkname) ); // expecting false
+var_dump( file_exists($dest_dir."/rename_variation_soft_link2.tmp") ); // expecting true
+
+// delete the link file now
+unlink($dest_dir."/rename_variation_soft_link2.tmp");
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation2.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() on soft links ***
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation3-win32.phpt b/ext/standard/tests/file/rename_variation3-win32.phpt
new file mode 100644
index 0000000..b5da587
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation3-win32.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+/* creating directory */
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/rename_variation3_dir";
+mkdir($dirname);
+
+/* test rename() by trying to rename an existing file/dir to the same name
+ and one another */
+
+$filename = "$file_path/rename_variation3.tmp";
+$fp = fopen($filename, "w");
+if (!$fp) {
+ die("Cannot create $filename\n");
+}
+fclose($fp);
+
+echo "\n-- Renaming file to same file name --\n";
+var_dump( rename($filename, $filename) );
+var_dump( file_exists($filename) );
+
+echo "\n-- Renaming directory to same directory name --\n";
+var_dump( rename($dirname, $dirname) );
+var_dump( file_exists($dirname) );
+
+echo "\n-- Renaming existing file to existing directory name --\n";
+var_dump( rename($filename, $dirname) );
+var_dump( file_exists($filename) );
+var_dump( file_exists($dirname) );
+
+echo "\n-- Renaming existing directory to existing file name --\n";
+$fp = fopen($filename, "w");
+fclose($fp);
+
+var_dump( rename($dirname, $filename) );
+var_dump( file_exists($filename) );
+var_dump( file_exists($dirname) );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation3_link.tmp");
+unlink($file_path."/rename_variation3.tmp");
+rmdir($file_path."/rename_variation3_dir");
+rmdir($file_path."/rename_variation3.tmp");
+?>
+--EXPECTF--
+-- Renaming file to same file name --
+bool(true)
+bool(true)
+
+-- Renaming directory to same directory name --
+bool(true)
+bool(true)
+
+-- Renaming existing file to existing directory name --
+
+Warning: rename(%s/rename_variation3.tmp,%s/rename_variation3_dir): Access is denied. (code: 5) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+
+-- Renaming existing directory to existing file name --
+bool(true)
+bool(true)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation3.phpt b/ext/standard/tests/file/rename_variation3.phpt
new file mode 100644
index 0000000..ce89216
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation3.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test rename() function: usage variations-4
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+
+$file_path = dirname(__FILE__);
+
+$dest_dir = "$file_path/rename_variation_dir";
+// create the $dest_dir
+mkdir($dest_dir);
+
+echo "\n*** Testing rename() on hard links ***\n";
+$filename = $file_path."/rename_variation1.tmp";
+@unlink($filename);
+var_dump(touch($filename));
+
+$linkname = $file_path."/rename_variation_hard_link1.tmp";
+var_dump(link($filename, $linkname));
+
+//rename the link to a new name in the same dir
+$dest_linkname = $file_path."/rename_variation_hard_link2.tmp";
+var_dump( rename( $filename, $dest_linkname) );
+//ensure that link was renamed
+var_dump( file_exists($filename) ); // expecting false
+var_dump( file_exists($dest_linkname) ); // expecting true
+
+// rename a hard link across dir
+var_dump( rename($dest_linkname, $dest_dir."/rename_variation_hard_link2.tmp") );
+//ensure that link got renamed
+var_dump( file_exists($dest_linkname) ); // expecting false
+var_dump( file_exists($dest_dir."/rename_variation_hard_link2.tmp") ); // expecting true
+
+// delete the link file now
+unlink($dest_dir."/rename_variation_hard_link2.tmp");
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_hard_link1.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() on hard links ***
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation4.phpt b/ext/standard/tests/file/rename_variation4.phpt
new file mode 100644
index 0000000..2965f75
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation4.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test rename() function: usage variations-5
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+
+$file_path = dirname(__FILE__);
+
+require dirname(__FILE__).'/file.inc';
+
+/* Renaming a file, link and directory to numeric name */
+echo "\n*** Testing rename() by renaming a file, link and directory to numeric name ***\n";
+$fp = fopen($file_path."/rename_variation.tmp", "w");
+fclose($fp);
+// renaming existing file to numeric name
+var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
+// ensure that rename worked fine
+var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false
+var_dump( file_exists($file_path."/12345" ) ); // expecting true
+// remove the file
+unlink($file_path."/12345");
+
+mkdir($file_path."/rename_variation_dir");
+
+// renaming a directory to numeric name
+var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
+// ensure that rename worked fine
+var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false
+var_dump( file_exists($file_path."/12345" ) ); // expecting true
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir($file_path."/12345");
+?>
+--EXPECTF--
+*** Testing rename() by renaming a file, link and directory to numeric name ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation5.phpt b/ext/standard/tests/file/rename_variation5.phpt
new file mode 100644
index 0000000..bf43e49
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation5.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test rename() function: usage variations-6
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+
+/* test rename() by trying to rename an existing file/dir/link to the same name
+ and one another */
+// create a dir
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/rename_variation_dir";
+mkdir($dirname);
+//create a file
+$filename = "$file_path/rename_variation.tmp";
+$fp = fopen($filename, "w");
+fclose($fp);
+// create a link
+$linkname = "$file_path/rename_variation_link.tmp";
+symlink($filename, $linkname);
+
+echo "\n-- Renaming link to same link name --\n";
+var_dump( rename($linkname, $linkname) );
+
+echo "\n-- Renaming file to same file name --\n";
+var_dump( rename($filename, $filename) );
+
+echo "\n-- Renaming directory to same directory name --\n";
+var_dump( rename($dirname, $dirname) );
+
+echo "\n-- Renaming existing link to existing directory name --\n";
+var_dump( rename($linkname, $dirname) );
+echo "\n-- Renaming existing link to existing file name --\n";
+var_dump( rename($linkname, $filename) );
+
+echo "\n-- Renaming existing file to existing directory name --\n";
+var_dump( rename($filename, $dirname) );
+echo "\n-- Renaming existing file to existing link name --\n";
+var_dump( rename($filename, $linkname) );
+
+echo "\n-- Renaming existing directory to existing file name --\n";
+$fp = fopen($filename, "w");
+fclose($fp);
+var_dump( rename($dirname, $filename) );
+echo "\n-- Renaming existing directory to existing link name --\n";
+var_dump( rename($dirname, $linkname) );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+-- Renaming link to same link name --
+bool(true)
+
+-- Renaming file to same file name --
+bool(true)
+
+-- Renaming directory to same directory name --
+bool(true)
+
+-- Renaming existing link to existing directory name --
+
+Warning: rename(%s,%s): Is a directory in %s on line %d
+bool(false)
+
+-- Renaming existing link to existing file name --
+bool(true)
+
+-- Renaming existing file to existing directory name --
+
+Warning: rename(%s,%s): Is a directory in %s on line %d
+bool(false)
+
+-- Renaming existing file to existing link name --
+bool(true)
+
+-- Renaming existing directory to existing file name --
+
+Warning: rename(%s,%s): Not a directory in %s on line %d
+bool(false)
+
+-- Renaming existing directory to existing link name --
+
+Warning: rename(%s,%s): Not a directory in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/rename_variation6-win32.phpt b/ext/standard/tests/file/rename_variation6-win32.phpt
new file mode 100644
index 0000000..9aab0a7
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation6-win32.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test rename() function: usage variations-6
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
+if (!function_exists("symlink")) die("skip symlinks are not supported");
+$ret = exec('mklink rename_variation13tmp.lnk ' . __FILE__ .' 2>&1', $out);
+if (strpos($ret, 'privilege')) {
+ die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
+}
+?>
+--FILE--
+<?php
+
+$tmp_file = __FILE__.".tmp";
+$tmp_link = __FILE__.".tmp.link";
+$tmp_link2 = __FILE__.".tmp.link2";
+
+touch($tmp_file);
+symlink($tmp_file, $tmp_link);
+rename($tmp_link, $tmp_link2);
+
+clearstatcache();
+
+var_dump(readlink($tmp_link));
+var_dump(readlink($tmp_link2));
+var_dump(file_exists($tmp_file));
+
+@unlink($tmp_link);
+@unlink($tmp_link2);
+@unlink($tmp_file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%srename_variation6-win32.php.tmp"
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation6.phpt b/ext/standard/tests/file/rename_variation6.phpt
new file mode 100644
index 0000000..413dc6e
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation6.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test rename() function: usage variations-6
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows');
+if (!function_exists("symlink")) die("skip symlinks are not supported");
+?>
+--FILE--
+<?php
+
+$tmp_file = __FILE__.".tmp";
+$tmp_link = __FILE__.".tmp.link";
+$tmp_link2 = __FILE__.".tmp.link2";
+
+touch($tmp_file);
+symlink($tmp_file, $tmp_link);
+rename($tmp_link, $tmp_link2);
+
+clearstatcache();
+
+var_dump(readlink($tmp_link));
+var_dump(readlink($tmp_link2));
+var_dump(file_exists($tmp_file));
+
+@unlink($tmp_link);
+@unlink($tmp_link2);
+@unlink($tmp_file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+string(%d) "%srename_variation6.php.tmp"
+bool(true)
+Done
diff --git a/ext/standard/tests/file/rename_variation7-win32.phpt b/ext/standard/tests/file/rename_variation7-win32.phpt
new file mode 100644
index 0000000..369e8c2
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation7-win32.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test rename() function: usage variations-8
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
+if (!function_exists("symlink")) die("skip symlinks are not supported");
+?>
+--FILE--
+<?php
+
+$tmp_link = __FILE__.".tmp.link";
+$tmp_link2 = __FILE__.".tmp.link2";
+
+if (symlink(dirname(__FILE__)."/there_is_no_such_file", $tmp_link)) {
+ rename($tmp_link, $tmp_link2);
+}
+
+clearstatcache();
+
+var_dump(readlink($tmp_link));
+var_dump(readlink($tmp_link2));
+
+@unlink($tmp_link);
+@unlink($tmp_link2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: symlink(): Could not fetch file information(error 2) in %srename_variation7-win32.php on line %d
+
+Warning: readlink(): readlink failed to read the symbolic link (%srename_variation7-win32.php.tmp.link), error 2) in %srename_variation7-win32.php on line %d
+bool(false)
+
+Warning: readlink(): readlink failed to read the symbolic link (%srename_variation7-win32.php.tmp.link2), error 2) in %srename_variation7-win32.php on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/rename_variation7.phpt b/ext/standard/tests/file/rename_variation7.phpt
new file mode 100644
index 0000000..5b93772
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation7.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test rename() function: usage variations-8
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows');
+if (!function_exists("symlink")) die("skip symlinks are not supported");
+?>
+--FILE--
+<?php
+
+$tmp_link = __FILE__.".tmp.link";
+$tmp_link2 = __FILE__.".tmp.link2";
+
+symlink(dirname(__FILE__)."/there_is_no_such_file", $tmp_link);
+rename($tmp_link, $tmp_link2);
+
+clearstatcache();
+
+var_dump(readlink($tmp_link));
+var_dump(readlink($tmp_link2));
+
+@unlink($tmp_link);
+@unlink($tmp_link2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+string(%d) "%sthere_is_no_such_file"
+Done
diff --git a/ext/standard/tests/file/rename_variation8-win32.phpt b/ext/standard/tests/file/rename_variation8-win32.phpt
new file mode 100644
index 0000000..1d25a12
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation8-win32.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test rename() function: variation
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() on non-existing file ***\n";
+$file_path = dirname(__FILE__);
+
+// try renaming a non existing file
+$src_name = $file_path."/non_existent_file.tmp";
+$dest_name = $file_path."/rename_variation8_new.tmp";
+var_dump( rename($src_name, $dest_name) );
+
+// ensure that $dest_name didn't get created
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting false
+
+// rename a existing dir to new name
+echo "\n*** Testing rename() on existing directory ***\n";
+$dir_name = $file_path."/rename_basic_dir";
+mkdir($dir_name);
+$new_dir_name = $file_path."/rename_basic_dir1";
+var_dump( rename($dir_name, $new_dir_name) );
+//ensure that $new_dir_name got created
+var_dump( file_exists($dir_name) ); // expecting false
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+// try to rename an non_existing dir
+echo "\n*** Testing rename() on non-existing directory ***\n";
+$non_existent_dir_name = $file_path."/non_existent_dir";
+$new_dir_name = "$file_path/rename_basic_dir2";
+var_dump( rename($non_existent_dir_name, $new_dir_name) );
+// ensure that $new_dir_name didn't get created
+var_dump( file_exists($non_existent_dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting false
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+rmdir(dirname(__FILE__)."/rename_basic_dir1");
+?>
+--EXPECTF--
+*** Testing rename() on non-existing file ***
+
+Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): The system cannot find the file specified. (code: 2) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing rename() on existing directory ***
+bool(true)
+bool(false)
+bool(true)
+
+*** Testing rename() on non-existing directory ***
+
+Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): The system cannot find the file specified. (code: 2) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation8.phpt b/ext/standard/tests/file/rename_variation8.phpt
new file mode 100644
index 0000000..6e236c3
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation8.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test rename() function: variation
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die('skip.. not for Windows');
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() on non-existing file ***\n";
+$file_path = dirname(__FILE__);
+
+// try renaming a non existing file
+$src_name = $file_path."/non_existent_file.tmp";
+$dest_name = $file_path."/rename_variation8_new.tmp";
+var_dump( rename($src_name, $dest_name) );
+
+// ensure that $dest_name didn't get created
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting false
+
+// rename a existing dir to new name
+echo "\n*** Testing rename() on existing directory ***\n";
+$dir_name = $file_path."/rename_basic_dir";
+mkdir($dir_name);
+$new_dir_name = $file_path."/rename_basic_dir1";
+var_dump( rename($dir_name, $new_dir_name) );
+//ensure that $new_dir_name got created
+var_dump( file_exists($dir_name) ); // expecting false
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+// try to rename an non_existing dir
+echo "\n*** Testing rename() on non-existing directory ***\n";
+$non_existent_dir_name = $file_path."/non_existent_dir";
+$new_dir_name = "$file_path/rename_basic_dir2";
+var_dump( rename($non_existent_dir_name, $new_dir_name) );
+// ensure that $new_dir_name didn't get created
+var_dump( file_exists($non_existent_dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting false
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/rename_basic_new2.tmp");
+rmdir(dirname(__FILE__)."/rename_basic_dir1");
+?>
+--EXPECTF--
+*** Testing rename() on non-existing file ***
+
+Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing rename() on existing directory ***
+bool(true)
+bool(false)
+bool(true)
+
+*** Testing rename() on non-existing directory ***
+
+Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation9.phpt b/ext/standard/tests/file/rename_variation9.phpt
new file mode 100644
index 0000000..272fa94
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation9.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test rename() function: basic functionality
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() by giving stream context as third argument ***\n";
+$file_path = dirname(__FILE__);
+
+$context = stream_context_create();
+
+// on directory
+$dir_name = "$file_path/rename_variation_dir9";
+$new_dir_name = "$file_path/rename_variation_dir9_new";
+
+mkdir($dir_name);
+
+var_dump( rename($dir_name, $new_dir_name, $context) );
+var_dump( file_exists($dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+//on file
+$src_name = "$file_path/rename_variation9.tmp";
+$dest_name = "$file_path/rename_variation9_new.tmp";
+
+// create the file
+$fp = fopen($src_name, "w");
+$s1 = stat($src_name);
+fclose($fp);
+
+var_dump( rename($src_name, $dest_name, $context) );
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting true
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/rename_variation9_new.tmp");
+rmdir(dirname(__FILE__)."/rename_variation_dir9_new");
+?>
+--EXPECT--
+*** Testing rename() by giving stream context as third argument ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/file/rmdir_variation1-win32.phpt b/ext/standard/tests/file/rmdir_variation1-win32.phpt
new file mode 100644
index 0000000..2516e61
--- /dev/null
+++ b/ext/standard/tests/file/rmdir_variation1-win32.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test rmdir() function : usage variation - invalid filenames
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool rmdir(string dirname[, resource context])
+ * Description: Remove a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rmdir() : usage variation ***\n";
+
+// 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');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase false' =>false,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // other
+ // php outputs Permission Denied, p8 outputs no suck file or dir
+ 'single space' => ' ',
+);
+
+// loop through each element of the array for dirname
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( rmdir($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rmdir() : usage variation ***
+
+--uppercase NULL--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--single space--
+Error: 2 - rmdir( ): %s, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/file/rmdir_variation1.phpt b/ext/standard/tests/file/rmdir_variation1.phpt
new file mode 100644
index 0000000..04fee0e
--- /dev/null
+++ b/ext/standard/tests/file/rmdir_variation1.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test rmdir() function : usage variation - invalid file names
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool rmdir(string dirname[, resource context])
+ * Description: Remove a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rmdir() : usage variation ***\n";
+
+// 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');
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase false' =>false,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // other
+ 'single space' => ' ',
+);
+
+// loop through each element of the array for dirname
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump(rmdir($value));
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rmdir() : usage variation ***
+
+--uppercase NULL--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - rmdir(): %s, %s(%d)
+bool(false)
+
+--single space--
+Error: 2 - rmdir( ): %s, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/file/rmdir_variation2.phpt b/ext/standard/tests/file/rmdir_variation2.phpt
new file mode 100644
index 0000000..2cee440
--- /dev/null
+++ b/ext/standard/tests/file/rmdir_variation2.phpt
@@ -0,0 +1,244 @@
+--TEST--
+Test rmdir() function : usage variation - different types for context
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool rmdir(string dirname[, resource context])
+ * Description: Remove a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rmdir() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$dirname = 'rmdirVar2.tmp';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+$fileres = fopen(__FILE__, 'r');
+
+//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,
+
+ // non stream context resource
+ $fileres,
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ @mkdir($dirname);
+ var_dump( rmdir($dirname, $value) );
+};
+
+@rmdir($dirname);
+fclose($fileres);
+?>
+===DONE===
+--EXPECTF--
+*** Testing rmdir() : usage variation ***
+
+--int 0--
+Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--string DQ--
+Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--string SQ--
+Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--mixed case string--
+Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--heredoc--
+Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - rmdir() expects parameter 2 to be resource, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - rmdir() expects parameter 2 to be resource, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--0--
+Error: 2 - rmdir(): supplied resource is not a valid Stream-Context resource, %s(%d)
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/file/rmdir_variation3-win32.phpt b/ext/standard/tests/file/rmdir_variation3-win32.phpt
new file mode 100644
index 0000000..e6b3eaa
--- /dev/null
+++ b/ext/standard/tests/file/rmdir_variation3-win32.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test rmdir() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool rmdir(string dirname[, resource context])
+ * Description: Remove a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rmdir() : variation ***\n";
+
+$workDir = "rmdirVar3.tmp";
+$subDir = "aSubDir";
+mkdir($workDir);
+$cwd = getcwd();
+
+$unixifiedDir = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDir, 3);
+
+$dirs = array(
+ // relative
+ $workDir.'\\'.$subDir,
+ '.\\'.$workDir.'\\'.$subDir,
+ $workDir.'\\..\\'.$workDir.'\\'.$subDir,
+
+ // relative bad path
+ $workDir.'\\..\\BADDIR\\'.$subDir,
+ 'BADDIR\\'.$subDir,
+
+ //absolute
+ $cwd.'\\'.$workDir.'\\'.$subDir,
+ $cwd.'\\.\\'.$workDir.'\\'.$subDir,
+ $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDir,
+
+ //absolute bad path
+ $cwd.'\\BADDIR\\'.$subDir,
+
+ //trailing separators
+ $workDir.'\\'.$subDir.'\\',
+ $cwd.'\\'.$workDir.'\\'.$subDir.'\\',
+
+ // multiple separators
+ $workDir.'\\\\'.$subDir,
+ $cwd.'\\\\'.$workDir.'\\\\'.$subDir,
+
+ // Unixified Dir
+ $unixifiedDir,
+
+ );
+
+
+foreach($dirs as $dir) {
+ mkdir($workDir.'/'.$subDir);
+ echo "-- removing $dir --\n";
+ $res = rmdir($dir);
+ if ($res === true) {
+ echo "Directory removed\n";
+ }
+ else {
+ rmdir($workDir.'/'.$subDir);
+ }
+}
+
+rmdir($workDir);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rmdir() : variation ***
+-- removing rmdirVar3.tmp\aSubDir --
+Directory removed
+-- removing .\rmdirVar3.tmp\aSubDir --
+Directory removed
+-- removing rmdirVar3.tmp\..\rmdirVar3.tmp\aSubDir --
+Directory removed
+-- removing rmdirVar3.tmp\..\BADDIR\aSubDir --
+
+Warning: rmdir(rmdirVar3.tmp\..\BADDIR\aSubDir): No such file or directory in %s on line %d
+-- removing BADDIR\aSubDir --
+
+Warning: rmdir(BADDIR\aSubDir): No such file or directory in %s on line %d
+-- removing %s\rmdirVar3.tmp\aSubDir --
+Directory removed
+-- removing %s\.\rmdirVar3.tmp\aSubDir --
+Directory removed
+-- removing %s\rmdirVar3.tmp\..\rmdirVar3.tmp\aSubDir --
+Directory removed
+-- removing %s\BADDIR\aSubDir --
+
+Warning: rmdir(%s\BADDIR\aSubDir): No such file or directory in %s on line %d
+-- removing rmdirVar3.tmp\aSubDir\ --
+Directory removed
+-- removing %s\rmdirVar3.tmp\aSubDir\ --
+Directory removed
+-- removing rmdirVar3.tmp\\aSubDir --
+Directory removed
+-- removing %s\\rmdirVar3.tmp\\aSubDir --
+Directory removed
+-- removing /%s/rmdirVar3.tmp/aSubDir --
+Directory removed
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/rmdir_variation3.phpt b/ext/standard/tests/file/rmdir_variation3.phpt
new file mode 100644
index 0000000..5848007
--- /dev/null
+++ b/ext/standard/tests/file/rmdir_variation3.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test rmdir() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool rmdir(string dirname[, resource context])
+ * Description: Remove a directory
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing rmdir() : variation ***\n";
+
+$workDir = "rmdirVar3.tmp";
+$subDir = "aSubDir";
+mkdir($workDir);
+$cwd = getcwd();
+
+$dirs = array(
+ // relative
+ $workDir.'/'.$subDir,
+ './'.$workDir.'/'.$subDir,
+ $workDir.'/../'.$workDir.'/'.$subDir,
+
+ // relative bad path
+ $workDir.'/../BADDIR/'.$subDir,
+ 'BADDIR/'.$subDir,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$subDir,
+ $cwd.'/./'.$workDir.'/'.$subDir,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$subDir,
+
+ //absolute bad path
+ $cwd.'/BADDIR/'.$subDir,
+
+ //trailing separators
+ $workDir.'/'.$subDir.'/',
+ $cwd.'/'.$workDir.'/'.$subDir.'/',
+
+ // multiple separators
+ $workDir.'//'.$subDir,
+ $cwd.'//'.$workDir.'//'.$subDir,
+
+ );
+
+
+foreach($dirs as $dir) {
+ mkdir($workDir.'/'.$subDir);
+ echo "-- removing $dir --\n";
+ $res = rmdir($dir);
+ if ($res === true) {
+ echo "Directory removed\n";
+ }
+ else {
+ rmdir($workDir.'/'.$subDir);
+ }
+}
+
+rmdir($workDir);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rmdir() : variation ***
+-- removing rmdirVar3.tmp/aSubDir --
+Directory removed
+-- removing ./rmdirVar3.tmp/aSubDir --
+Directory removed
+-- removing rmdirVar3.tmp/../rmdirVar3.tmp/aSubDir --
+Directory removed
+-- removing rmdirVar3.tmp/../BADDIR/aSubDir --
+
+Warning: rmdir(rmdirVar3.tmp/../BADDIR/aSubDir): No such file or directory in %s on line %d
+-- removing BADDIR/aSubDir --
+
+Warning: rmdir(BADDIR/aSubDir): No such file or directory in %s on line %d
+-- removing %s/rmdirVar3.tmp/aSubDir --
+Directory removed
+-- removing %s/./rmdirVar3.tmp/aSubDir --
+Directory removed
+-- removing %s/rmdirVar3.tmp/../rmdirVar3.tmp/aSubDir --
+Directory removed
+-- removing %s/BADDIR/aSubDir --
+
+Warning: rmdir(%s/BADDIR/aSubDir): No such file or directory in %s on line %d
+-- removing rmdirVar3.tmp/aSubDir/ --
+Directory removed
+-- removing %s/rmdirVar3.tmp/aSubDir/ --
+Directory removed
+-- removing rmdirVar3.tmp//aSubDir --
+Directory removed
+-- removing %s//rmdirVar3.tmp//aSubDir --
+Directory removed
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/stat_basic-win32.phpt b/ext/standard/tests/file/stat_basic-win32.phpt
new file mode 100644
index 0000000..e3e7ea7
--- /dev/null
+++ b/ext/standard/tests/file/stat_basic-win32.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test stat() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. valid only for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+require("$file_path/file.inc");
+
+echo "*** Testing stat() : basic functionality ***\n";
+
+/* creating temp directory and file */
+
+// creating dir
+$dirname = "$file_path/stat_basic";
+mkdir($dirname);
+// stat of the dir created
+$dir_stat = stat($dirname);
+clearstatcache();
+sleep(2);
+
+// creating file
+$filename = "$dirname/stat_basic.tmp";
+$file_handle = fopen($filename, "w");
+fclose($file_handle);
+// stat of the file created
+$file_stat = stat($filename);
+sleep(2);
+
+// now new stat of the dir after file is created
+$new_dir_stat = stat($dirname);
+clearstatcache();
+
+// stat contains 13 different values stored twice, can be accessed using
+// numeric and named keys, compare them to see they are same
+echo "*** Testing stat(): validating the values stored in stat ***\n";
+// Initial stat values
+var_dump( compare_self_stat($file_stat) ); //expect true
+var_dump( compare_self_stat($dir_stat) ); //expect true
+
+// New stat values taken after creation of file
+var_dump( compare_self_stat($new_dir_stat) ); // expect true
+
+// compare the two stat values, initial stat and stat recorded after
+// creating file, also dump the value of stats
+echo "*** Testing stat(): comparing stats (recorded before and after file creation) ***\n";
+echo "-- comparing difference in dir stats before and after creating file in it --\n";
+$affected_elements = array( 9, 'mtime' );
+var_dump( compare_stats($dir_stat, $new_dir_stat, $affected_elements, '!=', true) ); // expect true
+
+echo "*** Testing stat(): for the return value ***\n";
+var_dump( is_array( stat($filename) ) );
+
+echo "\n---Done---";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_basic/stat_basic.tmp");
+rmdir("$file_path/stat_basic");
+?>
+--EXPECTF--
+*** Testing stat() : basic functionality ***
+*** Testing stat(): validating the values stored in stat ***
+bool(true)
+bool(true)
+bool(true)
+*** Testing stat(): comparing stats (recorded before and after file creation) ***
+-- comparing difference in dir stats before and after creating file in it --
+array(26) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(0)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+ [9]=>
+ int(%d)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(-1)
+ [12]=>
+ int(-1)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(0)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(0)
+ ["gid"]=>
+ int(0)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(-1)
+ ["blocks"]=>
+ int(-1)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(-1)
+ [12]=>
+ int(-1)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(-1)
+ ["blocks"]=>
+ int(-1)
+}
+bool(true)
+*** Testing stat(): for the return value ***
+bool(true)
+
+---Done---
+
diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt
new file mode 100644
index 0000000..1b69da8
--- /dev/null
+++ b/ext/standard/tests/file/stat_error-win32.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test stat() function: error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/*
+ Prototype: array stat ( string $filename );
+ Description: Gives information about a file
+*/
+
+$file_path = dirname(__FILE__);
+$arr = array(__FILE__);
+
+echo "\n*** Testing stat() for error conditions ***\n";
+var_dump( stat() ); // args < expected
+var_dump( stat(__FILE__, 2) ); // file, args > expected
+var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected
+
+var_dump( stat("$file_path/temp.tmp") ); // non existing file
+var_dump( stat("$file_path/temp/") ); // non existing dir
+var_dump( stat(22) ); // scalar argument
+var_dump( stat($arr) ); // array argument
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing stat() for error conditions ***
+
+Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: stat(): stat failed for %s in %s on line %d
+bool(false)
+
+Warning: stat(): stat failed for %s in %s on line %d
+bool(false)
+
+Warning: stat(): stat failed for 22 in %s on line %d
+bool(false)
+
+Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
+NULL
+Done
+
diff --git a/ext/standard/tests/file/stat_variation1-win32.phpt b/ext/standard/tests/file/stat_variation1-win32.phpt
new file mode 100644
index 0000000..abbc88f
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation1-win32.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test stat() functions: usage variations - effects of rename()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the effects of rename() on stats of dir/file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+mkdir("$file_path/stat_variation1/"); // temp dir
+
+$file_handle = fopen("$file_path/stat_variation1.tmp", "w"); // temp file
+fclose($file_handle);
+
+
+echo "*** Testing stat(): on file and directory ater renaming them ***\n";
+
+// renaming a file
+echo "-- Testing stat() for files after being renamed --\n";
+$old_filename = "$file_path/stat_variation1.tmp";
+$new_filename = "$file_path/stat_variation1a.tmp";
+$old_stat = stat($old_filename);
+clearstatcache();
+sleep(2);
+var_dump( rename($old_filename, $new_filename) );
+$new_stat = stat($new_filename);
+
+// compare the self stat
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the two stats
+var_dump( compare_stats($old_stat, $old_stat, $all_stat_keys) );
+// clear the cache
+clearstatcache();
+
+// renaming a directory
+echo "-- Testing stat() for directory after being renamed --\n";
+$old_dirname = "$file_path/stat_variation1";
+$new_dirname = "$file_path/stat_variation1a";
+$old_stat = stat($old_dirname);
+clearstatcache();
+sleep(2);
+var_dump( rename($old_dirname, $new_dirname) );
+$new_stat = stat($new_dirname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the two stats
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) );
+// clear the cache
+clearstatcache();
+
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation1a.tmp");
+rmdir("$file_path/stat_variation1a");
+?>
+--EXPECTF--
+*** Testing stat(): on file and directory ater renaming them ***
+-- Testing stat() for files after being renamed --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+-- Testing stat() for directory after being renamed --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation2-win32.phpt b/ext/standard/tests/file/stat_variation2-win32.phpt
new file mode 100644
index 0000000..2bd9f80
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation2-win32.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test stat() functions: usage variations - effects of writing to file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the effects of writing to a file on the stats of the file */
+
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+$filename = "$file_path/stat_variation2.tmp";
+$file_handle = fopen($filename, "w"); // temp file
+fclose($file_handle);
+
+
+echo "*** Testing stat(): writing to a file ***\n";
+
+// writing to an empty file
+echo "-- Testing stat() on file after data is written in it --\n";
+$old_stat = stat($filename);
+clearstatcache();
+sleep(2);
+$file_handle = fopen($filename, "w"); // temp file
+fwrite($file_handle, "Hello World");
+fclose($file_handle);
+$new_stat = stat($filename);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stats
+$comp_arr = array(7, 'size');
+var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<"));
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation2.tmp");
+?>
+--EXPECTF--
+*** Testing stat(): writing to a file ***
+-- Testing stat() on file after data is written in it --
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation3-win32.phpt b/ext/standard/tests/file/stat_variation3-win32.phpt
new file mode 100644
index 0000000..e248116
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation3-win32.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test stat() functions: usage variations - effects of creating/deleting the dir/file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the effects of creating & deleting of subdir/file on the stats of dir/file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+mkdir("$file_path/stat_variation3/"); // temp dir
+
+echo "*** Testing stat(): with creating & deleting subdir/file ***\n";
+
+// creating and deleting subdir and files in the dir
+echo "-- Testing stat() on dir after subdir and file is created in it --\n";
+$dirname = "$file_path/stat_variation3";
+$old_stat = stat($dirname);
+clearstatcache();
+sleep(2);
+mkdir("$dirname/stat_variation3_subdir");
+$file_handle = fopen("$dirname/stat_variation3a.tmp", "w");
+fclose($file_handle);
+$new_stat = stat($dirname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stats
+$affected_members = array( 9, 'mtime');
+clearstatcache();
+sleep(2);
+var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
+unlink("$dirname/stat_variation3a.tmp");
+rmdir("$dirname/stat_variation3_subdir");
+clearstatcache();
+
+// comparing stats after the deletion of subdir and file
+echo "-- Testing stat() for comparing stats after the deletion of subdir and file --\n";
+$new_stat1 = stat($dirname);
+// compare self stats
+var_dump( compare_self_stat($new_stat1) );
+// compare the stats
+var_dump(compare_stats($new_stat, $new_stat1, $all_stat_keys, "="));
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/stat_variation3");
+?>
+--EXPECTF--
+
+*** Testing stat(): with creating & deleting subdir/file ***
+-- Testing stat() on dir after subdir and file is created in it --
+bool(true)
+bool(true)
+bool(true)
+-- Testing stat() for comparing stats after the deletion of subdir and file --
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation4-win32.phpt b/ext/standard/tests/file/stat_variation4-win32.phpt
new file mode 100644
index 0000000..a0ffed2
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation4-win32.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test stat() functions: usage variations - effects of is_dir() & is_file()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the effects on the stats of dir/file for using is_dir() & is_file() on dir/file */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+mkdir("$file_path/stat_variation4/"); // temp dir
+
+$file_handle = fopen("$file_path/stat_variation4.tmp", "w"); // temp file
+fclose($file_handle);
+
+
+echo "\n*** Testing stat(): on file and directory after accessing it
+ with is_dir() and is_file() functions ***\n";
+
+// is_dir() on a directory
+echo "-- Testing on Directory --\n";
+$old_dirname = "$file_path/stat_variation4";
+$old_stat = stat($old_dirname);
+// clear the cache
+clearstatcache();
+sleep(2);
+var_dump( is_dir($old_dirname) );
+$new_stat = stat($old_dirname);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") );
+// clear the stat
+clearstatcache();
+
+
+// is_file() on a file
+echo "-- Testing on file --\n";
+$old_filename = "$file_path/stat_variation4.tmp";
+$old_stat = stat($old_filename);
+// clear the stat
+clearstatcache();
+sleep(2);
+var_dump( is_file($old_filename) );
+$new_stat = stat($old_filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") );
+// clear the stat
+clearstatcache();
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation4.tmp");
+rmdir("$file_path/stat_variation4");
+?>
+--EXPECTF--
+*** Testing stat(): on file and directory after accessing it
+ with is_dir() and is_file() functions ***
+-- Testing on Directory --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+-- Testing on file --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation5-win32.phpt b/ext/standard/tests/file/stat_variation5-win32.phpt
new file mode 100644
index 0000000..038b9b6
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation5-win32.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test stat() functions: usage variations - file opened in read/write mode
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the stats of file opened in write mode and then same in read mode */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+$file_handle = fopen("$file_path/stat_variation5.tmp", "w"); // temp file
+fclose($file_handle);
+
+
+echo "\n*** Testing stat(): on a file with read/write permission ***\n";
+
+$filename = "$file_path/stat_variation5.tmp";
+$file_handle = fopen($filename, "w"); // create file
+fclose($file_handle);
+$old_stat = stat($filename);
+// clear the stat
+clearstatcache();
+sleep(2);
+// opening file again in read mode
+$file_handle = fopen($filename, "r"); // read file
+fclose($file_handle);
+$new_stat = stat($filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+$affected_members = array(10, 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
+// clear the stat
+clearstatcache();
+
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation5.tmp");
+?>
+--EXPECTF--
+
+*** Testing stat(): on a file with read/write permission ***
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation6-win32.phpt b/ext/standard/tests/file/stat_variation6-win32.phpt
new file mode 100644
index 0000000..3dae75b
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation6-win32.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test stat() functions: usage variations - changing permissions of dir/file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the effects on the stats of dir/file for changing permissions of dir/file */
+
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+$dirname = "$file_path/stat_variation6";
+mkdir($dirname); // temp dir
+
+$filename = "$file_path/stat_variation6.tmp";
+$file_handle = fopen($filename, "w"); // temp file
+fclose($file_handle);
+
+
+// checking stat() on file
+echo "\n*** Testing stat() on file with miscelleneous file permission and content ***\n";
+$old_stat = stat($filename);
+var_dump( chmod($filename, 0777) );
+// clear the stat
+clearstatcache();
+sleep(2);
+$new_stat = stat($filename);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+$affected_members = array( 10, 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
+// clear the stat
+clearstatcache(); // clear statement cache
+
+// checking stat() on directory
+echo "\n*** Testing stat() on directory with miscelleneous file permission ***\n";
+$old_stat = stat($dirname);
+var_dump( chmod($dirname, 0777) );
+// clear the stat
+clearstatcache();
+sleep(2);
+$new_stat = stat($dirname);
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+// compare the stat
+$affected_members = array( 10, 'ctime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
+// clear the stat
+clearstatcache(); // clear statement cache
+
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation6.tmp");
+rmdir("$file_path/stat_variation6");
+?>
+--EXPECTF--
+
+*** Testing stat() on file with miscelleneous file permission and content ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing stat() on directory with miscelleneous file permission ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation7-win32.phpt b/ext/standard/tests/file/stat_variation7-win32.phpt
new file mode 100644
index 0000000..d72305f
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation7-win32.phpt
@@ -0,0 +1,298 @@
+--TEST--
+Test stat() functions: usage variations - names of dir/file stored in objects
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the stats of dir/file when their names are stored in objects */
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+mkdir("$file_path/stat_variation7/"); // temp dir
+
+$file_handle = fopen("$file_path/stat_variation7.tmp", "w"); // temp file
+fclose($file_handle);
+
+
+echo "\n*** Testing stat(): with filename
+ and directory name stored inside a object ***\n";
+
+// creating object with members as numeric and non-numeric filename and directory name
+class object_temp {
+public $var_name;
+public function object_temp($name) {
+$this->var_name = $name;
+ }
+}
+
+// directory as member
+$obj1 = new object_temp("$file_path/stat_variation7/");
+$obj2 = new object_temp("$file_path/stat_variation7a/");
+
+// file as member
+$obj3 = new object_temp("$file_path/stat_variation7.tmp");
+$obj4 = new object_temp("$file_path/stat_variation7a.tmp");
+
+echo "\n-- Testing stat() on filename stored inside an object --\n";
+var_dump( stat($obj3->var_name) );
+
+$file_handle = fopen("$file_path/stat_variation7a.tmp", "w");
+fclose($file_handle);
+var_dump( stat($obj4->var_name) );
+
+echo "\n-- Testing stat() on directory name stored inside an object --\n";
+var_dump( stat($obj1->var_name) );
+
+mkdir("$file_path/stat_variation7a/");
+var_dump( stat($obj2->var_name) );
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation7.tmp");
+unlink("$file_path/stat_variation7a.tmp");
+rmdir("$file_path/stat_variation7");
+rmdir("$file_path/stat_variation7a");
+?>
+--EXPECTF--
+*** Testing stat(): with filename
+ and directory name stored inside a object ***
+
+-- Testing stat() on filename stored inside an object --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(-%d)
+ [12]=>
+ int(-%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(-%d)
+ ["blocks"]=>
+ int(-%d)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(-%d)
+ [12]=>
+ int(-%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(-%d)
+ ["blocks"]=>
+ int(-%d)
+}
+
+-- Testing stat() on directory name stored inside an object --
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(-%d)
+ [12]=>
+ int(-%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(-%d)
+ ["blocks"]=>
+ int(-%d)
+}
+array(26) {
+ [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)
+ [10]=>
+ int(%d)
+ [11]=>
+ int(-%d)
+ [12]=>
+ int(-%d)
+ ["dev"]=>
+ int(%d)
+ ["ino"]=>
+ int(%d)
+ ["mode"]=>
+ int(%d)
+ ["nlink"]=>
+ int(%d)
+ ["uid"]=>
+ int(%d)
+ ["gid"]=>
+ int(%d)
+ ["rdev"]=>
+ int(%d)
+ ["size"]=>
+ int(%d)
+ ["atime"]=>
+ int(%d)
+ ["mtime"]=>
+ int(%d)
+ ["ctime"]=>
+ int(%d)
+ ["blksize"]=>
+ int(-%d)
+ ["blocks"]=>
+ int(-%d)
+}
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/stat_variation8-win32.phpt b/ext/standard/tests/file/stat_variation8-win32.phpt
new file mode 100644
index 0000000..079bd0d
--- /dev/null
+++ b/ext/standard/tests/file/stat_variation8-win32.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test stat() functions: usage variations - effects of truncate()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+/*
+ * Prototype: array stat ( string $filename );
+ * Description: Gives information about a file
+ */
+
+/* test the effects of truncate() on stats of file */
+
+
+$file_path = dirname(__FILE__);
+require "$file_path/file.inc";
+
+
+/* create temp file and directory */
+
+$filename = "$file_path/stat_variation8.tmp";
+$file_handle = fopen($filename, "w"); // temp file
+fclose($file_handle);
+
+
+echo "\n*** Testing stat(): on file by truncating it to given size ***\n";
+
+// create temp file
+$file_handle = fopen($filename, "w");
+fclose($file_handle);
+
+clearstatcache(true, $filename);
+$old_stat = stat($filename);
+// clear the cache
+sleep(2);
+
+// opening file in r/w mode
+$file_handle = fopen($filename, "r+");
+var_dump( ftruncate($file_handle, 512) ); // truncate it
+fclose($file_handle);
+
+clearstatcache(true, $filename);
+$new_stat = stat($filename);
+
+// compare self stats
+var_dump( compare_self_stat($old_stat) );
+var_dump( compare_self_stat($new_stat) );
+
+// compare the stat
+$affected_members = array(7, 9, 'size', 'mtime');
+var_dump( compare_stats($old_stat, $new_stat, $affected_members, '!=') );
+
+// clear the stat
+clearstatcache(true, $filename); // clear previous size value in cache
+
+echo "\n*** Done ***";
+?>
+
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/stat_variation8.tmp");
+?>
+--EXPECTF--
+*** Testing stat(): on file by truncating it to given size ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/statcache-corruption.phpt b/ext/standard/tests/file/statcache-corruption.phpt
new file mode 100644
index 0000000..7fa3916
--- /dev/null
+++ b/ext/standard/tests/file/statcache-corruption.phpt
@@ -0,0 +1,13 @@
+--TEST--
+statcache corruption
+--FILE--
+<?php
+$a = stat(__FILE__);
+is_link(__FILE__);
+$b = stat(__FILE__);
+print_r(array_diff($a, $b));
+?>
+--EXPECT--
+Array
+(
+)
diff --git a/ext/standard/tests/file/statpage.phpt b/ext/standard/tests/file/statpage.phpt
new file mode 100644
index 0000000..f11be97
--- /dev/null
+++ b/ext/standard/tests/file/statpage.phpt
@@ -0,0 +1,20 @@
+--TEST--
+getlastmod() and others
+--FILE--
+<?php
+
+var_dump(getlastmod());
+var_dump(getmyinode());
+var_dump(getmyuid());
+var_dump(getmypid());
+var_dump(getmygid());
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+Done
diff --git a/ext/standard/tests/file/stream_001.phpt b/ext/standard/tests/file/stream_001.phpt
new file mode 100644
index 0000000..eece30a
--- /dev/null
+++ b/ext/standard/tests/file/stream_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+stream_wrapper_unregister() & stream_wrapper_restore()
+--FILE--
+<?php
+
+var_dump(stream_wrapper_unregister('file'));
+var_dump(fopen("file://".__FILE__, "r"));
+var_dump(stream_wrapper_restore('file'));
+var_dump(fopen("file://".__FILE__, "r"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+
+Warning: fopen(): Unable to find the wrapper "file" - did you forget to enable it when you configured PHP? in %s on line %d
+
+Warning: fopen(): file:// wrapper is disabled in the server configuration in %s on line %d
+
+Warning: fopen(file://%s): failed to open stream: no suitable wrapper could be found in %s on line %d
+bool(false)
+bool(true)
+resource(%d) of type (stream)
+Done
diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt
new file mode 100644
index 0000000..e982f70
--- /dev/null
+++ b/ext/standard/tests/file/stream_002.phpt
@@ -0,0 +1,53 @@
+--TEST--
+stream_socket_client() and invalid arguments
+--FILE--
+<?php
+
+$a = NULL;
+$b = NULL;
+var_dump(stream_socket_client("", $a, $b));
+var_dump($a, $b);
+var_dump(stream_socket_client("[", $a, $b));
+var_dump($a, $b);
+var_dump(stream_socket_client("[ ", $a, $b));
+var_dump($a, $b);
+var_dump(stream_socket_client(".", $a, $b));
+var_dump($a, $b);
+var_dump(stream_socket_client(1, $a, $b));
+var_dump($a, $b);
+var_dump(stream_socket_client(array(), $a, $b));
+var_dump($a, $b);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: stream_socket_client(): unable to connect to (Failed to parse address "") in %s on line %d
+bool(false)
+int(0)
+string(26) "Failed to parse address """
+
+Warning: stream_socket_client(): unable to connect to [ (Failed to parse address "[") in %s on line %d
+bool(false)
+int(0)
+string(27) "Failed to parse address "[""
+
+Warning: stream_socket_client(): unable to connect to [ (Failed to parse%saddress "[ ") in %s on line %d
+bool(false)
+int(0)
+string(%d) "Failed to parse%saddress "[ ""
+
+Warning: stream_socket_client(): unable to connect to . (Failed to parse address ".") in %s on line %d
+bool(false)
+int(0)
+string(27) "Failed to parse address ".""
+
+Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address "1") in %s on line %d
+bool(false)
+int(0)
+string(27) "Failed to parse address "1""
+
+Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+int(0)
+string(27) "Failed to parse address "1""
+Done
diff --git a/ext/standard/tests/file/stream_copy_to_stream.phpt b/ext/standard/tests/file/stream_copy_to_stream.phpt
new file mode 100644
index 0000000..716ae1f
--- /dev/null
+++ b/ext/standard/tests/file/stream_copy_to_stream.phpt
@@ -0,0 +1,154 @@
+--TEST--
+stream_copy_to_stream() tests
+--FILE--
+<?php
+define('WIN', substr(PHP_OS, 0, 3) == 'WIN');
+
+$initial_file = dirname(__FILE__).'/bug38086.txt';
+$new_file = dirname(__FILE__).'/bug38086_1.txt';
+
+$src = fopen($initial_file, 'r');
+stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest, 0));
+fclose($src); fclose($dest);
+
+var_dump(file_get_contents($new_file));
+unlink($new_file);
+
+/* --- */
+
+$src = fopen($initial_file, 'r');
+stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest, -1));
+fclose($src); fclose($dest);
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+/* --- */
+
+$src = fopen($initial_file, 'r');
+stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+/* --- */
+
+$src = fopen($initial_file, 'r');
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+/* --- */
+
+$src = fopen($initial_file, 'r');
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest, 1000000));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+
+unlink($new_file);
+
+/* --- */
+
+$src = fopen($initial_file, 'r');
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest, 10));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+/* --- */
+
+$src = fopen($initial_file, 'r');
+
+$dest = fopen($new_file, 'w');
+var_dump(stream_copy_to_stream($src, $dest, -1));
+fclose($src); fclose($dest);
+
+if (WIN) {
+ var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
+} else {
+ var_dump(file_get_contents($new_file));
+}
+unlink($new_file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(0)
+string(0) ""
+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
+"
+int(%d)
+string(134) "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
+"
+int(%d)
+string(134) "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
+"
+int(%d)
+string(10) "Another da"
+int(%d)
+string(134) "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
+"
+Done
diff --git a/ext/standard/tests/file/stream_enclosed.phpt b/ext/standard/tests/file/stream_enclosed.phpt
new file mode 100644
index 0000000..9520ecc
--- /dev/null
+++ b/ext/standard/tests/file/stream_enclosed.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Unexposed/leaked stream encloses another stream
+--SKIPIF--
+<?php
+if (!function_exists('leak_variable')) die("skip only debug builds");
+--FILE--
+<?php
+$s = fopen('php://temp/maxmemory=1024','wb+');
+
+$t = fopen('php://temp/maxmemory=1024','wb+');
+
+/* force conversion of inner stream to STDIO. */
+$i = 0;
+while ($i++ < 5000) {
+ fwrite($t, str_repeat('a',1024));
+}
+
+leak_variable($s, true);
+leak_variable($t, true);
+--EXPECT--
diff --git a/ext/standard/tests/file/stream_get_line.phpt b/ext/standard/tests/file/stream_get_line.phpt
new file mode 100644
index 0000000..89798ef
--- /dev/null
+++ b/ext/standard/tests/file/stream_get_line.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Crash inside stream_get_line(), when length=0
+--FILE--
+<?php
+$path = dirname(__FILE__) . '/test.html';
+
+file_put_contents($path, b"foo<br>bar<br>foo");
+$fp = fopen($path, "r");
+while ($fp && !feof($fp)) {
+ echo stream_get_line($fp, 0, "<br>")."\n";
+}
+fclose($fp);
+@unlink($path);
+?>
+--EXPECT--
+foo
+bar
+foo
diff --git a/ext/standard/tests/file/stream_rfc2397_001.phpt b/ext/standard/tests/file/stream_rfc2397_001.phpt
new file mode 100644
index 0000000..040dc26
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Stream: RFC2397 getting the data
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$data = 'data://,hello world';
+
+var_dump(file_get_contents($data));
+
+$file = fopen($data, 'r');
+unset($data);
+
+var_dump(stream_get_contents($file));
+
+?>
+===DONE===
+--EXPECT--
+string(11) "hello world"
+string(11) "hello world"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt
new file mode 100644
index 0000000..980863b
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_002.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Stream: RFC2397 getting meta data
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$streams = array(
+ 'data://,',
+ 'data://',
+ 'data://;base64,',
+ 'data://;base64',
+ 'data://foo,',
+ 'data://foo=bar,',
+ 'data://text/plain,',
+ 'data://text/plain;foo,',
+ 'data://text/plain;foo=bar,',
+ 'data://text/plain;foo=bar;bla,',
+ 'data://text/plain;foo=bar;base64,',
+ 'data://text/plain;foo=bar;bar=baz',
+ 'data://text/plain;foo=bar;bar=baz,',
+ );
+
+foreach($streams as $stream)
+{
+ $stream = fopen($stream, 'r');
+ $meta = @stream_get_meta_data($stream);
+ var_dump($meta);
+ var_dump(isset($meta['foo']) ? $meta['foo'] : null);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(7) {
+ ["wrapper_type"]=>
+ string(7) "RFC2397"
+ ["stream_type"]=>
+ string(7) "RFC2397"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(8) "data://,"
+ ["base64"]=>
+ bool(false)
+}
+NULL
+
+Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+array(7) {
+ ["wrapper_type"]=>
+ string(7) "RFC2397"
+ ["stream_type"]=>
+ string(7) "RFC2397"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(15) "data://;base64,"
+ ["base64"]=>
+ bool(true)
+}
+NULL
+
+Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+
+Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+
+Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+array(8) {
+ ["wrapper_type"]=>
+ string(7) "RFC2397"
+ ["stream_type"]=>
+ string(7) "RFC2397"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(18) "data://text/plain,"
+ ["mediatype"]=>
+ string(10) "text/plain"
+ ["base64"]=>
+ bool(false)
+}
+NULL
+
+Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+array(9) {
+ ["wrapper_type"]=>
+ string(7) "RFC2397"
+ ["stream_type"]=>
+ string(7) "RFC2397"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(26) "data://text/plain;foo=bar,"
+ ["mediatype"]=>
+ string(10) "text/plain"
+ ["foo"]=>
+ string(3) "bar"
+ ["base64"]=>
+ bool(false)
+}
+string(3) "bar"
+
+Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+array(9) {
+ ["wrapper_type"]=>
+ string(7) "RFC2397"
+ ["stream_type"]=>
+ string(7) "RFC2397"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(33) "data://text/plain;foo=bar;base64,"
+ ["mediatype"]=>
+ string(10) "text/plain"
+ ["foo"]=>
+ string(3) "bar"
+ ["base64"]=>
+ bool(true)
+}
+string(3) "bar"
+
+Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
+NULL
+NULL
+array(10) {
+ ["wrapper_type"]=>
+ string(7) "RFC2397"
+ ["stream_type"]=>
+ string(7) "RFC2397"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(34) "data://text/plain;foo=bar;bar=baz,"
+ ["mediatype"]=>
+ string(10) "text/plain"
+ ["foo"]=>
+ string(3) "bar"
+ ["bar"]=>
+ string(3) "baz"
+ ["base64"]=>
+ bool(false)
+}
+string(3) "bar"
+===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_003.gif b/ext/standard/tests/file/stream_rfc2397_003.gif
new file mode 100755
index 0000000..3dc4fc6
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_003.gif
Binary files differ
diff --git a/ext/standard/tests/file/stream_rfc2397_003.phpt b/ext/standard/tests/file/stream_rfc2397_003.phpt
new file mode 100644
index 0000000..7cc31fe
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_003.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Stream: RFC2397 decoding data
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$streams = array(
+ 'data://,A%20brief%20note',
+ 'data://application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local',
+ 'data://;base64,Zm9vYmFyIGZvb2Jhcg==',
+ 'stream_rfc2397_003.gif' => 'data://image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
+AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
+ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
+a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
+ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
+F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
+hhx4dbgYKAAA7',
+ );
+
+foreach($streams as $original => $stream)
+{
+ if (is_string($original)) {
+ var_dump(file_get_contents(dirname(__FILE__) . '/' . $original) == file_get_contents($stream));
+ } else {
+ var_dump(file_get_contents($stream));
+ }
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+string(12) "A brief note"
+string(40) "select_vcount,fcol_from_fieldtable/local"
+string(13) "foobar foobar"
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_004.phpt b/ext/standard/tests/file/stream_rfc2397_004.phpt
new file mode 100644
index 0000000..1a8da93
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_004.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Stream: RFC2397 Mozilla tests
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$streams = array(
+ 'data://,;test',
+ 'data://text/plain,test',
+ 'data://text/plain;charset=US-ASCII,test',
+ 'data://;charset=UTF-8,Hello',
+ 'data://text/plain;charset=UTF-8,Hello',
+ 'data://,a,b',
+ );
+
+foreach($streams as $stream)
+{
+ var_dump(@file_get_contents($stream));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+string(5) ";test"
+string(4) "test"
+string(4) "test"
+bool(false)
+string(5) "Hello"
+string(3) "a,b"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/stream_rfc2397_005.phpt b/ext/standard/tests/file/stream_rfc2397_005.phpt
new file mode 100644
index 0000000..8fa1c16
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_005.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Stream: RFC2397 without //
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$streams = array(
+ 'data:,A%20brief%20note',
+ 'data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local',
+ 'data:;base64,Zm9vYmFyIGZvb2Jhcg==',
+ 'data:,;test',
+ 'data:text/plain,test',
+ 'data:text/plain;charset=US-ASCII,test',
+ 'data:;charset=UTF-8,Hello',
+ 'data:text/plain;charset=UTF-8,Hello',
+ 'data:,a,b',
+ );
+
+foreach($streams as $stream)
+{
+ var_dump(@file_get_contents($stream));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+string(12) "A brief note"
+string(40) "select_vcount,fcol_from_fieldtable/local"
+string(13) "foobar foobar"
+string(5) ";test"
+string(4) "test"
+string(4) "test"
+bool(false)
+string(5) "Hello"
+string(3) "a,b"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt
new file mode 100644
index 0000000..e6694a2
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_006.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Stream: RFC2397 with corrupt? payload
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$streams = array(
+ "data:;base64,\0Zm9vYmFyIGZvb2Jhcg==",
+ "data:;base64,Zm9vYmFy\0IGZvb2Jhcg==",
+ 'data:;base64,#Zm9vYmFyIGZvb2Jhcg==',
+ 'data:;base64,#Zm9vYmFyIGZvb2Jhc=',
+ );
+
+foreach($streams as $stream)
+{
+ var_dump(file_get_contents($stream));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
+NULL
+
+Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
+NULL
+string(13) "foobar foobar"
+
+Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhc=): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_007.phpt b/ext/standard/tests/file/stream_rfc2397_007.phpt
new file mode 100644
index 0000000..8a6f315
--- /dev/null
+++ b/ext/standard/tests/file/stream_rfc2397_007.phpt
@@ -0,0 +1,143 @@
+--TEST--
+Stream: RFC2397 and seeking
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$streams = array(
+ "data:,012345",
+ );
+
+foreach($streams as $stream)
+{
+ echo "===$stream===\n";
+
+ $fp = fopen($stream, 'rb');
+
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:4,S===\n";
+ var_dump(fseek($fp, 4));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===GETC===\n";
+ var_dump(fgetc($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===GETC===\n";
+ var_dump(fgetc($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===REWIND===\n";
+ var_dump(rewind($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===GETC===\n";
+ var_dump(fgetc($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:3,S===\n";
+ var_dump(fseek($fp, 3, SEEK_SET));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:1,C===\n";
+ var_dump(fseek($fp, 1, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:-2,C===\n";
+ var_dump(fseek($fp, -2, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:-10,C===\n";
+ var_dump(fseek($fp, -10, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:3,S===\n";
+ var_dump(fseek($fp, 3, SEEK_SET));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:10,C===\n";
+ var_dump(fseek($fp, 10, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:-1,E===\n";
+ var_dump(fseek($fp, -1, SEEK_END));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:0,E===\n";
+ var_dump(fseek($fp, 0, SEEK_END));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:1,E===\n";
+ var_dump(fseek($fp, 1, SEEK_END));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+
+ fclose($fp);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===data:,012345===
+int(0)
+bool(false)
+===S:4,S===
+int(0)
+int(4)
+bool(false)
+===GETC===
+string(1) "4"
+int(5)
+bool(false)
+===GETC===
+string(1) "5"
+int(6)
+bool(true)
+===REWIND===
+bool(true)
+int(0)
+bool(false)
+===GETC===
+string(1) "0"
+int(1)
+bool(false)
+===S:3,S===
+int(0)
+int(3)
+bool(false)
+===S:1,C===
+int(0)
+int(4)
+bool(false)
+===S:-2,C===
+int(0)
+int(2)
+bool(false)
+===S:-10,C===
+int(-1)
+bool(false)
+bool(false)
+===S:3,S===
+int(0)
+int(3)
+bool(false)
+===S:10,C===
+int(-1)
+bool(false)
+bool(false)
+===S:-1,E===
+int(0)
+int(5)
+bool(false)
+===S:0,E===
+int(0)
+int(6)
+bool(false)
+===S:1,E===
+int(-1)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/file/stream_supports_lock.phpt b/ext/standard/tests/file/stream_supports_lock.phpt
new file mode 100644
index 0000000..bbf3993
--- /dev/null
+++ b/ext/standard/tests/file/stream_supports_lock.phpt
@@ -0,0 +1,46 @@
+--TEST--
+stream_supports_lock
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+$fp = fopen(__FILE__, "r");
+var_dump($fp);
+var_dump(stream_supports_lock($fp));
+fclose($fp);
+
+$fp = fopen("file://" . __FILE__, "r");
+var_dump($fp);
+var_dump(stream_supports_lock($fp));
+fclose($fp);
+
+$fp = fopen("php://memory", "r");
+var_dump($fp);
+var_dump(stream_supports_lock($fp));
+fclose($fp);
+
+$fp = fopen('data://text/plain,foobar', 'r');
+var_dump($fp);
+var_dump(stream_supports_lock($fp));
+fclose($fp);
+
+$sock = stream_context_create();
+var_dump($sock);
+var_dump(stream_supports_lock($sock));
+
+echo "Done\n";
+?>
+--EXPECTF--
+resource(%d) of type (stream)
+bool(true)
+resource(%d) of type (stream)
+bool(true)
+resource(%d) of type (stream)
+bool(false)
+resource(%d) of type (stream)
+bool(false)
+resource(%d) of type (stream-context)
+
+Warning: stream_supports_lock(): supplied resource is not a valid stream resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink.phpt b/ext/standard/tests/file/symlink.phpt
new file mode 100644
index 0000000..489c266
--- /dev/null
+++ b/ext/standard/tests/file/symlink.phpt
@@ -0,0 +1,78 @@
+--TEST--
+symlink() & friends
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/symlink.dat";
+$link = dirname(__FILE__)."/symlink.link";
+
+var_dump(symlink($filename, $link));
+var_dump(readlink($link));
+var_dump(linkinfo($link));
+@unlink($link);
+
+var_dump(readlink($link));
+var_dump(linkinfo($link));
+
+touch($filename);
+var_dump(symlink($filename, dirname(__FILE__)));
+@unlink($link);
+
+var_dump(symlink($filename, $link));
+@unlink($link);
+
+touch($link);
+var_dump(symlink($filename, $link));
+@unlink($link);
+
+var_dump(link($filename, $link));
+@unlink($filename);
+
+var_dump(link($filename, $link));
+@unlink($link);
+
+var_dump(symlink(".", "."));
+var_dump(link(".", "."));
+var_dump(readlink("."));
+var_dump(linkinfo("."));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+string(%d) "%ssymlink.dat"
+int(%d)
+
+Warning: readlink(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: linkinfo(): No such file or directory in %s on line %d
+int(-1)
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+bool(true)
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+bool(true)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: link(): %s in %s on line %d
+bool(false)
+
+Warning: readlink(): Invalid argument in %s on line %d
+bool(false)
+int(%d)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic1.phpt
new file mode 100644
index 0000000..416e6ae
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic1.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions: basic functionality - link to files
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+$file_path = dirname(__FILE__);
+
+// temp dir created in present working directory
+$dirname = "symlink_link_linkinfo_is_link_basic1";
+mkdir("$file_path/$dirname"); // creating temp dir
+
+/* Creating soft/hard link to $filename created in temp directory $dirname
+ and checking linkinfo() and is_link() on the link created */
+
+echo "*** Testing symlink(), linkinfo(), link() and is_link() : basic functionality ***\n";
+
+// creating file in $dirname, links are created to the this file
+$filename = "$file_path/$dirname/symlink_link_linkinfo_is_link_basic1.tmp";
+$filename = fopen($filename, "w");
+fclose($filename);
+
+// name of the soft link created to $filename
+$sym_linkname = "$file_path/$dirname/symlink_link_linkinfo_is_link_softlink_basic1.tmp";
+
+// name of the hard link created to $filename
+$linkname = "$file_path/$dirname/symlink_link_linkinfo_is_link_hardlink_basic1.tmp";
+
+// filename stored in array with single and double slash notation in its path
+$files = array (
+ "$file_path/$dirname/symlink_link_linkinfo_is_link_basic1.tmp",
+ "$file_path//$dirname//symlink_link_linkinfo_is_link_basic1.tmp"
+);
+
+$counter = 1;
+/* create soft/hard link to the file
+ and check linkinfo() and is_link() on the link created */
+foreach($files as $file) {
+ echo "\n-- Iteration $counter --\n";
+ echo "-- Testing on soft links --\n";
+ // create soft link
+ var_dump( symlink($file, $sym_linkname) );
+ // checking information of link with linkinfo()
+ var_dump( linkinfo($sym_linkname) );
+ // checking if given file is soft link
+ var_dump( is_link($sym_linkname) );
+ // clear the cache
+ clearstatcache();
+
+ // testing on hard link
+ echo "-- Testing on hard links --\n";
+ // creating hard link
+ var_dump( link($file, $linkname) );
+ // checking information of link with linkinfo()
+ var_dump( linkinfo($linkname) );
+ // checking if given link is soft link; expected: false
+ var_dump( is_link($linkname) );
+ // clear the cache
+ clearstatcache();
+
+ // deleting the links
+ unlink($sym_linkname);
+ unlink($linkname);
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$dirname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_basic1";
+unlink("$dirname/symlink_link_linkinfo_is_link_basic1.tmp");
+rmdir($dirname);
+?>
+--EXPECTF--
+*** Testing symlink(), linkinfo(), link() and is_link() : basic functionality ***
+
+-- Iteration 1 --
+-- Testing on soft links --
+bool(true)
+int(%d)
+bool(true)
+-- Testing on hard links --
+bool(true)
+int(%d)
+bool(false)
+
+-- Iteration 2 --
+-- Testing on soft links --
+bool(true)
+int(%d)
+bool(true)
+-- Testing on hard links --
+bool(true)
+int(%d)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic2.phpt
new file mode 100644
index 0000000..4df4872
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic2.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions: basic functionality - link to dirs
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing symlink(), linkinfo(), link() and is_link() : basic functionality ***\n";
+
+/* Creating soft/hard link to the temporary dir $dirname and checking
+ linkinfo() and is_link() on the link created to $dirname */
+
+$dirname = "symlink_link_linkinfo_is_link_basic2";
+mkdir($file_path."/".$dirname);
+
+echo "\n*** Testing symlink(), linkinfo(), link() and is_link() on directory ***\n";
+
+// name of the soft link created to $dirname
+$sym_linkname = "$file_path/$dirname/symlink_link_linkinfo_is_link_softlink_basic2.tmp";
+
+// name of the hard link created to $dirname
+$linkname = "$file_path/$dirname/symlink_link_linkinfo_is_link_hardlink_basic2.tmp";
+
+// testing on soft link
+echo "\n-- Testing on soft links --\n";
+// creating soft link to $dirname
+var_dump( symlink("$file_path/$dirname", $sym_linkname) ); // this works, expected true
+// gets information about soft link created to directory; expected: true
+var_dump( linkinfo($sym_linkname) );
+// checks if link created is soft link; expected: true
+var_dump( is_link($sym_linkname) );
+// clear the cache
+clearstatcache();
+
+// testing on hard link
+echo "\n-- Testing on hard links --\n";
+// creating hard link to $dirname; expected: false
+var_dump( link("$file_path/$dirname", $linkname) ); // this doesn't work, expected false
+var_dump( linkinfo($linkname) ); // link doesn't exists as not created, expected false
+var_dump( is_link($linkname) ); // link doesn't exists as not created, expected false
+// clear the cache
+clearstatcache();
+
+// deleting the links
+unlink($sym_linkname);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$dirname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_basic2";
+rmdir($dirname);
+?>
+--EXPECTF--
+*** Testing symlink(), linkinfo(), link() and is_link() : basic functionality ***
+
+*** Testing symlink(), linkinfo(), link() and is_link() on directory ***
+
+-- Testing on soft links --
+bool(true)
+int(%d)
+bool(true)
+
+-- Testing on hard links --
+
+Warning: link(): %s in %s on line %d
+bool(false)
+
+Warning: linkinfo(): No such file or directory in %s on line %d
+int(-1)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
new file mode 100644
index 0000000..8aae9b3
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
@@ -0,0 +1,115 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : error conditions - symlink & linkinfo
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+if (substr(PHP_OS, 0, 3) == 'SUN') {
+ die('skip Not valid for Sun Solaris');
+}
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+// create temp $filename and create link $linkname to it
+$filename = dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp";
+$fp = fopen($filename, "w"); // create temp file
+fclose($fp);
+
+// linkname used to create soft/hard link
+$linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp";
+
+echo "*** Testing symlink() for error conditions ***\n";
+//zero arguments
+var_dump( symlink() );
+
+//more than expected
+var_dump( symlink($filename, $linkname, true) );
+
+//invalid arguments
+var_dump( symlink(NULL, $linkname) ); // NULL as filename
+var_dump( symlink('', $linkname) ); // empty string as filename
+var_dump( symlink(false, $linkname) ); // boolean false as filename
+var_dump( symlink($filename, NULL) ); // NULL as linkname
+var_dump( symlink($filename, '') ); // '' as linkname
+var_dump( symlink($filename, false) ); // false as linkname
+
+echo "\n*** Testing linkinfo() for error conditions ***\n";
+//zero arguments
+var_dump( linkinfo() );
+
+//more than expected
+var_dump( linkinfo($linkname, true) );
+
+//invalid arguments
+var_dump( linkinfo(NULL) ); // NULL as linkname
+var_dump( linkinfo('') ); // empty string as linkname
+var_dump( linkinfo(false) ); // boolean false as linkname
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp");
+@unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp");
+?>
+--EXPECTF--
+*** Testing symlink() for error conditions ***
+
+Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+Warning: symlink(): %s in %s on line %d
+bool(false)
+
+*** Testing linkinfo() for error conditions ***
+
+Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: linkinfo(): %s in %s on line %d
+int(-1)
+
+Warning: linkinfo(): %s in %s on line %d
+int(-1)
+
+Warning: linkinfo(): %s in %s on line %d
+int(-1)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
new file mode 100644
index 0000000..98ce621
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : error conditions - link & is_link
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+// create temp $filename and create link $linkname to it
+$filename = dirname(__FILE__)."/symlink_link_linkinfo_is_link_error2.tmp";
+$fp = fopen($filename, "w"); // create temp file
+fclose($fp);
+
+// linkname used to create soft/hard link
+$linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error2.tmp";
+
+echo "*** Testing link() for error conditions ***\n";
+//zero arguments
+var_dump( link() );
+
+//more than expected
+var_dump( link($filename, $linkname, false) );
+
+//invalid arguments
+var_dump( link(NULL, $linkname) ); // NULL as filename
+var_dump( link('', $linkname) ); // empty string as filename
+var_dump( link(' ', $linkname) ); // space as filename
+var_dump( link(false, $linkname) ); // boolean false as filename
+var_dump( link($filename, NULL) ); // NULL as linkname
+var_dump( link($filename, '') ); // '' as linkname
+var_dump( link($filename, false) ); // false as linkname
+
+echo "\n*** Testing is_link() for error conditions ***\n";
+//zero arguments
+var_dump( is_link() );
+
+//more than expected
+var_dump( is_link($linkname, "/") );
+
+//invalid arguments
+var_dump( is_link(NULL) ); // NULL as linkname
+var_dump( is_link('') ); // empty string as linkname
+var_dump( is_link(' ') ); // space as linkname
+var_dump( is_link(false) ); // boolean false as linkname
+var_dump( is_link($filename) ); // file given to is_link
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error2.tmp");
+?>
+--EXPECTF--
+*** Testing link() for error conditions ***
+
+Warning: link() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: link() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+*** Testing is_link() for error conditions ***
+
+Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation1.phpt
new file mode 100644
index 0000000..e3185c4
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation1.phpt
@@ -0,0 +1,136 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - link name stored in an array/object
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 1 : Creating links across directories where linkname is stored as an object and array member */
+
+// creating temp directory which will contain temp file and links created
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/symlink_link_linkinfo_is_link_variation1/test/home";
+mkdir($dirname, 0777, true);
+
+// creating temp file; links are created to this file later on
+$filename = "$file_path/symlink_link_linkinfo_is_link_variation1/symlink_link_linkinfo_is_link_variation1.tmp";
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members in an object ***\n";
+class object_temp {
+ var $linkname;
+ function object_temp($link) {
+ $this->linkname = $link;
+ }
+}
+
+$obj = new object_temp("$dirname/symlink_link_linkinfo_is_link_link.tmp");
+/* Testing on soft links */
+echo "\n-- Working with soft links --\n";
+// creating soft link
+var_dump( symlink($filename, $obj->linkname) );
+// check if the link exists
+var_dump( linkinfo($obj->linkname) );
+// check if link is soft link
+var_dump( is_link($obj->linkname) );
+// delete the link created
+unlink($obj->linkname);
+// clear the cache
+clearstatcache();
+
+/* Testing on hard links */
+echo "\n-- Working with hard links --\n";
+// creating hard link
+var_dump( link($filename, $obj->linkname) );
+// check if the link exists
+var_dump( linkinfo($obj->linkname) );
+// check if link is soft link; expected: false as the link is a hardlink
+var_dump( is_link($obj->linkname) );
+// delete the link created
+unlink($obj->linkname);
+// clear the cache
+clearstatcache();
+
+echo "\n*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members of an array ***\n";
+
+$link_arr = array("$dirname/symlink_link_linkinfo_is_link_link.tmp");
+
+/* Testing on soft links */
+echo "\n-- Working with soft links --\n";
+// creating soft link
+var_dump( symlink($filename, $link_arr[0]) );
+// check if the link exist
+var_dump( linkinfo($link_arr[0]) );
+// check if link is soft link
+var_dump( is_link($link_arr[0]) );
+// delete the link created
+unlink($link_arr[0]);
+// clear the cache
+clearstatcache();
+
+/* Testing on hard links */
+echo "\n-- Working with hard links --\n";
+// creating hard link
+var_dump( link($filename, $link_arr[0]) );
+// check if the link exist
+var_dump( linkinfo($link_arr[0]) );
+// check if link is soft link; expected: false as this is a hardlink
+var_dump( is_link($link_arr[0]) );
+// delete the links created
+unlink($link_arr[0]);
+// clear the cache
+clearstatcache();
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/symlink_link_linkinfo_is_link_variation1";
+unlink("$dirname/symlink_link_linkinfo_is_link_variation1.tmp");
+rmdir("$dirname/test/home");
+rmdir("$dirname/test");
+rmdir($dirname);
+?>
+--EXPECTF--
+*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members in an object ***
+
+-- Working with soft links --
+bool(true)
+int(%d)
+bool(true)
+
+-- Working with hard links --
+bool(true)
+int(%d)
+bool(false)
+
+*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members of an array ***
+
+-- Working with soft links --
+bool(true)
+int(%d)
+bool(true)
+
+-- Working with hard links --
+bool(true)
+int(%d)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt
new file mode 100644
index 0000000..6ee6f12
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - hardlink to non-existent file
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 2 : Create hard link to non-existent file */
+
+$file_path = dirname(__FILE__);
+// non-existing filename
+$non_existent_file = "$file_path/non_existent_file_variation2.tmp";
+// non-existing linkname
+$non_existent_linkname = "$file_path/non_existent_linkname_variation2.tmp";
+
+echo "*** Creating a hard link to a non-existent file ***\n";
+// creating hard link to non_existent file
+var_dump( link($non_existent_file, $non_existent_linkname) ); // expected false
+
+// checking linkinfo() and is_link() on the link; expected: false
+var_dump( linkinfo($non_existent_linkname) );
+var_dump( is_link($non_existent_linkname) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Creating a hard link to a non-existent file ***
+
+Warning: link(): No such file or directory in %s on line %d
+bool(false)
+
+Warning: linkinfo(): No such file or directory in %s on line %d
+int(-1)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation3.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation3.phpt
new file mode 100644
index 0000000..21c9b57
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation3.phpt
@@ -0,0 +1,146 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - access/update file through softlink
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 3 : Create file and a soft link to the file
+ Access data of the file through the soft link
+ Update the file through soft link
+ Check size of file and soft link link
+*/
+
+$file_path = dirname(__FILE__);
+echo "*** Accessing and updating data of file through soft link ***\n";
+// Creating file and inserting data into it
+$filename = "$file_path/symlink_link_linkinfo_is_link_variation3.tmp";
+
+// create temp file
+$file = fopen($filename, "w");
+
+// create soft link to file
+$linkname = "$file_path/symlink_link_linkinfo_is_link_link_variation3.tmp";
+var_dump( symlink($filename, $linkname) );
+// storing size of symlink in a local variable
+$link_stat = lstat($linkname); // lstat of link
+$link_size = $link_stat[7]; // size of soft link
+
+// fill data into file
+fwrite($file, str_repeat("text", 20) );
+fclose($file);
+
+echo "\n-- Access data of the file through the soft link --\n";
+$data_from_link = file_get_contents($linkname); // data read from $filename
+var_dump( $data_from_link );
+
+echo "\n-- Check size of soft link and file --\n";
+var_dump( filesize($filename) );
+var_dump( filesize($linkname) );
+
+// taking lstat of symlink
+$stat = lstat($linkname);
+// checking that size of symlink remains same
+if ($link_size == $stat[7])
+ echo "\nSoft link size remains same \n";
+else
+ echo "\nWarning: Soft link size has changed \n";
+
+echo "\n-- Updating file with data through soft link --\n";
+// append link with data
+$fp = fopen($linkname, "a"); // open in append mode
+fwrite($fp, "Hello World");
+fclose($fp);
+
+// now check temp file for data; it should append "Hello World"
+$data_from_file = file_get_contents($filename);
+var_dump( $data_from_file );
+
+echo "\n-- Check size of soft link and file --\n";
+var_dump( filesize($filename) );
+var_dump( filesize($linkname) );
+
+// taking lstat of symlink
+$stat = lstat($linkname);
+// checking that size of symlink remains same
+if ($link_size == $stat[7])
+ echo "\nSoft link size remains same \n";
+else
+ echo "\nWarning: Soft link size has changed \n";
+
+echo "\n-- Updating file with data and check data through soft link --\n";
+// write to temp file
+$file = fopen($filename, "w");
+fwrite($file, "Hello World");
+fclose($file);
+
+// now check link for data; it should echo "Hello World"
+$data_from_link = file_get_contents($linkname);
+var_dump( $data_from_link );
+
+echo "\n-- Check size of soft link and file --\n";
+var_dump( filesize($filename) );
+var_dump( filesize($linkname) );
+
+// taking lstat of symlink
+$stat = lstat($linkname);
+// checking that size of symlink remains same
+if ($link_size == $stat[7])
+ echo "\nSoft link size remains same \n";
+else
+ echo "\nWarning: Soft link size has changed \n";
+
+// delete the link
+unlink($linkname);
+// delete the temporary file
+unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Accessing and updating data of file through soft link ***
+bool(true)
+
+-- Access data of the file through the soft link --
+string(80) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext"
+
+-- Check size of soft link and file --
+int(80)
+int(80)
+
+Soft link size remains same
+
+-- Updating file with data through soft link --
+string(91) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextHello World"
+
+-- Check size of soft link and file --
+int(91)
+int(91)
+
+Soft link size remains same
+
+-- Updating file with data and check data through soft link --
+string(11) "Hello World"
+
+-- Check size of soft link and file --
+int(11)
+int(11)
+
+Soft link size remains same
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation4.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation4.phpt
new file mode 100644
index 0000000..f58937c
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation4.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - access/update file through hard link
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 4 : Create file and a hard link to the file
+ Access data of the file through the hard link
+ Update the file through hard link
+ Check size of file and hard link
+*/
+$file_path = dirname(__FILE__);
+
+echo "*** Accessing and updating data of file through hard link ***\n";
+// Creating file and inserting data into it
+$filename = "$file_path/symlink__link_linkinfo_is_link_variation4.tmp";
+// create temp file
+$file = fopen($filename, "w");
+// fill data into file
+fwrite($file, str_repeat("text", 20) );
+fclose($file);
+
+echo "\n-- Access data of the file through the hard link --\n";
+// create hard link to file
+$linkname = "$file_path/symlink_link_linkinfo_is_link_link_variation4.tmp";
+var_dump( link($filename, $linkname) );
+$data_from_link = file_get_contents($linkname); // data read from $filename
+var_dump( $data_from_link );
+
+echo "\n-- Check size of hard link and file --\n";
+if( filesize($filename) == filesize($linkname) )
+ echo "\nSize of file and hard link are same\n";
+else
+ echo "\nWarning: Size of file and hard link differ\n";
+
+echo "\n-- Updating file with data through hard link --\n";
+// append link with data
+$fp = fopen($linkname, "a"); // open in append mode
+fwrite($fp, "Hello World");
+fclose($fp);
+
+// now check temp file for data; it should append "Hello World"
+$data_from_file = file_get_contents($filename);
+var_dump( $data_from_file );
+
+echo "\n-- Check size of hard link and file --\n";
+if( filesize($filename) == filesize($linkname) )
+ echo "\nSize of file and hard link are same\n";
+else
+ echo "\nWarning: Size of file and hard link differ\n";
+
+echo "\n-- Updating file with data and check data through hard link --\n";
+// write to temp file
+$file = fopen($filename, "w");
+fwrite($file, "Hello World");
+fclose($file);
+
+// now check link for data; it should echo "Hello World"
+$data_from_link = file_get_contents($linkname);
+var_dump( $data_from_link );
+
+echo "\n-- Check size of hard link and file --\n";
+var_dump( filesize($filename) );
+var_dump( filesize($linkname) );
+if( filesize($filename) == filesize($linkname) )
+ echo "\nSize of file and hard link are same\n";
+else
+ echo "\nWarning: Size of file and hard link differ\n";
+
+// delete the link
+unlink($linkname);
+// delete the temporary file
+unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Accessing and updating data of file through hard link ***
+
+-- Access data of the file through the hard link --
+bool(true)
+string(80) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext"
+
+-- Check size of hard link and file --
+
+Size of file and hard link are same
+
+-- Updating file with data through hard link --
+string(91) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextHello World"
+
+-- Check size of hard link and file --
+
+Size of file and hard link are same
+
+-- Updating file with data and check data through hard link --
+string(11) "Hello World"
+
+-- Check size of hard link and file --
+int(11)
+int(11)
+
+Size of file and hard link are same
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation5.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation5.phpt
new file mode 100644
index 0000000..f7d2774
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation5.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - work on deleted link
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 5 : Creating link, deleting it and checking linkinfo(), is_link() on it */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing linkinfo() and is_link() on deleted link ***\n";
+// link name used here
+$linkname = "$file_path/symlink_link_linkinfo_is_link_link_variation5.tmp";
+
+// create temp dir
+$dirname = "$file_path/symlink_link_linkinfo_is_link_variation5";
+mkdir($dirname);
+
+// filename used here
+$filename = "$dirname/symlink_link_linkinfo_is_link_variation5.tmp";
+// create the file
+$fp = fopen($filename, "w");
+$data = "Hello World";
+fwrite($fp, $data);
+fclose($fp);
+
+var_dump( symlink($filename, $linkname) ); // create link
+
+// delete the link
+var_dump( unlink($linkname) ); // delete the link
+
+// clear the cache
+clearstatcache();
+
+// try using linkinfo() & is_link() on deleted link; expected: false
+$deleted_link = $linkname;
+var_dump( linkinfo($deleted_link) );
+var_dump( is_link($deleted_link) );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/symlink_link_linkinfo_is_link_variation5";
+$filename = "$dirname/symlink_link_linkinfo_is_link_variation5.tmp";
+unlink($filename);
+rmdir($dirname);
+?>
+--EXPECTF--
+*** Testing linkinfo() and is_link() on deleted link ***
+bool(true)
+bool(true)
+
+Warning: linkinfo(): No such file or directory in %s on line %d
+int(-1)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt
new file mode 100644
index 0000000..9b9afba
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - link & dir perms.
+--SKIPIF--
+<?php
+if ( substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip no symlinks on Windows');
+}
+if ( substr(PHP_OS, 0, 3) == 'MAC' ) {
+ die('skip Not valid for MacOS');
+}
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/symlink_link_linkinfo_is_link6_check_root.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 6 : Change permission of directory and try creating links inside that directory */
+$file_path = dirname(__FILE__);
+
+echo "*** Creating links in a directory without permission to allow the operation ***\n";
+// temp file used
+$dirname = "$file_path/symlink_link_linkinfo_is_link_variation6";
+mkdir($dirname);
+$filename = "$dirname/symlink_link_linkinfo_is_link_variation6.tmp";
+
+// remove all permissions from dir
+var_dump( chmod($dirname, 0000) );
+
+echo "\n-- Working with soft links --\n";
+$linkname = "$dirname/non_existent_link_variation5.tmp";
+
+// expected: false
+var_dump( symlink($filename, $linkname) ); // this link won't get created
+var_dump( linkinfo($linkname) );
+var_dump( is_link($linkname) );
+// clear the cache
+clearstatcache();
+
+echo "\n-- Working with hard links --\n";
+// expected: false
+var_dump( link($filename, $linkname) );
+var_dump( linkinfo($linkname) );
+var_dump( is_link($linkname) );
+// clear the cache
+clearstatcache();
+
+chmod($dirname, 0777); // to enable dir deletion
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/symlink_link_linkinfo_is_link_variation6";
+$filename = "$dirname/symlink_link_linkinfo_is_link_variation6.tmp";
+if(file_exists($filename)) {
+unlink($filename);
+}
+if(file_exists($dirname)) {
+rmdir($dirname);
+}
+?>
+--EXPECTF--
+*** Creating links in a directory without permission to allow the operation ***
+bool(true)
+
+-- Working with soft links --
+
+Warning: symlink(): Permission denied in %s on line %d
+bool(false)
+
+Warning: linkinfo(): Permission denied in %s on line %d
+int(-1)
+bool(false)
+
+-- Working with hard links --
+
+Warning: link(): Permission denied in %s on line %d
+bool(false)
+
+Warning: linkinfo(): Permission denied in %s on line %d
+int(-1)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation7.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation7.phpt
new file mode 100644
index 0000000..82ca75b
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation7.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - try link to self
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 7 : Create soft/hard link to itself */
+
+// temp file used
+$file_path = dirname(__FILE__);
+$dir = "$file_path/symlink_link_linkinfo_is_link_variation7";
+$filename = "$dir/symlink_link_linkinfo_is_link_variation7.tmp";
+// link name used
+$linkname = "$dir/symlink_link_linkinfo_is_link_link_variation7.tmp";
+// temp dirname used
+$dirname = "$dir/home/test";
+mkdir($dirname, 0755, true);
+
+// create file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "*** Create soft link to file and then to itself ***\n";
+// create soft link to $filename
+var_dump( symlink($filename, $linkname) );
+// create another link to $linkname
+var_dump( symlink($linkname, $linkname) );
+// delete link
+unlink($linkname);
+
+echo "\n*** Create soft link to directory and then to itself ***\n";
+// create soft link to $dirname
+var_dump( symlink($dirname, $linkname) );
+// create another link to $dirname
+var_dump( symlink($linkname, $linkname) );
+// delete link
+unlink($linkname);
+
+echo "\n*** Create hard link to file and then to itself ***\n";
+// create hard link to $filename
+var_dump( link($filename, $linkname) );
+// create another link to $linkname
+var_dump( link($linkname, $linkname) );
+// delete link
+unlink($linkname);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir = "$file_path/symlink_link_linkinfo_is_link_variation7";
+$filename = "$dir/symlink_link_linkinfo_is_link_variation7.tmp";
+unlink($filename);
+rmdir("$dir/home/test");
+rmdir("$dir/home");
+rmdir($dir);
+?>
+--EXPECTF--
+*** Create soft link to file and then to itself ***
+bool(true)
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+
+*** Create soft link to directory and then to itself ***
+bool(true)
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+
+*** Create hard link to file and then to itself ***
+bool(true)
+
+Warning: link(): File exists in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation8.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation8.phpt
new file mode 100644
index 0000000..27b8f58
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation8.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - try link with same name in diff. dir
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 8 : Create soft/hard link to different directory */
+
+/* creating link to a file in different dir with the same name as the file */
+echo "\n*** Create hard link in different directory with same filename ***\n";
+// temp file used
+$file_path = dirname(__FILE__);
+$filename = "$file_path/symlink_link_linkinfo_is_link_variation8.tmp";
+// temp link name used
+$dirname = "$file_path/symlink_link_linkinfo_is_link1_variation8";
+mkdir($dirname);
+$linkname = "symlink_link_linkinfo_is_link_variation8.tmp";
+// create temp file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+var_dump( link($filename, $dirname."/") ); // this fails indicating file exists
+// ok, creates "$file_path/symlink_link_linkinfo_is_link1_variation8/symlink_link_linkinfo_is_link_variation8.tmp" link
+var_dump( link($filename, $dirname."/".$linkname) ); // this works fine
+// delete link
+unlink($dirname."/".$linkname);
+// delete temp file
+unlink($filename);
+// delete temp dir
+rmdir($dirname);
+
+echo "\n*** Create soft link in different directory with same filename ***\n";
+$filename = "$file_path/symlink_link_linkinfo_is_link_variation8.tmp";
+// temp link name used
+$dirname = "$file_path/symlink_link_linkinfo_is_link1_variation8";
+mkdir($dirname);
+$linkname = "symlink_link_linkinfo_is_link_variation8.tmp";
+// create temp file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+var_dump( symlink($filename, $dirname."/") ); // this fails indicating file exists
+// ok, creates "$file_path/symlink_link_linkinfo_is_link1_variation8/symlink_link_linkinfo_is_link_variation8.tmp" link
+var_dump( symlink($filename, $dirname."/".$linkname) ); // this works fine
+// delete link
+unlink($dirname."/".$linkname);
+// delete temp file
+unlink($filename);
+// delete temp dir
+rmdir($dirname);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Create hard link in different directory with same filename ***
+
+Warning: link(): File exists in %s on line %d
+bool(false)
+bool(true)
+
+*** Create soft link in different directory with same filename ***
+
+Warning: symlink(): File exists in %s on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt
new file mode 100644
index 0000000..aacbcd4
--- /dev/null
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test symlink(), linkinfo(), link() and is_link() functions : usage variations - link & lstat[dev] value
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool symlink ( string $target, string $link );
+ Description: creates a symbolic link to the existing target with the specified name link
+
+ Prototype: bool is_link ( string $filename );
+ Description: Tells whether the given file is a symbolic link.
+
+ Prototype: bool link ( string $target, string $link );
+ Description: Create a hard link
+
+ Prototype: int linkinfo ( string $path );
+ Description: Gets information about a link
+*/
+
+/* Variation 9 : Check lstat of soft/hard link created
+ Check linkinfo() value with lstat['dev']
+*/
+// temp file used
+$file_path = dirname(__FILE__);
+$dirname = $file_path."/symlink_link_linkinfo_is_link_variation9";
+mkdir($dirname);
+$filename = "$dirname/symlink_link_linkinfo_is_link_variation9.tmp";
+// soft link name used
+$soft_link = "$dirname/symlink_link_linkinfo_is_link_softlink_variation9.tmp";
+// hard link name used
+$hard_link = "$dirname/symlink_link_linkinfo_is_link_hardlink_variation9.tmp";
+
+// create the file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "*** Checking lstat() on soft link ***\n";
+// create soft link
+var_dump( symlink($filename, $soft_link) );
+
+// confirming that linkinfo() = lstat['dev'] , this should always match
+$linkinfo = linkinfo($soft_link);
+$s1 = lstat($soft_link);
+echo "linkinfo() returns : $linkinfo\n";
+echo "lstat() returns lstat['dev'] as $s1[0]\n";
+if( $s1[0] == $linkinfo )
+ echo "\nlinkinfo() value matches lstat['dev']\n";
+else
+ echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+// delete link
+unlink($soft_link);
+
+echo "\n*** Checking lstat() on hard link ***\n";
+// create hard link
+var_dump( link($filename, $hard_link) );
+// confirming that linkinfo() = lstat['dev'] , this should always match
+$linkinfo = linkinfo($hard_link);
+$s1 = lstat($hard_link);
+echo "linkinfo() returns : $linkinfo\n";
+echo "lstat() returns lstat['dev'] as $s1[0]\n";
+if( $s1[0] == $linkinfo )
+ echo "\nlinkinfo() value matches lstat['dev']\n";
+else
+ echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+
+// delete link
+unlink($hard_link);
+
+echo "\n*** Checking lstat() on a soft link to directory ***\n";
+// create soft link
+var_dump( symlink($dirname, $soft_link) );
+
+// confirming that linkinfo() = lstat['dev'], this should always match
+$linkinfo = linkinfo($soft_link);
+$s1 = lstat($soft_link);
+echo "linkinfo() returns : $linkinfo\n";
+echo "lstat() returns lstat['dev'] as $s1[0]\n";
+if( $s1[0] == $linkinfo )
+ echo "\nlinkinfo() value matches lstat['dev']\n";
+else
+ echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+
+// delete link
+unlink($soft_link);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dirname = $file_path."/symlink_link_linkinfo_is_link_variation9";
+$filename = "$dirname/symlink_link_linkinfo_is_link_variation9.tmp";
+unlink($filename);
+rmdir($dirname);
+?>
+--EXPECTF--
+*** Checking lstat() on soft link ***
+bool(true)
+linkinfo() returns : %d
+lstat() returns lstat['dev'] as %d
+
+linkinfo() value matches lstat['dev']
+
+*** Checking lstat() on hard link ***
+bool(true)
+linkinfo() returns : %d
+lstat() returns lstat['dev'] as %d
+
+linkinfo() value matches lstat['dev']
+
+*** Checking lstat() on a soft link to directory ***
+bool(true)
+linkinfo() returns : %d
+lstat() returns lstat['dev'] as %d
+
+linkinfo() value matches lstat['dev']
+Done
diff --git a/ext/standard/tests/file/symlink_to_symlink.phpt b/ext/standard/tests/file/symlink_to_symlink.phpt
new file mode 100644
index 0000000..b7554f9
--- /dev/null
+++ b/ext/standard/tests/file/symlink_to_symlink.phpt
@@ -0,0 +1,50 @@
+--TEST--
+symlink() using a relative path, and symlink() to a symlink
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+$prefix = __FILE__;
+
+touch($prefix . "_file");
+
+// symlink to a regular file using a relative dest
+symlink(basename($prefix . "_file"), $prefix . "_link1");
+
+// symlink to a symlink using a relative path
+symlink(basename($prefix . "_link1"), $prefix . "_link2");
+
+// symlink to a non-existent path
+@unlink($prefix . "_nonexistant");
+symlink(basename($prefix . "_nonexistant"), $prefix . "_link3");
+
+// symlink to a regular file using an absolute path
+symlink($prefix . "_file", $prefix . "_link4");
+
+// symlink to a symlink using an absolute path
+symlink($prefix . "_link4", $prefix . "_link5");
+
+var_dump(readlink($prefix . "_link1"));
+var_dump(readlink($prefix . "_link2"));
+var_dump(readlink($prefix . "_link3"));
+var_dump(readlink($prefix . "_link4"));
+var_dump(readlink($prefix . "_link5"));
+
+unlink($prefix . "_link5");
+unlink($prefix . "_link4");
+unlink($prefix . "_link3");
+unlink($prefix . "_link2");
+unlink($prefix . "_link1");
+unlink($prefix . "_file");
+
+?>
+--EXPECTF--
+%unicode|string%(%d) "symlink_to_symlink.php_file"
+%unicode|string%(%d) "symlink_to_symlink.php_link1"
+%unicode|string%(%d) "symlink_to_symlink.php_nonexistant"
+%unicode|string%(%d) "%s/symlink_to_symlink.php_file"
+%unicode|string%(%d) "%s/symlink_to_symlink.php_link4"
diff --git a/ext/standard/tests/file/tempnam_error.phpt b/ext/standard/tests/file/tempnam_error.phpt
new file mode 100644
index 0000000..91ca6a3
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_error.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test tempnam() function: error conditions
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+echo "*** Testing tempnam() error conditions ***\n";
+$file_path = dirname(__FILE__);
+
+/* More number of arguments than expected */
+var_dump( tempnam("$file_path", "tempnam_error.tmp", "") ); //Two Valid & One Invalid
+var_dump( tempnam("$file_path", "tempnam_error.tmp", TRUE) );
+
+/* Less number of arguments than expected */
+var_dump( tempnam("tempnam_error") ); //One Valid arg
+var_dump( tempnam("$file_path") ); //One Valid arg
+var_dump( tempnam("") ); //Empty string
+var_dump( tempnam(NULL) ); //NULL as arg
+var_dump( tempnam() ); //Zero args
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() error conditions ***
+
+Warning: tempnam() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: tempnam() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: tempnam() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation1-win32.phpt b/ext/standard/tests/file/tempnam_variation1-win32.phpt
new file mode 100644
index 0000000..a3dd7e9
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation1-win32.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test tempnam() function: usage variations - creating files
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Creating number of unique files by passing a file name as prefix */
+
+$file_path = dirname(__FILE__)."/tempnamVar1";
+mkdir($file_path);
+
+echo "*** Testing tempnam() in creation of unique files ***\n";
+for($i=1; $i<=10; $i++) {
+ echo "-- Iteration $i --\n";
+ $files[$i] = tempnam("$file_path", "tempnam_variation1.tmp");
+
+ if( file_exists($files[$i]) ) {
+
+ echo "File name is => ";
+ print($files[$i]);
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($files[$i]) );
+ echo "\n";
+ clearstatcache();
+
+ echo "File created in => ";
+ $file_dir = dirname($files[$i]);
+
+ if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ }
+ else if (realpath($file_dir) == realpath($file_path) || realpath($file_dir."\\") == realpath($file_path)) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+ clearstatcache();
+ }
+ else {
+ print("- File is not created -");
+ }
+}
+for($i=1; $i<=10; $i++) {
+ unlink($files[$i]);
+}
+rmdir($file_path);
+
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() in creation of unique files ***
+-- Iteration 1 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 2 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 3 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 4 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 5 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 6 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 7 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 8 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 9 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+-- Iteration 10 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => directory specified
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation1.phpt b/ext/standard/tests/file/tempnam_variation1.phpt
new file mode 100644
index 0000000..0745f53
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation1.phpt
@@ -0,0 +1,116 @@
+--TEST--
+Test tempnam() function: usage variations - creating files
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Creating number of unique files by passing a file name as prefix */
+
+$file_path = dirname(__FILE__)."/tempnamVar1";
+mkdir($file_path);
+
+echo "*** Testing tempnam() in creation of unique files ***\n";
+for($i=1; $i<=10; $i++) {
+ echo "-- Iteration $i --\n";
+ $files[$i] = tempnam("$file_path", "tempnam_variation1.tmp");
+
+ if( file_exists($files[$i]) ) {
+
+ echo "File name is => ";
+ print($files[$i]);
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($files[$i]) );
+ echo "\n";
+ clearstatcache();
+
+ echo "File inode is => ";
+ print_r( fileinode($files[$i]) ); //checking inodes
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($files[$i]);
+
+ if ($file_dir == sys_get_temp_dir()) {
+ echo "temp dir\n";
+ }
+ else if ($file_dir == $file_path) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+ clearstatcache();
+ }
+ else {
+ print("- File is not created -");
+ }
+}
+for($i=1; $i<=10; $i++) {
+ unlink($files[$i]);
+}
+
+rmdir($file_path);
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() in creation of unique files ***
+-- Iteration 1 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 2 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 3 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 4 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 5 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 6 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 7 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 8 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 9 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+-- Iteration 10 --
+File name is => %s%etempnam_variation1.tmp%s
+File permissions are => 100600
+File inode is => %d
+File created in => directory specified
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation2-win32.phpt b/ext/standard/tests/file/tempnam_variation2-win32.phpt
new file mode 100644
index 0000000..4224966
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation2-win32.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test tempnam() function: usage variations - various absolute and relative paths
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Creating unique files in various dirs by passing relative paths to $dir arg */
+
+echo "*** Testing tempnam() with absolute and relative paths ***\n";
+$dir_name = dirname(__FILE__)."/tempnam_variation2";
+mkdir($dir_name);
+$dir_path = $dir_name."/tempnam_variation2_sub";
+mkdir($dir_path);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$dir_paths = array(
+ // absolute paths
+ "$dir_path",
+ "$dir_path/",
+ "$dir_path/..",
+ "$dir_path//../",
+ "$dir_path/../.././tempnam_variation2",
+ "$dir_path/..///tempnam_variation2_sub//..//../tempnam_variation2",
+ "$dir_path/BADDIR",
+
+
+ // relative paths
+ ".",
+ "tempname_variation2",
+ "tempname_variation2/",
+ "tempnam_variation2/tempnam_variation2_sub",
+ "tempnam_variation2//tempnam_variation2_sub",
+ "./tempnam_variation2/../tempnam_variation2/tempnam_variation2_sub",
+ "BADDIR",
+);
+
+for($i = 0; $i<count($dir_paths); $i++) {
+ $j = $i+1;
+ echo "\n-- Iteration $j --\n";
+ $file_name = tempnam($dir_paths[$i], "tempnam_variation2.tmp");
+
+ if( file_exists($file_name) ){
+
+ echo "File name is => ";
+ print(realpath($file_name));
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+ $dir_req = $dir_paths[$i];
+
+ if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ }
+ else if (realpath($file_dir) == realpath($dir_req) || realpath($file_dir."\\") == realpath($dir_req)) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+
+
+ }
+ else {
+ echo "-- File is not created --";
+ }
+
+ unlink($file_name);
+}
+
+chdir($old_dir_path);
+rmdir($dir_path);
+rmdir($dir_name);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with absolute and relative paths ***
+
+-- Iteration 1 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 2 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 3 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 4 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 5 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 6 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 7 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+-- Iteration 8 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 9 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+-- Iteration 10 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+-- Iteration 11 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 12 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 13 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 14 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/tempnam_variation2.phpt b/ext/standard/tests/file/tempnam_variation2.phpt
new file mode 100644
index 0000000..b7e5cdc
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation2.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test tempnam() function: usage variations - various absolute and relative paths
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Creating unique files in various dirs by passing relative paths to $dir arg */
+
+echo "*** Testing tempnam() with absolute and relative paths ***\n";
+$dir_name = dirname(__FILE__)."/tempnam_variation2";
+mkdir($dir_name);
+$dir_path = $dir_name."/tempnam_variation2_sub";
+mkdir($dir_path);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$dir_paths = array(
+ // absolute paths
+ "$dir_path",
+ "$dir_path/",
+ "$dir_path/..",
+ "$dir_path//../",
+ "$dir_path/../.././tempnam_variation2",
+ "$dir_path/..///tempnam_variation2_sub//..//../tempnam_variation2",
+ "$dir_path/BADDIR",
+
+
+ // relative paths
+ ".",
+ "tempname_variation2",
+ "tempname_variation2/",
+ "tempnam_variation2/tempnam_variation2_sub",
+ "tempnam_variation2//tempnam_variation2_sub",
+ "./tempnam_variation2/../tempnam_variation2/tempnam_variation2_sub",
+ "BADDIR",
+);
+
+for($i = 0; $i<count($dir_paths); $i++) {
+ $j = $i+1;
+ echo "\n-- Iteration $j --\n";
+ $file_name = tempnam($dir_paths[$i], "tempnam_variation2.tmp");
+
+ if( file_exists($file_name) ){
+
+ echo "File name is => ";
+ print(realpath($file_name));
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+ $dir_req = $dir_paths[$i];
+
+ if (realpath($file_dir) == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ }
+ else if ($file_dir == realpath($dir_req)) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+
+
+ }
+ else {
+ echo "-- File is not created --";
+ }
+
+ unlink($file_name);
+}
+
+chdir($old_dir_path);
+rmdir($dir_path);
+rmdir($dir_name);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with absolute and relative paths ***
+
+-- Iteration 1 --
+File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 2 --
+File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 3 --
+File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 4 --
+File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 5 --
+File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 6 --
+File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 7 --
+File name is => %s/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => temp dir
+
+-- Iteration 8 --
+File name is => %s/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 9 --
+File name is => %s/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => temp dir
+
+-- Iteration 10 --
+File name is => %s/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => temp dir
+
+-- Iteration 11 --
+File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 12 --
+File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 13 --
+File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => directory specified
+
+-- Iteration 14 --
+File name is => %s/tempnam_variation2.tmp%s
+File permissions are => 100600
+File created in => temp dir
+
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt
new file mode 100644
index 0000000..fb457cb
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt
@@ -0,0 +1,115 @@
+--TEST--
+Test tempnam() function: usage variations - obscure prefixes
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip run only on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Passing invalid/non-existing args for $prefix */
+
+echo "*** Testing tempnam() with obscure prefixes ***\n";
+$file_path = dirname(__FILE__)."/tempnamVar3";
+if (!mkdir($file_path)) {
+ echo "Failed, cannot create temp dir $filepath\n";
+ exit(1);
+}
+
+$file_path = realpath($file_path);
+
+/* An array of prefixes */
+$names_arr = array(
+ /* Valid args (casting)*/
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ /* Invalid args */
+ array(),
+
+ /* Valid args*/
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir",
+ "php/php"
+);
+
+$res_arr = array(
+ /* Invalid args */
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
+
+ /* prefix with path separator of a non existing directory*/
+ true,
+ true
+);
+
+for( $i=0; $i<count($names_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam($file_path, $names_arr[$i]);
+
+ /* creating the files in existing dir */
+ if (file_exists($file_name) && !$res_arr[$i]) {
+ echo "Failed\n";
+ }
+ if ($res_arr[$i]) {
+ $file_dir = dirname($file_name);
+ if (realpath($file_dir) == $file_path || realpath($file_dir . "\\") == $file_path) {
+ echo "OK\n";
+ } else {
+ echo "Failed, not created in the correct directory " . realpath($file_dir) . ' vs ' . $file_path ."\n";
+ }
+
+ if (!is_writable($file_name)) {
+ printf("%o\n", fileperms($file_name) );
+
+ }
+ } else {
+ echo "OK\n";
+ }
+ @unlink($file_name);
+}
+
+rmdir($file_path);
+echo "\n*** Done. ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with obscure prefixes ***
+-- Iteration 0 --
+OK
+-- Iteration 1 --
+OK
+-- Iteration 2 --
+OK
+-- Iteration 3 --
+OK
+-- Iteration 4 --
+OK
+-- Iteration 5 --
+Failed, not created in the correct directory %s vs %s
+0
+-- Iteration 6 --
+OK
+-- Iteration 7 --
+
+Warning: tempnam() expects parameter 2 to be string, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d
+OK
+-- Iteration 8 --
+OK
+-- Iteration 9 --
+OK
+
+*** Done. ***
diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt
new file mode 100644
index 0000000..69ab16c
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation3.phpt
@@ -0,0 +1,122 @@
+--TEST--
+Test tempnam() function: usage variations - obscure prefixes
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Passing invalid/non-existing args for $prefix */
+
+echo "*** Testing tempnam() with obscure prefixes ***\n";
+$file_path = dirname(__FILE__)."/tempnamVar3";
+mkdir($file_path);
+
+/* An array of prefixes */
+$names_arr = array(
+ /* Invalid args */
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ array(),
+
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir",
+ "php/php"
+
+);
+
+for( $i=0; $i<count($names_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam("$file_path", $names_arr[$i]);
+
+ /* creating the files in existing dir */
+ if( file_exists($file_name) ) {
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+
+ if ($file_dir == sys_get_temp_dir()) {
+ echo "temp dir\n";
+ }
+ else if ($file_dir == $file_path) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+
+ }
+ else {
+ echo "-- File is not created --\n";
+ }
+
+ unlink($file_name);
+}
+
+rmdir($file_path);
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with obscure prefixes ***
+-- Iteration 0 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 1 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 2 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 3 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 4 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 5 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 6 --
+File name is => %s/%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 7 --
+
+Warning: tempnam() expects parameter 2 to be string, array given in %s on line %d
+-- File is not created --
+
+Warning: unlink(): %s in %s on line %d
+-- Iteration 8 --
+File name is => %s/dir%s
+File permissions are => 100600
+File created in => directory specified
+-- Iteration 9 --
+File name is => %s/php%s
+File permissions are => 100600
+File created in => directory specified
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/tempnam_variation4.phpt b/ext/standard/tests/file/tempnam_variation4.phpt
new file mode 100644
index 0000000..4ce1c7e
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation4.phpt
@@ -0,0 +1,1092 @@
+--TEST--
+Test tempnam() function: usage variations - permissions(0000 to 0777) of dir
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for Windows');
+}
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Trying to create the file in a dir with permissions from 0000 to 0777,
+ Allowable permissions: files are expected to be created in the input dir
+ Non-allowable permissions: files are expected to be created in '/tmp' dir
+*/
+
+echo "*** Testing tempnam() with dir of permissions from 0000 to 0777 ***\n";
+$file_path = dirname(__FILE__);
+$dir_name = $file_path."/tempnam_variation4";
+$prefix = "tempnamVar4.";
+
+mkdir($dir_name);
+
+for($mode = 0000; $mode <= 0777; $mode++) {
+ echo "-- dir perms ";
+ printf("%o", $mode);
+ echo " --\n";
+ chmod($dir_name, $mode);
+ $file_name = tempnam($dir_name, $prefix);
+
+ if(file_exists($file_name) ) {
+ if (realpath(dirname($file_name)) == realpath(sys_get_temp_dir())) {
+ $msg = " created in temp dir ";
+ }
+ else if (dirname($file_name) == $dir_name) {
+ $msg = " created in requested dir";
+ }
+ else {
+ $msg = " created in unexpected dir";
+ }
+
+ echo $msg."\n";
+ unlink($file_name);
+ }
+ else {
+ print("FAILED: File is not created\n");
+ }
+}
+
+rmdir($dir_name);
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with dir of permissions from 0000 to 0777 ***
+-- dir perms 0 --
+ created in temp dir
+-- dir perms 1 --
+ created in temp dir
+-- dir perms 2 --
+ created in temp dir
+-- dir perms 3 --
+ created in temp dir
+-- dir perms 4 --
+ created in temp dir
+-- dir perms 5 --
+ created in temp dir
+-- dir perms 6 --
+ created in temp dir
+-- dir perms 7 --
+ created in temp dir
+-- dir perms 10 --
+ created in temp dir
+-- dir perms 11 --
+ created in temp dir
+-- dir perms 12 --
+ created in temp dir
+-- dir perms 13 --
+ created in temp dir
+-- dir perms 14 --
+ created in temp dir
+-- dir perms 15 --
+ created in temp dir
+-- dir perms 16 --
+ created in temp dir
+-- dir perms 17 --
+ created in temp dir
+-- dir perms 20 --
+ created in temp dir
+-- dir perms 21 --
+ created in temp dir
+-- dir perms 22 --
+ created in temp dir
+-- dir perms 23 --
+ created in temp dir
+-- dir perms 24 --
+ created in temp dir
+-- dir perms 25 --
+ created in temp dir
+-- dir perms 26 --
+ created in temp dir
+-- dir perms 27 --
+ created in temp dir
+-- dir perms 30 --
+ created in temp dir
+-- dir perms 31 --
+ created in temp dir
+-- dir perms 32 --
+ created in temp dir
+-- dir perms 33 --
+ created in temp dir
+-- dir perms 34 --
+ created in temp dir
+-- dir perms 35 --
+ created in temp dir
+-- dir perms 36 --
+ created in temp dir
+-- dir perms 37 --
+ created in temp dir
+-- dir perms 40 --
+ created in temp dir
+-- dir perms 41 --
+ created in temp dir
+-- dir perms 42 --
+ created in temp dir
+-- dir perms 43 --
+ created in temp dir
+-- dir perms 44 --
+ created in temp dir
+-- dir perms 45 --
+ created in temp dir
+-- dir perms 46 --
+ created in temp dir
+-- dir perms 47 --
+ created in temp dir
+-- dir perms 50 --
+ created in temp dir
+-- dir perms 51 --
+ created in temp dir
+-- dir perms 52 --
+ created in temp dir
+-- dir perms 53 --
+ created in temp dir
+-- dir perms 54 --
+ created in temp dir
+-- dir perms 55 --
+ created in temp dir
+-- dir perms 56 --
+ created in temp dir
+-- dir perms 57 --
+ created in temp dir
+-- dir perms 60 --
+ created in temp dir
+-- dir perms 61 --
+ created in temp dir
+-- dir perms 62 --
+ created in temp dir
+-- dir perms 63 --
+ created in temp dir
+-- dir perms 64 --
+ created in temp dir
+-- dir perms 65 --
+ created in temp dir
+-- dir perms 66 --
+ created in temp dir
+-- dir perms 67 --
+ created in temp dir
+-- dir perms 70 --
+ created in temp dir
+-- dir perms 71 --
+ created in temp dir
+-- dir perms 72 --
+ created in temp dir
+-- dir perms 73 --
+ created in temp dir
+-- dir perms 74 --
+ created in temp dir
+-- dir perms 75 --
+ created in temp dir
+-- dir perms 76 --
+ created in temp dir
+-- dir perms 77 --
+ created in temp dir
+-- dir perms 100 --
+ created in temp dir
+-- dir perms 101 --
+ created in temp dir
+-- dir perms 102 --
+ created in temp dir
+-- dir perms 103 --
+ created in temp dir
+-- dir perms 104 --
+ created in temp dir
+-- dir perms 105 --
+ created in temp dir
+-- dir perms 106 --
+ created in temp dir
+-- dir perms 107 --
+ created in temp dir
+-- dir perms 110 --
+ created in temp dir
+-- dir perms 111 --
+ created in temp dir
+-- dir perms 112 --
+ created in temp dir
+-- dir perms 113 --
+ created in temp dir
+-- dir perms 114 --
+ created in temp dir
+-- dir perms 115 --
+ created in temp dir
+-- dir perms 116 --
+ created in temp dir
+-- dir perms 117 --
+ created in temp dir
+-- dir perms 120 --
+ created in temp dir
+-- dir perms 121 --
+ created in temp dir
+-- dir perms 122 --
+ created in temp dir
+-- dir perms 123 --
+ created in temp dir
+-- dir perms 124 --
+ created in temp dir
+-- dir perms 125 --
+ created in temp dir
+-- dir perms 126 --
+ created in temp dir
+-- dir perms 127 --
+ created in temp dir
+-- dir perms 130 --
+ created in temp dir
+-- dir perms 131 --
+ created in temp dir
+-- dir perms 132 --
+ created in temp dir
+-- dir perms 133 --
+ created in temp dir
+-- dir perms 134 --
+ created in temp dir
+-- dir perms 135 --
+ created in temp dir
+-- dir perms 136 --
+ created in temp dir
+-- dir perms 137 --
+ created in temp dir
+-- dir perms 140 --
+ created in temp dir
+-- dir perms 141 --
+ created in temp dir
+-- dir perms 142 --
+ created in temp dir
+-- dir perms 143 --
+ created in temp dir
+-- dir perms 144 --
+ created in temp dir
+-- dir perms 145 --
+ created in temp dir
+-- dir perms 146 --
+ created in temp dir
+-- dir perms 147 --
+ created in temp dir
+-- dir perms 150 --
+ created in temp dir
+-- dir perms 151 --
+ created in temp dir
+-- dir perms 152 --
+ created in temp dir
+-- dir perms 153 --
+ created in temp dir
+-- dir perms 154 --
+ created in temp dir
+-- dir perms 155 --
+ created in temp dir
+-- dir perms 156 --
+ created in temp dir
+-- dir perms 157 --
+ created in temp dir
+-- dir perms 160 --
+ created in temp dir
+-- dir perms 161 --
+ created in temp dir
+-- dir perms 162 --
+ created in temp dir
+-- dir perms 163 --
+ created in temp dir
+-- dir perms 164 --
+ created in temp dir
+-- dir perms 165 --
+ created in temp dir
+-- dir perms 166 --
+ created in temp dir
+-- dir perms 167 --
+ created in temp dir
+-- dir perms 170 --
+ created in temp dir
+-- dir perms 171 --
+ created in temp dir
+-- dir perms 172 --
+ created in temp dir
+-- dir perms 173 --
+ created in temp dir
+-- dir perms 174 --
+ created in temp dir
+-- dir perms 175 --
+ created in temp dir
+-- dir perms 176 --
+ created in temp dir
+-- dir perms 177 --
+ created in temp dir
+-- dir perms 200 --
+ created in temp dir
+-- dir perms 201 --
+ created in temp dir
+-- dir perms 202 --
+ created in temp dir
+-- dir perms 203 --
+ created in temp dir
+-- dir perms 204 --
+ created in temp dir
+-- dir perms 205 --
+ created in temp dir
+-- dir perms 206 --
+ created in temp dir
+-- dir perms 207 --
+ created in temp dir
+-- dir perms 210 --
+ created in temp dir
+-- dir perms 211 --
+ created in temp dir
+-- dir perms 212 --
+ created in temp dir
+-- dir perms 213 --
+ created in temp dir
+-- dir perms 214 --
+ created in temp dir
+-- dir perms 215 --
+ created in temp dir
+-- dir perms 216 --
+ created in temp dir
+-- dir perms 217 --
+ created in temp dir
+-- dir perms 220 --
+ created in temp dir
+-- dir perms 221 --
+ created in temp dir
+-- dir perms 222 --
+ created in temp dir
+-- dir perms 223 --
+ created in temp dir
+-- dir perms 224 --
+ created in temp dir
+-- dir perms 225 --
+ created in temp dir
+-- dir perms 226 --
+ created in temp dir
+-- dir perms 227 --
+ created in temp dir
+-- dir perms 230 --
+ created in temp dir
+-- dir perms 231 --
+ created in temp dir
+-- dir perms 232 --
+ created in temp dir
+-- dir perms 233 --
+ created in temp dir
+-- dir perms 234 --
+ created in temp dir
+-- dir perms 235 --
+ created in temp dir
+-- dir perms 236 --
+ created in temp dir
+-- dir perms 237 --
+ created in temp dir
+-- dir perms 240 --
+ created in temp dir
+-- dir perms 241 --
+ created in temp dir
+-- dir perms 242 --
+ created in temp dir
+-- dir perms 243 --
+ created in temp dir
+-- dir perms 244 --
+ created in temp dir
+-- dir perms 245 --
+ created in temp dir
+-- dir perms 246 --
+ created in temp dir
+-- dir perms 247 --
+ created in temp dir
+-- dir perms 250 --
+ created in temp dir
+-- dir perms 251 --
+ created in temp dir
+-- dir perms 252 --
+ created in temp dir
+-- dir perms 253 --
+ created in temp dir
+-- dir perms 254 --
+ created in temp dir
+-- dir perms 255 --
+ created in temp dir
+-- dir perms 256 --
+ created in temp dir
+-- dir perms 257 --
+ created in temp dir
+-- dir perms 260 --
+ created in temp dir
+-- dir perms 261 --
+ created in temp dir
+-- dir perms 262 --
+ created in temp dir
+-- dir perms 263 --
+ created in temp dir
+-- dir perms 264 --
+ created in temp dir
+-- dir perms 265 --
+ created in temp dir
+-- dir perms 266 --
+ created in temp dir
+-- dir perms 267 --
+ created in temp dir
+-- dir perms 270 --
+ created in temp dir
+-- dir perms 271 --
+ created in temp dir
+-- dir perms 272 --
+ created in temp dir
+-- dir perms 273 --
+ created in temp dir
+-- dir perms 274 --
+ created in temp dir
+-- dir perms 275 --
+ created in temp dir
+-- dir perms 276 --
+ created in temp dir
+-- dir perms 277 --
+ created in temp dir
+-- dir perms 300 --
+ created in requested dir
+-- dir perms 301 --
+ created in requested dir
+-- dir perms 302 --
+ created in requested dir
+-- dir perms 303 --
+ created in requested dir
+-- dir perms 304 --
+ created in requested dir
+-- dir perms 305 --
+ created in requested dir
+-- dir perms 306 --
+ created in requested dir
+-- dir perms 307 --
+ created in requested dir
+-- dir perms 310 --
+ created in requested dir
+-- dir perms 311 --
+ created in requested dir
+-- dir perms 312 --
+ created in requested dir
+-- dir perms 313 --
+ created in requested dir
+-- dir perms 314 --
+ created in requested dir
+-- dir perms 315 --
+ created in requested dir
+-- dir perms 316 --
+ created in requested dir
+-- dir perms 317 --
+ created in requested dir
+-- dir perms 320 --
+ created in requested dir
+-- dir perms 321 --
+ created in requested dir
+-- dir perms 322 --
+ created in requested dir
+-- dir perms 323 --
+ created in requested dir
+-- dir perms 324 --
+ created in requested dir
+-- dir perms 325 --
+ created in requested dir
+-- dir perms 326 --
+ created in requested dir
+-- dir perms 327 --
+ created in requested dir
+-- dir perms 330 --
+ created in requested dir
+-- dir perms 331 --
+ created in requested dir
+-- dir perms 332 --
+ created in requested dir
+-- dir perms 333 --
+ created in requested dir
+-- dir perms 334 --
+ created in requested dir
+-- dir perms 335 --
+ created in requested dir
+-- dir perms 336 --
+ created in requested dir
+-- dir perms 337 --
+ created in requested dir
+-- dir perms 340 --
+ created in requested dir
+-- dir perms 341 --
+ created in requested dir
+-- dir perms 342 --
+ created in requested dir
+-- dir perms 343 --
+ created in requested dir
+-- dir perms 344 --
+ created in requested dir
+-- dir perms 345 --
+ created in requested dir
+-- dir perms 346 --
+ created in requested dir
+-- dir perms 347 --
+ created in requested dir
+-- dir perms 350 --
+ created in requested dir
+-- dir perms 351 --
+ created in requested dir
+-- dir perms 352 --
+ created in requested dir
+-- dir perms 353 --
+ created in requested dir
+-- dir perms 354 --
+ created in requested dir
+-- dir perms 355 --
+ created in requested dir
+-- dir perms 356 --
+ created in requested dir
+-- dir perms 357 --
+ created in requested dir
+-- dir perms 360 --
+ created in requested dir
+-- dir perms 361 --
+ created in requested dir
+-- dir perms 362 --
+ created in requested dir
+-- dir perms 363 --
+ created in requested dir
+-- dir perms 364 --
+ created in requested dir
+-- dir perms 365 --
+ created in requested dir
+-- dir perms 366 --
+ created in requested dir
+-- dir perms 367 --
+ created in requested dir
+-- dir perms 370 --
+ created in requested dir
+-- dir perms 371 --
+ created in requested dir
+-- dir perms 372 --
+ created in requested dir
+-- dir perms 373 --
+ created in requested dir
+-- dir perms 374 --
+ created in requested dir
+-- dir perms 375 --
+ created in requested dir
+-- dir perms 376 --
+ created in requested dir
+-- dir perms 377 --
+ created in requested dir
+-- dir perms 400 --
+ created in temp dir
+-- dir perms 401 --
+ created in temp dir
+-- dir perms 402 --
+ created in temp dir
+-- dir perms 403 --
+ created in temp dir
+-- dir perms 404 --
+ created in temp dir
+-- dir perms 405 --
+ created in temp dir
+-- dir perms 406 --
+ created in temp dir
+-- dir perms 407 --
+ created in temp dir
+-- dir perms 410 --
+ created in temp dir
+-- dir perms 411 --
+ created in temp dir
+-- dir perms 412 --
+ created in temp dir
+-- dir perms 413 --
+ created in temp dir
+-- dir perms 414 --
+ created in temp dir
+-- dir perms 415 --
+ created in temp dir
+-- dir perms 416 --
+ created in temp dir
+-- dir perms 417 --
+ created in temp dir
+-- dir perms 420 --
+ created in temp dir
+-- dir perms 421 --
+ created in temp dir
+-- dir perms 422 --
+ created in temp dir
+-- dir perms 423 --
+ created in temp dir
+-- dir perms 424 --
+ created in temp dir
+-- dir perms 425 --
+ created in temp dir
+-- dir perms 426 --
+ created in temp dir
+-- dir perms 427 --
+ created in temp dir
+-- dir perms 430 --
+ created in temp dir
+-- dir perms 431 --
+ created in temp dir
+-- dir perms 432 --
+ created in temp dir
+-- dir perms 433 --
+ created in temp dir
+-- dir perms 434 --
+ created in temp dir
+-- dir perms 435 --
+ created in temp dir
+-- dir perms 436 --
+ created in temp dir
+-- dir perms 437 --
+ created in temp dir
+-- dir perms 440 --
+ created in temp dir
+-- dir perms 441 --
+ created in temp dir
+-- dir perms 442 --
+ created in temp dir
+-- dir perms 443 --
+ created in temp dir
+-- dir perms 444 --
+ created in temp dir
+-- dir perms 445 --
+ created in temp dir
+-- dir perms 446 --
+ created in temp dir
+-- dir perms 447 --
+ created in temp dir
+-- dir perms 450 --
+ created in temp dir
+-- dir perms 451 --
+ created in temp dir
+-- dir perms 452 --
+ created in temp dir
+-- dir perms 453 --
+ created in temp dir
+-- dir perms 454 --
+ created in temp dir
+-- dir perms 455 --
+ created in temp dir
+-- dir perms 456 --
+ created in temp dir
+-- dir perms 457 --
+ created in temp dir
+-- dir perms 460 --
+ created in temp dir
+-- dir perms 461 --
+ created in temp dir
+-- dir perms 462 --
+ created in temp dir
+-- dir perms 463 --
+ created in temp dir
+-- dir perms 464 --
+ created in temp dir
+-- dir perms 465 --
+ created in temp dir
+-- dir perms 466 --
+ created in temp dir
+-- dir perms 467 --
+ created in temp dir
+-- dir perms 470 --
+ created in temp dir
+-- dir perms 471 --
+ created in temp dir
+-- dir perms 472 --
+ created in temp dir
+-- dir perms 473 --
+ created in temp dir
+-- dir perms 474 --
+ created in temp dir
+-- dir perms 475 --
+ created in temp dir
+-- dir perms 476 --
+ created in temp dir
+-- dir perms 477 --
+ created in temp dir
+-- dir perms 500 --
+ created in temp dir
+-- dir perms 501 --
+ created in temp dir
+-- dir perms 502 --
+ created in temp dir
+-- dir perms 503 --
+ created in temp dir
+-- dir perms 504 --
+ created in temp dir
+-- dir perms 505 --
+ created in temp dir
+-- dir perms 506 --
+ created in temp dir
+-- dir perms 507 --
+ created in temp dir
+-- dir perms 510 --
+ created in temp dir
+-- dir perms 511 --
+ created in temp dir
+-- dir perms 512 --
+ created in temp dir
+-- dir perms 513 --
+ created in temp dir
+-- dir perms 514 --
+ created in temp dir
+-- dir perms 515 --
+ created in temp dir
+-- dir perms 516 --
+ created in temp dir
+-- dir perms 517 --
+ created in temp dir
+-- dir perms 520 --
+ created in temp dir
+-- dir perms 521 --
+ created in temp dir
+-- dir perms 522 --
+ created in temp dir
+-- dir perms 523 --
+ created in temp dir
+-- dir perms 524 --
+ created in temp dir
+-- dir perms 525 --
+ created in temp dir
+-- dir perms 526 --
+ created in temp dir
+-- dir perms 527 --
+ created in temp dir
+-- dir perms 530 --
+ created in temp dir
+-- dir perms 531 --
+ created in temp dir
+-- dir perms 532 --
+ created in temp dir
+-- dir perms 533 --
+ created in temp dir
+-- dir perms 534 --
+ created in temp dir
+-- dir perms 535 --
+ created in temp dir
+-- dir perms 536 --
+ created in temp dir
+-- dir perms 537 --
+ created in temp dir
+-- dir perms 540 --
+ created in temp dir
+-- dir perms 541 --
+ created in temp dir
+-- dir perms 542 --
+ created in temp dir
+-- dir perms 543 --
+ created in temp dir
+-- dir perms 544 --
+ created in temp dir
+-- dir perms 545 --
+ created in temp dir
+-- dir perms 546 --
+ created in temp dir
+-- dir perms 547 --
+ created in temp dir
+-- dir perms 550 --
+ created in temp dir
+-- dir perms 551 --
+ created in temp dir
+-- dir perms 552 --
+ created in temp dir
+-- dir perms 553 --
+ created in temp dir
+-- dir perms 554 --
+ created in temp dir
+-- dir perms 555 --
+ created in temp dir
+-- dir perms 556 --
+ created in temp dir
+-- dir perms 557 --
+ created in temp dir
+-- dir perms 560 --
+ created in temp dir
+-- dir perms 561 --
+ created in temp dir
+-- dir perms 562 --
+ created in temp dir
+-- dir perms 563 --
+ created in temp dir
+-- dir perms 564 --
+ created in temp dir
+-- dir perms 565 --
+ created in temp dir
+-- dir perms 566 --
+ created in temp dir
+-- dir perms 567 --
+ created in temp dir
+-- dir perms 570 --
+ created in temp dir
+-- dir perms 571 --
+ created in temp dir
+-- dir perms 572 --
+ created in temp dir
+-- dir perms 573 --
+ created in temp dir
+-- dir perms 574 --
+ created in temp dir
+-- dir perms 575 --
+ created in temp dir
+-- dir perms 576 --
+ created in temp dir
+-- dir perms 577 --
+ created in temp dir
+-- dir perms 600 --
+ created in temp dir
+-- dir perms 601 --
+ created in temp dir
+-- dir perms 602 --
+ created in temp dir
+-- dir perms 603 --
+ created in temp dir
+-- dir perms 604 --
+ created in temp dir
+-- dir perms 605 --
+ created in temp dir
+-- dir perms 606 --
+ created in temp dir
+-- dir perms 607 --
+ created in temp dir
+-- dir perms 610 --
+ created in temp dir
+-- dir perms 611 --
+ created in temp dir
+-- dir perms 612 --
+ created in temp dir
+-- dir perms 613 --
+ created in temp dir
+-- dir perms 614 --
+ created in temp dir
+-- dir perms 615 --
+ created in temp dir
+-- dir perms 616 --
+ created in temp dir
+-- dir perms 617 --
+ created in temp dir
+-- dir perms 620 --
+ created in temp dir
+-- dir perms 621 --
+ created in temp dir
+-- dir perms 622 --
+ created in temp dir
+-- dir perms 623 --
+ created in temp dir
+-- dir perms 624 --
+ created in temp dir
+-- dir perms 625 --
+ created in temp dir
+-- dir perms 626 --
+ created in temp dir
+-- dir perms 627 --
+ created in temp dir
+-- dir perms 630 --
+ created in temp dir
+-- dir perms 631 --
+ created in temp dir
+-- dir perms 632 --
+ created in temp dir
+-- dir perms 633 --
+ created in temp dir
+-- dir perms 634 --
+ created in temp dir
+-- dir perms 635 --
+ created in temp dir
+-- dir perms 636 --
+ created in temp dir
+-- dir perms 637 --
+ created in temp dir
+-- dir perms 640 --
+ created in temp dir
+-- dir perms 641 --
+ created in temp dir
+-- dir perms 642 --
+ created in temp dir
+-- dir perms 643 --
+ created in temp dir
+-- dir perms 644 --
+ created in temp dir
+-- dir perms 645 --
+ created in temp dir
+-- dir perms 646 --
+ created in temp dir
+-- dir perms 647 --
+ created in temp dir
+-- dir perms 650 --
+ created in temp dir
+-- dir perms 651 --
+ created in temp dir
+-- dir perms 652 --
+ created in temp dir
+-- dir perms 653 --
+ created in temp dir
+-- dir perms 654 --
+ created in temp dir
+-- dir perms 655 --
+ created in temp dir
+-- dir perms 656 --
+ created in temp dir
+-- dir perms 657 --
+ created in temp dir
+-- dir perms 660 --
+ created in temp dir
+-- dir perms 661 --
+ created in temp dir
+-- dir perms 662 --
+ created in temp dir
+-- dir perms 663 --
+ created in temp dir
+-- dir perms 664 --
+ created in temp dir
+-- dir perms 665 --
+ created in temp dir
+-- dir perms 666 --
+ created in temp dir
+-- dir perms 667 --
+ created in temp dir
+-- dir perms 670 --
+ created in temp dir
+-- dir perms 671 --
+ created in temp dir
+-- dir perms 672 --
+ created in temp dir
+-- dir perms 673 --
+ created in temp dir
+-- dir perms 674 --
+ created in temp dir
+-- dir perms 675 --
+ created in temp dir
+-- dir perms 676 --
+ created in temp dir
+-- dir perms 677 --
+ created in temp dir
+-- dir perms 700 --
+ created in requested dir
+-- dir perms 701 --
+ created in requested dir
+-- dir perms 702 --
+ created in requested dir
+-- dir perms 703 --
+ created in requested dir
+-- dir perms 704 --
+ created in requested dir
+-- dir perms 705 --
+ created in requested dir
+-- dir perms 706 --
+ created in requested dir
+-- dir perms 707 --
+ created in requested dir
+-- dir perms 710 --
+ created in requested dir
+-- dir perms 711 --
+ created in requested dir
+-- dir perms 712 --
+ created in requested dir
+-- dir perms 713 --
+ created in requested dir
+-- dir perms 714 --
+ created in requested dir
+-- dir perms 715 --
+ created in requested dir
+-- dir perms 716 --
+ created in requested dir
+-- dir perms 717 --
+ created in requested dir
+-- dir perms 720 --
+ created in requested dir
+-- dir perms 721 --
+ created in requested dir
+-- dir perms 722 --
+ created in requested dir
+-- dir perms 723 --
+ created in requested dir
+-- dir perms 724 --
+ created in requested dir
+-- dir perms 725 --
+ created in requested dir
+-- dir perms 726 --
+ created in requested dir
+-- dir perms 727 --
+ created in requested dir
+-- dir perms 730 --
+ created in requested dir
+-- dir perms 731 --
+ created in requested dir
+-- dir perms 732 --
+ created in requested dir
+-- dir perms 733 --
+ created in requested dir
+-- dir perms 734 --
+ created in requested dir
+-- dir perms 735 --
+ created in requested dir
+-- dir perms 736 --
+ created in requested dir
+-- dir perms 737 --
+ created in requested dir
+-- dir perms 740 --
+ created in requested dir
+-- dir perms 741 --
+ created in requested dir
+-- dir perms 742 --
+ created in requested dir
+-- dir perms 743 --
+ created in requested dir
+-- dir perms 744 --
+ created in requested dir
+-- dir perms 745 --
+ created in requested dir
+-- dir perms 746 --
+ created in requested dir
+-- dir perms 747 --
+ created in requested dir
+-- dir perms 750 --
+ created in requested dir
+-- dir perms 751 --
+ created in requested dir
+-- dir perms 752 --
+ created in requested dir
+-- dir perms 753 --
+ created in requested dir
+-- dir perms 754 --
+ created in requested dir
+-- dir perms 755 --
+ created in requested dir
+-- dir perms 756 --
+ created in requested dir
+-- dir perms 757 --
+ created in requested dir
+-- dir perms 760 --
+ created in requested dir
+-- dir perms 761 --
+ created in requested dir
+-- dir perms 762 --
+ created in requested dir
+-- dir perms 763 --
+ created in requested dir
+-- dir perms 764 --
+ created in requested dir
+-- dir perms 765 --
+ created in requested dir
+-- dir perms 766 --
+ created in requested dir
+-- dir perms 767 --
+ created in requested dir
+-- dir perms 770 --
+ created in requested dir
+-- dir perms 771 --
+ created in requested dir
+-- dir perms 772 --
+ created in requested dir
+-- dir perms 773 --
+ created in requested dir
+-- dir perms 774 --
+ created in requested dir
+-- dir perms 775 --
+ created in requested dir
+-- dir perms 776 --
+ created in requested dir
+-- dir perms 777 --
+ created in requested dir
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation5-win32.phpt b/ext/standard/tests/file/tempnam_variation5-win32.phpt
new file mode 100644
index 0000000..3e39352
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation5-win32.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test tempnam() function: usage variations - existing file
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Windows only");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Passing an existing file as $prefix for tempnam() fn */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test tempnam() function: by passing an existing filename as prefix ***\n";
+$dir_name = $file_path."/tempnam_variation6";
+mkdir($dir_name);
+$h = fopen($dir_name."/tempnam_variation6.tmp", "w");
+
+for($i=1; $i<=3; $i++) {
+ echo "-- Iteration $i --\n";
+ $created_file = tempnam("$dir_name", "tempnam_variation6.tmp");
+
+ if( file_exists($created_file) ) {
+ echo "File name is => ";
+ print($created_file);
+ echo "\n";
+ }
+ else
+ print("File is not created");
+
+ unlink($created_file);
+}
+fclose($h);
+unlink($dir_name."/tempnam_variation6.tmp");
+rmdir($dir_name);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test tempnam() function: by passing an existing filename as prefix ***
+-- Iteration 1 --
+File name is => %stempnam_variation6%et%s
+-- Iteration 2 --
+File name is => %stempnam_variation6%et%s
+-- Iteration 3 --
+File name is => %stempnam_variation6%et%s
+
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation5.phpt b/ext/standard/tests/file/tempnam_variation5.phpt
new file mode 100644
index 0000000..26c3f91
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation5.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test tempnam() function: usage variations - existing file
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Passing an existing file as $prefix for tempnam() fn */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Test tempnam() function: by passing an existing filename as prefix ***\n";
+$dir_name = $file_path."/tempnam_variation6";
+mkdir($dir_name);
+$h = fopen($dir_name."/tempnam_variation6.tmp", "w");
+
+for($i=1; $i<=3; $i++) {
+ echo "-- Iteration $i --\n";
+ $created_file = tempnam("$dir_name", "tempnam_variation6.tmp");
+
+ if( file_exists($created_file) ) {
+ echo "File name is => ";
+ print($created_file);
+ echo "\n";
+ }
+ else
+ print("File is not created");
+
+ unlink($created_file);
+}
+fclose($h);
+unlink($dir_name."/tempnam_variation6.tmp");
+rmdir($dir_name);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test tempnam() function: by passing an existing filename as prefix ***
+-- Iteration 1 --
+File name is => %stempnam_variation6%etempnam_variation6.tmp%s
+-- Iteration 2 --
+File name is => %stempnam_variation6%etempnam_variation6.tmp%s
+-- Iteration 3 --
+File name is => %stempnam_variation6%etempnam_variation6.tmp%s
+
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation6-win32.phpt b/ext/standard/tests/file/tempnam_variation6-win32.phpt
new file mode 100644
index 0000000..efe7e86
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation6-win32.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test tempnam() function: usage variations - Using previous unique filename
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Windows Only");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Trying to create unique files by passing previously created unique file name as prefix */
+
+$file_path = dirname(__FILE__);
+
+echo "\n*** Test tempnam(): by passing previously created filenames ***\n";
+$file_name = "tempnam_variation6.tmp";
+for($i=1; $i<=3; $i++) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam("$file_path", $file_name);
+
+ if( file_exists($file_name) ) {
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+
+ if ($file_dir == sys_get_temp_dir()) {
+ echo "temp dir\n";
+ }
+ else if ($file_dir == $file_path) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+ }
+
+ unlink($file_name);
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test tempnam(): by passing previously created filenames ***
+-- Iteration 1 --
+File name is => %s%et%s
+File created in => directory specified
+-- Iteration 2 --
+File name is => %s%et%s
+File created in => directory specified
+-- Iteration 3 --
+File name is => %s%et%s
+File created in => directory specified
+
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation6.phpt b/ext/standard/tests/file/tempnam_variation6.phpt
new file mode 100644
index 0000000..5eb6e6f
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation6.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test tempnam() function: usage variations - Using previous unique filename
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Trying to create unique files by passing previously created unique file name as prefix */
+
+$file_path = dirname(__FILE__);
+
+echo "\n*** Test tempnam(): by passing previously created filenames ***\n";
+$file_name = "tempnam_variation6.tmp";
+for($i=1; $i<=3; $i++) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam("$file_path", $file_name);
+
+ if( file_exists($file_name) ) {
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+
+ if ($file_dir == sys_get_temp_dir()) {
+ echo "temp dir\n";
+ }
+ else if ($file_dir == $file_path) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+ }
+
+ unlink($file_name);
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test tempnam(): by passing previously created filenames ***
+-- Iteration 1 --
+File name is => %s%etempnam_variation6.tmp%s
+File created in => directory specified
+-- Iteration 2 --
+File name is => %s%etempnam_variation6.tmp%s
+File created in => directory specified
+-- Iteration 3 --
+File name is => %s%etempnam_variation6.tmp%s
+File created in => directory specified
+
+*** Done ***
diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt
new file mode 100644
index 0000000..0c8caca
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Test tempnam() function: usage variations - invalid/non-existing dir
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Passing invalid/non-existing args for $dir,
+ hence the unique files will be created in temporary dir */
+
+echo "*** Testing tempnam() with invalid/non-existing directory names ***\n";
+/* An array of names, which will be passed as a dir name */
+$names_arr = array(
+ /* Invalid args */
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ array(),
+
+ /* Non-existing dirs */
+ "/no/such/file/dir",
+ "php"
+);
+
+for( $i=0; $i<count($names_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+
+ if( file_exists($file_name) ){
+
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+ if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ } else {
+ echo "unknown location\n";
+ }
+ } else {
+ echo "-- File is not created --\n";
+ }
+
+ unlink($file_name);
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with invalid/non-existing directory names ***
+-- Iteration 0 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 1 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 2 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 3 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 4 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 5 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 6 --
+
+Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d
+-- File is not created --
+
+Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
+-- Iteration 7 --
+
+Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
+-- File is not created --
+
+Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
+-- Iteration 8 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+-- Iteration 9 --
+File name is => %s%et%s
+File permissions are => 100666
+File created in => temp dir
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt
new file mode 100644
index 0000000..b6f81ca
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation7.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test tempnam() function: usage variations - invalid/non-existing dir
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Passing invalid/non-existing args for $dir,
+ hence the unique files will be created in temporary dir */
+
+echo "*** Testing tempnam() with invalid/non-existing directory names ***\n";
+/* An array of names, which will be passed as a dir name */
+$names_arr = array(
+ /* Invalid args */
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ array(),
+
+ /* Non-existing dirs */
+ "/no/such/file/dir",
+ "php"
+
+);
+
+for( $i=0; $i<count($names_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+
+ if( file_exists($file_name) ){
+
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+
+ if (realpath($file_dir) == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+
+ }
+ else {
+ echo "-- File is not created --\n";
+ }
+
+ unlink($file_name);
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with invalid/non-existing directory names ***
+-- Iteration 0 --
+File name is => %s%etempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 1 --
+File name is => %s%etempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 2 --
+File name is => %s%etempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 3 --
+File name is => %s%etempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 4 --
+File name is => %s%etempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 5 --
+File name is => %s%etempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 6 --
+
+Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d
+-- File is not created --
+
+Warning: unlink(): %s in %s on line %d
+-- Iteration 7 --
+
+Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
+-- File is not created --
+
+Warning: unlink(): %s in %s on line %d
+-- Iteration 8 --
+File name is => %s/tempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+-- Iteration 9 --
+File name is => %s/tempnam_variation3.tmp%s
+File permissions are => 100600
+File created in => temp dir
+
+*** Done ***
+
diff --git a/ext/standard/tests/file/tempnam_variation8-win32.phpt b/ext/standard/tests/file/tempnam_variation8-win32.phpt
new file mode 100644
index 0000000..8df67b6
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation8-win32.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test tempnam() function: usage variations - various absolute and relative paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Creating unique files in various dirs by passing relative paths to $dir arg */
+
+echo "*** Testing tempnam() with absolute and relative paths ***\n";
+$dir_name = dirname(__FILE__)."\\tempnam_variation2";
+mkdir($dir_name);
+$dir_path = $dir_name."/tempnam_variation2_sub";
+mkdir($dir_path);
+
+$old_dir_path = getcwd();
+chdir(dirname(__FILE__));
+
+$dir_paths = array(
+ // absolute paths
+ "$dir_path\\",
+ "$dir_path\\..",
+ "$dir_path\\\\..\\",
+ "$dir_path\\..\\..\\.\\tempnam_variation2",
+ "$dir_path\\..\\\\\\tempnam_variation2_sub\\\\..\\\\..\\tempnam_variation2",
+ "$dir_path\\BADDIR",
+
+
+ // relative paths
+ "tempname_variation2\\",
+ "tempnam_variation2\\tempnam_variation2_sub",
+ "tempnam_variation2\\\\tempnam_variation2_sub",
+ ".\\tempnam_variation2\\..\\tempnam_variation2\\tempnam_variation2_sub",
+ "BADDIR",
+);
+
+for($i = 0; $i<count($dir_paths); $i++) {
+ $j = $i+1;
+ echo "\n-- Iteration $j --\n";
+ $file_name = tempnam($dir_paths[$i], "tempnam_variation2.tmp");
+
+ if( file_exists($file_name) ){
+
+ echo "File name is => ";
+ print(realpath($file_name));
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+ $dir_req = $dir_paths[$i];
+
+ if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ }
+ else if (realpath($file_dir) == realpath($dir_req) || realpath($file_dir."\\") == realpath($dir_req)) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+
+
+ }
+ else {
+ echo "-- File is not created --";
+ }
+
+ unlink($file_name);
+}
+
+chdir($old_dir_path);
+rmdir($dir_path);
+rmdir($dir_name);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing tempnam() with absolute and relative paths ***
+
+-- Iteration 1 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 2 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 3 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 4 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 5 --
+File name is => %s\tempnam_variation2\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 6 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+-- Iteration 7 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+-- Iteration 8 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 9 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 10 --
+File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s
+File permissions are => 100666
+File created in => directory specified
+
+-- Iteration 11 --
+File name is => %s\t%s
+File permissions are => 100666
+File created in => temp dir
+
+*** Done ***
diff --git a/ext/standard/tests/file/test.csv b/ext/standard/tests/file/test.csv
new file mode 100644
index 0000000..d99984c
--- /dev/null
+++ b/ext/standard/tests/file/test.csv
@@ -0,0 +1,17 @@
+6,7,8,line1
+1,2,3,"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/test2.csv b/ext/standard/tests/file/test2.csv
new file mode 100644
index 0000000..d816464
--- /dev/null
+++ b/ext/standard/tests/file/test2.csv
@@ -0,0 +1 @@
+"One","\"Two\"","Three\"","Four","\\","\\\\\\\\\\\\\\\\\\\\\\\"\\\\"
diff --git a/ext/standard/tests/file/test3.csv b/ext/standard/tests/file/test3.csv
new file mode 100644
index 0000000..63f0903
--- /dev/null
+++ b/ext/standard/tests/file/test3.csv
Binary files differ
diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt
new file mode 100644
index 0000000..c6c270d
--- /dev/null
+++ b/ext/standard/tests/file/touch.phpt
@@ -0,0 +1,58 @@
+--TEST--
+touch() tests
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Non Windows.');
+}
+?>
+--FILE--
+<?php
+
+// This doesn't work for windows, time, atime usage results in very different
+// output to linux. This could be a php.net bug on windows or a windows querk.
+$filename = dirname(__FILE__)."/touch.dat";
+
+var_dump(touch());
+var_dump(touch($filename));
+var_dump(filemtime($filename));
+@unlink($filename);
+var_dump(touch($filename, 101));
+var_dump(filemtime($filename));
+
+@unlink($filename);
+var_dump(touch($filename, -1));
+var_dump(filemtime($filename));
+
+@unlink($filename);
+var_dump(touch($filename, 100, 100));
+var_dump(filemtime($filename));
+
+@unlink($filename);
+var_dump(touch($filename, 100, -100));
+var_dump(filemtime($filename));
+
+var_dump(touch("/no/such/file/or/directory"));
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+bool(true)
+int(%d)
+bool(true)
+int(101)
+bool(true)
+int(%i)
+bool(true)
+int(100)
+bool(true)
+int(100)
+
+Warning: touch(): Unable to create file /no/such/file/or/directory because %s in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/touch_basic-win32.phpt b/ext/standard/tests/file/touch_basic-win32.phpt
new file mode 100644
index 0000000..b4ad29f
--- /dev/null
+++ b/ext/standard/tests/file/touch_basic-win32.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test touch() function : basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing touch() : basic functionality ***\n";
+
+$filename = dirname(__FILE__)."/touch.dat";
+
+echo "\n--- testing touch creates a file ---\n";
+@unlink($filename);
+if (file_exists($filename)) {
+ die("touch_basic failed");
+}
+var_dump( touch($filename) );
+if (file_exists($filename) == false) {
+ die("touch_basic failed");
+}
+
+echo "\n --- testing touch doesn't alter file contents ---\n";
+$testln = "Here is a test line";
+$h = fopen($filename, "wb");
+fwrite($h, $testln);
+fclose($h);
+touch($filename);
+$h = fopen($filename, "rb");
+echo fgets($h);
+fclose($h);
+
+echo "\n\n --- testing touch alters the correct file metadata ---\n";
+$init_meta = stat($filename);
+clearstatcache();
+sleep(1);
+touch($filename);
+$next_meta = stat($filename);
+$type = array("dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "ctime",
+ "blksize", "blocks");
+
+for ($i = 0; $i < count($type); $i++) {
+ if ($init_meta[$i] != $next_meta[$i]) {
+ echo "stat data differs at $type[$i]\n";
+ }
+}
+
+
+// Initialise all required variables
+$time = 10000;
+$atime = 20470;
+
+// Calling touch() with all possible arguments
+echo "\n --- testing touch using all parameters ---\n";
+var_dump( touch($filename, $time, $atime) );
+clearstatcache();
+$init_meta = stat($filename);
+echo "ctime=".$init_meta['ctime']."\n";
+echo "mtime=".$init_meta['mtime']."\n";
+echo "atime=".$init_meta['atime']."\n";
+
+unlink($filename);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing touch() : basic functionality ***
+
+--- testing touch creates a file ---
+bool(true)
+
+ --- testing touch doesn't alter file contents ---
+Here is a test line
+
+ --- testing touch alters the correct file metadata ---
+stat data differs at atime
+stat data differs at mtime
+
+ --- testing touch using all parameters ---
+bool(true)
+ctime=%d
+mtime=10000
+atime=20470
+Done
+
diff --git a/ext/standard/tests/file/touch_basic.phpt b/ext/standard/tests/file/touch_basic.phpt
new file mode 100644
index 0000000..c41fdf1
--- /dev/null
+++ b/ext/standard/tests/file/touch_basic.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test touch() function : basic functionality
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Non Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing touch() : basic functionality ***\n";
+
+$filename = dirname(__FILE__)."/touch.dat";
+
+echo "\n--- testing touch creates a file ---\n";
+@unlink($filename);
+if (file_exists($filename)) {
+ die("touch_basic failed");
+}
+var_dump( touch($filename) );
+if (file_exists($filename) == false) {
+ die("touch_basic failed");
+}
+
+echo "\n --- testing touch doesn't alter file contents ---\n";
+$testln = "Here is a test line";
+$h = fopen($filename, "wb");
+fwrite($h, $testln);
+fclose($h);
+touch($filename);
+$h = fopen($filename, "rb");
+echo fgets($h);
+fclose($h);
+
+echo "\n\n --- testing touch alters the correct file metadata ---\n";
+$init_meta = stat($filename);
+clearstatcache();
+sleep(1);
+touch($filename);
+$next_meta = stat($filename);
+$type = array("dev", "ino", "mode", "nlink", "uid", "gid",
+ "rdev", "size", "atime", "mtime", "ctime",
+ "blksize", "blocks");
+
+for ($i = 0; $i < count($type); $i++) {
+ if ($init_meta[$i] != $next_meta[$i]) {
+ echo "stat data differs at $type[$i]\n";
+ }
+}
+
+
+// Initialise all required variables
+$time = 10000;
+$atime = 20470;
+
+// Calling touch() with all possible arguments
+echo "\n --- testing touch using all parameters ---\n";
+var_dump( touch($filename, $time, $atime) );
+clearstatcache();
+$init_meta = stat($filename);
+echo "ctime=".$init_meta['ctime']."\n";
+echo "mtime=".$init_meta['mtime']."\n";
+echo "atime=".$init_meta['atime']."\n";
+
+unlink($filename);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing touch() : basic functionality ***
+
+--- testing touch creates a file ---
+bool(true)
+
+ --- testing touch doesn't alter file contents ---
+Here is a test line
+
+ --- testing touch alters the correct file metadata ---
+stat data differs at atime
+stat data differs at mtime
+stat data differs at ctime
+
+ --- testing touch using all parameters ---
+bool(true)
+ctime=%d
+mtime=10000
+atime=20470
+Done
diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt
new file mode 100644
index 0000000..ec58fee
--- /dev/null
+++ b/ext/standard/tests/file/touch_error.phpt
@@ -0,0 +1,22 @@
+--TEST--
+touch() error tests
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+var_dump(touch());
+var_dump(touch(1, 2, 3, 4));
+var_dump(touch("/no/such/file/or/directory"));
+
+?>
+--EXPECTF--
+Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d
+bool(false)
+
diff --git a/ext/standard/tests/file/touch_variation1.phpt b/ext/standard/tests/file/touch_variation1.phpt
new file mode 100644
index 0000000..dba41a6
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation1.phpt
@@ -0,0 +1,39 @@
+--TEST--
+touch() with times
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/touch.dat";
+
+
+var_dump(touch($filename, 101));
+var_dump(filemtime($filename));
+var_dump(fileatime($filename));
+
+@unlink($filename);
+
+@unlink($filename);
+var_dump(touch($filename, 100, 102));
+var_dump(filemtime($filename));
+var_dump(fileatime($filename));
+
+@unlink($filename);
+echo "Done\n";
+
+?>
+--EXPECTF--
+bool(true)
+int(101)
+int(101)
+bool(true)
+int(100)
+int(102)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/touch_variation2.phpt b/ext/standard/tests/file/touch_variation2.phpt
new file mode 100644
index 0000000..9ccb90c
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+touch() - ensure touch does not delete existing file.
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/touch.dat";
+$fp=fopen($filename,"w");
+fwrite ($fp,"mydata");
+fclose($fp);
+
+var_dump(touch($filename, 101));
+var_dump(file_get_contents($filename));
+
+@unlink($filename);
+echo "Done\n";
+
+?>
+--EXPECT--
+bool(true)
+string(6) "mydata"
+Done
diff --git a/ext/standard/tests/file/touch_variation3-win32.phpt b/ext/standard/tests/file/touch_variation3-win32.phpt
new file mode 100644
index 0000000..43556b8
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation3-win32.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test touch() function : usage variation - different types for time
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing touch() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'touchVar2.tmp';
+$atime = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ '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 time
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( touch($filename, $value, $atime) );
+};
+
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : usage variation ***
+
+--float 10.5--
+bool(true)
+
+--float 12.3456789000e10--
+bool(true)
+
+--float .5--
+bool(true)
+
+--empty array--
+Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - touch() 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 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - touch() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - touch() 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/touch_variation3.phpt b/ext/standard/tests/file/touch_variation3.phpt
new file mode 100644
index 0000000..810cd71
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation3.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test touch() function : usage variation - different types for time
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing touch() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'touchVar2.tmp';
+$atime = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ '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 time
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( touch($filename, $value, $atime) );
+};
+
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : usage variation ***
+
+--float 10.5--
+bool(true)
+
+--float 12.3456789000e10--
+bool(true)
+
+--float .5--
+bool(true)
+
+--empty array--
+Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - touch() 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 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - touch() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - touch() 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/touch_variation4-win32.phpt b/ext/standard/tests/file/touch_variation4-win32.phpt
new file mode 100644
index 0000000..ee2639a
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation4-win32.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test touch() function : usage variation - different types for atime
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing touch() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'touchVar3.tmp';
+$time = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ '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 atime
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( touch($filename, $time, $value) );
+};
+
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : usage variation ***
+
+--float 10.5--
+bool(true)
+
+--float 12.3456789000e10--
+bool(true)
+
+--float .5--
+bool(true)
+
+--empty array--
+Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - touch() expects parameter 3 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 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+bool(true)
+
+--unset var--
+bool(true)
+===DONE===
+
diff --git a/ext/standard/tests/file/touch_variation4.phpt b/ext/standard/tests/file/touch_variation4.phpt
new file mode 100644
index 0000000..b0238b1
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation4.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test touch() function : usage variation - different types for atime
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+echo "*** Testing touch() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = 'touchVar3.tmp';
+$time = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ '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 atime
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( touch($filename, $time, $value) );
+};
+
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : usage variation ***
+
+--float 10.5--
+bool(true)
+
+--float 12.3456789000e10--
+bool(true)
+
+--float .5--
+bool(true)
+
+--empty array--
+Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - touch() expects parameter 3 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 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+bool(true)
+
+--unset var--
+bool(true)
+===DONE===
+
diff --git a/ext/standard/tests/file/touch_variation5-win32.phpt b/ext/standard/tests/file/touch_variation5-win32.phpt
new file mode 100644
index 0000000..92bd8b7
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation5-win32.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test touch() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+$workDir = "touchVar5.tmp";
+$subDirOrFile = "aSubDirOrFile";
+$cwd = __DIR__;
+chdir($cwd);
+if (!mkdir($cwd . '/' . $workDir)) die("cannot create directory $workDir");
+
+$paths = array(
+ // relative
+ $workDir.'/'.$subDirOrFile,
+ './'.$workDir.'/'.$subDirOrFile,
+ $workDir.'/../'.$workDir.'/'.$subDirOrFile,
+
+ // relative bad path (note p8 msgs differ)
+ $workDir.'/../BADDIR/'.$subDirOrFile,
+ 'BADDIR/'.$subDirOrFile,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$subDirOrFile,
+ $cwd.'/./'.$workDir.'/'.$subDirOrFile,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$subDirOrFile,
+
+ //absolute bad path (note p8 msgs differ)
+ $cwd.'/BADDIR/'.$subDirOrFile,
+
+ //trailing separators
+ $workDir.'/'.$subDirOrFile.'/',
+ $cwd.'/'.$workDir.'/'.$subDirOrFile.'/',
+
+ // multiple separators
+ $workDir.'//'.$subDirOrFile,
+ $cwd.'//'.$workDir.'//'.$subDirOrFile,
+
+ );
+
+echo "*** Testing touch() : variation ***\n";
+
+echo "\n*** testing nonexisting paths ***\n";
+test_nonexisting($paths);
+
+echo "\n*** testing existing files ***\n";
+test_existing($paths, false);
+
+echo "\n*** testing existing directories ***\n";
+test_existing($paths, true);
+
+
+rmdir($workDir);
+
+
+
+function test_nonexisting($paths) {
+ foreach($paths as $path) {
+ echo "--- testing $path ---\n";
+
+ if (is_dir($path) || is_file($path)) {
+ echo "FAILED: $path - exists\n";
+ }
+ else {
+ $res = touch($path);
+ if ($res === true) {
+ // something was created
+ if (file_exists($path)) {
+ // something found
+ if (is_dir($path)) {
+ echo "FAILED: $path - unexpected directory\n";
+ }
+ else {
+ echo "PASSED: $path - created\n";
+ unlink($path);
+ }
+ }
+ else {
+ // nothing found
+ echo "FAILED: $path - touch returned true, nothing there\n";
+ }
+ }
+ else {
+ // nothing created
+ if (file_exists($path)) {
+ //something found
+ echo "FAILED: $path - touch returned false, something there\n";
+ if (is_dir($path)) {
+ rmdir($path);
+ }
+ else {
+ unlink($path);
+ }
+ }
+ }
+ }
+ }
+}
+
+function test_existing($paths, $are_dirs) {
+ foreach($paths as $path) {
+ if ($are_dirs) {
+ $res = @mkdir($path);
+ if ($res == true) {
+ test_path($path);
+ rmdir($path);
+ }
+ }
+ else {
+ $h = @fopen($path,"w");
+ if ($h !== false) {
+ fclose($h);
+ test_path($path);
+ unlink($path);
+ }
+ }
+ }
+}
+
+
+function test_path($path) {
+ echo "--- testing $path ---\n";
+ $org_atime = get_atime($path);
+ clearstatcache();
+ $res = touch($path,0,0);
+ $next_atime = get_atime($path);
+ if ($next_atime == $org_atime) {
+ echo "FAILED: $path - access time not changed\n";
+ }
+ else {
+ echo "PASSED: $path - touched\n";
+ }
+}
+
+function get_atime($path) {
+ $temp = stat($path);
+ return $temp['atime'];
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : variation ***
+
+*** testing nonexisting paths ***
+--- testing touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/aSubDirOrFile - created
+--- testing ./touchVar5.tmp/aSubDirOrFile ---
+PASSED: ./touchVar5.tmp/aSubDirOrFile - created
+--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created
+--- testing touchVar5.tmp/../BADDIR/aSubDirOrFile ---
+
+Warning: touch(): Unable to create file touchVar5.tmp/../BADDIR/aSubDirOrFile because %s in %s on line %d
+--- testing BADDIR/aSubDirOrFile ---
+
+Warning: touch(): Unable to create file BADDIR/aSubDirOrFile because %s in %s on line %d
+--- testing %s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/touchVar5.tmp/aSubDirOrFile - created
+--- testing %s/./touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/./touchVar5.tmp/aSubDirOrFile - created
+--- testing %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created
+--- testing %s/BADDIR/aSubDirOrFile ---
+
+Warning: touch(): Unable to create file %s/BADDIR/aSubDirOrFile because %s in %s on line %d
+--- testing touchVar5.tmp/aSubDirOrFile/ ---
+
+Warning: touch(): Unable to create file touchVar5.tmp/aSubDirOrFile/ because Invalid argument in %s on line %d
+--- testing %s/touchVar5.tmp/aSubDirOrFile/ ---
+
+Warning: touch(): Unable to create file %s/touchVar5.tmp/aSubDirOrFile/ because Invalid argument in %s on line %d
+--- testing touchVar5.tmp//aSubDirOrFile ---
+PASSED: touchVar5.tmp//aSubDirOrFile - created
+--- testing %s//touchVar5.tmp//aSubDirOrFile ---
+PASSED: %s//touchVar5.tmp//aSubDirOrFile - created
+
+*** testing existing files ***
+--- testing touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/aSubDirOrFile - touched
+--- testing ./touchVar5.tmp/aSubDirOrFile ---
+PASSED: ./touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing %s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/touchVar5.tmp/aSubDirOrFile - touched
+--- testing %s/./touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/./touchVar5.tmp/aSubDirOrFile - touched
+--- testing %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp//aSubDirOrFile ---
+PASSED: touchVar5.tmp//aSubDirOrFile - touched
+--- testing %s//touchVar5.tmp//aSubDirOrFile ---
+PASSED: %s//touchVar5.tmp//aSubDirOrFile - touched
+
+*** testing existing directories ***
+--- testing touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/aSubDirOrFile - touched
+--- testing ./touchVar5.tmp/aSubDirOrFile ---
+PASSED: ./touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing %s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/touchVar5.tmp/aSubDirOrFile - touched
+--- testing %s/./touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/./touchVar5.tmp/aSubDirOrFile - touched
+--- testing %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp/aSubDirOrFile/ ---
+PASSED: touchVar5.tmp/aSubDirOrFile/ - touched
+--- testing %s/touchVar5.tmp/aSubDirOrFile/ ---
+PASSED: %s/touchVar5.tmp/aSubDirOrFile/ - touched
+--- testing touchVar5.tmp//aSubDirOrFile ---
+PASSED: touchVar5.tmp//aSubDirOrFile - touched
+--- testing %s//touchVar5.tmp//aSubDirOrFile ---
+PASSED: %s//touchVar5.tmp//aSubDirOrFile - touched
+===DONE===
+
diff --git a/ext/standard/tests/file/touch_variation5.phpt b/ext/standard/tests/file/touch_variation5.phpt
new file mode 100644
index 0000000..a448db3
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation5.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test touch() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+$workDir = "touchVar5.tmp";
+$subDirOrFile = "aSubDirOrFile";
+mkdir($workDir);
+$cwd = getcwd();
+
+$paths = array(
+ // relative
+ $workDir.'/'.$subDirOrFile,
+ './'.$workDir.'/'.$subDirOrFile,
+ $workDir.'/../'.$workDir.'/'.$subDirOrFile,
+
+ // relative bad path
+ $workDir.'/../BADDIR/'.$subDirOrFile,
+ 'BADDIR/'.$subDirOrFile,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$subDirOrFile,
+ $cwd.'/./'.$workDir.'/'.$subDirOrFile,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$subDirOrFile,
+
+ //absolute bad path
+ $cwd.'/BADDIR/'.$subDirOrFile,
+
+ //trailing separators
+ $workDir.'/'.$subDirOrFile.'/',
+ $cwd.'/'.$workDir.'/'.$subDirOrFile.'/',
+
+ // multiple separators
+ $workDir.'//'.$subDirOrFile,
+ $cwd.'//'.$workDir.'//'.$subDirOrFile,
+
+ );
+
+echo "*** Testing touch() : variation ***\n";
+
+echo "\n*** testing nonexisting paths ***\n";
+test_nonexisting($paths);
+
+echo "\n*** testing existing files ***\n";
+test_existing($paths, false);
+
+echo "\n*** testing existing directories ***\n";
+test_existing($paths, true);
+
+
+rmdir($workDir);
+
+
+
+function test_nonexisting($paths) {
+ foreach($paths as $path) {
+ echo "--- testing $path ---\n";
+
+ if (is_dir($path) || is_file($path)) {
+ echo "FAILED: $path - exists\n";
+ }
+ else {
+ $res = touch($path);
+ if ($res === true) {
+ // something was created
+ if (file_exists($path)) {
+ // something found
+ if (is_dir($path)) {
+ echo "FAILED: $path - unexpected directory\n";
+ }
+ else {
+ echo "PASSED: $path - created\n";
+ unlink($path);
+ }
+ }
+ else {
+ // nothing found
+ echo "FAILED: $path - touch returned true, nothing there\n";
+ }
+ }
+ else {
+ // nothing created
+ if (file_exists($path)) {
+ //something found
+ echo "FAILED: $path - touch returned false, something there\n";
+ if (is_dir($path)) {
+ rmdir($path);
+ }
+ else {
+ unlink($path);
+ }
+ }
+ }
+ }
+ }
+}
+
+function test_existing($paths, $are_dirs) {
+ foreach($paths as $path) {
+ if ($are_dirs) {
+ $res = @mkdir($path);
+ if ($res == true) {
+ test_path($path);
+ rmdir($path);
+ }
+ }
+ else {
+ $h = @fopen($path,"w");
+ if ($h !== false) {
+ fclose($h);
+ test_path($path);
+ unlink($path);
+ }
+ }
+ }
+}
+
+
+function test_path($path) {
+ echo "--- testing $path ---\n";
+ $org_atime = get_atime($path);
+ clearstatcache();
+ $res = touch($path,0,0);
+ $next_atime = get_atime($path);
+ if ($next_atime == $org_atime) {
+ echo "FAILED: $path - access time not changed\n";
+ }
+ else {
+ echo "PASSED: $path - touched\n";
+ }
+}
+
+function get_atime($path) {
+ $temp = stat($path);
+ return $temp['atime'];
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : variation ***
+
+*** testing nonexisting paths ***
+--- testing touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/aSubDirOrFile - created
+--- testing ./touchVar5.tmp/aSubDirOrFile ---
+PASSED: ./touchVar5.tmp/aSubDirOrFile - created
+--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created
+--- testing touchVar5.tmp/../BADDIR/aSubDirOrFile ---
+
+Warning: touch(): Unable to create file touchVar5.tmp/../BADDIR/aSubDirOrFile because %s in %s on line %d
+--- testing BADDIR/aSubDirOrFile ---
+
+Warning: touch(): Unable to create file BADDIR/aSubDirOrFile because %s in %s on line %d
+--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile - created
+--- testing /%s/./touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/./touchVar5.tmp/aSubDirOrFile - created
+--- testing /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created
+--- testing /%s/BADDIR/aSubDirOrFile ---
+
+Warning: touch(): Unable to create file /%s/BADDIR/aSubDirOrFile because %s in %s on line %d
+--- testing touchVar5.tmp/aSubDirOrFile/ ---
+
+Warning: touch(): Unable to create file touchVar5.tmp/aSubDirOrFile/ because %s in %s on line %d
+--- testing /%s/touchVar5.tmp/aSubDirOrFile/ ---
+
+Warning: touch(): Unable to create file /%s/touchVar5.tmp/aSubDirOrFile/ because %s in %s on line %d
+--- testing touchVar5.tmp//aSubDirOrFile ---
+PASSED: touchVar5.tmp//aSubDirOrFile - created
+--- testing /%s//touchVar5.tmp//aSubDirOrFile ---
+PASSED: /%s//touchVar5.tmp//aSubDirOrFile - created
+
+*** testing existing files ***
+--- testing touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/aSubDirOrFile - touched
+--- testing ./touchVar5.tmp/aSubDirOrFile ---
+PASSED: ./touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched
+--- testing /%s/./touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/./touchVar5.tmp/aSubDirOrFile - touched
+--- testing /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp//aSubDirOrFile ---
+PASSED: touchVar5.tmp//aSubDirOrFile - touched
+--- testing /%s//touchVar5.tmp//aSubDirOrFile ---
+PASSED: /%s//touchVar5.tmp//aSubDirOrFile - touched
+
+*** testing existing directories ***
+--- testing touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/aSubDirOrFile - touched
+--- testing ./touchVar5.tmp/aSubDirOrFile ---
+PASSED: ./touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched
+--- testing /%s/./touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/./touchVar5.tmp/aSubDirOrFile - touched
+--- testing /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched
+--- testing touchVar5.tmp/aSubDirOrFile/ ---
+PASSED: touchVar5.tmp/aSubDirOrFile/ - touched
+--- testing /%s/touchVar5.tmp/aSubDirOrFile/ ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile/ - touched
+--- testing touchVar5.tmp//aSubDirOrFile ---
+PASSED: touchVar5.tmp//aSubDirOrFile - touched
+--- testing /%s//touchVar5.tmp//aSubDirOrFile ---
+PASSED: /%s//touchVar5.tmp//aSubDirOrFile - touched
+===DONE===
+
diff --git a/ext/standard/tests/file/touch_variation6-win32.phpt b/ext/standard/tests/file/touch_variation6-win32.phpt
new file mode 100644
index 0000000..625e571
--- /dev/null
+++ b/ext/standard/tests/file/touch_variation6-win32.phpt
@@ -0,0 +1,242 @@
+--TEST--
+Test touch() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool touch(string filename [, int time [, int atime]])
+ * Description: Set modification time of file
+ * Source code: ext/standard/filestat.c
+ * Alias to functions:
+ */
+
+$workDir = "touchVar5.tmp";
+$subDirOrFile = "aSubDirOrFile";
+chdir(__DIR__);
+mkdir($workDir);
+$cwd = getcwd();
+
+$unixifiedDirOrFile = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDirOrFile, 3);
+
+$paths = array(
+ // relative
+ $workDir.'\\'.$subDirOrFile,
+ '.\\'.$workDir.'\\'.$subDirOrFile,
+ $workDir.'\\..\\'.$workDir.'\\'.$subDirOrFile,
+
+ // relative bad path (note p8 msgs differ)
+ $workDir.'\\..\\BADDIR\\'.$subDirOrFile,
+ 'BADDIR\\'.$subDirOrFile,
+
+ //absolute
+ $cwd.'\\'.$workDir.'\\'.$subDirOrFile,
+ $cwd.'\\.\\'.$workDir.'\\'.$subDirOrFile,
+ $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDirOrFile,
+
+ //absolute bad path (note p8 msgs differ)
+ $cwd.'\\BADDIR\\'.$subDirOrFile,
+
+ //trailing separators
+ $workDir.'\\'.$subDirOrFile.'\\',
+ $cwd.'\\'.$workDir.'\\'.$subDirOrFile.'\\',
+
+ // multiple separators
+ $workDir.'\\\\'.$subDirOrFile,
+ $cwd.'\\\\'.$workDir.'\\\\'.$subDirOrFile,
+
+ // Unixified Dir Or File
+ $unixifiedDirOrFile,
+
+ );
+
+echo "*** Testing touch() : variation ***\n";
+
+echo "\n*** testing nonexisting paths ***\n";
+test_nonexisting($paths);
+
+echo "\n*** testing existing files ***\n";
+test_existing($paths, false);
+
+echo "\n*** testing existing directories ***\n";
+test_existing($paths, true);
+
+
+rmdir($workDir);
+
+
+
+function test_nonexisting($paths) {
+ foreach($paths as $path) {
+ echo "--- testing $path ---\n";
+
+ if (is_dir($path) || is_file($path)) {
+ echo "FAILED: $path - exists\n";
+ }
+ else {
+ $res = touch($path);
+ if ($res === true) {
+ // something was created
+ if (file_exists($path)) {
+ // something found
+ if (is_dir($path)) {
+ echo "FAILED: $path - unexpected directory\n";
+ }
+ else {
+ echo "PASSED: $path - created\n";
+ unlink($path);
+ }
+ }
+ else {
+ // nothing found
+ echo "FAILED: $path - touch returned true, nothing there\n";
+ }
+ }
+ else {
+ // nothing created
+ if (file_exists($path)) {
+ //something found
+ echo "FAILED: $path - touch returned false, something there\n";
+ if (is_dir($path)) {
+ rmdir($path);
+ }
+ else {
+ unlink($path);
+ }
+ }
+ }
+ }
+ }
+}
+
+function test_existing($paths, $are_dirs) {
+ foreach($paths as $path) {
+ if ($are_dirs) {
+ $res = @mkdir($path);
+ if ($res == true) {
+ test_path($path);
+ rmdir($path);
+ }
+ }
+ else {
+ $h = @fopen($path,"w");
+ if ($h !== false) {
+ fclose($h);
+ test_path($path);
+ unlink($path);
+ }
+ }
+ }
+}
+
+
+function test_path($path) {
+ echo "--- testing $path ---\n";
+ $org_atime = get_atime($path);
+ clearstatcache();
+ $res = touch($path,0,0);
+ $next_atime = get_atime($path);
+ if ($next_atime == $org_atime) {
+ echo "FAILED: $path - access time not changed\n";
+ }
+ else {
+ echo "PASSED: $path - touched\n";
+ }
+}
+
+function get_atime($path) {
+ $temp = stat($path);
+ return $temp['atime'];
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing touch() : variation ***
+
+*** testing nonexisting paths ***
+--- testing touchVar5.tmp\aSubDirOrFile ---
+PASSED: touchVar5.tmp\aSubDirOrFile - created
+--- testing .\touchVar5.tmp\aSubDirOrFile ---
+PASSED: .\touchVar5.tmp\aSubDirOrFile - created
+--- testing touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile ---
+PASSED: touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - created
+--- testing touchVar5.tmp\..\BADDIR\aSubDirOrFile ---
+
+Warning: touch(): Unable to create file touchVar5.tmp\..\BADDIR\aSubDirOrFile because %s in %s on line %d
+--- testing BADDIR\aSubDirOrFile ---
+
+Warning: touch(): Unable to create file BADDIR\aSubDirOrFile because %s in %s on line %d
+--- testing %s\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\touchVar5.tmp\aSubDirOrFile - created
+--- testing %s\.\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\.\touchVar5.tmp\aSubDirOrFile - created
+--- testing %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - created
+--- testing %s\BADDIR\aSubDirOrFile ---
+
+Warning: touch(): Unable to create file %s\BADDIR\aSubDirOrFile because %s in %s on line %d
+--- testing touchVar5.tmp\aSubDirOrFile\ ---
+
+Warning: touch(): Unable to create file touchVar5.tmp\aSubDirOrFile\ because Invalid argument in %s on line %d
+--- testing %s\touchVar5.tmp\aSubDirOrFile\ ---
+
+Warning: touch(): Unable to create file %s\touchVar5.tmp\aSubDirOrFile\ because Invalid argument in %s on line %d
+--- testing touchVar5.tmp\\aSubDirOrFile ---
+PASSED: touchVar5.tmp\\aSubDirOrFile - created
+--- testing %s\\touchVar5.tmp\\aSubDirOrFile ---
+PASSED: %s\\touchVar5.tmp\\aSubDirOrFile - created
+--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile - created
+
+*** testing existing files ***
+--- testing touchVar5.tmp\aSubDirOrFile ---
+PASSED: touchVar5.tmp\aSubDirOrFile - touched
+--- testing .\touchVar5.tmp\aSubDirOrFile ---
+PASSED: .\touchVar5.tmp\aSubDirOrFile - touched
+--- testing touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile ---
+PASSED: touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - touched
+--- testing %s\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\touchVar5.tmp\aSubDirOrFile - touched
+--- testing %s\.\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\.\touchVar5.tmp\aSubDirOrFile - touched
+--- testing %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - touched
+--- testing touchVar5.tmp\\aSubDirOrFile ---
+PASSED: touchVar5.tmp\\aSubDirOrFile - touched
+--- testing %s\\touchVar5.tmp\\aSubDirOrFile ---
+PASSED: %s\\touchVar5.tmp\\aSubDirOrFile - touched
+--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched
+
+*** testing existing directories ***
+--- testing touchVar5.tmp\aSubDirOrFile ---
+PASSED: touchVar5.tmp\aSubDirOrFile - touched
+--- testing .\touchVar5.tmp\aSubDirOrFile ---
+PASSED: .\touchVar5.tmp\aSubDirOrFile - touched
+--- testing touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile ---
+PASSED: touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - touched
+--- testing %s\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\touchVar5.tmp\aSubDirOrFile - touched
+--- testing %s\.\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\.\touchVar5.tmp\aSubDirOrFile - touched
+--- testing %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile ---
+PASSED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - touched
+--- testing touchVar5.tmp\aSubDirOrFile\ ---
+PASSED: touchVar5.tmp\aSubDirOrFile\ - touched
+--- testing %s\touchVar5.tmp\aSubDirOrFile\ ---
+PASSED: %s\touchVar5.tmp\aSubDirOrFile\ - touched
+--- testing touchVar5.tmp\\aSubDirOrFile ---
+PASSED: touchVar5.tmp\\aSubDirOrFile - touched
+--- testing %s\\touchVar5.tmp\\aSubDirOrFile ---
+PASSED: %s\\touchVar5.tmp\\aSubDirOrFile - touched
+--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
+PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched
+===DONE===
+
diff --git a/ext/standard/tests/file/umask_basic.phpt b/ext/standard/tests/file/umask_basic.phpt
new file mode 100644
index 0000000..761df97
--- /dev/null
+++ b/ext/standard/tests/file/umask_basic.phpt
@@ -0,0 +1,2079 @@
+--TEST--
+Test umask() function: basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int umask ( [int $mask] );
+ Description: Changes the current umask
+*/
+
+echo "*** Testing umask() : basic functionality ***\n";
+// checking umask() on all the modes
+for($mask = 0000; $mask <= 0777; $mask++) {
+ echo "-- Setting umask to $mask --\n";
+ var_dump( umask($mask) );
+ var_dump( umask() );
+ echo "\n";
+ if ($mask != umask()) {
+ die('An error occurred while changing back the umask');
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing umask() : basic functionality ***
+-- Setting umask to 0 --
+int(%d)
+int(0)
+
+-- Setting umask to 1 --
+int(0)
+int(1)
+
+-- Setting umask to 2 --
+int(1)
+int(2)
+
+-- Setting umask to 3 --
+int(2)
+int(3)
+
+-- Setting umask to 4 --
+int(3)
+int(4)
+
+-- Setting umask to 5 --
+int(4)
+int(5)
+
+-- Setting umask to 6 --
+int(5)
+int(6)
+
+-- Setting umask to 7 --
+int(6)
+int(7)
+
+-- Setting umask to 8 --
+int(7)
+int(8)
+
+-- Setting umask to 9 --
+int(8)
+int(9)
+
+-- Setting umask to 10 --
+int(9)
+int(10)
+
+-- Setting umask to 11 --
+int(10)
+int(11)
+
+-- Setting umask to 12 --
+int(11)
+int(12)
+
+-- Setting umask to 13 --
+int(12)
+int(13)
+
+-- Setting umask to 14 --
+int(13)
+int(14)
+
+-- Setting umask to 15 --
+int(14)
+int(15)
+
+-- Setting umask to 16 --
+int(15)
+int(16)
+
+-- Setting umask to 17 --
+int(16)
+int(17)
+
+-- Setting umask to 18 --
+int(17)
+int(18)
+
+-- Setting umask to 19 --
+int(18)
+int(19)
+
+-- Setting umask to 20 --
+int(19)
+int(20)
+
+-- Setting umask to 21 --
+int(20)
+int(21)
+
+-- Setting umask to 22 --
+int(21)
+int(22)
+
+-- Setting umask to 23 --
+int(22)
+int(23)
+
+-- Setting umask to 24 --
+int(23)
+int(24)
+
+-- Setting umask to 25 --
+int(24)
+int(25)
+
+-- Setting umask to 26 --
+int(25)
+int(26)
+
+-- Setting umask to 27 --
+int(26)
+int(27)
+
+-- Setting umask to 28 --
+int(27)
+int(28)
+
+-- Setting umask to 29 --
+int(28)
+int(29)
+
+-- Setting umask to 30 --
+int(29)
+int(30)
+
+-- Setting umask to 31 --
+int(30)
+int(31)
+
+-- Setting umask to 32 --
+int(31)
+int(32)
+
+-- Setting umask to 33 --
+int(32)
+int(33)
+
+-- Setting umask to 34 --
+int(33)
+int(34)
+
+-- Setting umask to 35 --
+int(34)
+int(35)
+
+-- Setting umask to 36 --
+int(35)
+int(36)
+
+-- Setting umask to 37 --
+int(36)
+int(37)
+
+-- Setting umask to 38 --
+int(37)
+int(38)
+
+-- Setting umask to 39 --
+int(38)
+int(39)
+
+-- Setting umask to 40 --
+int(39)
+int(40)
+
+-- Setting umask to 41 --
+int(40)
+int(41)
+
+-- Setting umask to 42 --
+int(41)
+int(42)
+
+-- Setting umask to 43 --
+int(42)
+int(43)
+
+-- Setting umask to 44 --
+int(43)
+int(44)
+
+-- Setting umask to 45 --
+int(44)
+int(45)
+
+-- Setting umask to 46 --
+int(45)
+int(46)
+
+-- Setting umask to 47 --
+int(46)
+int(47)
+
+-- Setting umask to 48 --
+int(47)
+int(48)
+
+-- Setting umask to 49 --
+int(48)
+int(49)
+
+-- Setting umask to 50 --
+int(49)
+int(50)
+
+-- Setting umask to 51 --
+int(50)
+int(51)
+
+-- Setting umask to 52 --
+int(51)
+int(52)
+
+-- Setting umask to 53 --
+int(52)
+int(53)
+
+-- Setting umask to 54 --
+int(53)
+int(54)
+
+-- Setting umask to 55 --
+int(54)
+int(55)
+
+-- Setting umask to 56 --
+int(55)
+int(56)
+
+-- Setting umask to 57 --
+int(56)
+int(57)
+
+-- Setting umask to 58 --
+int(57)
+int(58)
+
+-- Setting umask to 59 --
+int(58)
+int(59)
+
+-- Setting umask to 60 --
+int(59)
+int(60)
+
+-- Setting umask to 61 --
+int(60)
+int(61)
+
+-- Setting umask to 62 --
+int(61)
+int(62)
+
+-- Setting umask to 63 --
+int(62)
+int(63)
+
+-- Setting umask to 64 --
+int(63)
+int(64)
+
+-- Setting umask to 65 --
+int(64)
+int(65)
+
+-- Setting umask to 66 --
+int(65)
+int(66)
+
+-- Setting umask to 67 --
+int(66)
+int(67)
+
+-- Setting umask to 68 --
+int(67)
+int(68)
+
+-- Setting umask to 69 --
+int(68)
+int(69)
+
+-- Setting umask to 70 --
+int(69)
+int(70)
+
+-- Setting umask to 71 --
+int(70)
+int(71)
+
+-- Setting umask to 72 --
+int(71)
+int(72)
+
+-- Setting umask to 73 --
+int(72)
+int(73)
+
+-- Setting umask to 74 --
+int(73)
+int(74)
+
+-- Setting umask to 75 --
+int(74)
+int(75)
+
+-- Setting umask to 76 --
+int(75)
+int(76)
+
+-- Setting umask to 77 --
+int(76)
+int(77)
+
+-- Setting umask to 78 --
+int(77)
+int(78)
+
+-- Setting umask to 79 --
+int(78)
+int(79)
+
+-- Setting umask to 80 --
+int(79)
+int(80)
+
+-- Setting umask to 81 --
+int(80)
+int(81)
+
+-- Setting umask to 82 --
+int(81)
+int(82)
+
+-- Setting umask to 83 --
+int(82)
+int(83)
+
+-- Setting umask to 84 --
+int(83)
+int(84)
+
+-- Setting umask to 85 --
+int(84)
+int(85)
+
+-- Setting umask to 86 --
+int(85)
+int(86)
+
+-- Setting umask to 87 --
+int(86)
+int(87)
+
+-- Setting umask to 88 --
+int(87)
+int(88)
+
+-- Setting umask to 89 --
+int(88)
+int(89)
+
+-- Setting umask to 90 --
+int(89)
+int(90)
+
+-- Setting umask to 91 --
+int(90)
+int(91)
+
+-- Setting umask to 92 --
+int(91)
+int(92)
+
+-- Setting umask to 93 --
+int(92)
+int(93)
+
+-- Setting umask to 94 --
+int(93)
+int(94)
+
+-- Setting umask to 95 --
+int(94)
+int(95)
+
+-- Setting umask to 96 --
+int(95)
+int(96)
+
+-- Setting umask to 97 --
+int(96)
+int(97)
+
+-- Setting umask to 98 --
+int(97)
+int(98)
+
+-- Setting umask to 99 --
+int(98)
+int(99)
+
+-- Setting umask to 100 --
+int(99)
+int(100)
+
+-- Setting umask to 101 --
+int(100)
+int(101)
+
+-- Setting umask to 102 --
+int(101)
+int(102)
+
+-- Setting umask to 103 --
+int(102)
+int(103)
+
+-- Setting umask to 104 --
+int(103)
+int(104)
+
+-- Setting umask to 105 --
+int(104)
+int(105)
+
+-- Setting umask to 106 --
+int(105)
+int(106)
+
+-- Setting umask to 107 --
+int(106)
+int(107)
+
+-- Setting umask to 108 --
+int(107)
+int(108)
+
+-- Setting umask to 109 --
+int(108)
+int(109)
+
+-- Setting umask to 110 --
+int(109)
+int(110)
+
+-- Setting umask to 111 --
+int(110)
+int(111)
+
+-- Setting umask to 112 --
+int(111)
+int(112)
+
+-- Setting umask to 113 --
+int(112)
+int(113)
+
+-- Setting umask to 114 --
+int(113)
+int(114)
+
+-- Setting umask to 115 --
+int(114)
+int(115)
+
+-- Setting umask to 116 --
+int(115)
+int(116)
+
+-- Setting umask to 117 --
+int(116)
+int(117)
+
+-- Setting umask to 118 --
+int(117)
+int(118)
+
+-- Setting umask to 119 --
+int(118)
+int(119)
+
+-- Setting umask to 120 --
+int(119)
+int(120)
+
+-- Setting umask to 121 --
+int(120)
+int(121)
+
+-- Setting umask to 122 --
+int(121)
+int(122)
+
+-- Setting umask to 123 --
+int(122)
+int(123)
+
+-- Setting umask to 124 --
+int(123)
+int(124)
+
+-- Setting umask to 125 --
+int(124)
+int(125)
+
+-- Setting umask to 126 --
+int(125)
+int(126)
+
+-- Setting umask to 127 --
+int(126)
+int(127)
+
+-- Setting umask to 128 --
+int(127)
+int(128)
+
+-- Setting umask to 129 --
+int(128)
+int(129)
+
+-- Setting umask to 130 --
+int(129)
+int(130)
+
+-- Setting umask to 131 --
+int(130)
+int(131)
+
+-- Setting umask to 132 --
+int(131)
+int(132)
+
+-- Setting umask to 133 --
+int(132)
+int(133)
+
+-- Setting umask to 134 --
+int(133)
+int(134)
+
+-- Setting umask to 135 --
+int(134)
+int(135)
+
+-- Setting umask to 136 --
+int(135)
+int(136)
+
+-- Setting umask to 137 --
+int(136)
+int(137)
+
+-- Setting umask to 138 --
+int(137)
+int(138)
+
+-- Setting umask to 139 --
+int(138)
+int(139)
+
+-- Setting umask to 140 --
+int(139)
+int(140)
+
+-- Setting umask to 141 --
+int(140)
+int(141)
+
+-- Setting umask to 142 --
+int(141)
+int(142)
+
+-- Setting umask to 143 --
+int(142)
+int(143)
+
+-- Setting umask to 144 --
+int(143)
+int(144)
+
+-- Setting umask to 145 --
+int(144)
+int(145)
+
+-- Setting umask to 146 --
+int(145)
+int(146)
+
+-- Setting umask to 147 --
+int(146)
+int(147)
+
+-- Setting umask to 148 --
+int(147)
+int(148)
+
+-- Setting umask to 149 --
+int(148)
+int(149)
+
+-- Setting umask to 150 --
+int(149)
+int(150)
+
+-- Setting umask to 151 --
+int(150)
+int(151)
+
+-- Setting umask to 152 --
+int(151)
+int(152)
+
+-- Setting umask to 153 --
+int(152)
+int(153)
+
+-- Setting umask to 154 --
+int(153)
+int(154)
+
+-- Setting umask to 155 --
+int(154)
+int(155)
+
+-- Setting umask to 156 --
+int(155)
+int(156)
+
+-- Setting umask to 157 --
+int(156)
+int(157)
+
+-- Setting umask to 158 --
+int(157)
+int(158)
+
+-- Setting umask to 159 --
+int(158)
+int(159)
+
+-- Setting umask to 160 --
+int(159)
+int(160)
+
+-- Setting umask to 161 --
+int(160)
+int(161)
+
+-- Setting umask to 162 --
+int(161)
+int(162)
+
+-- Setting umask to 163 --
+int(162)
+int(163)
+
+-- Setting umask to 164 --
+int(163)
+int(164)
+
+-- Setting umask to 165 --
+int(164)
+int(165)
+
+-- Setting umask to 166 --
+int(165)
+int(166)
+
+-- Setting umask to 167 --
+int(166)
+int(167)
+
+-- Setting umask to 168 --
+int(167)
+int(168)
+
+-- Setting umask to 169 --
+int(168)
+int(169)
+
+-- Setting umask to 170 --
+int(169)
+int(170)
+
+-- Setting umask to 171 --
+int(170)
+int(171)
+
+-- Setting umask to 172 --
+int(171)
+int(172)
+
+-- Setting umask to 173 --
+int(172)
+int(173)
+
+-- Setting umask to 174 --
+int(173)
+int(174)
+
+-- Setting umask to 175 --
+int(174)
+int(175)
+
+-- Setting umask to 176 --
+int(175)
+int(176)
+
+-- Setting umask to 177 --
+int(176)
+int(177)
+
+-- Setting umask to 178 --
+int(177)
+int(178)
+
+-- Setting umask to 179 --
+int(178)
+int(179)
+
+-- Setting umask to 180 --
+int(179)
+int(180)
+
+-- Setting umask to 181 --
+int(180)
+int(181)
+
+-- Setting umask to 182 --
+int(181)
+int(182)
+
+-- Setting umask to 183 --
+int(182)
+int(183)
+
+-- Setting umask to 184 --
+int(183)
+int(184)
+
+-- Setting umask to 185 --
+int(184)
+int(185)
+
+-- Setting umask to 186 --
+int(185)
+int(186)
+
+-- Setting umask to 187 --
+int(186)
+int(187)
+
+-- Setting umask to 188 --
+int(187)
+int(188)
+
+-- Setting umask to 189 --
+int(188)
+int(189)
+
+-- Setting umask to 190 --
+int(189)
+int(190)
+
+-- Setting umask to 191 --
+int(190)
+int(191)
+
+-- Setting umask to 192 --
+int(191)
+int(192)
+
+-- Setting umask to 193 --
+int(192)
+int(193)
+
+-- Setting umask to 194 --
+int(193)
+int(194)
+
+-- Setting umask to 195 --
+int(194)
+int(195)
+
+-- Setting umask to 196 --
+int(195)
+int(196)
+
+-- Setting umask to 197 --
+int(196)
+int(197)
+
+-- Setting umask to 198 --
+int(197)
+int(198)
+
+-- Setting umask to 199 --
+int(198)
+int(199)
+
+-- Setting umask to 200 --
+int(199)
+int(200)
+
+-- Setting umask to 201 --
+int(200)
+int(201)
+
+-- Setting umask to 202 --
+int(201)
+int(202)
+
+-- Setting umask to 203 --
+int(202)
+int(203)
+
+-- Setting umask to 204 --
+int(203)
+int(204)
+
+-- Setting umask to 205 --
+int(204)
+int(205)
+
+-- Setting umask to 206 --
+int(205)
+int(206)
+
+-- Setting umask to 207 --
+int(206)
+int(207)
+
+-- Setting umask to 208 --
+int(207)
+int(208)
+
+-- Setting umask to 209 --
+int(208)
+int(209)
+
+-- Setting umask to 210 --
+int(209)
+int(210)
+
+-- Setting umask to 211 --
+int(210)
+int(211)
+
+-- Setting umask to 212 --
+int(211)
+int(212)
+
+-- Setting umask to 213 --
+int(212)
+int(213)
+
+-- Setting umask to 214 --
+int(213)
+int(214)
+
+-- Setting umask to 215 --
+int(214)
+int(215)
+
+-- Setting umask to 216 --
+int(215)
+int(216)
+
+-- Setting umask to 217 --
+int(216)
+int(217)
+
+-- Setting umask to 218 --
+int(217)
+int(218)
+
+-- Setting umask to 219 --
+int(218)
+int(219)
+
+-- Setting umask to 220 --
+int(219)
+int(220)
+
+-- Setting umask to 221 --
+int(220)
+int(221)
+
+-- Setting umask to 222 --
+int(221)
+int(222)
+
+-- Setting umask to 223 --
+int(222)
+int(223)
+
+-- Setting umask to 224 --
+int(223)
+int(224)
+
+-- Setting umask to 225 --
+int(224)
+int(225)
+
+-- Setting umask to 226 --
+int(225)
+int(226)
+
+-- Setting umask to 227 --
+int(226)
+int(227)
+
+-- Setting umask to 228 --
+int(227)
+int(228)
+
+-- Setting umask to 229 --
+int(228)
+int(229)
+
+-- Setting umask to 230 --
+int(229)
+int(230)
+
+-- Setting umask to 231 --
+int(230)
+int(231)
+
+-- Setting umask to 232 --
+int(231)
+int(232)
+
+-- Setting umask to 233 --
+int(232)
+int(233)
+
+-- Setting umask to 234 --
+int(233)
+int(234)
+
+-- Setting umask to 235 --
+int(234)
+int(235)
+
+-- Setting umask to 236 --
+int(235)
+int(236)
+
+-- Setting umask to 237 --
+int(236)
+int(237)
+
+-- Setting umask to 238 --
+int(237)
+int(238)
+
+-- Setting umask to 239 --
+int(238)
+int(239)
+
+-- Setting umask to 240 --
+int(239)
+int(240)
+
+-- Setting umask to 241 --
+int(240)
+int(241)
+
+-- Setting umask to 242 --
+int(241)
+int(242)
+
+-- Setting umask to 243 --
+int(242)
+int(243)
+
+-- Setting umask to 244 --
+int(243)
+int(244)
+
+-- Setting umask to 245 --
+int(244)
+int(245)
+
+-- Setting umask to 246 --
+int(245)
+int(246)
+
+-- Setting umask to 247 --
+int(246)
+int(247)
+
+-- Setting umask to 248 --
+int(247)
+int(248)
+
+-- Setting umask to 249 --
+int(248)
+int(249)
+
+-- Setting umask to 250 --
+int(249)
+int(250)
+
+-- Setting umask to 251 --
+int(250)
+int(251)
+
+-- Setting umask to 252 --
+int(251)
+int(252)
+
+-- Setting umask to 253 --
+int(252)
+int(253)
+
+-- Setting umask to 254 --
+int(253)
+int(254)
+
+-- Setting umask to 255 --
+int(254)
+int(255)
+
+-- Setting umask to 256 --
+int(255)
+int(256)
+
+-- Setting umask to 257 --
+int(256)
+int(257)
+
+-- Setting umask to 258 --
+int(257)
+int(258)
+
+-- Setting umask to 259 --
+int(258)
+int(259)
+
+-- Setting umask to 260 --
+int(259)
+int(260)
+
+-- Setting umask to 261 --
+int(260)
+int(261)
+
+-- Setting umask to 262 --
+int(261)
+int(262)
+
+-- Setting umask to 263 --
+int(262)
+int(263)
+
+-- Setting umask to 264 --
+int(263)
+int(264)
+
+-- Setting umask to 265 --
+int(264)
+int(265)
+
+-- Setting umask to 266 --
+int(265)
+int(266)
+
+-- Setting umask to 267 --
+int(266)
+int(267)
+
+-- Setting umask to 268 --
+int(267)
+int(268)
+
+-- Setting umask to 269 --
+int(268)
+int(269)
+
+-- Setting umask to 270 --
+int(269)
+int(270)
+
+-- Setting umask to 271 --
+int(270)
+int(271)
+
+-- Setting umask to 272 --
+int(271)
+int(272)
+
+-- Setting umask to 273 --
+int(272)
+int(273)
+
+-- Setting umask to 274 --
+int(273)
+int(274)
+
+-- Setting umask to 275 --
+int(274)
+int(275)
+
+-- Setting umask to 276 --
+int(275)
+int(276)
+
+-- Setting umask to 277 --
+int(276)
+int(277)
+
+-- Setting umask to 278 --
+int(277)
+int(278)
+
+-- Setting umask to 279 --
+int(278)
+int(279)
+
+-- Setting umask to 280 --
+int(279)
+int(280)
+
+-- Setting umask to 281 --
+int(280)
+int(281)
+
+-- Setting umask to 282 --
+int(281)
+int(282)
+
+-- Setting umask to 283 --
+int(282)
+int(283)
+
+-- Setting umask to 284 --
+int(283)
+int(284)
+
+-- Setting umask to 285 --
+int(284)
+int(285)
+
+-- Setting umask to 286 --
+int(285)
+int(286)
+
+-- Setting umask to 287 --
+int(286)
+int(287)
+
+-- Setting umask to 288 --
+int(287)
+int(288)
+
+-- Setting umask to 289 --
+int(288)
+int(289)
+
+-- Setting umask to 290 --
+int(289)
+int(290)
+
+-- Setting umask to 291 --
+int(290)
+int(291)
+
+-- Setting umask to 292 --
+int(291)
+int(292)
+
+-- Setting umask to 293 --
+int(292)
+int(293)
+
+-- Setting umask to 294 --
+int(293)
+int(294)
+
+-- Setting umask to 295 --
+int(294)
+int(295)
+
+-- Setting umask to 296 --
+int(295)
+int(296)
+
+-- Setting umask to 297 --
+int(296)
+int(297)
+
+-- Setting umask to 298 --
+int(297)
+int(298)
+
+-- Setting umask to 299 --
+int(298)
+int(299)
+
+-- Setting umask to 300 --
+int(299)
+int(300)
+
+-- Setting umask to 301 --
+int(300)
+int(301)
+
+-- Setting umask to 302 --
+int(301)
+int(302)
+
+-- Setting umask to 303 --
+int(302)
+int(303)
+
+-- Setting umask to 304 --
+int(303)
+int(304)
+
+-- Setting umask to 305 --
+int(304)
+int(305)
+
+-- Setting umask to 306 --
+int(305)
+int(306)
+
+-- Setting umask to 307 --
+int(306)
+int(307)
+
+-- Setting umask to 308 --
+int(307)
+int(308)
+
+-- Setting umask to 309 --
+int(308)
+int(309)
+
+-- Setting umask to 310 --
+int(309)
+int(310)
+
+-- Setting umask to 311 --
+int(310)
+int(311)
+
+-- Setting umask to 312 --
+int(311)
+int(312)
+
+-- Setting umask to 313 --
+int(312)
+int(313)
+
+-- Setting umask to 314 --
+int(313)
+int(314)
+
+-- Setting umask to 315 --
+int(314)
+int(315)
+
+-- Setting umask to 316 --
+int(315)
+int(316)
+
+-- Setting umask to 317 --
+int(316)
+int(317)
+
+-- Setting umask to 318 --
+int(317)
+int(318)
+
+-- Setting umask to 319 --
+int(318)
+int(319)
+
+-- Setting umask to 320 --
+int(319)
+int(320)
+
+-- Setting umask to 321 --
+int(320)
+int(321)
+
+-- Setting umask to 322 --
+int(321)
+int(322)
+
+-- Setting umask to 323 --
+int(322)
+int(323)
+
+-- Setting umask to 324 --
+int(323)
+int(324)
+
+-- Setting umask to 325 --
+int(324)
+int(325)
+
+-- Setting umask to 326 --
+int(325)
+int(326)
+
+-- Setting umask to 327 --
+int(326)
+int(327)
+
+-- Setting umask to 328 --
+int(327)
+int(328)
+
+-- Setting umask to 329 --
+int(328)
+int(329)
+
+-- Setting umask to 330 --
+int(329)
+int(330)
+
+-- Setting umask to 331 --
+int(330)
+int(331)
+
+-- Setting umask to 332 --
+int(331)
+int(332)
+
+-- Setting umask to 333 --
+int(332)
+int(333)
+
+-- Setting umask to 334 --
+int(333)
+int(334)
+
+-- Setting umask to 335 --
+int(334)
+int(335)
+
+-- Setting umask to 336 --
+int(335)
+int(336)
+
+-- Setting umask to 337 --
+int(336)
+int(337)
+
+-- Setting umask to 338 --
+int(337)
+int(338)
+
+-- Setting umask to 339 --
+int(338)
+int(339)
+
+-- Setting umask to 340 --
+int(339)
+int(340)
+
+-- Setting umask to 341 --
+int(340)
+int(341)
+
+-- Setting umask to 342 --
+int(341)
+int(342)
+
+-- Setting umask to 343 --
+int(342)
+int(343)
+
+-- Setting umask to 344 --
+int(343)
+int(344)
+
+-- Setting umask to 345 --
+int(344)
+int(345)
+
+-- Setting umask to 346 --
+int(345)
+int(346)
+
+-- Setting umask to 347 --
+int(346)
+int(347)
+
+-- Setting umask to 348 --
+int(347)
+int(348)
+
+-- Setting umask to 349 --
+int(348)
+int(349)
+
+-- Setting umask to 350 --
+int(349)
+int(350)
+
+-- Setting umask to 351 --
+int(350)
+int(351)
+
+-- Setting umask to 352 --
+int(351)
+int(352)
+
+-- Setting umask to 353 --
+int(352)
+int(353)
+
+-- Setting umask to 354 --
+int(353)
+int(354)
+
+-- Setting umask to 355 --
+int(354)
+int(355)
+
+-- Setting umask to 356 --
+int(355)
+int(356)
+
+-- Setting umask to 357 --
+int(356)
+int(357)
+
+-- Setting umask to 358 --
+int(357)
+int(358)
+
+-- Setting umask to 359 --
+int(358)
+int(359)
+
+-- Setting umask to 360 --
+int(359)
+int(360)
+
+-- Setting umask to 361 --
+int(360)
+int(361)
+
+-- Setting umask to 362 --
+int(361)
+int(362)
+
+-- Setting umask to 363 --
+int(362)
+int(363)
+
+-- Setting umask to 364 --
+int(363)
+int(364)
+
+-- Setting umask to 365 --
+int(364)
+int(365)
+
+-- Setting umask to 366 --
+int(365)
+int(366)
+
+-- Setting umask to 367 --
+int(366)
+int(367)
+
+-- Setting umask to 368 --
+int(367)
+int(368)
+
+-- Setting umask to 369 --
+int(368)
+int(369)
+
+-- Setting umask to 370 --
+int(369)
+int(370)
+
+-- Setting umask to 371 --
+int(370)
+int(371)
+
+-- Setting umask to 372 --
+int(371)
+int(372)
+
+-- Setting umask to 373 --
+int(372)
+int(373)
+
+-- Setting umask to 374 --
+int(373)
+int(374)
+
+-- Setting umask to 375 --
+int(374)
+int(375)
+
+-- Setting umask to 376 --
+int(375)
+int(376)
+
+-- Setting umask to 377 --
+int(376)
+int(377)
+
+-- Setting umask to 378 --
+int(377)
+int(378)
+
+-- Setting umask to 379 --
+int(378)
+int(379)
+
+-- Setting umask to 380 --
+int(379)
+int(380)
+
+-- Setting umask to 381 --
+int(380)
+int(381)
+
+-- Setting umask to 382 --
+int(381)
+int(382)
+
+-- Setting umask to 383 --
+int(382)
+int(383)
+
+-- Setting umask to 384 --
+int(383)
+int(384)
+
+-- Setting umask to 385 --
+int(384)
+int(385)
+
+-- Setting umask to 386 --
+int(385)
+int(386)
+
+-- Setting umask to 387 --
+int(386)
+int(387)
+
+-- Setting umask to 388 --
+int(387)
+int(388)
+
+-- Setting umask to 389 --
+int(388)
+int(389)
+
+-- Setting umask to 390 --
+int(389)
+int(390)
+
+-- Setting umask to 391 --
+int(390)
+int(391)
+
+-- Setting umask to 392 --
+int(391)
+int(392)
+
+-- Setting umask to 393 --
+int(392)
+int(393)
+
+-- Setting umask to 394 --
+int(393)
+int(394)
+
+-- Setting umask to 395 --
+int(394)
+int(395)
+
+-- Setting umask to 396 --
+int(395)
+int(396)
+
+-- Setting umask to 397 --
+int(396)
+int(397)
+
+-- Setting umask to 398 --
+int(397)
+int(398)
+
+-- Setting umask to 399 --
+int(398)
+int(399)
+
+-- Setting umask to 400 --
+int(399)
+int(400)
+
+-- Setting umask to 401 --
+int(400)
+int(401)
+
+-- Setting umask to 402 --
+int(401)
+int(402)
+
+-- Setting umask to 403 --
+int(402)
+int(403)
+
+-- Setting umask to 404 --
+int(403)
+int(404)
+
+-- Setting umask to 405 --
+int(404)
+int(405)
+
+-- Setting umask to 406 --
+int(405)
+int(406)
+
+-- Setting umask to 407 --
+int(406)
+int(407)
+
+-- Setting umask to 408 --
+int(407)
+int(408)
+
+-- Setting umask to 409 --
+int(408)
+int(409)
+
+-- Setting umask to 410 --
+int(409)
+int(410)
+
+-- Setting umask to 411 --
+int(410)
+int(411)
+
+-- Setting umask to 412 --
+int(411)
+int(412)
+
+-- Setting umask to 413 --
+int(412)
+int(413)
+
+-- Setting umask to 414 --
+int(413)
+int(414)
+
+-- Setting umask to 415 --
+int(414)
+int(415)
+
+-- Setting umask to 416 --
+int(415)
+int(416)
+
+-- Setting umask to 417 --
+int(416)
+int(417)
+
+-- Setting umask to 418 --
+int(417)
+int(418)
+
+-- Setting umask to 419 --
+int(418)
+int(419)
+
+-- Setting umask to 420 --
+int(419)
+int(420)
+
+-- Setting umask to 421 --
+int(420)
+int(421)
+
+-- Setting umask to 422 --
+int(421)
+int(422)
+
+-- Setting umask to 423 --
+int(422)
+int(423)
+
+-- Setting umask to 424 --
+int(423)
+int(424)
+
+-- Setting umask to 425 --
+int(424)
+int(425)
+
+-- Setting umask to 426 --
+int(425)
+int(426)
+
+-- Setting umask to 427 --
+int(426)
+int(427)
+
+-- Setting umask to 428 --
+int(427)
+int(428)
+
+-- Setting umask to 429 --
+int(428)
+int(429)
+
+-- Setting umask to 430 --
+int(429)
+int(430)
+
+-- Setting umask to 431 --
+int(430)
+int(431)
+
+-- Setting umask to 432 --
+int(431)
+int(432)
+
+-- Setting umask to 433 --
+int(432)
+int(433)
+
+-- Setting umask to 434 --
+int(433)
+int(434)
+
+-- Setting umask to 435 --
+int(434)
+int(435)
+
+-- Setting umask to 436 --
+int(435)
+int(436)
+
+-- Setting umask to 437 --
+int(436)
+int(437)
+
+-- Setting umask to 438 --
+int(437)
+int(438)
+
+-- Setting umask to 439 --
+int(438)
+int(439)
+
+-- Setting umask to 440 --
+int(439)
+int(440)
+
+-- Setting umask to 441 --
+int(440)
+int(441)
+
+-- Setting umask to 442 --
+int(441)
+int(442)
+
+-- Setting umask to 443 --
+int(442)
+int(443)
+
+-- Setting umask to 444 --
+int(443)
+int(444)
+
+-- Setting umask to 445 --
+int(444)
+int(445)
+
+-- Setting umask to 446 --
+int(445)
+int(446)
+
+-- Setting umask to 447 --
+int(446)
+int(447)
+
+-- Setting umask to 448 --
+int(447)
+int(448)
+
+-- Setting umask to 449 --
+int(448)
+int(449)
+
+-- Setting umask to 450 --
+int(449)
+int(450)
+
+-- Setting umask to 451 --
+int(450)
+int(451)
+
+-- Setting umask to 452 --
+int(451)
+int(452)
+
+-- Setting umask to 453 --
+int(452)
+int(453)
+
+-- Setting umask to 454 --
+int(453)
+int(454)
+
+-- Setting umask to 455 --
+int(454)
+int(455)
+
+-- Setting umask to 456 --
+int(455)
+int(456)
+
+-- Setting umask to 457 --
+int(456)
+int(457)
+
+-- Setting umask to 458 --
+int(457)
+int(458)
+
+-- Setting umask to 459 --
+int(458)
+int(459)
+
+-- Setting umask to 460 --
+int(459)
+int(460)
+
+-- Setting umask to 461 --
+int(460)
+int(461)
+
+-- Setting umask to 462 --
+int(461)
+int(462)
+
+-- Setting umask to 463 --
+int(462)
+int(463)
+
+-- Setting umask to 464 --
+int(463)
+int(464)
+
+-- Setting umask to 465 --
+int(464)
+int(465)
+
+-- Setting umask to 466 --
+int(465)
+int(466)
+
+-- Setting umask to 467 --
+int(466)
+int(467)
+
+-- Setting umask to 468 --
+int(467)
+int(468)
+
+-- Setting umask to 469 --
+int(468)
+int(469)
+
+-- Setting umask to 470 --
+int(469)
+int(470)
+
+-- Setting umask to 471 --
+int(470)
+int(471)
+
+-- Setting umask to 472 --
+int(471)
+int(472)
+
+-- Setting umask to 473 --
+int(472)
+int(473)
+
+-- Setting umask to 474 --
+int(473)
+int(474)
+
+-- Setting umask to 475 --
+int(474)
+int(475)
+
+-- Setting umask to 476 --
+int(475)
+int(476)
+
+-- Setting umask to 477 --
+int(476)
+int(477)
+
+-- Setting umask to 478 --
+int(477)
+int(478)
+
+-- Setting umask to 479 --
+int(478)
+int(479)
+
+-- Setting umask to 480 --
+int(479)
+int(480)
+
+-- Setting umask to 481 --
+int(480)
+int(481)
+
+-- Setting umask to 482 --
+int(481)
+int(482)
+
+-- Setting umask to 483 --
+int(482)
+int(483)
+
+-- Setting umask to 484 --
+int(483)
+int(484)
+
+-- Setting umask to 485 --
+int(484)
+int(485)
+
+-- Setting umask to 486 --
+int(485)
+int(486)
+
+-- Setting umask to 487 --
+int(486)
+int(487)
+
+-- Setting umask to 488 --
+int(487)
+int(488)
+
+-- Setting umask to 489 --
+int(488)
+int(489)
+
+-- Setting umask to 490 --
+int(489)
+int(490)
+
+-- Setting umask to 491 --
+int(490)
+int(491)
+
+-- Setting umask to 492 --
+int(491)
+int(492)
+
+-- Setting umask to 493 --
+int(492)
+int(493)
+
+-- Setting umask to 494 --
+int(493)
+int(494)
+
+-- Setting umask to 495 --
+int(494)
+int(495)
+
+-- Setting umask to 496 --
+int(495)
+int(496)
+
+-- Setting umask to 497 --
+int(496)
+int(497)
+
+-- Setting umask to 498 --
+int(497)
+int(498)
+
+-- Setting umask to 499 --
+int(498)
+int(499)
+
+-- Setting umask to 500 --
+int(499)
+int(500)
+
+-- Setting umask to 501 --
+int(500)
+int(501)
+
+-- Setting umask to 502 --
+int(501)
+int(502)
+
+-- Setting umask to 503 --
+int(502)
+int(503)
+
+-- Setting umask to 504 --
+int(503)
+int(504)
+
+-- Setting umask to 505 --
+int(504)
+int(505)
+
+-- Setting umask to 506 --
+int(505)
+int(506)
+
+-- Setting umask to 507 --
+int(506)
+int(507)
+
+-- Setting umask to 508 --
+int(507)
+int(508)
+
+-- Setting umask to 509 --
+int(508)
+int(509)
+
+-- Setting umask to 510 --
+int(509)
+int(510)
+
+-- Setting umask to 511 --
+int(510)
+int(511)
+
+Done
diff --git a/ext/standard/tests/file/umask_error.phpt b/ext/standard/tests/file/umask_error.phpt
new file mode 100644
index 0000000..ddf60ab
--- /dev/null
+++ b/ext/standard/tests/file/umask_error.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test umask() function: error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int umask ( [int $mask] );
+ Description: Changes the current umask
+*/
+
+echo "*** Testing umask() : error conditions ***\n";
+
+var_dump( umask(0000, true) ); // args > expected
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing umask() : error conditions ***
+
+Warning: umask() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/umask_variation1.phpt b/ext/standard/tests/file/umask_variation1.phpt
new file mode 100644
index 0000000..29fe92e
--- /dev/null
+++ b/ext/standard/tests/file/umask_variation1.phpt
@@ -0,0 +1,761 @@
+--TEST--
+Test umask() function: usage variations - perms from 0000 to 0350
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int umask ( [int $mask] );
+ Description: Changes the current umask
+*/
+
+$file_path = dirname(__FILE__);
+
+/* Check umask() on file/dir */
+
+echo "*** Testing umask() on file and directory ***\n";
+// temp filename used
+$filename = "$file_path/umask_variation1.tmp";
+// temp dir used
+$dirname = "$file_path/umask_variation1";
+
+for($mask = 0000; $mask <= 0350; $mask++) {
+ echo "-- Setting umask to ";
+ echo sprintf('%03o', $mask);
+ echo " --\n";
+ // setting umask
+ umask($mask);
+
+ /* umasking file */
+ // creating temp file
+ $fp = fopen($filename, "w");
+ fclose($fp);
+ echo "File permission : ";
+ // check file permission
+ echo substr(sprintf('%o', fileperms($filename)), -3);
+ echo "\n";
+ // chmod file to 0777 to enable deletion
+ chmod($filename, 0777);
+ // delete temp file created here
+ unlink($filename);
+
+ /* umasking directory */
+ // create temp dir
+ mkdir($dirname);
+ echo "Directory permission : ";
+ // check $dirname permission
+ echo substr(sprintf('%o', fileperms($dirname)), -3);
+ echo "\n";
+ // chmod 0777 to enable deletion
+ chmod($dirname, 0777);
+ // delete temp dir created
+ rmdir($dirname);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing umask() on file and directory ***
+-- Setting umask to 000 --
+File permission : 666
+Directory permission : 777
+-- Setting umask to 001 --
+File permission : 666
+Directory permission : 776
+-- Setting umask to 002 --
+File permission : 664
+Directory permission : 775
+-- Setting umask to 003 --
+File permission : 664
+Directory permission : 774
+-- Setting umask to 004 --
+File permission : 662
+Directory permission : 773
+-- Setting umask to 005 --
+File permission : 662
+Directory permission : 772
+-- Setting umask to 006 --
+File permission : 660
+Directory permission : 771
+-- Setting umask to 007 --
+File permission : 660
+Directory permission : 770
+-- Setting umask to 010 --
+File permission : 666
+Directory permission : 767
+-- Setting umask to 011 --
+File permission : 666
+Directory permission : 766
+-- Setting umask to 012 --
+File permission : 664
+Directory permission : 765
+-- Setting umask to 013 --
+File permission : 664
+Directory permission : 764
+-- Setting umask to 014 --
+File permission : 662
+Directory permission : 763
+-- Setting umask to 015 --
+File permission : 662
+Directory permission : 762
+-- Setting umask to 016 --
+File permission : 660
+Directory permission : 761
+-- Setting umask to 017 --
+File permission : 660
+Directory permission : 760
+-- Setting umask to 020 --
+File permission : 646
+Directory permission : 757
+-- Setting umask to 021 --
+File permission : 646
+Directory permission : 756
+-- Setting umask to 022 --
+File permission : 644
+Directory permission : 755
+-- Setting umask to 023 --
+File permission : 644
+Directory permission : 754
+-- Setting umask to 024 --
+File permission : 642
+Directory permission : 753
+-- Setting umask to 025 --
+File permission : 642
+Directory permission : 752
+-- Setting umask to 026 --
+File permission : 640
+Directory permission : 751
+-- Setting umask to 027 --
+File permission : 640
+Directory permission : 750
+-- Setting umask to 030 --
+File permission : 646
+Directory permission : 747
+-- Setting umask to 031 --
+File permission : 646
+Directory permission : 746
+-- Setting umask to 032 --
+File permission : 644
+Directory permission : 745
+-- Setting umask to 033 --
+File permission : 644
+Directory permission : 744
+-- Setting umask to 034 --
+File permission : 642
+Directory permission : 743
+-- Setting umask to 035 --
+File permission : 642
+Directory permission : 742
+-- Setting umask to 036 --
+File permission : 640
+Directory permission : 741
+-- Setting umask to 037 --
+File permission : 640
+Directory permission : 740
+-- Setting umask to 040 --
+File permission : 626
+Directory permission : 737
+-- Setting umask to 041 --
+File permission : 626
+Directory permission : 736
+-- Setting umask to 042 --
+File permission : 624
+Directory permission : 735
+-- Setting umask to 043 --
+File permission : 624
+Directory permission : 734
+-- Setting umask to 044 --
+File permission : 622
+Directory permission : 733
+-- Setting umask to 045 --
+File permission : 622
+Directory permission : 732
+-- Setting umask to 046 --
+File permission : 620
+Directory permission : 731
+-- Setting umask to 047 --
+File permission : 620
+Directory permission : 730
+-- Setting umask to 050 --
+File permission : 626
+Directory permission : 727
+-- Setting umask to 051 --
+File permission : 626
+Directory permission : 726
+-- Setting umask to 052 --
+File permission : 624
+Directory permission : 725
+-- Setting umask to 053 --
+File permission : 624
+Directory permission : 724
+-- Setting umask to 054 --
+File permission : 622
+Directory permission : 723
+-- Setting umask to 055 --
+File permission : 622
+Directory permission : 722
+-- Setting umask to 056 --
+File permission : 620
+Directory permission : 721
+-- Setting umask to 057 --
+File permission : 620
+Directory permission : 720
+-- Setting umask to 060 --
+File permission : 606
+Directory permission : 717
+-- Setting umask to 061 --
+File permission : 606
+Directory permission : 716
+-- Setting umask to 062 --
+File permission : 604
+Directory permission : 715
+-- Setting umask to 063 --
+File permission : 604
+Directory permission : 714
+-- Setting umask to 064 --
+File permission : 602
+Directory permission : 713
+-- Setting umask to 065 --
+File permission : 602
+Directory permission : 712
+-- Setting umask to 066 --
+File permission : 600
+Directory permission : 711
+-- Setting umask to 067 --
+File permission : 600
+Directory permission : 710
+-- Setting umask to 070 --
+File permission : 606
+Directory permission : 707
+-- Setting umask to 071 --
+File permission : 606
+Directory permission : 706
+-- Setting umask to 072 --
+File permission : 604
+Directory permission : 705
+-- Setting umask to 073 --
+File permission : 604
+Directory permission : 704
+-- Setting umask to 074 --
+File permission : 602
+Directory permission : 703
+-- Setting umask to 075 --
+File permission : 602
+Directory permission : 702
+-- Setting umask to 076 --
+File permission : 600
+Directory permission : 701
+-- Setting umask to 077 --
+File permission : 600
+Directory permission : 700
+-- Setting umask to 100 --
+File permission : 666
+Directory permission : 677
+-- Setting umask to 101 --
+File permission : 666
+Directory permission : 676
+-- Setting umask to 102 --
+File permission : 664
+Directory permission : 675
+-- Setting umask to 103 --
+File permission : 664
+Directory permission : 674
+-- Setting umask to 104 --
+File permission : 662
+Directory permission : 673
+-- Setting umask to 105 --
+File permission : 662
+Directory permission : 672
+-- Setting umask to 106 --
+File permission : 660
+Directory permission : 671
+-- Setting umask to 107 --
+File permission : 660
+Directory permission : 670
+-- Setting umask to 110 --
+File permission : 666
+Directory permission : 667
+-- Setting umask to 111 --
+File permission : 666
+Directory permission : 666
+-- Setting umask to 112 --
+File permission : 664
+Directory permission : 665
+-- Setting umask to 113 --
+File permission : 664
+Directory permission : 664
+-- Setting umask to 114 --
+File permission : 662
+Directory permission : 663
+-- Setting umask to 115 --
+File permission : 662
+Directory permission : 662
+-- Setting umask to 116 --
+File permission : 660
+Directory permission : 661
+-- Setting umask to 117 --
+File permission : 660
+Directory permission : 660
+-- Setting umask to 120 --
+File permission : 646
+Directory permission : 657
+-- Setting umask to 121 --
+File permission : 646
+Directory permission : 656
+-- Setting umask to 122 --
+File permission : 644
+Directory permission : 655
+-- Setting umask to 123 --
+File permission : 644
+Directory permission : 654
+-- Setting umask to 124 --
+File permission : 642
+Directory permission : 653
+-- Setting umask to 125 --
+File permission : 642
+Directory permission : 652
+-- Setting umask to 126 --
+File permission : 640
+Directory permission : 651
+-- Setting umask to 127 --
+File permission : 640
+Directory permission : 650
+-- Setting umask to 130 --
+File permission : 646
+Directory permission : 647
+-- Setting umask to 131 --
+File permission : 646
+Directory permission : 646
+-- Setting umask to 132 --
+File permission : 644
+Directory permission : 645
+-- Setting umask to 133 --
+File permission : 644
+Directory permission : 644
+-- Setting umask to 134 --
+File permission : 642
+Directory permission : 643
+-- Setting umask to 135 --
+File permission : 642
+Directory permission : 642
+-- Setting umask to 136 --
+File permission : 640
+Directory permission : 641
+-- Setting umask to 137 --
+File permission : 640
+Directory permission : 640
+-- Setting umask to 140 --
+File permission : 626
+Directory permission : 637
+-- Setting umask to 141 --
+File permission : 626
+Directory permission : 636
+-- Setting umask to 142 --
+File permission : 624
+Directory permission : 635
+-- Setting umask to 143 --
+File permission : 624
+Directory permission : 634
+-- Setting umask to 144 --
+File permission : 622
+Directory permission : 633
+-- Setting umask to 145 --
+File permission : 622
+Directory permission : 632
+-- Setting umask to 146 --
+File permission : 620
+Directory permission : 631
+-- Setting umask to 147 --
+File permission : 620
+Directory permission : 630
+-- Setting umask to 150 --
+File permission : 626
+Directory permission : 627
+-- Setting umask to 151 --
+File permission : 626
+Directory permission : 626
+-- Setting umask to 152 --
+File permission : 624
+Directory permission : 625
+-- Setting umask to 153 --
+File permission : 624
+Directory permission : 624
+-- Setting umask to 154 --
+File permission : 622
+Directory permission : 623
+-- Setting umask to 155 --
+File permission : 622
+Directory permission : 622
+-- Setting umask to 156 --
+File permission : 620
+Directory permission : 621
+-- Setting umask to 157 --
+File permission : 620
+Directory permission : 620
+-- Setting umask to 160 --
+File permission : 606
+Directory permission : 617
+-- Setting umask to 161 --
+File permission : 606
+Directory permission : 616
+-- Setting umask to 162 --
+File permission : 604
+Directory permission : 615
+-- Setting umask to 163 --
+File permission : 604
+Directory permission : 614
+-- Setting umask to 164 --
+File permission : 602
+Directory permission : 613
+-- Setting umask to 165 --
+File permission : 602
+Directory permission : 612
+-- Setting umask to 166 --
+File permission : 600
+Directory permission : 611
+-- Setting umask to 167 --
+File permission : 600
+Directory permission : 610
+-- Setting umask to 170 --
+File permission : 606
+Directory permission : 607
+-- Setting umask to 171 --
+File permission : 606
+Directory permission : 606
+-- Setting umask to 172 --
+File permission : 604
+Directory permission : 605
+-- Setting umask to 173 --
+File permission : 604
+Directory permission : 604
+-- Setting umask to 174 --
+File permission : 602
+Directory permission : 603
+-- Setting umask to 175 --
+File permission : 602
+Directory permission : 602
+-- Setting umask to 176 --
+File permission : 600
+Directory permission : 601
+-- Setting umask to 177 --
+File permission : 600
+Directory permission : 600
+-- Setting umask to 200 --
+File permission : 466
+Directory permission : 577
+-- Setting umask to 201 --
+File permission : 466
+Directory permission : 576
+-- Setting umask to 202 --
+File permission : 464
+Directory permission : 575
+-- Setting umask to 203 --
+File permission : 464
+Directory permission : 574
+-- Setting umask to 204 --
+File permission : 462
+Directory permission : 573
+-- Setting umask to 205 --
+File permission : 462
+Directory permission : 572
+-- Setting umask to 206 --
+File permission : 460
+Directory permission : 571
+-- Setting umask to 207 --
+File permission : 460
+Directory permission : 570
+-- Setting umask to 210 --
+File permission : 466
+Directory permission : 567
+-- Setting umask to 211 --
+File permission : 466
+Directory permission : 566
+-- Setting umask to 212 --
+File permission : 464
+Directory permission : 565
+-- Setting umask to 213 --
+File permission : 464
+Directory permission : 564
+-- Setting umask to 214 --
+File permission : 462
+Directory permission : 563
+-- Setting umask to 215 --
+File permission : 462
+Directory permission : 562
+-- Setting umask to 216 --
+File permission : 460
+Directory permission : 561
+-- Setting umask to 217 --
+File permission : 460
+Directory permission : 560
+-- Setting umask to 220 --
+File permission : 446
+Directory permission : 557
+-- Setting umask to 221 --
+File permission : 446
+Directory permission : 556
+-- Setting umask to 222 --
+File permission : 444
+Directory permission : 555
+-- Setting umask to 223 --
+File permission : 444
+Directory permission : 554
+-- Setting umask to 224 --
+File permission : 442
+Directory permission : 553
+-- Setting umask to 225 --
+File permission : 442
+Directory permission : 552
+-- Setting umask to 226 --
+File permission : 440
+Directory permission : 551
+-- Setting umask to 227 --
+File permission : 440
+Directory permission : 550
+-- Setting umask to 230 --
+File permission : 446
+Directory permission : 547
+-- Setting umask to 231 --
+File permission : 446
+Directory permission : 546
+-- Setting umask to 232 --
+File permission : 444
+Directory permission : 545
+-- Setting umask to 233 --
+File permission : 444
+Directory permission : 544
+-- Setting umask to 234 --
+File permission : 442
+Directory permission : 543
+-- Setting umask to 235 --
+File permission : 442
+Directory permission : 542
+-- Setting umask to 236 --
+File permission : 440
+Directory permission : 541
+-- Setting umask to 237 --
+File permission : 440
+Directory permission : 540
+-- Setting umask to 240 --
+File permission : 426
+Directory permission : 537
+-- Setting umask to 241 --
+File permission : 426
+Directory permission : 536
+-- Setting umask to 242 --
+File permission : 424
+Directory permission : 535
+-- Setting umask to 243 --
+File permission : 424
+Directory permission : 534
+-- Setting umask to 244 --
+File permission : 422
+Directory permission : 533
+-- Setting umask to 245 --
+File permission : 422
+Directory permission : 532
+-- Setting umask to 246 --
+File permission : 420
+Directory permission : 531
+-- Setting umask to 247 --
+File permission : 420
+Directory permission : 530
+-- Setting umask to 250 --
+File permission : 426
+Directory permission : 527
+-- Setting umask to 251 --
+File permission : 426
+Directory permission : 526
+-- Setting umask to 252 --
+File permission : 424
+Directory permission : 525
+-- Setting umask to 253 --
+File permission : 424
+Directory permission : 524
+-- Setting umask to 254 --
+File permission : 422
+Directory permission : 523
+-- Setting umask to 255 --
+File permission : 422
+Directory permission : 522
+-- Setting umask to 256 --
+File permission : 420
+Directory permission : 521
+-- Setting umask to 257 --
+File permission : 420
+Directory permission : 520
+-- Setting umask to 260 --
+File permission : 406
+Directory permission : 517
+-- Setting umask to 261 --
+File permission : 406
+Directory permission : 516
+-- Setting umask to 262 --
+File permission : 404
+Directory permission : 515
+-- Setting umask to 263 --
+File permission : 404
+Directory permission : 514
+-- Setting umask to 264 --
+File permission : 402
+Directory permission : 513
+-- Setting umask to 265 --
+File permission : 402
+Directory permission : 512
+-- Setting umask to 266 --
+File permission : 400
+Directory permission : 511
+-- Setting umask to 267 --
+File permission : 400
+Directory permission : 510
+-- Setting umask to 270 --
+File permission : 406
+Directory permission : 507
+-- Setting umask to 271 --
+File permission : 406
+Directory permission : 506
+-- Setting umask to 272 --
+File permission : 404
+Directory permission : 505
+-- Setting umask to 273 --
+File permission : 404
+Directory permission : 504
+-- Setting umask to 274 --
+File permission : 402
+Directory permission : 503
+-- Setting umask to 275 --
+File permission : 402
+Directory permission : 502
+-- Setting umask to 276 --
+File permission : 400
+Directory permission : 501
+-- Setting umask to 277 --
+File permission : 400
+Directory permission : 500
+-- Setting umask to 300 --
+File permission : 466
+Directory permission : 477
+-- Setting umask to 301 --
+File permission : 466
+Directory permission : 476
+-- Setting umask to 302 --
+File permission : 464
+Directory permission : 475
+-- Setting umask to 303 --
+File permission : 464
+Directory permission : 474
+-- Setting umask to 304 --
+File permission : 462
+Directory permission : 473
+-- Setting umask to 305 --
+File permission : 462
+Directory permission : 472
+-- Setting umask to 306 --
+File permission : 460
+Directory permission : 471
+-- Setting umask to 307 --
+File permission : 460
+Directory permission : 470
+-- Setting umask to 310 --
+File permission : 466
+Directory permission : 467
+-- Setting umask to 311 --
+File permission : 466
+Directory permission : 466
+-- Setting umask to 312 --
+File permission : 464
+Directory permission : 465
+-- Setting umask to 313 --
+File permission : 464
+Directory permission : 464
+-- Setting umask to 314 --
+File permission : 462
+Directory permission : 463
+-- Setting umask to 315 --
+File permission : 462
+Directory permission : 462
+-- Setting umask to 316 --
+File permission : 460
+Directory permission : 461
+-- Setting umask to 317 --
+File permission : 460
+Directory permission : 460
+-- Setting umask to 320 --
+File permission : 446
+Directory permission : 457
+-- Setting umask to 321 --
+File permission : 446
+Directory permission : 456
+-- Setting umask to 322 --
+File permission : 444
+Directory permission : 455
+-- Setting umask to 323 --
+File permission : 444
+Directory permission : 454
+-- Setting umask to 324 --
+File permission : 442
+Directory permission : 453
+-- Setting umask to 325 --
+File permission : 442
+Directory permission : 452
+-- Setting umask to 326 --
+File permission : 440
+Directory permission : 451
+-- Setting umask to 327 --
+File permission : 440
+Directory permission : 450
+-- Setting umask to 330 --
+File permission : 446
+Directory permission : 447
+-- Setting umask to 331 --
+File permission : 446
+Directory permission : 446
+-- Setting umask to 332 --
+File permission : 444
+Directory permission : 445
+-- Setting umask to 333 --
+File permission : 444
+Directory permission : 444
+-- Setting umask to 334 --
+File permission : 442
+Directory permission : 443
+-- Setting umask to 335 --
+File permission : 442
+Directory permission : 442
+-- Setting umask to 336 --
+File permission : 440
+Directory permission : 441
+-- Setting umask to 337 --
+File permission : 440
+Directory permission : 440
+-- Setting umask to 340 --
+File permission : 426
+Directory permission : 437
+-- Setting umask to 341 --
+File permission : 426
+Directory permission : 436
+-- Setting umask to 342 --
+File permission : 424
+Directory permission : 435
+-- Setting umask to 343 --
+File permission : 424
+Directory permission : 434
+-- Setting umask to 344 --
+File permission : 422
+Directory permission : 433
+-- Setting umask to 345 --
+File permission : 422
+Directory permission : 432
+-- Setting umask to 346 --
+File permission : 420
+Directory permission : 431
+-- Setting umask to 347 --
+File permission : 420
+Directory permission : 430
+-- Setting umask to 350 --
+File permission : 426
+Directory permission : 427
+Done
diff --git a/ext/standard/tests/file/umask_variation2.phpt b/ext/standard/tests/file/umask_variation2.phpt
new file mode 100644
index 0000000..85b1a67
--- /dev/null
+++ b/ext/standard/tests/file/umask_variation2.phpt
@@ -0,0 +1,899 @@
+--TEST--
+Test umask() function: usage variations - perms from 0351 to 0777
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype: int umask ( [int $mask] );
+ Description: Changes the current umask
+*/
+
+$file_path = dirname(__FILE__);
+
+/* Check umask() on file/dir */
+
+echo "*** Testing umask() on file and directory ***\n";
+// temp filename used
+$filename = "$file_path/umask_variation2.tmp";
+// temp dir used
+$dirname = "$file_path/umask_variation2";
+
+for($mask = 0351; $mask <= 0777; $mask++) {
+ echo "-- Setting umask to ";
+ echo sprintf('%03o', $mask);
+ echo " --\n";
+ // setting umask
+ umask($mask);
+
+ /* umasking file */
+ // creating temp file
+ $fp = fopen($filename, "w");
+ fclose($fp);
+ echo "File permission : ";
+ // check file permission
+ echo substr(sprintf('%o', fileperms($filename)), -3);
+ echo "\n";
+ // chmod file to 0777 to enable deletion
+ chmod($filename, 0777);
+ // delete temp file created here
+ unlink($filename);
+
+ /* umasking directory */
+ // create temp dir
+ mkdir($dirname);
+ echo "Directory permission : ";
+ // check $dirname permission
+ echo substr(sprintf('%o', fileperms($dirname)), -3);
+ echo "\n";
+ // chmod 0777 to enable deletion
+ chmod($dirname, 0777);
+ // delete temp dir created
+ rmdir($dirname);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing umask() on file and directory ***
+-- Setting umask to 351 --
+File permission : 426
+Directory permission : 426
+-- Setting umask to 352 --
+File permission : 424
+Directory permission : 425
+-- Setting umask to 353 --
+File permission : 424
+Directory permission : 424
+-- Setting umask to 354 --
+File permission : 422
+Directory permission : 423
+-- Setting umask to 355 --
+File permission : 422
+Directory permission : 422
+-- Setting umask to 356 --
+File permission : 420
+Directory permission : 421
+-- Setting umask to 357 --
+File permission : 420
+Directory permission : 420
+-- Setting umask to 360 --
+File permission : 406
+Directory permission : 417
+-- Setting umask to 361 --
+File permission : 406
+Directory permission : 416
+-- Setting umask to 362 --
+File permission : 404
+Directory permission : 415
+-- Setting umask to 363 --
+File permission : 404
+Directory permission : 414
+-- Setting umask to 364 --
+File permission : 402
+Directory permission : 413
+-- Setting umask to 365 --
+File permission : 402
+Directory permission : 412
+-- Setting umask to 366 --
+File permission : 400
+Directory permission : 411
+-- Setting umask to 367 --
+File permission : 400
+Directory permission : 410
+-- Setting umask to 370 --
+File permission : 406
+Directory permission : 407
+-- Setting umask to 371 --
+File permission : 406
+Directory permission : 406
+-- Setting umask to 372 --
+File permission : 404
+Directory permission : 405
+-- Setting umask to 373 --
+File permission : 404
+Directory permission : 404
+-- Setting umask to 374 --
+File permission : 402
+Directory permission : 403
+-- Setting umask to 375 --
+File permission : 402
+Directory permission : 402
+-- Setting umask to 376 --
+File permission : 400
+Directory permission : 401
+-- Setting umask to 377 --
+File permission : 400
+Directory permission : 400
+-- Setting umask to 400 --
+File permission : 266
+Directory permission : 377
+-- Setting umask to 401 --
+File permission : 266
+Directory permission : 376
+-- Setting umask to 402 --
+File permission : 264
+Directory permission : 375
+-- Setting umask to 403 --
+File permission : 264
+Directory permission : 374
+-- Setting umask to 404 --
+File permission : 262
+Directory permission : 373
+-- Setting umask to 405 --
+File permission : 262
+Directory permission : 372
+-- Setting umask to 406 --
+File permission : 260
+Directory permission : 371
+-- Setting umask to 407 --
+File permission : 260
+Directory permission : 370
+-- Setting umask to 410 --
+File permission : 266
+Directory permission : 367
+-- Setting umask to 411 --
+File permission : 266
+Directory permission : 366
+-- Setting umask to 412 --
+File permission : 264
+Directory permission : 365
+-- Setting umask to 413 --
+File permission : 264
+Directory permission : 364
+-- Setting umask to 414 --
+File permission : 262
+Directory permission : 363
+-- Setting umask to 415 --
+File permission : 262
+Directory permission : 362
+-- Setting umask to 416 --
+File permission : 260
+Directory permission : 361
+-- Setting umask to 417 --
+File permission : 260
+Directory permission : 360
+-- Setting umask to 420 --
+File permission : 246
+Directory permission : 357
+-- Setting umask to 421 --
+File permission : 246
+Directory permission : 356
+-- Setting umask to 422 --
+File permission : 244
+Directory permission : 355
+-- Setting umask to 423 --
+File permission : 244
+Directory permission : 354
+-- Setting umask to 424 --
+File permission : 242
+Directory permission : 353
+-- Setting umask to 425 --
+File permission : 242
+Directory permission : 352
+-- Setting umask to 426 --
+File permission : 240
+Directory permission : 351
+-- Setting umask to 427 --
+File permission : 240
+Directory permission : 350
+-- Setting umask to 430 --
+File permission : 246
+Directory permission : 347
+-- Setting umask to 431 --
+File permission : 246
+Directory permission : 346
+-- Setting umask to 432 --
+File permission : 244
+Directory permission : 345
+-- Setting umask to 433 --
+File permission : 244
+Directory permission : 344
+-- Setting umask to 434 --
+File permission : 242
+Directory permission : 343
+-- Setting umask to 435 --
+File permission : 242
+Directory permission : 342
+-- Setting umask to 436 --
+File permission : 240
+Directory permission : 341
+-- Setting umask to 437 --
+File permission : 240
+Directory permission : 340
+-- Setting umask to 440 --
+File permission : 226
+Directory permission : 337
+-- Setting umask to 441 --
+File permission : 226
+Directory permission : 336
+-- Setting umask to 442 --
+File permission : 224
+Directory permission : 335
+-- Setting umask to 443 --
+File permission : 224
+Directory permission : 334
+-- Setting umask to 444 --
+File permission : 222
+Directory permission : 333
+-- Setting umask to 445 --
+File permission : 222
+Directory permission : 332
+-- Setting umask to 446 --
+File permission : 220
+Directory permission : 331
+-- Setting umask to 447 --
+File permission : 220
+Directory permission : 330
+-- Setting umask to 450 --
+File permission : 226
+Directory permission : 327
+-- Setting umask to 451 --
+File permission : 226
+Directory permission : 326
+-- Setting umask to 452 --
+File permission : 224
+Directory permission : 325
+-- Setting umask to 453 --
+File permission : 224
+Directory permission : 324
+-- Setting umask to 454 --
+File permission : 222
+Directory permission : 323
+-- Setting umask to 455 --
+File permission : 222
+Directory permission : 322
+-- Setting umask to 456 --
+File permission : 220
+Directory permission : 321
+-- Setting umask to 457 --
+File permission : 220
+Directory permission : 320
+-- Setting umask to 460 --
+File permission : 206
+Directory permission : 317
+-- Setting umask to 461 --
+File permission : 206
+Directory permission : 316
+-- Setting umask to 462 --
+File permission : 204
+Directory permission : 315
+-- Setting umask to 463 --
+File permission : 204
+Directory permission : 314
+-- Setting umask to 464 --
+File permission : 202
+Directory permission : 313
+-- Setting umask to 465 --
+File permission : 202
+Directory permission : 312
+-- Setting umask to 466 --
+File permission : 200
+Directory permission : 311
+-- Setting umask to 467 --
+File permission : 200
+Directory permission : 310
+-- Setting umask to 470 --
+File permission : 206
+Directory permission : 307
+-- Setting umask to 471 --
+File permission : 206
+Directory permission : 306
+-- Setting umask to 472 --
+File permission : 204
+Directory permission : 305
+-- Setting umask to 473 --
+File permission : 204
+Directory permission : 304
+-- Setting umask to 474 --
+File permission : 202
+Directory permission : 303
+-- Setting umask to 475 --
+File permission : 202
+Directory permission : 302
+-- Setting umask to 476 --
+File permission : 200
+Directory permission : 301
+-- Setting umask to 477 --
+File permission : 200
+Directory permission : 300
+-- Setting umask to 500 --
+File permission : 266
+Directory permission : 277
+-- Setting umask to 501 --
+File permission : 266
+Directory permission : 276
+-- Setting umask to 502 --
+File permission : 264
+Directory permission : 275
+-- Setting umask to 503 --
+File permission : 264
+Directory permission : 274
+-- Setting umask to 504 --
+File permission : 262
+Directory permission : 273
+-- Setting umask to 505 --
+File permission : 262
+Directory permission : 272
+-- Setting umask to 506 --
+File permission : 260
+Directory permission : 271
+-- Setting umask to 507 --
+File permission : 260
+Directory permission : 270
+-- Setting umask to 510 --
+File permission : 266
+Directory permission : 267
+-- Setting umask to 511 --
+File permission : 266
+Directory permission : 266
+-- Setting umask to 512 --
+File permission : 264
+Directory permission : 265
+-- Setting umask to 513 --
+File permission : 264
+Directory permission : 264
+-- Setting umask to 514 --
+File permission : 262
+Directory permission : 263
+-- Setting umask to 515 --
+File permission : 262
+Directory permission : 262
+-- Setting umask to 516 --
+File permission : 260
+Directory permission : 261
+-- Setting umask to 517 --
+File permission : 260
+Directory permission : 260
+-- Setting umask to 520 --
+File permission : 246
+Directory permission : 257
+-- Setting umask to 521 --
+File permission : 246
+Directory permission : 256
+-- Setting umask to 522 --
+File permission : 244
+Directory permission : 255
+-- Setting umask to 523 --
+File permission : 244
+Directory permission : 254
+-- Setting umask to 524 --
+File permission : 242
+Directory permission : 253
+-- Setting umask to 525 --
+File permission : 242
+Directory permission : 252
+-- Setting umask to 526 --
+File permission : 240
+Directory permission : 251
+-- Setting umask to 527 --
+File permission : 240
+Directory permission : 250
+-- Setting umask to 530 --
+File permission : 246
+Directory permission : 247
+-- Setting umask to 531 --
+File permission : 246
+Directory permission : 246
+-- Setting umask to 532 --
+File permission : 244
+Directory permission : 245
+-- Setting umask to 533 --
+File permission : 244
+Directory permission : 244
+-- Setting umask to 534 --
+File permission : 242
+Directory permission : 243
+-- Setting umask to 535 --
+File permission : 242
+Directory permission : 242
+-- Setting umask to 536 --
+File permission : 240
+Directory permission : 241
+-- Setting umask to 537 --
+File permission : 240
+Directory permission : 240
+-- Setting umask to 540 --
+File permission : 226
+Directory permission : 237
+-- Setting umask to 541 --
+File permission : 226
+Directory permission : 236
+-- Setting umask to 542 --
+File permission : 224
+Directory permission : 235
+-- Setting umask to 543 --
+File permission : 224
+Directory permission : 234
+-- Setting umask to 544 --
+File permission : 222
+Directory permission : 233
+-- Setting umask to 545 --
+File permission : 222
+Directory permission : 232
+-- Setting umask to 546 --
+File permission : 220
+Directory permission : 231
+-- Setting umask to 547 --
+File permission : 220
+Directory permission : 230
+-- Setting umask to 550 --
+File permission : 226
+Directory permission : 227
+-- Setting umask to 551 --
+File permission : 226
+Directory permission : 226
+-- Setting umask to 552 --
+File permission : 224
+Directory permission : 225
+-- Setting umask to 553 --
+File permission : 224
+Directory permission : 224
+-- Setting umask to 554 --
+File permission : 222
+Directory permission : 223
+-- Setting umask to 555 --
+File permission : 222
+Directory permission : 222
+-- Setting umask to 556 --
+File permission : 220
+Directory permission : 221
+-- Setting umask to 557 --
+File permission : 220
+Directory permission : 220
+-- Setting umask to 560 --
+File permission : 206
+Directory permission : 217
+-- Setting umask to 561 --
+File permission : 206
+Directory permission : 216
+-- Setting umask to 562 --
+File permission : 204
+Directory permission : 215
+-- Setting umask to 563 --
+File permission : 204
+Directory permission : 214
+-- Setting umask to 564 --
+File permission : 202
+Directory permission : 213
+-- Setting umask to 565 --
+File permission : 202
+Directory permission : 212
+-- Setting umask to 566 --
+File permission : 200
+Directory permission : 211
+-- Setting umask to 567 --
+File permission : 200
+Directory permission : 210
+-- Setting umask to 570 --
+File permission : 206
+Directory permission : 207
+-- Setting umask to 571 --
+File permission : 206
+Directory permission : 206
+-- Setting umask to 572 --
+File permission : 204
+Directory permission : 205
+-- Setting umask to 573 --
+File permission : 204
+Directory permission : 204
+-- Setting umask to 574 --
+File permission : 202
+Directory permission : 203
+-- Setting umask to 575 --
+File permission : 202
+Directory permission : 202
+-- Setting umask to 576 --
+File permission : 200
+Directory permission : 201
+-- Setting umask to 577 --
+File permission : 200
+Directory permission : 200
+-- Setting umask to 600 --
+File permission : 066
+Directory permission : 177
+-- Setting umask to 601 --
+File permission : 066
+Directory permission : 176
+-- Setting umask to 602 --
+File permission : 064
+Directory permission : 175
+-- Setting umask to 603 --
+File permission : 064
+Directory permission : 174
+-- Setting umask to 604 --
+File permission : 062
+Directory permission : 173
+-- Setting umask to 605 --
+File permission : 062
+Directory permission : 172
+-- Setting umask to 606 --
+File permission : 060
+Directory permission : 171
+-- Setting umask to 607 --
+File permission : 060
+Directory permission : 170
+-- Setting umask to 610 --
+File permission : 066
+Directory permission : 167
+-- Setting umask to 611 --
+File permission : 066
+Directory permission : 166
+-- Setting umask to 612 --
+File permission : 064
+Directory permission : 165
+-- Setting umask to 613 --
+File permission : 064
+Directory permission : 164
+-- Setting umask to 614 --
+File permission : 062
+Directory permission : 163
+-- Setting umask to 615 --
+File permission : 062
+Directory permission : 162
+-- Setting umask to 616 --
+File permission : 060
+Directory permission : 161
+-- Setting umask to 617 --
+File permission : 060
+Directory permission : 160
+-- Setting umask to 620 --
+File permission : 046
+Directory permission : 157
+-- Setting umask to 621 --
+File permission : 046
+Directory permission : 156
+-- Setting umask to 622 --
+File permission : 044
+Directory permission : 155
+-- Setting umask to 623 --
+File permission : 044
+Directory permission : 154
+-- Setting umask to 624 --
+File permission : 042
+Directory permission : 153
+-- Setting umask to 625 --
+File permission : 042
+Directory permission : 152
+-- Setting umask to 626 --
+File permission : 040
+Directory permission : 151
+-- Setting umask to 627 --
+File permission : 040
+Directory permission : 150
+-- Setting umask to 630 --
+File permission : 046
+Directory permission : 147
+-- Setting umask to 631 --
+File permission : 046
+Directory permission : 146
+-- Setting umask to 632 --
+File permission : 044
+Directory permission : 145
+-- Setting umask to 633 --
+File permission : 044
+Directory permission : 144
+-- Setting umask to 634 --
+File permission : 042
+Directory permission : 143
+-- Setting umask to 635 --
+File permission : 042
+Directory permission : 142
+-- Setting umask to 636 --
+File permission : 040
+Directory permission : 141
+-- Setting umask to 637 --
+File permission : 040
+Directory permission : 140
+-- Setting umask to 640 --
+File permission : 026
+Directory permission : 137
+-- Setting umask to 641 --
+File permission : 026
+Directory permission : 136
+-- Setting umask to 642 --
+File permission : 024
+Directory permission : 135
+-- Setting umask to 643 --
+File permission : 024
+Directory permission : 134
+-- Setting umask to 644 --
+File permission : 022
+Directory permission : 133
+-- Setting umask to 645 --
+File permission : 022
+Directory permission : 132
+-- Setting umask to 646 --
+File permission : 020
+Directory permission : 131
+-- Setting umask to 647 --
+File permission : 020
+Directory permission : 130
+-- Setting umask to 650 --
+File permission : 026
+Directory permission : 127
+-- Setting umask to 651 --
+File permission : 026
+Directory permission : 126
+-- Setting umask to 652 --
+File permission : 024
+Directory permission : 125
+-- Setting umask to 653 --
+File permission : 024
+Directory permission : 124
+-- Setting umask to 654 --
+File permission : 022
+Directory permission : 123
+-- Setting umask to 655 --
+File permission : 022
+Directory permission : 122
+-- Setting umask to 656 --
+File permission : 020
+Directory permission : 121
+-- Setting umask to 657 --
+File permission : 020
+Directory permission : 120
+-- Setting umask to 660 --
+File permission : 006
+Directory permission : 117
+-- Setting umask to 661 --
+File permission : 006
+Directory permission : 116
+-- Setting umask to 662 --
+File permission : 004
+Directory permission : 115
+-- Setting umask to 663 --
+File permission : 004
+Directory permission : 114
+-- Setting umask to 664 --
+File permission : 002
+Directory permission : 113
+-- Setting umask to 665 --
+File permission : 002
+Directory permission : 112
+-- Setting umask to 666 --
+File permission : 000
+Directory permission : 111
+-- Setting umask to 667 --
+File permission : 000
+Directory permission : 110
+-- Setting umask to 670 --
+File permission : 006
+Directory permission : 107
+-- Setting umask to 671 --
+File permission : 006
+Directory permission : 106
+-- Setting umask to 672 --
+File permission : 004
+Directory permission : 105
+-- Setting umask to 673 --
+File permission : 004
+Directory permission : 104
+-- Setting umask to 674 --
+File permission : 002
+Directory permission : 103
+-- Setting umask to 675 --
+File permission : 002
+Directory permission : 102
+-- Setting umask to 676 --
+File permission : 000
+Directory permission : 101
+-- Setting umask to 677 --
+File permission : 000
+Directory permission : 100
+-- Setting umask to 700 --
+File permission : 066
+Directory permission : 077
+-- Setting umask to 701 --
+File permission : 066
+Directory permission : 076
+-- Setting umask to 702 --
+File permission : 064
+Directory permission : 075
+-- Setting umask to 703 --
+File permission : 064
+Directory permission : 074
+-- Setting umask to 704 --
+File permission : 062
+Directory permission : 073
+-- Setting umask to 705 --
+File permission : 062
+Directory permission : 072
+-- Setting umask to 706 --
+File permission : 060
+Directory permission : 071
+-- Setting umask to 707 --
+File permission : 060
+Directory permission : 070
+-- Setting umask to 710 --
+File permission : 066
+Directory permission : 067
+-- Setting umask to 711 --
+File permission : 066
+Directory permission : 066
+-- Setting umask to 712 --
+File permission : 064
+Directory permission : 065
+-- Setting umask to 713 --
+File permission : 064
+Directory permission : 064
+-- Setting umask to 714 --
+File permission : 062
+Directory permission : 063
+-- Setting umask to 715 --
+File permission : 062
+Directory permission : 062
+-- Setting umask to 716 --
+File permission : 060
+Directory permission : 061
+-- Setting umask to 717 --
+File permission : 060
+Directory permission : 060
+-- Setting umask to 720 --
+File permission : 046
+Directory permission : 057
+-- Setting umask to 721 --
+File permission : 046
+Directory permission : 056
+-- Setting umask to 722 --
+File permission : 044
+Directory permission : 055
+-- Setting umask to 723 --
+File permission : 044
+Directory permission : 054
+-- Setting umask to 724 --
+File permission : 042
+Directory permission : 053
+-- Setting umask to 725 --
+File permission : 042
+Directory permission : 052
+-- Setting umask to 726 --
+File permission : 040
+Directory permission : 051
+-- Setting umask to 727 --
+File permission : 040
+Directory permission : 050
+-- Setting umask to 730 --
+File permission : 046
+Directory permission : 047
+-- Setting umask to 731 --
+File permission : 046
+Directory permission : 046
+-- Setting umask to 732 --
+File permission : 044
+Directory permission : 045
+-- Setting umask to 733 --
+File permission : 044
+Directory permission : 044
+-- Setting umask to 734 --
+File permission : 042
+Directory permission : 043
+-- Setting umask to 735 --
+File permission : 042
+Directory permission : 042
+-- Setting umask to 736 --
+File permission : 040
+Directory permission : 041
+-- Setting umask to 737 --
+File permission : 040
+Directory permission : 040
+-- Setting umask to 740 --
+File permission : 026
+Directory permission : 037
+-- Setting umask to 741 --
+File permission : 026
+Directory permission : 036
+-- Setting umask to 742 --
+File permission : 024
+Directory permission : 035
+-- Setting umask to 743 --
+File permission : 024
+Directory permission : 034
+-- Setting umask to 744 --
+File permission : 022
+Directory permission : 033
+-- Setting umask to 745 --
+File permission : 022
+Directory permission : 032
+-- Setting umask to 746 --
+File permission : 020
+Directory permission : 031
+-- Setting umask to 747 --
+File permission : 020
+Directory permission : 030
+-- Setting umask to 750 --
+File permission : 026
+Directory permission : 027
+-- Setting umask to 751 --
+File permission : 026
+Directory permission : 026
+-- Setting umask to 752 --
+File permission : 024
+Directory permission : 025
+-- Setting umask to 753 --
+File permission : 024
+Directory permission : 024
+-- Setting umask to 754 --
+File permission : 022
+Directory permission : 023
+-- Setting umask to 755 --
+File permission : 022
+Directory permission : 022
+-- Setting umask to 756 --
+File permission : 020
+Directory permission : 021
+-- Setting umask to 757 --
+File permission : 020
+Directory permission : 020
+-- Setting umask to 760 --
+File permission : 006
+Directory permission : 017
+-- Setting umask to 761 --
+File permission : 006
+Directory permission : 016
+-- Setting umask to 762 --
+File permission : 004
+Directory permission : 015
+-- Setting umask to 763 --
+File permission : 004
+Directory permission : 014
+-- Setting umask to 764 --
+File permission : 002
+Directory permission : 013
+-- Setting umask to 765 --
+File permission : 002
+Directory permission : 012
+-- Setting umask to 766 --
+File permission : 000
+Directory permission : 011
+-- Setting umask to 767 --
+File permission : 000
+Directory permission : 010
+-- Setting umask to 770 --
+File permission : 006
+Directory permission : 007
+-- Setting umask to 771 --
+File permission : 006
+Directory permission : 006
+-- Setting umask to 772 --
+File permission : 004
+Directory permission : 005
+-- Setting umask to 773 --
+File permission : 004
+Directory permission : 004
+-- Setting umask to 774 --
+File permission : 002
+Directory permission : 003
+-- Setting umask to 775 --
+File permission : 002
+Directory permission : 002
+-- Setting umask to 776 --
+File permission : 000
+Directory permission : 001
+-- Setting umask to 777 --
+File permission : 000
+Directory permission : 000
+Done
diff --git a/ext/standard/tests/file/umask_variation3.phpt b/ext/standard/tests/file/umask_variation3.phpt
new file mode 100644
index 0000000..c666c32
--- /dev/null
+++ b/ext/standard/tests/file/umask_variation3.phpt
@@ -0,0 +1,237 @@
+--TEST--
+Test umask() function : usage variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only for Non Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : int umask([int mask])
+ * Description: Return or change the umask
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing umask() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+ //out of boundary integers
+ 'int -100' => -100,
+ 'int 99999' => 99999,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ //'float -12.3456789000e10' => -12.3456789000e10, different in p8
+ '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 mask
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ umask(0);
+ var_dump(umask($value));
+ var_dump( umask() & 0777);
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing umask() : usage variation ***
+
+--int -100--
+int(0)
+int(412)
+
+--int 99999--
+int(0)
+int(159)
+
+--float 10.5--
+int(0)
+int(10)
+
+--float -10.5--
+int(0)
+int(502)
+
+--float 12.3456789000e10--
+int(0)
+int(%d)
+
+--float .5--
+int(0)
+int(0)
+
+--empty array--
+Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d)
+bool(false)
+int(63)
+
+--int indexed array--
+Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d)
+bool(false)
+int(63)
+
+--associative array--
+Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d)
+bool(false)
+int(63)
+
+--nested arrays--
+Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d)
+bool(false)
+int(63)
+
+--uppercase NULL--
+int(0)
+int(0)
+
+--lowercase null--
+int(0)
+int(0)
+
+--lowercase true--
+int(0)
+int(1)
+
+--lowercase false--
+int(0)
+int(0)
+
+--uppercase TRUE--
+int(0)
+int(1)
+
+--uppercase FALSE--
+int(0)
+int(0)
+
+--empty string DQ--
+Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d)
+bool(false)
+int(63)
+
+--empty string SQ--
+Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d)
+bool(false)
+int(63)
+
+--string DQ--
+Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d)
+bool(false)
+int(63)
+
+--string SQ--
+Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d)
+bool(false)
+int(63)
+
+--mixed case string--
+Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d)
+bool(false)
+int(63)
+
+--heredoc--
+Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d)
+bool(false)
+int(63)
+
+--instance of classWithToString--
+Error: 2 - umask() expects parameter 1 to be long, object given, %s(%d)
+bool(false)
+int(63)
+
+--instance of classWithoutToString--
+Error: 2 - umask() expects parameter 1 to be long, object given, %s(%d)
+bool(false)
+int(63)
+
+--undefined var--
+int(0)
+int(0)
+
+--unset var--
+int(0)
+int(0)
+===DONE===
+
diff --git a/ext/standard/tests/file/unlink_basic.phpt b/ext/standard/tests/file/unlink_basic.phpt
new file mode 100644
index 0000000..97e6aa6
--- /dev/null
+++ b/ext/standard/tests/file/unlink_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Testing unlink() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing unlink() on a file ***\n";
+$filename = "$file_path/unlink_basic.tmp"; // temp file name used here
+$fp = fopen($filename, "w"); // create file
+fwrite($fp, "Hello World");
+fclose($fp);
+
+// delete file
+var_dump( unlink($filename) );
+var_dump( file_exists($filename) ); // confirm file doesnt exist
+
+echo "\n*** Testing unlink() : checking second argument ***\n";
+// creating a context
+$context = stream_context_create();
+// temp file name used here
+$filename = "$file_path/unlink_basic.tmp";
+$fp = fopen($filename, "w"); // create file
+fclose($fp);
+
+// delete file
+var_dump( unlink($filename, $context) ); // using $context in second argument
+var_dump( file_exists($filename) ); // confirm file doesnt exist
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on a file ***
+bool(true)
+bool(false)
+
+*** Testing unlink() : checking second argument ***
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt
new file mode 100644
index 0000000..e55f6ed
--- /dev/null
+++ b/ext/standard/tests/file/unlink_error-win32.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Testing unlink() function : error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+$file_path = dirname(__FILE__);
+
+$filename = "$file_path/unlink_error.tmp"; // temp file name used here
+$fp = fopen($filename, "w"); // create file
+fclose($fp);
+
+// creating a context
+$context = stream_context_create();
+
+echo "*** Testing unlink() : error conditions ***\n";
+
+echo "-- Testing unlink() on unexpected no. of arguments --\n";
+// arg < expected
+var_dump( unlink() );
+// args > expected
+var_dump( unlink($filename, $context, true) );
+var_dump( file_exists($filename) ); // expected: true
+
+echo "\n-- Testing unlink() on invalid arguments --\n";
+// invalid arguments
+var_dump( unlink('') ); // $filename as empty string
+var_dump( file_exists('') ); // confirm file doesnt exist
+
+var_dump( unlink(NULL) ); // $filename as NULL
+var_dump( file_exists(NULL) ); // confirm file doesnt exist
+
+var_dump( unlink(false) ); // $filename as boolean false
+var_dump( file_exists(false) ); // confirm file doesnt exist
+
+var_dump( unlink($filename, '') ); // $context as empty string
+var_dump( unlink($filename, false) ); // $context as boolean false
+var_dump( unlink($filename, NULL) ); // $context as NULL
+
+
+echo "\n-- Testing unlink() on non-existent file --\n";
+var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") );
+
+echo "\n-- Testing unlink() on directory --\n";
+// temp directory used here
+$dirname = "$file_path/unlink_error";
+// create temp dir
+mkdir($dirname);
+// unlinking directory
+var_dump( unlink($dirname) ); // expected: false as unlink() does not work on dir
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/unlink_error.tmp");
+rmdir(dirname(__FILE__)."/unlink_error");
+?>
+--EXPECTF--
+*** Testing unlink() : error conditions ***
+-- Testing unlink() on unexpected no. of arguments --
+
+Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+bool(true)
+
+-- Testing unlink() on invalid arguments --
+
+Warning: unlink(): %s in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink(): %s in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink(): %s in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
+bool(false)
+
+Warning: unlink() expects parameter 2 to be resource, boolean given in %s on line %d
+bool(false)
+
+Warning: unlink() expects parameter 2 to be resource, null given in %s on line %d
+bool(false)
+
+-- Testing unlink() on non-existent file --
+
+Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
+bool(false)
+
+-- Testing unlink() on directory --
+
+Warning: unlink(%s/unlink_error): Permission denied in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt
new file mode 100644
index 0000000..9571784
--- /dev/null
+++ b/ext/standard/tests/file/unlink_error.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Testing unlink() function : error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+$file_path = dirname(__FILE__);
+
+$filename = "$file_path/unlink_error.tmp"; // temp file name used here
+$fp = fopen($filename, "w"); // create file
+fclose($fp);
+
+// creating a context
+$context = stream_context_create();
+
+echo "*** Testing unlink() : error conditions ***\n";
+
+echo "-- Testing unlink() on unexpected no. of arguments --\n";
+// arg < expected
+var_dump( unlink() );
+// args > expected
+var_dump( unlink($filename, $context, true) );
+var_dump( file_exists($filename) ); // expected true
+
+echo "\n-- Testing unlink() on invalid arguments --\n";
+// invalid arguments
+var_dump( unlink('') ); // $filename as empty string
+var_dump( file_exists('') ); // confirm file doesnt exist
+
+var_dump( unlink(NULL) ); // $filename as NULL
+var_dump( file_exists(NULL) ); // confirm file doesnt exist
+
+var_dump( unlink(false) ); // $filename as boolean false
+var_dump( file_exists(false) ); // confirm file doesnt exist
+
+var_dump( unlink($filename, '') ); // $context as empty string
+var_dump( unlink($filename, false) ); // $context as boolean false
+var_dump( unlink($filename, NULL) ); // $context as NULL
+
+
+echo "\n-- Testing unlink() on non-existent file --\n";
+var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") );
+
+echo "\n-- Testing unlink() on directory --\n";
+// temp directory used here
+$dirname = "$file_path/unlink_error";
+// create temp dir
+mkdir($dirname);
+// unlinking directory
+var_dump( unlink($dirname) ); // expected: false as unlink() does not work on dir
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/unlink_error.tmp");
+rmdir(dirname(__FILE__)."/unlink_error");
+?>
+--EXPECTF--
+*** Testing unlink() : error conditions ***
+-- Testing unlink() on unexpected no. of arguments --
+
+Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+bool(true)
+
+-- Testing unlink() on invalid arguments --
+
+Warning: unlink(): %s in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink(): %s in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink(): %s in %s on line %d
+bool(false)
+bool(false)
+
+Warning: unlink() expects parameter 2 to be resource, %unicode_string_optional% given in %s on line %d
+bool(false)
+
+Warning: unlink() expects parameter 2 to be resource, boolean given in %s on line %d
+bool(false)
+
+Warning: unlink() expects parameter 2 to be resource, null given in %s on line %d
+bool(false)
+
+-- Testing unlink() on non-existent file --
+
+Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
+bool(false)
+
+-- Testing unlink() on directory --
+
+Warning: unlink(%s/unlink_error): %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation1-win32.phpt b/ext/standard/tests/file/unlink_variation1-win32.phpt
new file mode 100644
index 0000000..b00e546
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation1-win32.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test unlink() function : usage variations - unlinking file in a directory
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* Delete file having default permission but its dir having readonly permission
+ Delete file having readonly permission but dir having default permission
+*/
+
+
+$file_path = dirname(__FILE__);
+
+// temp dir name used here
+$dirname = "$file_path/unlink_variation1";
+// temp filename used here
+$filename = "$dirname/unlink_variation1-win32.tmp";
+
+echo "\n*** Testing unlink() on file inside a directory ***\n";
+// create temp dir
+mkdir($dirname);
+// create temp file inside $dirname
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "-- Unlink file having default permission and its dir having read only permission --\n";
+// remove write permission of $dirname
+// on windows dir permission is not respected
+var_dump( chmod($dirname, 0444) );
+// now try deleting $filename
+var_dump( unlink($filename) ); // expected: true
+var_dump( file_exists($filename) ); // confirm file is deleted
+
+// remove the dir
+var_dump( chmod($dirname, 0777) );
+rmdir($dirname);
+
+echo "\n-- Unlinking file without write permission, its dir having default permission --\n";
+// create the temp dir
+mkdir($dirname);
+
+// create the temp file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+// remove write permission from file
+var_dump( chmod($filename, 0444) );
+
+// now try deleting temp file inside $dirname
+var_dump( unlink($filename) ); // expected: false
+
+// reassign write permission to temp file
+chmod($filename, 0777);
+// delete temp file
+var_dump( unlink($filename) );
+var_dump( file_exists($filename) ); // confirm file is deleted
+// remove temp dir
+rmdir($dirname);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on file inside a directory ***
+-- Unlink file having default permission and its dir having read only permission --
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+
+-- Unlinking file without write permission, its dir having default permission --
+bool(true)
+
+Warning: unlink(%s/unlink_variation1/unlink_variation1-win32.tmp): Permission denied in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation1.phpt b/ext/standard/tests/file/unlink_variation1.phpt
new file mode 100644
index 0000000..c27c13d
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation1.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test unlink() function : usage variations - unlinking file in a directory
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only on Linux');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/unlink_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip cannot be run as root');
+}
+
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* Delete file having default permission but its dir having readonly permission
+ Delete file having readonly permission but dir having default permission
+*/
+
+
+$file_path = dirname(__FILE__);
+
+// temp dir name used here
+$dirname = "$file_path/unlink_variation1";
+// temp filename used here
+$filename = "$dirname/unlink_variation1.tmp";
+
+echo "\n*** Testing unlink() on file inside a directory ***\n";
+// create temp dir
+mkdir($dirname);
+// create temp file inside $dirname
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "-- Unlink file having default permission and its dir having read only permission --\n";
+// remove write permission of $dirname
+var_dump( chmod($dirname, 0444) );
+// now try deleting $filename
+var_dump( unlink($filename) ); // expected false
+var_dump( file_exists($filename) ); // confirm file is deleted
+
+// remove the dir
+var_dump( chmod($dirname, 0777) );
+var_dump( unlink($filename) ); // expected true
+var_dump( rmdir($dirname) );
+
+echo "\n-- Unlinking file without write permission, its dir having default permission --\n";
+// create the temp dir
+var_dump( mkdir($dirname) );
+// create the temp file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+// remove write permission from file
+var_dump( chmod($filename, 0444) );
+// now try deleting temp file inside $dirname
+var_dump( unlink($filename) ); // expected: true
+var_dump( file_exists($filename) ); // expected: false
+
+// remove temp dir
+var_dump( rmdir($dirname) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on file inside a directory ***
+-- Unlink file having default permission and its dir having read only permission --
+bool(true)
+
+Warning: unlink(%s): %s in %s on line %d
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+
+-- Unlinking file without write permission, its dir having default permission --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/unlink_variation10.phpt b/ext/standard/tests/file/unlink_variation10.phpt
new file mode 100644
index 0000000..e0c92ca
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation10.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Test unlink() function : variation: unlinking directories
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink(string filename[, context context])
+ * Description: Delete a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing unlink() : variation ***\n";
+
+$workDir = "unlinkVar8.tmp";
+$tmpDir = "subDir.tmp";
+$dirToLinkTo = $workDir.'/'."linkme.tmp";
+
+mkdir($workDir);
+$cwd = getcwd();
+mkdir($dirToLinkTo);
+
+$dirs = array(
+ // relative
+ $workDir.'/'.$tmpDir,
+ './'.$workDir.'/'.$tmpDir,
+ $workDir.'/../'.$workDir.'/'.$tmpDir,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$tmpDir,
+ $cwd.'/./'.$workDir.'/'.$tmpDir,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$tmpDir,
+
+ // multiple separators
+ $workDir.'//'.$tmpDir,
+ $cwd.'//'.$workDir.'//'.$tmpDir,
+
+ );
+
+
+foreach($dirs as $dirToUnlink) {
+ test_link($workDir.'/'.$tmpDir, $dirToLinkTo, $dirToUnlink, true); //soft link
+ //cannot test hard links unless you are root.
+}
+
+echo "\n--- try to unlink a directory ---\n";
+unlink($dirToLinkTo);
+rmdir($dirToLinkTo);
+rmdir($workDir);
+
+function test_link($linkedDir, $toLinkTo, $tounlink, $softlink) {
+ if ($softlink == true) {
+ symlink($toLinkTo, $linkedDir);
+ $msg = "soft link";
+ }
+ else {
+ link($toLinkTo, $linkedDir);
+ $msg = "hard link";
+ }
+ echo "-- unlinking $msg $tounlink --\n";
+ $res = unlink($tounlink);
+ if ($res === true) {
+ if (is_link($tounlink) === false) {
+ echo "directory unlinked\n";
+ }
+ else {
+ echo "FAILED: directory not unlinked\n";
+ }
+ }
+ else {
+ unlink($linkedDir);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing unlink() : variation ***
+-- unlinking soft link unlinkVar8.tmp/subDir.tmp --
+directory unlinked
+-- unlinking soft link ./unlinkVar8.tmp/subDir.tmp --
+directory unlinked
+-- unlinking soft link unlinkVar8.tmp/../unlinkVar8.tmp/subDir.tmp --
+directory unlinked
+-- unlinking soft link /%s/unlinkVar8.tmp/subDir.tmp --
+directory unlinked
+-- unlinking soft link /%s/./unlinkVar8.tmp/subDir.tmp --
+directory unlinked
+-- unlinking soft link /%s/unlinkVar8.tmp/../unlinkVar8.tmp/subDir.tmp --
+directory unlinked
+-- unlinking soft link unlinkVar8.tmp//subDir.tmp --
+directory unlinked
+-- unlinking soft link /%s//unlinkVar8.tmp//subDir.tmp --
+directory unlinked
+
+--- try to unlink a directory ---
+
+Warning: unlink(unlinkVar8.tmp/linkme.tmp): %s in %s on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/file/unlink_variation2-win32.phpt b/ext/standard/tests/file/unlink_variation2-win32.phpt
new file mode 100644
index 0000000..af7b381
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation2-win32.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test unlink() function : usage variations - unlink file in use
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* Try to unlink file when file handle is still in use */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing unlink() on a file when file handle is open ***\n";
+// temp file name used here
+$filename = "$file_path/unlink_variation2-win32.tmp";
+
+// create file
+$fp = fopen($filename, "w");
+// try unlink() on $filename
+var_dump( unlink($filename) ); // expected: false as file handle is still open
+// now close file handle
+fclose($fp);
+
+// now unlink file
+var_dump( unlink($filename) ); // expected: true
+var_dump( file_exists($filename) ); // confirm file is deleted
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on a file when file handle is open ***
+
+Warning: unlink(%s): %s in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation2.phpt b/ext/standard/tests/file/unlink_variation2.phpt
new file mode 100644
index 0000000..071a657
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test unlink() function : usage variations - unlink file in use
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* Try to unlink file when file handle is still in use */
+
+$file_path = dirname(__FILE__);
+
+echo "*** Testing unlink() on a file which is in use ***\n";
+// temp file name used here
+$filename = "$file_path/unlink_variation2.tmp";
+
+// create file
+$fp = fopen($filename, "w");
+// try unlink() on $filename
+var_dump( unlink($filename) ); // expected: true on linux
+var_dump( file_exists($filename) ); // confirm file is deleted
+// now close file handle
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on a file which is in use ***
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation3.phpt b/ext/standard/tests/file/unlink_variation3.phpt
new file mode 100644
index 0000000..96f21b2
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation3.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test unlink() function : usage variations - unlink links
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* Delete link files - soft and hard links */
+
+$file_path = dirname(__FILE__);
+// temp file used
+$filename = "$file_path/unlink_variation3.tmp";
+
+echo "*** Testing unlink() on soft and hard links ***\n";
+// create temp file
+$fp = fopen($filename, "w");
+fclose($fp);
+// link name used here
+$linkname = "$file_path/unlink_variation3_link.tmp";
+
+echo "-- Testing unlink() on soft link --\n";
+// create soft link
+var_dump( symlink($filename, $linkname) ); // expected: true
+// unlink soft link
+var_dump( unlink($linkname) ); // expected: true
+var_dump( file_exists($linkname) ); // confirm link is deleted
+
+echo "-- Testing unlink() on hard link --\n";
+// create hard link
+var_dump( link($filename, $linkname) ); // expected: true
+// delete hard link
+var_dump( unlink($linkname) ); // expected: true
+var_dump( file_exists($linkname) ); // confirm link is deleted
+
+// delete temp file
+var_dump( unlink($filename) );
+var_dump( file_exists($filename) ); // confirm file is deleted
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on soft and hard links ***
+-- Testing unlink() on soft link --
+bool(true)
+bool(true)
+bool(false)
+-- Testing unlink() on hard link --
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation4.phpt b/ext/standard/tests/file/unlink_variation4.phpt
new file mode 100644
index 0000000..746cfd3
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation4.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test unlink() function : usage variations - unlink deleted file
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* Try deleting a file which is already deleted */
+
+$file_path = dirname(__FILE__);
+
+// temp file used
+$filename = "$file_path/unlink_variation4.tmp";
+
+echo "*** Testing unlink() on deleted file ***\n";
+// create temp file
+$fp = fopen($filename, "w");
+fclose($fp);
+
+// delete temp file
+var_dump( unlink($filename) ); // expected: true
+var_dump( file_exists($filename) ); // confirm file deleted
+
+// delete deleted file
+var_dump( unlink($filename) ); // expected: false
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on deleted file ***
+bool(true)
+bool(false)
+
+Warning: unlink(%s/unlink_variation4.tmp): %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation5.phpt b/ext/standard/tests/file/unlink_variation5.phpt
new file mode 100644
index 0000000..51bb2c7
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation5.phpt
@@ -0,0 +1,2087 @@
+--TEST--
+Test unlink() function : usage variations - files with diff. file permissions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip only on Linux');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink ( string $filename [, resource $context] );
+ Description : Deletes filename
+*/
+
+/* delete files with different file permission(0000 to 0777) */
+
+$file_path = dirname(__FILE__);
+
+// temp file used
+$filename = "$file_path/unlink_variation5.tmp";
+
+echo "*** Testing unlink() on a file ***\n";
+
+for($mode = 0000; $mode <= 0777; $mode++ ) {
+ // create temp file
+ $fp = fopen($filename, "w");
+ fclose($fp);
+ // changing mode of file
+ echo "File permission : $mode\n";
+ var_dump( chmod($filename, $mode) );
+ var_dump( unlink($filename) ); // deleting file
+ var_dump( file_exists($filename) ); // confirm file deleted
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing unlink() on a file ***
+File permission : 0
+bool(true)
+bool(true)
+bool(false)
+File permission : 1
+bool(true)
+bool(true)
+bool(false)
+File permission : 2
+bool(true)
+bool(true)
+bool(false)
+File permission : 3
+bool(true)
+bool(true)
+bool(false)
+File permission : 4
+bool(true)
+bool(true)
+bool(false)
+File permission : 5
+bool(true)
+bool(true)
+bool(false)
+File permission : 6
+bool(true)
+bool(true)
+bool(false)
+File permission : 7
+bool(true)
+bool(true)
+bool(false)
+File permission : 8
+bool(true)
+bool(true)
+bool(false)
+File permission : 9
+bool(true)
+bool(true)
+bool(false)
+File permission : 10
+bool(true)
+bool(true)
+bool(false)
+File permission : 11
+bool(true)
+bool(true)
+bool(false)
+File permission : 12
+bool(true)
+bool(true)
+bool(false)
+File permission : 13
+bool(true)
+bool(true)
+bool(false)
+File permission : 14
+bool(true)
+bool(true)
+bool(false)
+File permission : 15
+bool(true)
+bool(true)
+bool(false)
+File permission : 16
+bool(true)
+bool(true)
+bool(false)
+File permission : 17
+bool(true)
+bool(true)
+bool(false)
+File permission : 18
+bool(true)
+bool(true)
+bool(false)
+File permission : 19
+bool(true)
+bool(true)
+bool(false)
+File permission : 20
+bool(true)
+bool(true)
+bool(false)
+File permission : 21
+bool(true)
+bool(true)
+bool(false)
+File permission : 22
+bool(true)
+bool(true)
+bool(false)
+File permission : 23
+bool(true)
+bool(true)
+bool(false)
+File permission : 24
+bool(true)
+bool(true)
+bool(false)
+File permission : 25
+bool(true)
+bool(true)
+bool(false)
+File permission : 26
+bool(true)
+bool(true)
+bool(false)
+File permission : 27
+bool(true)
+bool(true)
+bool(false)
+File permission : 28
+bool(true)
+bool(true)
+bool(false)
+File permission : 29
+bool(true)
+bool(true)
+bool(false)
+File permission : 30
+bool(true)
+bool(true)
+bool(false)
+File permission : 31
+bool(true)
+bool(true)
+bool(false)
+File permission : 32
+bool(true)
+bool(true)
+bool(false)
+File permission : 33
+bool(true)
+bool(true)
+bool(false)
+File permission : 34
+bool(true)
+bool(true)
+bool(false)
+File permission : 35
+bool(true)
+bool(true)
+bool(false)
+File permission : 36
+bool(true)
+bool(true)
+bool(false)
+File permission : 37
+bool(true)
+bool(true)
+bool(false)
+File permission : 38
+bool(true)
+bool(true)
+bool(false)
+File permission : 39
+bool(true)
+bool(true)
+bool(false)
+File permission : 40
+bool(true)
+bool(true)
+bool(false)
+File permission : 41
+bool(true)
+bool(true)
+bool(false)
+File permission : 42
+bool(true)
+bool(true)
+bool(false)
+File permission : 43
+bool(true)
+bool(true)
+bool(false)
+File permission : 44
+bool(true)
+bool(true)
+bool(false)
+File permission : 45
+bool(true)
+bool(true)
+bool(false)
+File permission : 46
+bool(true)
+bool(true)
+bool(false)
+File permission : 47
+bool(true)
+bool(true)
+bool(false)
+File permission : 48
+bool(true)
+bool(true)
+bool(false)
+File permission : 49
+bool(true)
+bool(true)
+bool(false)
+File permission : 50
+bool(true)
+bool(true)
+bool(false)
+File permission : 51
+bool(true)
+bool(true)
+bool(false)
+File permission : 52
+bool(true)
+bool(true)
+bool(false)
+File permission : 53
+bool(true)
+bool(true)
+bool(false)
+File permission : 54
+bool(true)
+bool(true)
+bool(false)
+File permission : 55
+bool(true)
+bool(true)
+bool(false)
+File permission : 56
+bool(true)
+bool(true)
+bool(false)
+File permission : 57
+bool(true)
+bool(true)
+bool(false)
+File permission : 58
+bool(true)
+bool(true)
+bool(false)
+File permission : 59
+bool(true)
+bool(true)
+bool(false)
+File permission : 60
+bool(true)
+bool(true)
+bool(false)
+File permission : 61
+bool(true)
+bool(true)
+bool(false)
+File permission : 62
+bool(true)
+bool(true)
+bool(false)
+File permission : 63
+bool(true)
+bool(true)
+bool(false)
+File permission : 64
+bool(true)
+bool(true)
+bool(false)
+File permission : 65
+bool(true)
+bool(true)
+bool(false)
+File permission : 66
+bool(true)
+bool(true)
+bool(false)
+File permission : 67
+bool(true)
+bool(true)
+bool(false)
+File permission : 68
+bool(true)
+bool(true)
+bool(false)
+File permission : 69
+bool(true)
+bool(true)
+bool(false)
+File permission : 70
+bool(true)
+bool(true)
+bool(false)
+File permission : 71
+bool(true)
+bool(true)
+bool(false)
+File permission : 72
+bool(true)
+bool(true)
+bool(false)
+File permission : 73
+bool(true)
+bool(true)
+bool(false)
+File permission : 74
+bool(true)
+bool(true)
+bool(false)
+File permission : 75
+bool(true)
+bool(true)
+bool(false)
+File permission : 76
+bool(true)
+bool(true)
+bool(false)
+File permission : 77
+bool(true)
+bool(true)
+bool(false)
+File permission : 78
+bool(true)
+bool(true)
+bool(false)
+File permission : 79
+bool(true)
+bool(true)
+bool(false)
+File permission : 80
+bool(true)
+bool(true)
+bool(false)
+File permission : 81
+bool(true)
+bool(true)
+bool(false)
+File permission : 82
+bool(true)
+bool(true)
+bool(false)
+File permission : 83
+bool(true)
+bool(true)
+bool(false)
+File permission : 84
+bool(true)
+bool(true)
+bool(false)
+File permission : 85
+bool(true)
+bool(true)
+bool(false)
+File permission : 86
+bool(true)
+bool(true)
+bool(false)
+File permission : 87
+bool(true)
+bool(true)
+bool(false)
+File permission : 88
+bool(true)
+bool(true)
+bool(false)
+File permission : 89
+bool(true)
+bool(true)
+bool(false)
+File permission : 90
+bool(true)
+bool(true)
+bool(false)
+File permission : 91
+bool(true)
+bool(true)
+bool(false)
+File permission : 92
+bool(true)
+bool(true)
+bool(false)
+File permission : 93
+bool(true)
+bool(true)
+bool(false)
+File permission : 94
+bool(true)
+bool(true)
+bool(false)
+File permission : 95
+bool(true)
+bool(true)
+bool(false)
+File permission : 96
+bool(true)
+bool(true)
+bool(false)
+File permission : 97
+bool(true)
+bool(true)
+bool(false)
+File permission : 98
+bool(true)
+bool(true)
+bool(false)
+File permission : 99
+bool(true)
+bool(true)
+bool(false)
+File permission : 100
+bool(true)
+bool(true)
+bool(false)
+File permission : 101
+bool(true)
+bool(true)
+bool(false)
+File permission : 102
+bool(true)
+bool(true)
+bool(false)
+File permission : 103
+bool(true)
+bool(true)
+bool(false)
+File permission : 104
+bool(true)
+bool(true)
+bool(false)
+File permission : 105
+bool(true)
+bool(true)
+bool(false)
+File permission : 106
+bool(true)
+bool(true)
+bool(false)
+File permission : 107
+bool(true)
+bool(true)
+bool(false)
+File permission : 108
+bool(true)
+bool(true)
+bool(false)
+File permission : 109
+bool(true)
+bool(true)
+bool(false)
+File permission : 110
+bool(true)
+bool(true)
+bool(false)
+File permission : 111
+bool(true)
+bool(true)
+bool(false)
+File permission : 112
+bool(true)
+bool(true)
+bool(false)
+File permission : 113
+bool(true)
+bool(true)
+bool(false)
+File permission : 114
+bool(true)
+bool(true)
+bool(false)
+File permission : 115
+bool(true)
+bool(true)
+bool(false)
+File permission : 116
+bool(true)
+bool(true)
+bool(false)
+File permission : 117
+bool(true)
+bool(true)
+bool(false)
+File permission : 118
+bool(true)
+bool(true)
+bool(false)
+File permission : 119
+bool(true)
+bool(true)
+bool(false)
+File permission : 120
+bool(true)
+bool(true)
+bool(false)
+File permission : 121
+bool(true)
+bool(true)
+bool(false)
+File permission : 122
+bool(true)
+bool(true)
+bool(false)
+File permission : 123
+bool(true)
+bool(true)
+bool(false)
+File permission : 124
+bool(true)
+bool(true)
+bool(false)
+File permission : 125
+bool(true)
+bool(true)
+bool(false)
+File permission : 126
+bool(true)
+bool(true)
+bool(false)
+File permission : 127
+bool(true)
+bool(true)
+bool(false)
+File permission : 128
+bool(true)
+bool(true)
+bool(false)
+File permission : 129
+bool(true)
+bool(true)
+bool(false)
+File permission : 130
+bool(true)
+bool(true)
+bool(false)
+File permission : 131
+bool(true)
+bool(true)
+bool(false)
+File permission : 132
+bool(true)
+bool(true)
+bool(false)
+File permission : 133
+bool(true)
+bool(true)
+bool(false)
+File permission : 134
+bool(true)
+bool(true)
+bool(false)
+File permission : 135
+bool(true)
+bool(true)
+bool(false)
+File permission : 136
+bool(true)
+bool(true)
+bool(false)
+File permission : 137
+bool(true)
+bool(true)
+bool(false)
+File permission : 138
+bool(true)
+bool(true)
+bool(false)
+File permission : 139
+bool(true)
+bool(true)
+bool(false)
+File permission : 140
+bool(true)
+bool(true)
+bool(false)
+File permission : 141
+bool(true)
+bool(true)
+bool(false)
+File permission : 142
+bool(true)
+bool(true)
+bool(false)
+File permission : 143
+bool(true)
+bool(true)
+bool(false)
+File permission : 144
+bool(true)
+bool(true)
+bool(false)
+File permission : 145
+bool(true)
+bool(true)
+bool(false)
+File permission : 146
+bool(true)
+bool(true)
+bool(false)
+File permission : 147
+bool(true)
+bool(true)
+bool(false)
+File permission : 148
+bool(true)
+bool(true)
+bool(false)
+File permission : 149
+bool(true)
+bool(true)
+bool(false)
+File permission : 150
+bool(true)
+bool(true)
+bool(false)
+File permission : 151
+bool(true)
+bool(true)
+bool(false)
+File permission : 152
+bool(true)
+bool(true)
+bool(false)
+File permission : 153
+bool(true)
+bool(true)
+bool(false)
+File permission : 154
+bool(true)
+bool(true)
+bool(false)
+File permission : 155
+bool(true)
+bool(true)
+bool(false)
+File permission : 156
+bool(true)
+bool(true)
+bool(false)
+File permission : 157
+bool(true)
+bool(true)
+bool(false)
+File permission : 158
+bool(true)
+bool(true)
+bool(false)
+File permission : 159
+bool(true)
+bool(true)
+bool(false)
+File permission : 160
+bool(true)
+bool(true)
+bool(false)
+File permission : 161
+bool(true)
+bool(true)
+bool(false)
+File permission : 162
+bool(true)
+bool(true)
+bool(false)
+File permission : 163
+bool(true)
+bool(true)
+bool(false)
+File permission : 164
+bool(true)
+bool(true)
+bool(false)
+File permission : 165
+bool(true)
+bool(true)
+bool(false)
+File permission : 166
+bool(true)
+bool(true)
+bool(false)
+File permission : 167
+bool(true)
+bool(true)
+bool(false)
+File permission : 168
+bool(true)
+bool(true)
+bool(false)
+File permission : 169
+bool(true)
+bool(true)
+bool(false)
+File permission : 170
+bool(true)
+bool(true)
+bool(false)
+File permission : 171
+bool(true)
+bool(true)
+bool(false)
+File permission : 172
+bool(true)
+bool(true)
+bool(false)
+File permission : 173
+bool(true)
+bool(true)
+bool(false)
+File permission : 174
+bool(true)
+bool(true)
+bool(false)
+File permission : 175
+bool(true)
+bool(true)
+bool(false)
+File permission : 176
+bool(true)
+bool(true)
+bool(false)
+File permission : 177
+bool(true)
+bool(true)
+bool(false)
+File permission : 178
+bool(true)
+bool(true)
+bool(false)
+File permission : 179
+bool(true)
+bool(true)
+bool(false)
+File permission : 180
+bool(true)
+bool(true)
+bool(false)
+File permission : 181
+bool(true)
+bool(true)
+bool(false)
+File permission : 182
+bool(true)
+bool(true)
+bool(false)
+File permission : 183
+bool(true)
+bool(true)
+bool(false)
+File permission : 184
+bool(true)
+bool(true)
+bool(false)
+File permission : 185
+bool(true)
+bool(true)
+bool(false)
+File permission : 186
+bool(true)
+bool(true)
+bool(false)
+File permission : 187
+bool(true)
+bool(true)
+bool(false)
+File permission : 188
+bool(true)
+bool(true)
+bool(false)
+File permission : 189
+bool(true)
+bool(true)
+bool(false)
+File permission : 190
+bool(true)
+bool(true)
+bool(false)
+File permission : 191
+bool(true)
+bool(true)
+bool(false)
+File permission : 192
+bool(true)
+bool(true)
+bool(false)
+File permission : 193
+bool(true)
+bool(true)
+bool(false)
+File permission : 194
+bool(true)
+bool(true)
+bool(false)
+File permission : 195
+bool(true)
+bool(true)
+bool(false)
+File permission : 196
+bool(true)
+bool(true)
+bool(false)
+File permission : 197
+bool(true)
+bool(true)
+bool(false)
+File permission : 198
+bool(true)
+bool(true)
+bool(false)
+File permission : 199
+bool(true)
+bool(true)
+bool(false)
+File permission : 200
+bool(true)
+bool(true)
+bool(false)
+File permission : 201
+bool(true)
+bool(true)
+bool(false)
+File permission : 202
+bool(true)
+bool(true)
+bool(false)
+File permission : 203
+bool(true)
+bool(true)
+bool(false)
+File permission : 204
+bool(true)
+bool(true)
+bool(false)
+File permission : 205
+bool(true)
+bool(true)
+bool(false)
+File permission : 206
+bool(true)
+bool(true)
+bool(false)
+File permission : 207
+bool(true)
+bool(true)
+bool(false)
+File permission : 208
+bool(true)
+bool(true)
+bool(false)
+File permission : 209
+bool(true)
+bool(true)
+bool(false)
+File permission : 210
+bool(true)
+bool(true)
+bool(false)
+File permission : 211
+bool(true)
+bool(true)
+bool(false)
+File permission : 212
+bool(true)
+bool(true)
+bool(false)
+File permission : 213
+bool(true)
+bool(true)
+bool(false)
+File permission : 214
+bool(true)
+bool(true)
+bool(false)
+File permission : 215
+bool(true)
+bool(true)
+bool(false)
+File permission : 216
+bool(true)
+bool(true)
+bool(false)
+File permission : 217
+bool(true)
+bool(true)
+bool(false)
+File permission : 218
+bool(true)
+bool(true)
+bool(false)
+File permission : 219
+bool(true)
+bool(true)
+bool(false)
+File permission : 220
+bool(true)
+bool(true)
+bool(false)
+File permission : 221
+bool(true)
+bool(true)
+bool(false)
+File permission : 222
+bool(true)
+bool(true)
+bool(false)
+File permission : 223
+bool(true)
+bool(true)
+bool(false)
+File permission : 224
+bool(true)
+bool(true)
+bool(false)
+File permission : 225
+bool(true)
+bool(true)
+bool(false)
+File permission : 226
+bool(true)
+bool(true)
+bool(false)
+File permission : 227
+bool(true)
+bool(true)
+bool(false)
+File permission : 228
+bool(true)
+bool(true)
+bool(false)
+File permission : 229
+bool(true)
+bool(true)
+bool(false)
+File permission : 230
+bool(true)
+bool(true)
+bool(false)
+File permission : 231
+bool(true)
+bool(true)
+bool(false)
+File permission : 232
+bool(true)
+bool(true)
+bool(false)
+File permission : 233
+bool(true)
+bool(true)
+bool(false)
+File permission : 234
+bool(true)
+bool(true)
+bool(false)
+File permission : 235
+bool(true)
+bool(true)
+bool(false)
+File permission : 236
+bool(true)
+bool(true)
+bool(false)
+File permission : 237
+bool(true)
+bool(true)
+bool(false)
+File permission : 238
+bool(true)
+bool(true)
+bool(false)
+File permission : 239
+bool(true)
+bool(true)
+bool(false)
+File permission : 240
+bool(true)
+bool(true)
+bool(false)
+File permission : 241
+bool(true)
+bool(true)
+bool(false)
+File permission : 242
+bool(true)
+bool(true)
+bool(false)
+File permission : 243
+bool(true)
+bool(true)
+bool(false)
+File permission : 244
+bool(true)
+bool(true)
+bool(false)
+File permission : 245
+bool(true)
+bool(true)
+bool(false)
+File permission : 246
+bool(true)
+bool(true)
+bool(false)
+File permission : 247
+bool(true)
+bool(true)
+bool(false)
+File permission : 248
+bool(true)
+bool(true)
+bool(false)
+File permission : 249
+bool(true)
+bool(true)
+bool(false)
+File permission : 250
+bool(true)
+bool(true)
+bool(false)
+File permission : 251
+bool(true)
+bool(true)
+bool(false)
+File permission : 252
+bool(true)
+bool(true)
+bool(false)
+File permission : 253
+bool(true)
+bool(true)
+bool(false)
+File permission : 254
+bool(true)
+bool(true)
+bool(false)
+File permission : 255
+bool(true)
+bool(true)
+bool(false)
+File permission : 256
+bool(true)
+bool(true)
+bool(false)
+File permission : 257
+bool(true)
+bool(true)
+bool(false)
+File permission : 258
+bool(true)
+bool(true)
+bool(false)
+File permission : 259
+bool(true)
+bool(true)
+bool(false)
+File permission : 260
+bool(true)
+bool(true)
+bool(false)
+File permission : 261
+bool(true)
+bool(true)
+bool(false)
+File permission : 262
+bool(true)
+bool(true)
+bool(false)
+File permission : 263
+bool(true)
+bool(true)
+bool(false)
+File permission : 264
+bool(true)
+bool(true)
+bool(false)
+File permission : 265
+bool(true)
+bool(true)
+bool(false)
+File permission : 266
+bool(true)
+bool(true)
+bool(false)
+File permission : 267
+bool(true)
+bool(true)
+bool(false)
+File permission : 268
+bool(true)
+bool(true)
+bool(false)
+File permission : 269
+bool(true)
+bool(true)
+bool(false)
+File permission : 270
+bool(true)
+bool(true)
+bool(false)
+File permission : 271
+bool(true)
+bool(true)
+bool(false)
+File permission : 272
+bool(true)
+bool(true)
+bool(false)
+File permission : 273
+bool(true)
+bool(true)
+bool(false)
+File permission : 274
+bool(true)
+bool(true)
+bool(false)
+File permission : 275
+bool(true)
+bool(true)
+bool(false)
+File permission : 276
+bool(true)
+bool(true)
+bool(false)
+File permission : 277
+bool(true)
+bool(true)
+bool(false)
+File permission : 278
+bool(true)
+bool(true)
+bool(false)
+File permission : 279
+bool(true)
+bool(true)
+bool(false)
+File permission : 280
+bool(true)
+bool(true)
+bool(false)
+File permission : 281
+bool(true)
+bool(true)
+bool(false)
+File permission : 282
+bool(true)
+bool(true)
+bool(false)
+File permission : 283
+bool(true)
+bool(true)
+bool(false)
+File permission : 284
+bool(true)
+bool(true)
+bool(false)
+File permission : 285
+bool(true)
+bool(true)
+bool(false)
+File permission : 286
+bool(true)
+bool(true)
+bool(false)
+File permission : 287
+bool(true)
+bool(true)
+bool(false)
+File permission : 288
+bool(true)
+bool(true)
+bool(false)
+File permission : 289
+bool(true)
+bool(true)
+bool(false)
+File permission : 290
+bool(true)
+bool(true)
+bool(false)
+File permission : 291
+bool(true)
+bool(true)
+bool(false)
+File permission : 292
+bool(true)
+bool(true)
+bool(false)
+File permission : 293
+bool(true)
+bool(true)
+bool(false)
+File permission : 294
+bool(true)
+bool(true)
+bool(false)
+File permission : 295
+bool(true)
+bool(true)
+bool(false)
+File permission : 296
+bool(true)
+bool(true)
+bool(false)
+File permission : 297
+bool(true)
+bool(true)
+bool(false)
+File permission : 298
+bool(true)
+bool(true)
+bool(false)
+File permission : 299
+bool(true)
+bool(true)
+bool(false)
+File permission : 300
+bool(true)
+bool(true)
+bool(false)
+File permission : 301
+bool(true)
+bool(true)
+bool(false)
+File permission : 302
+bool(true)
+bool(true)
+bool(false)
+File permission : 303
+bool(true)
+bool(true)
+bool(false)
+File permission : 304
+bool(true)
+bool(true)
+bool(false)
+File permission : 305
+bool(true)
+bool(true)
+bool(false)
+File permission : 306
+bool(true)
+bool(true)
+bool(false)
+File permission : 307
+bool(true)
+bool(true)
+bool(false)
+File permission : 308
+bool(true)
+bool(true)
+bool(false)
+File permission : 309
+bool(true)
+bool(true)
+bool(false)
+File permission : 310
+bool(true)
+bool(true)
+bool(false)
+File permission : 311
+bool(true)
+bool(true)
+bool(false)
+File permission : 312
+bool(true)
+bool(true)
+bool(false)
+File permission : 313
+bool(true)
+bool(true)
+bool(false)
+File permission : 314
+bool(true)
+bool(true)
+bool(false)
+File permission : 315
+bool(true)
+bool(true)
+bool(false)
+File permission : 316
+bool(true)
+bool(true)
+bool(false)
+File permission : 317
+bool(true)
+bool(true)
+bool(false)
+File permission : 318
+bool(true)
+bool(true)
+bool(false)
+File permission : 319
+bool(true)
+bool(true)
+bool(false)
+File permission : 320
+bool(true)
+bool(true)
+bool(false)
+File permission : 321
+bool(true)
+bool(true)
+bool(false)
+File permission : 322
+bool(true)
+bool(true)
+bool(false)
+File permission : 323
+bool(true)
+bool(true)
+bool(false)
+File permission : 324
+bool(true)
+bool(true)
+bool(false)
+File permission : 325
+bool(true)
+bool(true)
+bool(false)
+File permission : 326
+bool(true)
+bool(true)
+bool(false)
+File permission : 327
+bool(true)
+bool(true)
+bool(false)
+File permission : 328
+bool(true)
+bool(true)
+bool(false)
+File permission : 329
+bool(true)
+bool(true)
+bool(false)
+File permission : 330
+bool(true)
+bool(true)
+bool(false)
+File permission : 331
+bool(true)
+bool(true)
+bool(false)
+File permission : 332
+bool(true)
+bool(true)
+bool(false)
+File permission : 333
+bool(true)
+bool(true)
+bool(false)
+File permission : 334
+bool(true)
+bool(true)
+bool(false)
+File permission : 335
+bool(true)
+bool(true)
+bool(false)
+File permission : 336
+bool(true)
+bool(true)
+bool(false)
+File permission : 337
+bool(true)
+bool(true)
+bool(false)
+File permission : 338
+bool(true)
+bool(true)
+bool(false)
+File permission : 339
+bool(true)
+bool(true)
+bool(false)
+File permission : 340
+bool(true)
+bool(true)
+bool(false)
+File permission : 341
+bool(true)
+bool(true)
+bool(false)
+File permission : 342
+bool(true)
+bool(true)
+bool(false)
+File permission : 343
+bool(true)
+bool(true)
+bool(false)
+File permission : 344
+bool(true)
+bool(true)
+bool(false)
+File permission : 345
+bool(true)
+bool(true)
+bool(false)
+File permission : 346
+bool(true)
+bool(true)
+bool(false)
+File permission : 347
+bool(true)
+bool(true)
+bool(false)
+File permission : 348
+bool(true)
+bool(true)
+bool(false)
+File permission : 349
+bool(true)
+bool(true)
+bool(false)
+File permission : 350
+bool(true)
+bool(true)
+bool(false)
+File permission : 351
+bool(true)
+bool(true)
+bool(false)
+File permission : 352
+bool(true)
+bool(true)
+bool(false)
+File permission : 353
+bool(true)
+bool(true)
+bool(false)
+File permission : 354
+bool(true)
+bool(true)
+bool(false)
+File permission : 355
+bool(true)
+bool(true)
+bool(false)
+File permission : 356
+bool(true)
+bool(true)
+bool(false)
+File permission : 357
+bool(true)
+bool(true)
+bool(false)
+File permission : 358
+bool(true)
+bool(true)
+bool(false)
+File permission : 359
+bool(true)
+bool(true)
+bool(false)
+File permission : 360
+bool(true)
+bool(true)
+bool(false)
+File permission : 361
+bool(true)
+bool(true)
+bool(false)
+File permission : 362
+bool(true)
+bool(true)
+bool(false)
+File permission : 363
+bool(true)
+bool(true)
+bool(false)
+File permission : 364
+bool(true)
+bool(true)
+bool(false)
+File permission : 365
+bool(true)
+bool(true)
+bool(false)
+File permission : 366
+bool(true)
+bool(true)
+bool(false)
+File permission : 367
+bool(true)
+bool(true)
+bool(false)
+File permission : 368
+bool(true)
+bool(true)
+bool(false)
+File permission : 369
+bool(true)
+bool(true)
+bool(false)
+File permission : 370
+bool(true)
+bool(true)
+bool(false)
+File permission : 371
+bool(true)
+bool(true)
+bool(false)
+File permission : 372
+bool(true)
+bool(true)
+bool(false)
+File permission : 373
+bool(true)
+bool(true)
+bool(false)
+File permission : 374
+bool(true)
+bool(true)
+bool(false)
+File permission : 375
+bool(true)
+bool(true)
+bool(false)
+File permission : 376
+bool(true)
+bool(true)
+bool(false)
+File permission : 377
+bool(true)
+bool(true)
+bool(false)
+File permission : 378
+bool(true)
+bool(true)
+bool(false)
+File permission : 379
+bool(true)
+bool(true)
+bool(false)
+File permission : 380
+bool(true)
+bool(true)
+bool(false)
+File permission : 381
+bool(true)
+bool(true)
+bool(false)
+File permission : 382
+bool(true)
+bool(true)
+bool(false)
+File permission : 383
+bool(true)
+bool(true)
+bool(false)
+File permission : 384
+bool(true)
+bool(true)
+bool(false)
+File permission : 385
+bool(true)
+bool(true)
+bool(false)
+File permission : 386
+bool(true)
+bool(true)
+bool(false)
+File permission : 387
+bool(true)
+bool(true)
+bool(false)
+File permission : 388
+bool(true)
+bool(true)
+bool(false)
+File permission : 389
+bool(true)
+bool(true)
+bool(false)
+File permission : 390
+bool(true)
+bool(true)
+bool(false)
+File permission : 391
+bool(true)
+bool(true)
+bool(false)
+File permission : 392
+bool(true)
+bool(true)
+bool(false)
+File permission : 393
+bool(true)
+bool(true)
+bool(false)
+File permission : 394
+bool(true)
+bool(true)
+bool(false)
+File permission : 395
+bool(true)
+bool(true)
+bool(false)
+File permission : 396
+bool(true)
+bool(true)
+bool(false)
+File permission : 397
+bool(true)
+bool(true)
+bool(false)
+File permission : 398
+bool(true)
+bool(true)
+bool(false)
+File permission : 399
+bool(true)
+bool(true)
+bool(false)
+File permission : 400
+bool(true)
+bool(true)
+bool(false)
+File permission : 401
+bool(true)
+bool(true)
+bool(false)
+File permission : 402
+bool(true)
+bool(true)
+bool(false)
+File permission : 403
+bool(true)
+bool(true)
+bool(false)
+File permission : 404
+bool(true)
+bool(true)
+bool(false)
+File permission : 405
+bool(true)
+bool(true)
+bool(false)
+File permission : 406
+bool(true)
+bool(true)
+bool(false)
+File permission : 407
+bool(true)
+bool(true)
+bool(false)
+File permission : 408
+bool(true)
+bool(true)
+bool(false)
+File permission : 409
+bool(true)
+bool(true)
+bool(false)
+File permission : 410
+bool(true)
+bool(true)
+bool(false)
+File permission : 411
+bool(true)
+bool(true)
+bool(false)
+File permission : 412
+bool(true)
+bool(true)
+bool(false)
+File permission : 413
+bool(true)
+bool(true)
+bool(false)
+File permission : 414
+bool(true)
+bool(true)
+bool(false)
+File permission : 415
+bool(true)
+bool(true)
+bool(false)
+File permission : 416
+bool(true)
+bool(true)
+bool(false)
+File permission : 417
+bool(true)
+bool(true)
+bool(false)
+File permission : 418
+bool(true)
+bool(true)
+bool(false)
+File permission : 419
+bool(true)
+bool(true)
+bool(false)
+File permission : 420
+bool(true)
+bool(true)
+bool(false)
+File permission : 421
+bool(true)
+bool(true)
+bool(false)
+File permission : 422
+bool(true)
+bool(true)
+bool(false)
+File permission : 423
+bool(true)
+bool(true)
+bool(false)
+File permission : 424
+bool(true)
+bool(true)
+bool(false)
+File permission : 425
+bool(true)
+bool(true)
+bool(false)
+File permission : 426
+bool(true)
+bool(true)
+bool(false)
+File permission : 427
+bool(true)
+bool(true)
+bool(false)
+File permission : 428
+bool(true)
+bool(true)
+bool(false)
+File permission : 429
+bool(true)
+bool(true)
+bool(false)
+File permission : 430
+bool(true)
+bool(true)
+bool(false)
+File permission : 431
+bool(true)
+bool(true)
+bool(false)
+File permission : 432
+bool(true)
+bool(true)
+bool(false)
+File permission : 433
+bool(true)
+bool(true)
+bool(false)
+File permission : 434
+bool(true)
+bool(true)
+bool(false)
+File permission : 435
+bool(true)
+bool(true)
+bool(false)
+File permission : 436
+bool(true)
+bool(true)
+bool(false)
+File permission : 437
+bool(true)
+bool(true)
+bool(false)
+File permission : 438
+bool(true)
+bool(true)
+bool(false)
+File permission : 439
+bool(true)
+bool(true)
+bool(false)
+File permission : 440
+bool(true)
+bool(true)
+bool(false)
+File permission : 441
+bool(true)
+bool(true)
+bool(false)
+File permission : 442
+bool(true)
+bool(true)
+bool(false)
+File permission : 443
+bool(true)
+bool(true)
+bool(false)
+File permission : 444
+bool(true)
+bool(true)
+bool(false)
+File permission : 445
+bool(true)
+bool(true)
+bool(false)
+File permission : 446
+bool(true)
+bool(true)
+bool(false)
+File permission : 447
+bool(true)
+bool(true)
+bool(false)
+File permission : 448
+bool(true)
+bool(true)
+bool(false)
+File permission : 449
+bool(true)
+bool(true)
+bool(false)
+File permission : 450
+bool(true)
+bool(true)
+bool(false)
+File permission : 451
+bool(true)
+bool(true)
+bool(false)
+File permission : 452
+bool(true)
+bool(true)
+bool(false)
+File permission : 453
+bool(true)
+bool(true)
+bool(false)
+File permission : 454
+bool(true)
+bool(true)
+bool(false)
+File permission : 455
+bool(true)
+bool(true)
+bool(false)
+File permission : 456
+bool(true)
+bool(true)
+bool(false)
+File permission : 457
+bool(true)
+bool(true)
+bool(false)
+File permission : 458
+bool(true)
+bool(true)
+bool(false)
+File permission : 459
+bool(true)
+bool(true)
+bool(false)
+File permission : 460
+bool(true)
+bool(true)
+bool(false)
+File permission : 461
+bool(true)
+bool(true)
+bool(false)
+File permission : 462
+bool(true)
+bool(true)
+bool(false)
+File permission : 463
+bool(true)
+bool(true)
+bool(false)
+File permission : 464
+bool(true)
+bool(true)
+bool(false)
+File permission : 465
+bool(true)
+bool(true)
+bool(false)
+File permission : 466
+bool(true)
+bool(true)
+bool(false)
+File permission : 467
+bool(true)
+bool(true)
+bool(false)
+File permission : 468
+bool(true)
+bool(true)
+bool(false)
+File permission : 469
+bool(true)
+bool(true)
+bool(false)
+File permission : 470
+bool(true)
+bool(true)
+bool(false)
+File permission : 471
+bool(true)
+bool(true)
+bool(false)
+File permission : 472
+bool(true)
+bool(true)
+bool(false)
+File permission : 473
+bool(true)
+bool(true)
+bool(false)
+File permission : 474
+bool(true)
+bool(true)
+bool(false)
+File permission : 475
+bool(true)
+bool(true)
+bool(false)
+File permission : 476
+bool(true)
+bool(true)
+bool(false)
+File permission : 477
+bool(true)
+bool(true)
+bool(false)
+File permission : 478
+bool(true)
+bool(true)
+bool(false)
+File permission : 479
+bool(true)
+bool(true)
+bool(false)
+File permission : 480
+bool(true)
+bool(true)
+bool(false)
+File permission : 481
+bool(true)
+bool(true)
+bool(false)
+File permission : 482
+bool(true)
+bool(true)
+bool(false)
+File permission : 483
+bool(true)
+bool(true)
+bool(false)
+File permission : 484
+bool(true)
+bool(true)
+bool(false)
+File permission : 485
+bool(true)
+bool(true)
+bool(false)
+File permission : 486
+bool(true)
+bool(true)
+bool(false)
+File permission : 487
+bool(true)
+bool(true)
+bool(false)
+File permission : 488
+bool(true)
+bool(true)
+bool(false)
+File permission : 489
+bool(true)
+bool(true)
+bool(false)
+File permission : 490
+bool(true)
+bool(true)
+bool(false)
+File permission : 491
+bool(true)
+bool(true)
+bool(false)
+File permission : 492
+bool(true)
+bool(true)
+bool(false)
+File permission : 493
+bool(true)
+bool(true)
+bool(false)
+File permission : 494
+bool(true)
+bool(true)
+bool(false)
+File permission : 495
+bool(true)
+bool(true)
+bool(false)
+File permission : 496
+bool(true)
+bool(true)
+bool(false)
+File permission : 497
+bool(true)
+bool(true)
+bool(false)
+File permission : 498
+bool(true)
+bool(true)
+bool(false)
+File permission : 499
+bool(true)
+bool(true)
+bool(false)
+File permission : 500
+bool(true)
+bool(true)
+bool(false)
+File permission : 501
+bool(true)
+bool(true)
+bool(false)
+File permission : 502
+bool(true)
+bool(true)
+bool(false)
+File permission : 503
+bool(true)
+bool(true)
+bool(false)
+File permission : 504
+bool(true)
+bool(true)
+bool(false)
+File permission : 505
+bool(true)
+bool(true)
+bool(false)
+File permission : 506
+bool(true)
+bool(true)
+bool(false)
+File permission : 507
+bool(true)
+bool(true)
+bool(false)
+File permission : 508
+bool(true)
+bool(true)
+bool(false)
+File permission : 509
+bool(true)
+bool(true)
+bool(false)
+File permission : 510
+bool(true)
+bool(true)
+bool(false)
+File permission : 511
+bool(true)
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/file/unlink_variation6.phpt b/ext/standard/tests/file/unlink_variation6.phpt
new file mode 100644
index 0000000..ede9ada
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation6.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test unlink() function : variation
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool unlink(string filename[, context context])
+ * Description: Delete a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing unlink() : variation: contexts and relative files ***\n";
+
+// test relative directories and stream contexts.
+$subdir = 'subdir';
+$testfile = $subdir.'/testfile.txt';
+mkdir($subdir);
+touch($testfile);
+f_exists($testfile);
+$context = stream_context_create();
+var_dump(unlink($testfile, $context));
+f_exists($testfile);
+rmdir($subdir);
+
+function f_exists($file) {
+ if (file_exists($file) == true) {
+ echo "$file exists\n";
+ }
+ else {
+ echo "$file doesn't exist\n";
+ }
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing unlink() : variation: contexts and relative files ***
+subdir/testfile.txt exists
+bool(true)
+subdir/testfile.txt doesn't exist
+===DONE===
diff --git a/ext/standard/tests/file/unlink_variation7.phpt b/ext/standard/tests/file/unlink_variation7.phpt
new file mode 100644
index 0000000..4c63e11
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation7.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test unlink() function : usage variation different types for context
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--FILE--
+<?php
+/* Prototype : bool unlink(string filename[, context context])
+ * Description: Delete a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing unlink() : usage variation different types for context ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$filename = __FILE__.'tmp';
+$fileRes = fopen(__FILE__, 'r');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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,
+
+ // file resource
+ 'file resource' => $fileRes
+);
+
+// loop through each element of the array for context
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ touch($filename); // create if it doesn't exist
+ var_dump( unlink($filename, $value) );
+};
+
+if (file_exists($filename)) {
+ unlink($filename);
+}
+fclose($fileRes);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing unlink() : usage variation different types for context ***
+
+--int 0--
+Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--string DQ--
+Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--string SQ--
+Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--mixed case string--
+Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--heredoc--
+Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - unlink() expects parameter 2 to be resource, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - unlink() expects parameter 2 to be resource, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d)
+bool(false)
+
+--file resource--
+Error: 2 - unlink(): supplied resource is not a valid Stream-Context resource, %s(%d)
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/file/unlink_variation8-win32.phpt b/ext/standard/tests/file/unlink_variation8-win32.phpt
new file mode 100644
index 0000000..3ad7ff2
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation8-win32.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Test unlink() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink(string filename[, context context])
+ * Description: Delete a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing unlink() : variation ***\n";
+
+$workDir = "unlinkVar8.tmp";
+$tmpFile = "file.tmp";
+chdir(__DIR__);
+mkdir($workDir);
+$cwd = __DIR__;
+
+$files = array(
+ // relative
+ $workDir.'/'.$tmpFile,
+ './'.$workDir.'/'.$tmpFile,
+ $workDir.'/../'.$workDir.'/'.$tmpFile,
+
+ // relative bad path
+ $workDir.'/../BADDIR/'.$tmpFile,
+ 'BADDIR/'.$tmpFile,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$tmpFile,
+ $cwd.'/./'.$workDir.'/'.$tmpFile,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$tmpFile,
+
+ //absolute bad path
+ $cwd.'/BADDIR/'.$tmpFile,
+
+ //trailing separators
+ $workDir.'/'.$tmpFile.'/',
+ $cwd.'/'.$workDir.'/'.$tmpFile.'/',
+
+ // multiple separators
+ $workDir.'//'.$tmpFile,
+ $cwd.'//'.$workDir.'//'.$tmpFile,
+
+ );
+
+
+foreach($files as $fileToUnlink) {
+ test_realfile($workDir.'/'.$tmpFile, $fileToUnlink);
+}
+
+rmdir($workDir);
+
+function test_realfile($file, $tounlink) {
+ touch($file);
+ echo "-- removing $tounlink --\n";
+ $res = unlink($tounlink);
+ if ($res === true) {
+ if (file_exists($tounlink) === false) {
+ echo "file removed\n";
+ }
+ else {
+ echo "FAILED: file not removed\n";
+ }
+ }
+ else {
+ unlink($file);
+ }
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing unlink() : variation ***
+-- removing unlinkVar8.tmp/file.tmp --
+file removed
+-- removing ./unlinkVar8.tmp/file.tmp --
+file removed
+-- removing unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file removed
+-- removing unlinkVar8.tmp/../BADDIR/file.tmp --
+
+Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d
+-- removing BADDIR/file.tmp --
+
+Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d
+-- removing %s/unlinkVar8.tmp/file.tmp --
+file removed
+-- removing %s/./unlinkVar8.tmp/file.tmp --
+file removed
+-- removing %s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file removed
+-- removing %s/BADDIR/file.tmp --
+
+Warning: unlink(%s/BADDIR/file.tmp): No such file or directory in %s on line %d
+-- removing unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(unlinkVar8.tmp/file.tmp/): Invalid argument in %s on line %d
+-- removing %s/unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): Invalid argument in %s on line %d
+-- removing unlinkVar8.tmp//file.tmp --
+file removed
+-- removing %s//unlinkVar8.tmp//file.tmp --
+file removed
+===DONE===
diff --git a/ext/standard/tests/file/unlink_variation8.phpt b/ext/standard/tests/file/unlink_variation8.phpt
new file mode 100644
index 0000000..e142763
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation8.phpt
@@ -0,0 +1,206 @@
+--TEST--
+Test unlink() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink(string filename[, context context])
+ * Description: Delete a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing unlink() : variation ***\n";
+
+$workDir = "unlinkVar8.tmp";
+$tmpFile = "file.tmp";
+$fileToLinkTo = $workDir.'/'."linkme.tmp";
+
+mkdir($workDir);
+$cwd = getcwd();
+touch($fileToLinkTo);
+
+$files = array(
+ // relative
+ $workDir.'/'.$tmpFile,
+ './'.$workDir.'/'.$tmpFile,
+ $workDir.'/../'.$workDir.'/'.$tmpFile,
+
+ // relative bad path
+ $workDir.'/../BADDIR/'.$tmpFile,
+ 'BADDIR/'.$tmpFile,
+
+ //absolute
+ $cwd.'/'.$workDir.'/'.$tmpFile,
+ $cwd.'/./'.$workDir.'/'.$tmpFile,
+ $cwd.'/'.$workDir.'/../'.$workDir.'/'.$tmpFile,
+
+ //absolute bad path
+ $cwd.'/BADDIR/'.$tmpFile,
+
+ //trailing separators
+ $workDir.'/'.$tmpFile.'/',
+ $cwd.'/'.$workDir.'/'.$tmpFile.'/',
+
+ // multiple separators
+ $workDir.'//'.$tmpFile,
+ $cwd.'//'.$workDir.'//'.$tmpFile,
+
+ );
+
+
+foreach($files as $fileToUnlink) {
+ test_realfile($workDir.'/'.$tmpFile, $fileToUnlink);
+ test_link($workDir.'/'.$tmpFile, $fileToLinkTo, $fileToUnlink, true); //soft link
+ test_link($workDir.'/'.$tmpFile, $fileToLinkTo, $fileToUnlink, false); //hard link
+}
+
+unlink($fileToLinkTo);
+rmdir($workDir);
+
+function test_realfile($file, $tounlink) {
+ touch($file);
+ echo "-- removing $tounlink --\n";
+ $res = unlink($tounlink);
+ if ($res === true) {
+ if (file_exists($tounlink) === false) {
+ echo "file removed\n";
+ }
+ else {
+ echo "FAILED: file not removed\n";
+ }
+ }
+ else {
+ unlink($file);
+ }
+}
+
+function test_link($linkedfile, $toLinkTo, $tounlink, $softlink) {
+ if ($softlink == true) {
+ symlink($toLinkTo, $linkedfile);
+ $msg = "soft link";
+ }
+ else {
+ link($toLinkTo, $linkedfile);
+ $msg = "hard link";
+ }
+ echo "-- unlinking $msg $tounlink --\n";
+ $res = unlink($tounlink);
+ if ($res === true) {
+ if (file_exists($tounlink) === false) {
+ echo "file unlinked\n";
+ }
+ else {
+ echo "FAILED: file not unlinked\n";
+ }
+ }
+ else {
+ unlink($linkedfile);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing unlink() : variation ***
+-- removing unlinkVar8.tmp/file.tmp --
+file removed
+-- unlinking soft link unlinkVar8.tmp/file.tmp --
+file unlinked
+-- unlinking hard link unlinkVar8.tmp/file.tmp --
+file unlinked
+-- removing ./unlinkVar8.tmp/file.tmp --
+file removed
+-- unlinking soft link ./unlinkVar8.tmp/file.tmp --
+file unlinked
+-- unlinking hard link ./unlinkVar8.tmp/file.tmp --
+file unlinked
+-- removing unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file removed
+-- unlinking soft link unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file unlinked
+-- unlinking hard link unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file unlinked
+-- removing unlinkVar8.tmp/../BADDIR/file.tmp --
+
+Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d
+-- unlinking soft link unlinkVar8.tmp/../BADDIR/file.tmp --
+
+Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d
+-- unlinking hard link unlinkVar8.tmp/../BADDIR/file.tmp --
+
+Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d
+-- removing BADDIR/file.tmp --
+
+Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d
+-- unlinking soft link BADDIR/file.tmp --
+
+Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d
+-- unlinking hard link BADDIR/file.tmp --
+
+Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d
+-- removing /%s/unlinkVar8.tmp/file.tmp --
+file removed
+-- unlinking soft link /%s/unlinkVar8.tmp/file.tmp --
+file unlinked
+-- unlinking hard link /%s/unlinkVar8.tmp/file.tmp --
+file unlinked
+-- removing /%s/./unlinkVar8.tmp/file.tmp --
+file removed
+-- unlinking soft link /%s/./unlinkVar8.tmp/file.tmp --
+file unlinked
+-- unlinking hard link /%s/./unlinkVar8.tmp/file.tmp --
+file unlinked
+-- removing /%s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file removed
+-- unlinking soft link /%s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file unlinked
+-- unlinking hard link /%s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp --
+file unlinked
+-- removing /%s/BADDIR/file.tmp --
+
+Warning: unlink(/%s/BADDIR/file.tmp): No such file or directory in %s on line %d
+-- unlinking soft link /%s/BADDIR/file.tmp --
+
+Warning: unlink(/%s/BADDIR/file.tmp): No such file or directory in %s on line %d
+-- unlinking hard link /%s/BADDIR/file.tmp --
+
+Warning: unlink(/%s/BADDIR/file.tmp): No such file or directory in %s on line %d
+-- removing unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d
+-- unlinking soft link unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(unlinkVar8.tmp/file.tmp/): %s directory in %s on line %d
+-- unlinking hard link unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d
+-- removing /%s/unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(/%s/unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d
+-- unlinking soft link /%s/unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(/%s/unlinkVar8.tmp/file.tmp/): %s directory in %s on line %d
+-- unlinking hard link /%s/unlinkVar8.tmp/file.tmp/ --
+
+Warning: unlink(/%s/unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d
+-- removing unlinkVar8.tmp//file.tmp --
+file removed
+-- unlinking soft link unlinkVar8.tmp//file.tmp --
+file unlinked
+-- unlinking hard link unlinkVar8.tmp//file.tmp --
+file unlinked
+-- removing /%s//unlinkVar8.tmp//file.tmp --
+file removed
+-- unlinking soft link /%s//unlinkVar8.tmp//file.tmp --
+file unlinked
+-- unlinking hard link /%s//unlinkVar8.tmp//file.tmp --
+file unlinked
+===DONE===
diff --git a/ext/standard/tests/file/unlink_variation9-win32.phpt b/ext/standard/tests/file/unlink_variation9-win32.phpt
new file mode 100644
index 0000000..acc2ce6
--- /dev/null
+++ b/ext/standard/tests/file/unlink_variation9-win32.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Test unlink() function : variation: various valid and invalid paths
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : bool unlink(string filename[, context context])
+ * Description: Delete a file
+ * Source code: ext/standard/file.c
+ * Alias to functions:
+ */
+
+echo "*** Testing unlink() : variation ***\n";
+
+$workDir = "unlinkVar9.tmp";
+$tmpFile = "file.tmp";
+chdir(__DIR__);
+mkdir($workDir);
+$cwd = __DIR__;
+$unixifiedFile = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$tmpFile, 3);
+
+$files = array(
+ // relative
+ $workDir.'\\'.$tmpFile,
+ '.\\'.$workDir.'\\'.$tmpFile,
+ $workDir.'\\..\\'.$workDir.'\\'.$tmpFile,
+
+ // relative bad path
+ $workDir.'\\..\\BADDIR\\'.$tmpFile,
+ 'BADDIR\\'.$tmpFile,
+
+ //absolute
+ $cwd.'\\'.$workDir.'\\'.$tmpFile,
+ $cwd.'\\.\\'.$workDir.'\\'.$tmpFile,
+ $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$tmpFile,
+
+ //absolute bad path
+ $cwd.'\\BADDIR\\'.$tmpFile,
+
+ //trailing separators
+ $workDir.'\\'.$tmpFile.'\\',
+ $cwd.'\\'.$workDir.'\\'.$tmpFile.'\\',
+
+ // multiple separators
+ $workDir.'\\\\'.$tmpFile,
+ $cwd.'\\\\'.$workDir.'\\\\'.$tmpFile,
+
+ // Unixified File
+ $unixifiedFile,
+
+ );
+
+
+foreach($files as $fileToUnlink) {
+ $file = $workDir.'/'.$tmpFile;
+ $tounlink = $fileToUnlink;
+ touch($file);
+ echo "-- removing $tounlink --\n";
+ $res = unlink($tounlink);
+ if ($res === true) {
+ if (file_exists($tounlink) === false) {
+ echo "file removed\n";
+ }
+ else {
+ echo "FAILED: file not removed\n";
+ }
+ }
+ else {
+ unlink($file);
+ }
+}
+
+rmdir($workDir);
+?>
+===DONE===
+--EXPECTF--
+*** Testing unlink() : variation ***
+-- removing unlinkVar9.tmp\file.tmp --
+file removed
+-- removing .\unlinkVar9.tmp\file.tmp --
+file removed
+-- removing unlinkVar9.tmp\..\unlinkVar9.tmp\file.tmp --
+file removed
+-- removing unlinkVar9.tmp\..\BADDIR\file.tmp --
+
+Warning: unlink(unlinkVar9.tmp\..\BADDIR\file.tmp): No such file or directory in %s on line %d
+-- removing BADDIR\file.tmp --
+
+Warning: unlink(BADDIR\file.tmp): No such file or directory in %s on line %d
+-- removing %s\unlinkVar9.tmp\file.tmp --
+file removed
+-- removing %s\.\unlinkVar9.tmp\file.tmp --
+file removed
+-- removing %s\unlinkVar9.tmp\..\unlinkVar9.tmp\file.tmp --
+file removed
+-- removing %s\BADDIR\file.tmp --
+
+Warning: unlink(%s\BADDIR\file.tmp): No such file or directory in %s on line %d
+-- removing unlinkVar9.tmp\file.tmp\ --
+
+Warning: unlink(unlinkVar9.tmp\file.tmp\): Invalid argument in %s on line %d
+-- removing %s\unlinkVar9.tmp\file.tmp\ --
+
+Warning: unlink(%s\unlinkVar9.tmp\file.tmp\): Invalid argument in %s on line %d
+-- removing unlinkVar9.tmp\\file.tmp --
+file removed
+-- removing %s\\unlinkVar9.tmp\\file.tmp --
+file removed
+-- removing /%s/unlinkVar9.tmp/file.tmp --
+file removed
+===DONE===
diff --git a/ext/standard/tests/file/userdirstream.phpt b/ext/standard/tests/file/userdirstream.phpt
new file mode 100644
index 0000000..a83e899
--- /dev/null
+++ b/ext/standard/tests/file/userdirstream.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Directory Streams
+--FILE--
+<?php
+class test {
+ public $idx = 0;
+
+ function dir_opendir($path, $options) {
+ print "Opening\n";
+ $this->idx = 0;
+
+ return true;
+ }
+
+ function dir_readdir() {
+ $sample = array('first','second','third','fourth');
+
+ if ($this->idx >= count($sample)) return false;
+ else return $sample[$this->idx++];
+ }
+
+ function dir_rewinddir() {
+ $this->idx = 0;
+
+ return true;
+ }
+
+ function dir_closedir() {
+ print "Closing up!\n";
+
+ return true;
+ }
+}
+
+stream_wrapper_register('test', 'test');
+
+var_dump(scandir('test://example.com/path/to/test'));
+?>
+--EXPECT--
+Opening
+Closing up!
+array(4) {
+ [0]=>
+ string(5) "first"
+ [1]=>
+ string(6) "fourth"
+ [2]=>
+ string(6) "second"
+ [3]=>
+ string(5) "third"
+}
diff --git a/ext/standard/tests/file/userfilters.phpt b/ext/standard/tests/file/userfilters.phpt
new file mode 100644
index 0000000..2246b5d
--- /dev/null
+++ b/ext/standard/tests/file/userfilters.phpt
@@ -0,0 +1,37 @@
+--TEST--
+stream userfilter test
+--FILE--
+<?php
+# vim600:syn=php:
+class testfilter extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $bucket->data = strtoupper($bucket->data);
+ $consumed += strlen($bucket->data);
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_PASS_ON;
+ }
+
+ function oncreate() {
+ echo "params: {$this->params}\n";
+ }
+}
+
+stream_filter_register('testfilter','testfilter');
+
+$text = b"Hello There!";
+
+$fp = tmpfile();
+fwrite($fp, $text);
+
+rewind($fp);
+stream_filter_append($fp, 'testfilter', STREAM_FILTER_READ, 'testuserfilter');
+
+var_dump(fgets($fp));
+fclose($fp);
+
+?>
+--EXPECT--
+params: testuserfilter
+string(12) "HELLO THERE!"
diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt
new file mode 100644
index 0000000..b5a9707
--- /dev/null
+++ b/ext/standard/tests/file/userstreams.phpt
@@ -0,0 +1,325 @@
+--TEST--
+User-space streams
+--FILE--
+<?php
+# vim600:syn=php:
+
+/* This is a fairly aggressive test that looks at
+ * user streams and also gives the seek/gets/buffer
+ * layer of streams a thorough testing */
+
+$lyrics = <<<EOD
+...and the road becomes my bride
+I have stripped of all but pride
+so in her I do confide
+and she keeps me satisfied
+gives me all I need
+...and with dust in throat I crave
+to the game you stay a slave
+rover wanderer
+nomad vagabond
+call me what you will
+ But Ill take my time anywhere
+ Free to speak my mind anywhere
+ and Ill redefine anywhere
+ Anywhere I roam
+ Where I lay my head is home
+...and the earth becomes my throne
+I adapt to the unknown
+under wandering stars Ive grown
+by myself but not alone
+I ask no one
+...and my ties are severed clean
+the less I have the more I gain
+off the beaten path I reign
+rover wanderer
+nomad vagabond
+call me what you will
+ But Ill take my time anywhere
+ Free to speak my mind anywhere
+ and Ill never mind anywhere
+ Anywhere I roam
+ Where I lay my head is home
+ But Ill take my time anywhere
+ Free to speak my mind anywhere
+ and Ill take my find anywhere
+ Anywhere I roam
+ Where I lay my head is home
+ carved upon my stone
+ my body lie but still I roam
+ Wherever I may roam.
+
+Wherever I May Roam
+
+EOD;
+
+/* repeat the data a few times so that it grows larger than
+ * the default cache chunk size and that we have something
+ * to seek around... */
+$DATA = "";
+for ($i = 0; $i < 30; $i++) {
+ if ($i % 2 == 0)
+ $DATA .= str_rot13($lyrics);
+ else
+ $DATA .= $lyrics;
+}
+
+/* store the data in a regular file so that we can compare
+ * the results */
+$tf = tmpfile();
+fwrite($tf, (binary)$DATA);
+$n = ftell($tf);
+rewind($tf) or die("failed to rewind tmp file!");
+if (ftell($tf) != 0)
+ die("tmpfile is not at start!");
+$DATALEN = strlen($DATA);
+if ($n != $DATALEN)
+ die("tmpfile stored $n bytes; should be $DATALEN!");
+
+class uselessstream
+{
+}
+
+class mystream
+{
+ public $path;
+ public $mode;
+ public $options;
+
+ public $position;
+ public $varname;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $this->path = $path;
+ $this->mode = $mode;
+ $this->options = $options;
+
+ $split = parse_url($path);
+ $this->varname = $split["host"];
+
+ if (strchr($mode, 'a'))
+ $this->position = strlen($GLOBALS[$this->varname]);
+ else
+ $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_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;
+ }
+ }
+
+}
+
+if (@stream_wrapper_register("bogus", "class_not_exist")) {
+ die("Registered a non-existant class!!!???");
+}
+echo "Not Registered\n";
+
+if (!stream_wrapper_register("test", "mystream")) {
+ die("test wrapper registration failed");
+}
+echo "Registered\n";
+
+if (!stream_wrapper_register("bogon", "uselessstream")) {
+ die("bogon wrapper registration failed");
+}
+echo "Registered\n";
+
+$b = @fopen("bogon://url", "rb");
+if (is_resource($b)) {
+ die("Opened a bogon??");
+}
+
+$fp = fopen("test://DATA", "rb");
+if (!$fp || !is_resource($fp)) {
+ die("Failed to open resource");
+}
+
+/* some default seeks that will cause buffer/cache misses */
+$seeks = array(
+ array(SEEK_SET, 0, 0),
+ array(SEEK_CUR, 8450, 8450),
+ array(SEEK_CUR, -7904, 546),
+ array(SEEK_CUR, 12456, 13002),
+
+ /* end up at BOF so that randomly generated seek offsets
+ * below will know where they are supposed to be */
+ array(SEEK_SET, 0, 0)
+);
+
+$whence_map = array(
+ SEEK_CUR,
+ SEEK_SET,
+ SEEK_END
+);
+$whence_names = array(
+ SEEK_CUR => "SEEK_CUR",
+ SEEK_SET => "SEEK_SET",
+ SEEK_END => "SEEK_END"
+ );
+
+/* generate some random seek offsets */
+$position = 0;
+for ($i = 0; $i < 256; $i++) {
+ $whence = $whence_map[array_rand($whence_map, 1)];
+ switch($whence) {
+ case SEEK_SET:
+ $offset = rand(0, $DATALEN - 1);
+ $position = $offset;
+ break;
+ case SEEK_END:
+ $offset = -rand(0, $DATALEN - 1);
+ $position = $DATALEN + $offset;
+ break;
+ case SEEK_CUR:
+ $offset = rand(0, $DATALEN - 1);
+ $offset -= $position;
+ $position += $offset;
+ break;
+ }
+
+ $seeks[] = array($whence, $offset, $position);
+}
+
+/* we compare the results of fgets using differing line lengths to
+ * test the fgets layer also */
+$line_lengths = array(1024, 256, 64, 16);
+$fail_count = 0;
+
+ob_start();
+foreach($line_lengths as $line_length) {
+ /* now compare the real stream with the user stream */
+ $j = 0;
+ rewind($tf);
+ rewind($fp);
+ foreach($seeks as $seekdata) {
+ list($whence, $offset, $position) = $seekdata;
+
+ $rpb = ftell($tf);
+ $rr = (int)fseek($tf, $offset, $whence);
+ $rpa = ftell($tf);
+ $rline = fgets($tf, $line_length);
+ (int)fseek($tf, - strlen($rline), SEEK_CUR);
+
+ $upb = ftell($fp);
+ $ur = (int)fseek($fp, $offset, $whence);
+ $upa = ftell($fp);
+ $uline = fgets($fp, $line_length);
+ (int)fseek($fp, - strlen($uline), SEEK_CUR);
+
+ printf("\n--[%d] whence=%s offset=%d line_length=%d position_should_be=%d --\n",
+ $j, $whence_names[$whence], $offset, $line_length, $position);
+ printf("REAL: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $rpb, $rpa, ftell($tf), $rr, strlen($rline), $rline);
+ printf("USER: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $upb, $upa, ftell($fp), $ur, strlen($uline), $uline);
+
+ if ($rr != $ur || $rline != $uline || $rpa != $position || $upa != $position) {
+ $fail_count++;
+ echo "###################################### FAIL!\n";
+ $dat = stream_get_meta_data($fp);
+ var_dump($dat);
+ break;
+ }
+
+ $j++;
+ }
+ if ($fail_count)
+ break;
+}
+
+if ($fail_count == 0) {
+ ob_end_clean();
+ echo "SEEK: OK\n";
+} else {
+ echo "SEEK: FAIL\n";
+ ob_end_flush();
+}
+
+$fail_count = 0;
+
+fseek($fp, $DATALEN / 2, SEEK_SET);
+fseek($tf, $DATALEN / 2, SEEK_SET);
+
+if (ftell($fp) != ftell($tf)) {
+ echo "SEEK: positions do not match!\n";
+}
+
+$n = 0;
+while(!feof($fp)) {
+ $uline = fgets($fp, 1024);
+ $rline = fgets($tf, 1024);
+
+ if ($uline != $rline) {
+ echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . "]\nreal=$rline [pos=" . ftell($tf) . "]\n";
+ $fail_count++;
+ break;
+ }
+}
+
+if ($fail_count == 0) {
+ echo "FGETS: OK\n";
+}
+
+/* One final test to see if the position is respected when opened for append */
+$fp = fopen("test://lyrics", "a+");
+rewind($fp);
+var_dump(ftell($fp));
+$data = fgets($fp);
+fclose($fp);
+echo $data . "\n";
+
+?>
+--EXPECT--
+Not Registered
+Registered
+Registered
+SEEK: OK
+FGETS: OK
+int(0)
+...and the road becomes my bride
diff --git a/ext/standard/tests/file/userstreams_002.phpt b/ext/standard/tests/file/userstreams_002.phpt
new file mode 100644
index 0000000..81f463d
--- /dev/null
+++ b/ext/standard/tests/file/userstreams_002.phpt
@@ -0,0 +1,94 @@
+--TEST--
+User-space streams: stream_cast()
+--FILE--
+<?php
+class test_wrapper_base {
+ public $return_value;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+}
+class test_wrapper extends test_wrapper_base {
+ function stream_cast($castas) {
+ return $this->return_value;
+ }
+}
+function test($name, $fd, $return_value) {
+ echo "\n------ $name: -------\n";
+ $data = stream_get_meta_data($fd);
+ $data['wrapper_data']->return_value = $return_value;
+ $r = array($fd);
+ $w = $e = null;
+ var_dump(stream_select($r, $w, $e, 0) !== false);
+}
+
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+var_dump(stream_wrapper_register('test2', 'test_wrapper_base'));
+
+$fd = fopen("test://foo","r");
+$fd2 = fopen("test2://foo","r");
+
+test("valid stream", $fd, STDIN);
+test("stream_cast not implemented", $fd2, null);
+test("return value is false", $fd, false);
+test("return value not a stream resource", $fd, "foo");
+test("return value is stream itself", $fd, $fd);
+test("return value cannot be casted", $fd, $fd2);
+
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+
+------ valid stream: -------
+bool(true)
+
+------ stream_cast not implemented: -------
+
+Warning: stream_select(): test_wrapper_base::stream_cast is not implemented! in %s
+
+Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+
+Warning: stream_select(): No stream arrays were passed in %s
+bool(false)
+
+------ return value is false: -------
+
+Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+
+Warning: stream_select(): No stream arrays were passed in %s
+bool(false)
+
+------ return value not a stream resource: -------
+
+Warning: stream_select(): supplied argument is not a valid stream resource in %s
+
+Warning: stream_select(): test_wrapper::stream_cast must return a stream resource in %s
+
+Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+
+Warning: stream_select(): No stream arrays were passed in %s
+bool(false)
+
+------ return value is stream itself: -------
+
+Warning: stream_select(): test_wrapper::stream_cast must not return itself in %s
+
+Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+
+Warning: stream_select(): No stream arrays were passed in %s
+bool(false)
+
+------ return value cannot be casted: -------
+
+Warning: stream_select(): test_wrapper_base::stream_cast is not implemented! in %s
+
+Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+
+Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+
+Warning: stream_select(): No stream arrays were passed in %s
+bool(false)
diff --git a/ext/standard/tests/file/userstreams_003.phpt b/ext/standard/tests/file/userstreams_003.phpt
new file mode 100644
index 0000000..01a8efb
--- /dev/null
+++ b/ext/standard/tests/file/userstreams_003.phpt
@@ -0,0 +1,153 @@
+--TEST--
+User-space streams: stream_set_option()
+--FILE--
+<?php
+class test_wrapper_base {
+ public $return_value;
+ public $expected_option;
+ public $expected_value;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+}
+class test_wrapper extends test_wrapper_base {
+ function stream_set_option($option, $value, $ptrparam) {
+ echo "value:\n";
+ var_dump($value);
+ echo "ptrparam:\n";
+ var_dump($ptrparam);
+ echo "\$option === $option === " . $this->expected_option . ":\n";;
+ var_dump($option === $this->expected_option);
+ echo "\$value === $value === " . $this->expected_value. ":\n";;
+ var_dump($value === $this->expected_value);
+ return $this->return_value;
+ }
+}
+
+function test($name, $fd, $return_value, $func, $args, $expected_option, $expected_value) {
+ echo "\n------ $name: -------\n";
+ $data = stream_get_meta_data($fd);
+ $data['wrapper_data']->return_value = $return_value;
+ $data['wrapper_data']->expected_option = $expected_option;
+ $data['wrapper_data']->expected_value = $expected_value;
+ var_dump(call_user_func_array($func, $args));
+}
+
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+var_dump(stream_wrapper_register('test2', 'test_wrapper_base'));
+
+$fd = fopen("test://foo","r");
+$fd2 = fopen("test2://foo","r");
+
+test("stream_set_blocking - 1", $fd, true, "stream_set_blocking", array($fd,0), STREAM_OPTION_BLOCKING, 0);
+test("stream_set_blocking - 2", $fd, false, "stream_set_blocking", array($fd,1), STREAM_OPTION_BLOCKING, 1);
+test("stream_set_blocking - 3", $fd, "foo", "stream_set_blocking", array($fd,0), STREAM_OPTION_BLOCKING, 0);
+test("stream_set_blocking - 4", $fd2, true, "stream_set_blocking", array($fd2,1), STREAM_OPTION_BLOCKING, 1);
+
+test("stream_set_write_buffer - 1", $fd, true, "stream_set_write_buffer", array($fd,0), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_NONE);
+test("stream_set_write_buffer - 2", $fd, true, "stream_set_write_buffer", array($fd,4096), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_FULL);
+test("stream_set_write_buffer - 3", $fd, false, "stream_set_write_buffer", array($fd,8192), STREAM_OPTION_WRITE_BUFFER, STREAM_BUFFER_FULL);
+
+test("stream_set_timeout - 1", $fd, true, "stream_set_timeout", array($fd,10,11), STREAM_OPTION_READ_TIMEOUT, 10);
+test("stream_set_timeout - 2", $fd, false, "stream_set_timeout", array($fd,11,12), STREAM_OPTION_READ_TIMEOUT, 11);
+
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+
+------ stream_set_blocking - 1: -------
+value:
+int(0)
+ptrparam:
+NULL
+$option === 1 === 1:
+bool(true)
+$value === 0 === 0:
+bool(true)
+bool(true)
+
+------ stream_set_blocking - 2: -------
+value:
+int(1)
+ptrparam:
+NULL
+$option === 1 === 1:
+bool(true)
+$value === 1 === 1:
+bool(true)
+bool(false)
+
+------ stream_set_blocking - 3: -------
+value:
+int(0)
+ptrparam:
+NULL
+$option === 1 === 1:
+bool(true)
+$value === 0 === 0:
+bool(true)
+bool(true)
+
+------ stream_set_blocking - 4: -------
+
+Warning: stream_set_blocking(): test_wrapper_base::stream_set_option is not implemented! in %s
+bool(false)
+
+------ stream_set_write_buffer - 1: -------
+value:
+int(0)
+ptrparam:
+int(%d)
+$option === 3 === 3:
+bool(true)
+$value === 0 === 0:
+bool(true)
+int(0)
+
+------ stream_set_write_buffer - 2: -------
+value:
+int(2)
+ptrparam:
+int(4096)
+$option === 3 === 3:
+bool(true)
+$value === 2 === 2:
+bool(true)
+int(0)
+
+------ stream_set_write_buffer - 3: -------
+value:
+int(2)
+ptrparam:
+int(8192)
+$option === 3 === 3:
+bool(true)
+$value === 2 === 2:
+bool(true)
+int(-1)
+
+------ stream_set_timeout - 1: -------
+value:
+int(10)
+ptrparam:
+int(11)
+$option === 4 === 4:
+bool(true)
+$value === 10 === 10:
+bool(true)
+bool(true)
+
+------ stream_set_timeout - 2: -------
+value:
+int(11)
+ptrparam:
+int(12)
+$option === 4 === 4:
+bool(true)
+$value === 11 === 11:
+bool(true)
+bool(false)
diff --git a/ext/standard/tests/file/userstreams_004.phpt b/ext/standard/tests/file/userstreams_004.phpt
new file mode 100644
index 0000000..da9f148
--- /dev/null
+++ b/ext/standard/tests/file/userstreams_004.phpt
@@ -0,0 +1,58 @@
+--TEST--
+User-space streams: stream_lock()
+--FILE--
+<?php
+class test_wrapper_base {
+ public $mode;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+}
+class test_wrapper extends test_wrapper_base {
+ function stream_lock($mode) {
+ $this->mode = $mode;
+ }
+}
+function test($name, $fd, $mode) {
+ echo "------ $name: -------\n";
+ flock($fd, $mode);
+ $data = stream_get_meta_data($fd);
+ var_dump($data['wrapper_data']->mode === $mode);
+}
+
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+var_dump(stream_wrapper_register('test2', 'test_wrapper_base'));
+
+$fd = fopen("test://foo","r");
+$fd2 = fopen("test2://foo","r");
+
+test("stream_lock not implemented", $fd2, LOCK_EX);
+
+foreach(array("LOCK_SH","LOCK_EX","LOCK_UN") as $mode) {
+ test("fclock($mode)", $fd, constant($mode));
+ test("fclock($mode|LOCK_NB)", $fd, constant($mode)|LOCK_NB);
+}
+
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+------ stream_lock not implemented: -------
+
+Warning: flock(): test_wrapper_base::stream_lock is not implemented! in %s
+bool(false)
+------ fclock(LOCK_SH): -------
+bool(true)
+------ fclock(LOCK_SH|LOCK_NB): -------
+bool(true)
+------ fclock(LOCK_EX): -------
+bool(true)
+------ fclock(LOCK_EX|LOCK_NB): -------
+bool(true)
+------ fclock(LOCK_UN): -------
+bool(true)
+------ fclock(LOCK_UN|LOCK_NB): -------
+bool(true)
diff --git a/ext/standard/tests/file/userstreams_005.phpt b/ext/standard/tests/file/userstreams_005.phpt
new file mode 100644
index 0000000..2d39be2
--- /dev/null
+++ b/ext/standard/tests/file/userstreams_005.phpt
@@ -0,0 +1,63 @@
+--TEST--
+User-space streams: stream_truncate()
+--FILE--
+<?php
+class test_wrapper_base {
+ public $mode;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+}
+class test_wrapper extends test_wrapper_base {
+ function stream_truncate($new_size) {
+ echo "truncation with new_size=$new_size\n";
+ return true;
+ }
+}
+class test_wrapper_bad extends test_wrapper_base {
+ function stream_truncate($new_size) {
+ echo "truncation with new_size=$new_size\n";
+ return "kkk";
+ }
+}
+function test($name, $fd, $dest_size) {
+ echo "------ $name: -------\n";
+ var_dump(ftruncate($fd, $dest_size));
+}
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+var_dump(stream_wrapper_register('test2', 'test_wrapper_base'));
+var_dump(stream_wrapper_register('test3', 'test_wrapper_bad'));
+
+$fd = fopen("test://foo","r");
+$fd2 = fopen("test2://foo","r");
+$fd3 = fopen("test3://foo","r");
+
+test("stream_truncate not implemented", $fd2, 0);
+test("stream_truncate size 0", $fd, 0);
+test("stream_truncate size 10", $fd, 10);
+test("stream_truncate negative size", $fd, -1);
+test("stream_truncate bad return", $fd3, 0);
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+------ stream_truncate not implemented: -------
+
+Warning: ftruncate(): Can't truncate this stream! in %s on line %d
+bool(false)
+------ stream_truncate size 0: -------
+truncation with new_size=0
+bool(true)
+------ stream_truncate size 10: -------
+truncation with new_size=10
+bool(true)
+------ stream_truncate negative size: -------
+bool(false)
+------ stream_truncate bad return: -------
+truncation with new_size=0
+
+Warning: ftruncate(): test_wrapper_bad::stream_truncate did not return a boolean! in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/file/userstreams_006.phpt b/ext/standard/tests/file/userstreams_006.phpt
new file mode 100644
index 0000000..69ebd8d
--- /dev/null
+++ b/ext/standard/tests/file/userstreams_006.phpt
@@ -0,0 +1,38 @@
+--TEST--
+User-space streams: set_options returns "not implemented" for unhandled option types
+--FILE--
+<?php
+class test_wrapper {
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+ function stream_write($data) {
+ echo "size: ", strlen($data), "\n";
+ return strlen($data);
+ }
+ function stream_set_option($option, $arg1, $arg2) {
+ echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
+ return false;
+ }
+}
+
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+
+$fd = fopen("test://foo","r");
+
+var_dump(stream_set_write_buffer($fd, 50));
+var_dump(stream_set_chunk_size($fd, 42));
+
+var_dump(fwrite($fd, str_repeat('0', 70)));
+
+--EXPECT--
+bool(true)
+option: 3, 2, 50
+int(-1)
+int(8192)
+size: 42
+size: 28
+int(70)
diff --git a/ext/standard/tests/file/userstreams_007.phpt b/ext/standard/tests/file/userstreams_007.phpt
new file mode 100644
index 0000000..3f66f18
--- /dev/null
+++ b/ext/standard/tests/file/userstreams_007.phpt
@@ -0,0 +1,49 @@
+--TEST--
+User-space streams: test metadata option
+--FILE--
+<?php
+class test_wrapper {
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ public function stream_metadata($path, $option, $var) {
+ echo "metadata: $path, $option\n";
+ if(is_array($var)) {
+ echo join(",", $var);
+ } else {
+ echo $var;
+ }
+ echo "\n";
+ return false;
+ }
+}
+
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+
+$fd = fopen("test://foo","r");
+touch("test://testdir/touch");
+touch("test://testdir/touch", 1);
+touch("test://testdir/touch", 1, 2);
+chown("test://testdir/chown", "test");
+chown("test://testdir/chown", 42);
+chgrp("test://testdir/chgrp", "test");
+chgrp("test://testdir/chgrp", 42);
+chmod("test://testdir/chmod", 0755);
+--EXPECT--
+bool(true)
+metadata: test://testdir/touch, 1
+
+metadata: test://testdir/touch, 1
+1,1
+metadata: test://testdir/touch, 1
+1,2
+metadata: test://testdir/chown, 2
+test
+metadata: test://testdir/chown, 3
+42
+metadata: test://testdir/chgrp, 4
+test
+metadata: test://testdir/chgrp, 5
+42
+metadata: test://testdir/chmod, 6
+493 \ No newline at end of file
diff --git a/ext/standard/tests/file/userwrapper.phpt b/ext/standard/tests/file/userwrapper.phpt
new file mode 100644
index 0000000..717e73c
--- /dev/null
+++ b/ext/standard/tests/file/userwrapper.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Userstream unlink, rename, mkdir, rmdir, and url_stat.
+--FILE--
+<?php # vim:ft=php:
+class test {
+ function unlink($file) {
+ print "Unlinking file: $file\n";
+ }
+
+ function rename($from, $to) {
+ print "Renaming $from to $to\n";
+ }
+
+ function mkdir($directory, $mode, $options) {
+ printf("Making directory: %s as %o%s\n", $directory, $mode, $options & STREAM_MKDIR_RECURSIVE ? " recursively" : "");
+ }
+
+ function rmdir($directory, $options) {
+ print "Removing directory: $directory\n";
+ }
+
+ function url_stat($path, $options) {
+ /* By printing out a notice that we are actively stating the file
+ then subsequently performing multiple stat operations on it
+ we effectively test the stat cache mechanism */
+ print "Stating file: $path\n";
+ return array('dev'=>1, 'ino'=>2, 'mode'=>0644, 'nlink'=>3,
+ 'uid'=>100, 'gid'=>1000, 'rdev'=>-1, 'size'=>31337,
+ 'atime'=>1234567890, 'mtime'=>1231231231, 'ctime'=>1234564564,
+ 'blksize'=>-1, 'blocks'=>-1);
+ }
+}
+
+stream_wrapper_register('test', 'test');
+
+unlink('test://example.com/path/to/file');
+rename('test://example.com/path/to/from', 'test://example.com/path/to/to');
+/* We *want* this to fail and thus not output the watch statement */
+@rename('test://example.com/path/to/from', 'http://example.com/path/to/to');
+mkdir('test://example.com/path/to/directory', 0755);
+rmdir('test://example.com/path/to/directory');
+print_r(stat('test://example.com/path/to/file'));
+echo "Filesize = " . filesize('test://example.com/path/to/file') . "\n";
+echo "filemtime = " . filemtime('test://example.com/path/to/file') . "\n";
+?>
+--EXPECT--
+Unlinking file: test://example.com/path/to/file
+Renaming test://example.com/path/to/from to test://example.com/path/to/to
+Making directory: test://example.com/path/to/directory as 755
+Removing directory: test://example.com/path/to/directory
+Stating file: test://example.com/path/to/file
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 420
+ [3] => 3
+ [4] => 100
+ [5] => 1000
+ [6] => -1
+ [7] => 31337
+ [8] => 1234567890
+ [9] => 1231231231
+ [10] => 1234564564
+ [11] => -1
+ [12] => -1
+ [dev] => 1
+ [ino] => 2
+ [mode] => 420
+ [nlink] => 3
+ [uid] => 100
+ [gid] => 1000
+ [rdev] => -1
+ [size] => 31337
+ [atime] => 1234567890
+ [mtime] => 1231231231
+ [ctime] => 1234564564
+ [blksize] => -1
+ [blocks] => -1
+)
+Filesize = 31337
+filemtime = 1231231231
+
diff --git a/ext/standard/tests/file/windows_acls/bug44859.phpt b/ext/standard/tests/file/windows_acls/bug44859.phpt
new file mode 100644
index 0000000..952b6eb
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/bug44859.phpt
@@ -0,0 +1,63 @@
+--TEST--
+bug #44859 (incorrect result with NTFS ACL permissions, is_writable)
+--SKIPIF--
+<?php
+include_once __DIR__ . '/common.inc';
+skipif();
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+fix_acls();
+
+$iteration = array(
+ PHPT_ACL_READ => false,
+ PHPT_ACL_NONE => false,
+ PHPT_ACL_WRITE => true,
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,
+);
+
+echo "Testing file:\n";
+$i = 1;
+$path = __DIR__ . '/a.txt';
+foreach ($iteration as $perms => $exp) {
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_writable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_writable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
+}
+
+echo "Testing directory:\n";
+$path = __DIR__ . '/adir';
+$i = 1;
+foreach ($iteration as $perms => $exp) {
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_writable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_writable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
+}
+
+?>
+--EXPECT--
+Testing file:
+Iteration #1: passed.
+Iteration #2: passed.
+Iteration #3: passed.
+Iteration #4: passed.
+Testing directory:
+Iteration #1: passed.
+Iteration #2: passed.
+Iteration #3: passed.
+Iteration #4: passed.
diff --git a/ext/standard/tests/file/windows_acls/bug44859_2.phpt b/ext/standard/tests/file/windows_acls/bug44859_2.phpt
new file mode 100644
index 0000000..d741156
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/bug44859_2.phpt
@@ -0,0 +1,63 @@
+--TEST--
+bug #44859 (incorrect result with NTFS ACL permissions, is_readable)
+--SKIPIF--
+<?php
+include_once __DIR__ . '/common.inc';
+skipif();
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+fix_acls();
+
+$iteration = array(
+ PHPT_ACL_READ => true,
+ PHPT_ACL_NONE => false,
+ PHPT_ACL_WRITE => false,
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,
+);
+
+echo "Testing file:\n";
+$i = 1;
+$path = __DIR__ . '/a.txt';
+foreach ($iteration as $perms => $exp) {
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
+}
+
+echo "Testing directory:\n";
+$path = __DIR__ . '/adir';
+$i = 1;
+foreach ($iteration as $perms => $exp) {
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
+}
+
+?>
+--EXPECT--
+Testing file:
+Iteration #1: passed.
+Iteration #2: passed.
+Iteration #3: passed.
+Iteration #4: passed.
+Testing directory:
+Iteration #1: passed.
+Iteration #2: passed.
+Iteration #3: passed.
+Iteration #4: passed.
diff --git a/ext/standard/tests/file/windows_acls/bug44859_3.phpt b/ext/standard/tests/file/windows_acls/bug44859_3.phpt
new file mode 100644
index 0000000..ed57abb
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/bug44859_3.phpt
@@ -0,0 +1,37 @@
+--TEST--
+bug #44859 (incorrect result with NTFS ACL permissions, is_executable)
+--SKIPIF--
+<?php
+include_once __DIR__ . '/common.inc';
+skipif();
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+fix_acls();
+
+$iteration = array(
+ 'tiny.exe' => true,
+ //'tiny.bat' => true, To be fixed in _access
+ __FILE__ => false
+);
+
+$i = 1;
+$path = __DIR__;
+
+foreach ($iteration as $file => $exp) {
+ $path = __DIR__ . '/' . $file;
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_executable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_executable($path), $exp);
+ echo "failed.\n";
+ }
+}
+
+
+?>
+--EXPECT--
+Iteration #1: passed.
+Iteration #2: passed.
diff --git a/ext/standard/tests/file/windows_acls/bug44859_4.phpt b/ext/standard/tests/file/windows_acls/bug44859_4.phpt
new file mode 100644
index 0000000..954c100
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/bug44859_4.phpt
@@ -0,0 +1,65 @@
+--TEST--
+bug #44859 (incorrect result with NTFS ACL permissions, is_readable)
+--CREDITS--
+Venkat Raman Don
+--SKIPIF--
+<?php
+include_once __DIR__ . '/common.inc';
+skipif();
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+fix_acls();
+
+$iteration = array(
+ PHPT_ACL_READ => true,
+ PHPT_ACL_NONE => false,
+ PHPT_ACL_WRITE => false,
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,
+);
+
+echo "Testing file with relative path:\n";
+$i = 1;
+$path = './a.txt';
+foreach ($iteration as $perms => $exp) {
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
+}
+
+echo "Testing directory with relative path:\n";
+$path = 'adir';
+$i = 1;
+foreach ($iteration as $perms => $exp) {
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
+}
+
+?>
+--EXPECT--
+Testing file with relative path:
+Iteration #1: passed.
+Iteration #2: passed.
+Iteration #3: passed.
+Iteration #4: passed.
+Testing directory with relative path:
+Iteration #1: passed.
+Iteration #2: passed.
+Iteration #3: passed.
+Iteration #4: passed.
diff --git a/ext/standard/tests/file/windows_acls/common.inc b/ext/standard/tests/file/windows_acls/common.inc
new file mode 100644
index 0000000..26fadf3
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/common.inc
@@ -0,0 +1,199 @@
+<?php
+error_reporting(E_ALL);
+define('PHPT_ACL_READ', 1 << 1);
+define('PHPT_ACL_WRITE', 1 << 2);
+define('PHPT_ACL_EXEC', 1 << 3);
+define('PHPT_ACL_NONE', 1 << 4);
+define('PHPT_ACL_FULL', 1 << 5);
+
+define('PHPT_ACL_GRANT', 1);
+define('PHPT_ACL_DENY', 2);
+
+function skipif() {
+ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+ }
+ if(stripos(php_uname(), 'XP') !== FALSE) {
+ die('skip windows 2003 or newer only test');
+ }
+}
+
+function get_username(){
+ $user = getenv('USERNAME');
+
+ if (!$user) {
+ $user = get_current_user();
+ }
+
+ if (!$user) {
+ $user = exec('echo %USERNAME%');
+ }
+
+ return $user;
+}
+
+function get_domainname()
+{
+ $domain = getenv('USERDOMAIN');
+
+ return $domain;
+}
+
+function get_icacls()
+{
+ $sysroot = exec('echo %SYSTEMROOT%');
+
+ return "$sysroot\\System32\\icacls.exe";
+}
+
+function fix_acls() {
+ $user = get_username();
+ /* Current user needs to be owner of the test files. As well
+ all the other users having acls on the files must loose them.
+ The following fixes this just partially, as dynamically reading
+ all the users having acls on a file could be sophisticated. */
+ exec(get_icacls() . ' . /setowner $user /T /L /Q 2> nul');
+ exec(get_icacls() . ' . /remove:g Administrators /T /L /Q 2> nul');
+}
+
+function icacls_set($path, $mode, $perm) {
+ $icacls = get_icacls();
+ $user = get_username();
+ $path_escaped = '"' . $path . '"';
+ $perm_entry = array();
+
+ if ($perm & PHPT_ACL_READ) $perm_entry[] = 'R';
+ if ($perm & PHPT_ACL_WRITE) $perm_entry[] = 'W';
+ if ($perm & PHPT_ACL_EXEC) $perm_entry[] = 'RX';
+ if ($perm & PHPT_ACL_FULL) $perm_entry[] = 'F';
+
+ // Deny all
+ $cmd = $icacls . ' ' . $path_escaped . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)';
+ exec($cmd);
+
+ if ($perm & PHPT_ACL_NONE) {
+ /*
+ This is required to remove all the previously denied
+ permission for the USER. Just granting permission doesn't
+ remove the previously denied permission.
+ */
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
+ exec($cmd);
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
+ exec($cmd);
+ return;
+ }
+
+ if ($mode == PHPT_ACL_GRANT) {
+ $mode = 'grant';
+ } else {
+ $mode = 'deny';
+ }
+
+
+ // Deny all
+ $cmd = $icacls . ' ' . $path_escaped . ' /deny ' . $user . ':(F,M,R,RX,W)';
+ exec($cmd);
+
+ /*
+ This is required to remove all the previously denied
+ permission for the USER. Just granting permission doesn't
+ remove the previously denied permission.
+ */
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
+ exec($cmd);
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
+ exec($cmd);
+
+
+ /*
+ Required to set no permission and check that is_readable()
+ returns false. If the $perm_entry contains 'N' skip this step.
+ This will make the file/dir with NO aceess.
+ */
+ if (!in_array('N', $perm_entry)) {
+ /*
+ This is required to remove all the previously denied
+ permission for the USER. Just granting permission doesn't
+ remove the previously denied permission.
+ */
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
+ exec($cmd);
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
+ exec($cmd);
+
+ $cmd = $icacls . ' ' . $path_escaped . ' /' . $mode . ' ' . $user;
+ $cmd .= ':' . '(' . implode($perm_entry, ',') . ')';
+ exec($cmd);
+ }
+}
+
+function create_dir($name, $perms) {
+ if (empty($name)) {
+ echo "create_dir: Empty name is not allowed\n";
+ return;
+ }
+
+ mkdir($name);
+ $dst = realpath($name);
+ icacls_set($name, PHPT_ACL_GRANT, $perms);
+}
+
+function create_file($name, $perms) {
+ if (empty($name)) {
+ echo "create_file: Empty name is not allowed\n";
+ return;
+ }
+
+ touch($name);
+ icacls_set($name, PHPT_ACL_GRANT, $perms);
+}
+
+function delete_file($path) {
+ icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL);
+ if (is_file($path)) {
+ unlink($path);
+ } else {
+ echo "delete_file: '$path' is not a file\n";
+ return;
+ }
+}
+
+function delete_dir($path) {
+ if (is_dir($path)) {
+ icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL);
+ rmdir($path);
+ } else {
+ echo "delete_dir: '$path' is not a directory\n";
+ return;
+ }
+}
+if (0) {
+$path = __DIR__ . '/a.txt';
+create_file($path, PHPT_ACL_NONE);
+if (!is_writable($path)) {
+ echo "PHPT_ACL_NONE success!!\n";
+} else {
+ echo "PHPT_ACL_NONE failed!!\n";
+}
+delete_file($path);
+
+$path = __DIR__ . '/a.txt';
+create_file($path, PHPT_ACL_READ);
+if (!is_writable($path)) {
+ echo "PHPT_ACL_READ success!!\n";
+} else {
+ echo "PHPT_ACL_READ failed!!\n";
+}
+delete_file($path);
+
+$path = __DIR__ . '/adir';
+create_dir($path, PHPT_ACL_READ);
+if (!is_writable($path)) {
+ echo "PHPT_ACL_READ dir success!!\n";
+} else {
+ echo "PHPT_ACL_READ dir failed!!\n";
+}
+delete_dir($path);
+
+}
diff --git a/ext/standard/tests/file/windows_acls/tiny.bat b/ext/standard/tests/file/windows_acls/tiny.bat
new file mode 100644
index 0000000..c5464d3
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/tiny.bat
@@ -0,0 +1 @@
+echo FOO
diff --git a/ext/standard/tests/file/windows_acls/tiny.exe b/ext/standard/tests/file/windows_acls/tiny.exe
new file mode 100644
index 0000000..a27e3e6
--- /dev/null
+++ b/ext/standard/tests/file/windows_acls/tiny.exe
Binary files differ
diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt b/ext/standard/tests/file/windows_links/bug48746.phpt
new file mode 100644
index 0000000..5978e7f
--- /dev/null
+++ b/ext/standard/tests/file/windows_links/bug48746.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
+$ret = @exec($cmd, $output, $return_val);
+if (count($output) == 0) {
+ die("mklink.exe not found in PATH");
+}
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+mkdir($dirname, 0700, true);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+var_dump(file_exists("directory"));
+var_dump(file_exists("mklink_junction"));
+var_dump(file_exists("mounted_volume"));
+var_dump(file_exists("$fullpath"));
+var_dump(is_dir("mklink_junction"));
+var_dump(is_dir("$fullpath"));
+var_dump(is_readable("mklink_junction"));
+var_dump(is_writeable("$fullpath"));
+chdir($old_dir);
+
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/windows_links/bug48746_1.phpt b/ext/standard/tests/file/windows_links/bug48746_1.phpt
new file mode 100644
index 0000000..a4277a4
--- /dev/null
+++ b/ext/standard/tests/file/windows_links/bug48746_1.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
+$ret = @exec($cmd, $output, $return_val);
+if (count($output) == 0) {
+ die("mklink.exe not found in PATH");
+}
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+include_once "mklink_junction\\a.php";
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
+require "$fullpath\\mnt\\test\\directory\\b.php";
+file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "<?php echo \"I am included.\n\" ?>");
+require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
+var_dump(is_file("mklink_junction\\a.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+I am included.
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/windows_links/bug48746_2.phpt b/ext/standard/tests/file/windows_links/bug48746_2.phpt
new file mode 100644
index 0000000..509610f
--- /dev/null
+++ b/ext/standard/tests/file/windows_links/bug48746_2.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
+if (strpos($ret, 'privilege')) {
+ die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
+}
+unlink('bug48746_tmp.lnk');
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+$drive = substr(__DIR__, 0, 2);
+$pathwithoutdrive = substr(__DIR__, 2);
+$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
+exec("mklink /j mounted_volume " . $ret, $output, $ret_val);
+$fullpath = "mounted_volume" . $pathwithoutdrive;
+exec("mklink /j mklink_junction directory", $output, $ret_val);
+file_put_contents("mklink_junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "<?php echo \"I am included.\n\" ?>");
+print_r(scandir("mklink_junction"));
+print_r(scandir("$fullpath\\mnt\\test\\directory"));
+print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
diff --git a/ext/standard/tests/file/windows_links/bug48746_3.phpt b/ext/standard/tests/file/windows_links/bug48746_3.phpt
new file mode 100644
index 0000000..98e8178
--- /dev/null
+++ b/ext/standard/tests/file/windows_links/bug48746_3.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDITS--
+Venkat Raman Don (don.raman@microsoft.com)
+
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+include_once __DIR__ . '/common.inc';
+$ret = exec(get_junction().' /? 2>&1', $out);
+if (strpos($out[0], 'recognized')) {
+ die('skip. junction.exe not found in PATH.');
+}
+
+?>
+--FILE--
+<?php
+include_once __DIR__ . '/common.inc';
+$old_dir = __DIR__;
+$dirname = __DIR__ . "\\mnt\\test\\directory";
+exec("mkdir " . $dirname, $output, $ret_val);
+chdir(__DIR__ . "\\mnt\\test");
+exec(get_junction()." junction directory", $output, $ret_val);
+file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
+file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
+include "junction/a.php";
+require_once "junction\\b.php";
+print_r(scandir("junction"));
+unlink("junction\\a.php");
+unlink("junction\\b.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\junction");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+Array
+(
+ [0] => .
+ [1] => ..
+ [2] => a.php
+ [3] => b.php
+)
diff --git a/ext/standard/tests/file/windows_links/common.inc b/ext/standard/tests/file/windows_links/common.inc
new file mode 100644
index 0000000..2d4b47c
--- /dev/null
+++ b/ext/standard/tests/file/windows_links/common.inc
@@ -0,0 +1,23 @@
+<?php
+
+function get_sysroot() {
+ // usually c:\\windows, but not always
+ return exec('echo %SYSTEMROOT%');
+}
+
+function get_junction(){
+ // junction.exe isn't included with Windows
+ // its a sysinternals tool for working with filesystem links
+ // see: http://technet.microsoft.com/en-us/sysinternals/bb896768
+
+ // install somewhere that is on %path% or added to %path%
+ return "junction.exe";
+}
+
+function get_mountvol() {
+ $sysroot = get_sysroot();
+
+ return "$sysroot\\System32\\mountvol.exe";
+}
+
+?>
diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt
new file mode 100644
index 0000000..afbcdcf
--- /dev/null
+++ b/ext/standard/tests/filters/001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+stream_filter_register() and invalid arguments
+--FILE--
+<?php
+
+var_dump(stream_filter_register("", ""));
+var_dump(stream_filter_register("test", ""));
+var_dump(stream_filter_register("", "test"));
+var_dump(stream_filter_register("------", "nonexistentclass"));
+var_dump(stream_filter_register(array(), "aa"));
+var_dump(stream_filter_register("", array()));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d
+bool(false)
+
+Warning: stream_filter_register(): Class name cannot be empty in %s on line %d
+bool(false)
+
+Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d
+bool(false)
+bool(true)
+
+Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/filters/basic.phpt b/ext/standard/tests/filters/basic.phpt
new file mode 100644
index 0000000..13a79e2
--- /dev/null
+++ b/ext/standard/tests/filters/basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+basic stream filter tests
+--FILE--
+<?php
+# vim600:syn=php:
+
+$text = "Hello There!";
+$filters = array("string.rot13", "string.toupper", "string.tolower");
+
+function filter_test($names)
+{
+ $fp = tmpfile();
+ fwrite($fp, $GLOBALS["text"]);
+ rewind($fp);
+ foreach ($names as $name) {
+ echo "filter: $name\n";
+ var_dump(stream_filter_prepend($fp, $name));
+ }
+ var_dump(fgets($fp));
+ fclose($fp);
+}
+
+foreach ($filters as $filter) {
+ filter_test(array($filter));
+}
+
+filter_test(array($filters[0], $filters[1]));
+
+?>
+--EXPECTF--
+filter: string.rot13
+resource(%d) of type (stream filter)
+string(12) "Uryyb Gurer!"
+filter: string.toupper
+resource(%d) of type (stream filter)
+string(12) "HELLO THERE!"
+filter: string.tolower
+resource(%d) of type (stream filter)
+string(12) "hello there!"
+filter: string.rot13
+resource(%d) of type (stream filter)
+filter: string.toupper
+resource(%d) of type (stream filter)
+string(12) "URYYB GURER!"
diff --git a/ext/standard/tests/filters/bug22538.phpt b/ext/standard/tests/filters/bug22538.phpt
new file mode 100644
index 0000000..438b5be
--- /dev/null
+++ b/ext/standard/tests/filters/bug22538.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Bug #22538 (filtered stream doesn't update file pointer)
+--FILE--
+<?php
+function my_stream_copy_to_stream($fin, $fout) {
+ while (!feof($fin)) {
+ fwrite($fout, fread($fin, 4096));
+ }
+}
+
+$size = 65536;
+
+do {
+ $path1 = sprintf("%s/%s%da", dirname(__FILE__), uniqid(), time());
+ $path2 = sprintf("%s/%s%db", dirname(__FILE__), uniqid(), time());
+} while ($path1 == $path2);
+
+$fp = fopen($path1, "w") or die("Can not open $path1\n");
+$str = "abcdefghijklmnopqrstuvwxyz\n";
+$str_len = strlen($str);
+$cnt = $size;
+while (($cnt -= $str_len) > 0) {
+ fwrite($fp, $str);
+}
+$cnt = $size - ($str_len + $cnt);
+fclose($fp);
+$fin = fopen($path1, "r") or die("Can not open $path1\n");;
+$fout = fopen($path2, "w") or die("Can not open $path2\n");;
+stream_filter_append($fout, "string.rot13");
+my_stream_copy_to_stream($fin, $fout);
+fclose($fout);
+fclose($fin);
+var_dump($cnt);
+var_dump(filesize($path2));
+var_dump(md5_file($path1));
+var_dump(md5_file($path2));
+unlink($path1);
+unlink($path2);
+?>
+--EXPECT--
+int(65529)
+int(65529)
+string(32) "e10e3d1ae81b084b822e8592d019b57a"
+string(32) "931f0fbf8a72312e3bab9965b1d1081c"
diff --git a/ext/standard/tests/filters/bug35916.phpt b/ext/standard/tests/filters/bug35916.phpt
new file mode 100644
index 0000000..4d2027d
--- /dev/null
+++ b/ext/standard/tests/filters/bug35916.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #35916 (Duplicate calls to stream_bucket_append() lead to a crash)
+--FILE--
+<?php
+$file = dirname(__FILE__) . "/bug35916.txt";
+@unlink($file);
+
+class strtoupper_filter extends php_user_filter
+{
+ function filter($in, $out, &$consumed, $closing)
+ {
+ while($bucket=stream_bucket_make_writeable($in)) {
+ $bucket->data = strtoupper($bucket->data);
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_PASS_ON;
+ }
+ function onCreate()
+ {
+ echo "fffffffffff\n";
+ }
+ function onClose()
+ {
+ echo "hello\n";
+ }
+}
+
+stream_filter_register("strtoupper", "strtoupper_filter");
+$fp=fopen($file, "w");
+stream_filter_append($fp, "strtoupper");
+fread($fp, 1024);
+fwrite($fp, "Thank you\n");
+fclose($fp);
+readfile($file);
+unlink($file);
+?>
+--EXPECT--
+fffffffffff
+hello
+THANK YOU
diff --git a/ext/standard/tests/filters/bug46164-1.phpt b/ext/standard/tests/filters/bug46164-1.phpt
new file mode 100644
index 0000000..b2d2d4e
--- /dev/null
+++ b/ext/standard/tests/filters/bug46164-1.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #46164 - 1 (stream_filter_remove() closes the stream)
+--FILE--
+<?php
+class user_filter extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ while($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_PASS_ON;
+ }
+}
+stream_filter_register('user_filter','user_filter');
+
+$fd = fopen('php://memory','w');
+$filter = stream_filter_append($fd, 'user_filter');
+stream_filter_remove($filter);
+var_dump(fclose($fd));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/filters/bug46164-2.phpt b/ext/standard/tests/filters/bug46164-2.phpt
new file mode 100644
index 0000000..6a1bde5
--- /dev/null
+++ b/ext/standard/tests/filters/bug46164-2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #46164 - 2 (stream_filter_remove() closes the stream)
+--FILE--
+<?php
+class user_filter extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ while($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ unset($this->stream);
+ return PSFS_PASS_ON;
+ }
+}
+stream_filter_register('user_filter','user_filter');
+
+$fd = fopen('php://memory','w');
+$filter = stream_filter_append($fd, 'user_filter');
+fwrite($fd, "foo");
+fflush($fd);
+var_dump(fclose($fd));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/filters/bug50363.phpt b/ext/standard/tests/filters/bug50363.phpt
new file mode 100644
index 0000000..3395ede
--- /dev/null
+++ b/ext/standard/tests/filters/bug50363.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #50363 (Invalid parsing in convert.quoted-printable-decode filter)
+--FILE--
+<?php
+
+$foo = "Sauvegarder=C3=A9ussi(e) n=C3=A3o N=C3=83O\n";
+$foo .= "Sauvegarder=c3=a9ussi(e) n=c3=a3o N=c3=83O\n"; // Does not work!
+$b = fopen('php://temp', 'w+');
+stream_filter_append($b, 'convert.quoted-printable-decode', STREAM_FILTER_WRITE);
+fwrite($b, $foo);
+rewind($b);
+fpassthru($b);
+
+?>
+--EXPECTF--
+Sauvegarderéussi(e) não NÃO
+Sauvegarderéussi(e) não NÃO
diff --git a/ext/standard/tests/filters/chunked_001.phpt b/ext/standard/tests/filters/chunked_001.phpt
new file mode 100644
index 0000000..0e0f645
--- /dev/null
+++ b/ext/standard/tests/filters/chunked_001.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Chunked encoding
+--SKIPIF--
+<?php
+$filters = stream_get_filters();
+if(! in_array( "dechunk", $filters )) die( "chunked filter not available." );
+?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+$streams = array(
+ "data://text/plain,0\r\n",
+ "data://text/plain,2\r\nte\r\n2\r\nst\r\n0\r\n",
+ "data://text/plain,2\nte\n2\nst\n0\n",
+ "data://text/plain,2;a=1\nte\n2;a=2;b=3\r\nst\n0\n",
+ "data://text/plain,2\nte\n2\nst\n0\na=b\r\nc=d\n\r\n",
+ "data://text/plain,1f\n0123456789abcdef0123456789abcde\n1\nf\n0\n",
+ "data://text/plain,1E\n0123456789abcdef0123456789abcd\n2\nef\n0\n",
+);
+foreach ($streams as $name) {
+ $fp = fopen($name, "r");
+ stream_filter_append($fp, "dechunk", STREAM_FILTER_READ);
+ var_dump(stream_get_contents($fp));
+ fclose($fp);
+}
+?>
+--EXPECT--
+string(0) ""
+string(4) "test"
+string(4) "test"
+string(4) "test"
+string(4) "test"
+string(32) "0123456789abcdef0123456789abcdef"
+string(32) "0123456789abcdef0123456789abcdef"
diff --git a/ext/standard/tests/filters/filter_errors.inc b/ext/standard/tests/filters/filter_errors.inc
new file mode 100644
index 0000000..7345df3
--- /dev/null
+++ b/ext/standard/tests/filters/filter_errors.inc
@@ -0,0 +1,37 @@
+<?php
+
+function filter_errors_skipif($needle) {
+ if (!function_exists('fnmatch')) {
+ die('skip fnmatch() not available');
+ }
+ $filters = stream_get_filters();
+ foreach($filters as $filter) {
+ if (fnmatch($filter, $needle)) return;
+ }
+ die("skip $needle not available");
+}
+
+function filter_errors_test($filter, $data) {
+
+ echo "test filtering of buffered data\n";
+
+ $stream = fopen('php://memory', 'wb+');
+
+ fwrite($stream, b".\r\n$data");
+ fseek($stream, 0, SEEK_SET);
+ stream_get_line($stream, 8192, "\r\n");
+
+ $f = stream_filter_append($stream, $filter);
+
+ echo "test filtering of non buffered data\n";
+
+ $stream = fopen('php://memory', 'wb+');
+
+ fwrite($stream, b"$data");
+ fseek($stream, 0, SEEK_SET);
+
+ stream_filter_append($stream, $filter);
+ stream_get_contents($stream);
+
+}
+
diff --git a/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt b/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt
new file mode 100644
index 0000000..4c043be
--- /dev/null
+++ b/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Filter errors: convert.base64-decode
+--SKIPIF--
+<?php require 'filter_errors.inc'; filter_errors_skipif('convert.base64-decode'); ?>
+--FILE--
+<?php
+require 'filter_errors.inc';
+filter_errors_test('convert.base64-decode', '===');
+?>
+--EXPECTF--
+test filtering of buffered data
+
+Warning: stream_filter_append(): stream filter (convert.base64-decode): invalid byte sequence in %s
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
+
+Warning: stream_get_contents(): stream filter (convert.base64-decode): invalid byte sequence in %s
diff --git a/ext/standard/tests/filters/filter_errors_user.phpt b/ext/standard/tests/filters/filter_errors_user.phpt
new file mode 100644
index 0000000..7bdf8de
--- /dev/null
+++ b/ext/standard/tests/filters/filter_errors_user.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Filter errors: user filter
+--FILE--
+<?php
+require 'filter_errors.inc';
+
+class test_filter0 extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ return PSFS_ERR_FATAL;
+ }
+}
+class test_filter1 extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ $bucket = stream_bucket_make_writeable($in);
+ return PSFS_ERR_FATAL;
+ }
+}
+class test_filter2 extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_ERR_FATAL;
+ }
+}
+class test_filter3 extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ if (!$closing) {
+ $bucket = stream_bucket_new($this->stream, "42");
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_ERR_FATAL;
+ }
+}
+class test_filter4 extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {
+ if (!$closing) {
+ $bucket = stream_bucket_new($this->stream, "42");
+ }
+ return PSFS_ERR_FATAL;
+ }
+}
+
+for($i = 0; $i < 5; ++$i) {
+ echo "test_filter$i\n";
+ var_dump(stream_filter_register("test_filter$i", "test_filter$i"));
+ filter_errors_test("test_filter$i", "42");
+}
+
+echo "test append / read / remove\n";
+for($i = 0; $i < 5; ++$i) {
+ echo "test_filter$i\n";
+ $stream = fopen('php://memory', 'wb+');
+ fwrite($stream, b"42");
+ fseek($stream, 0, SEEK_SET);
+ $f = stream_filter_append($stream, "test_filter$i");
+ stream_get_contents($stream);
+ stream_filter_remove($f);
+}
+
+echo "test append all / read / remove all\n";
+$stream = fopen('php://memory', 'wb+');
+fwrite($stream, b"42");
+fseek($stream, 0, SEEK_SET);
+$filters = array();
+for($i = 0; $i < 5; ++$i) {
+ echo "test_filter$i\n";
+ $filters[] = stream_filter_append($stream, "test_filter$i");
+}
+stream_get_contents($stream);
+foreach($filters as $filter) {
+ stream_filter_remove($filter);
+}
+
+echo "test append all / read / close\n";
+$stream = fopen('php://memory', 'wb+');
+fwrite($stream, b"42");
+fseek($stream, 0, SEEK_SET);
+$filters = array();
+for($i = 0; $i < 5; ++$i) {
+ echo "test_filter$i\n";
+ $filters[] = stream_filter_append($stream, "test_filter$i");
+}
+stream_get_contents($stream);
+fclose($stream);
+
+?>
+--EXPECTF--
+test_filter0
+bool(true)
+test filtering of buffered data
+
+Warning: stream_filter_append(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+test_filter1
+bool(true)
+test filtering of buffered data
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
+test_filter2
+bool(true)
+test filtering of buffered data
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
+test_filter3
+bool(true)
+test filtering of buffered data
+
+Warning: stream_filter_append(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+test_filter4
+bool(true)
+test filtering of buffered data
+
+Warning: stream_filter_append(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+test append / read / remove
+test_filter0
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+test_filter1
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+test_filter2
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+test_filter3
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+test_filter4
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+test append all / read / remove all
+test_filter0
+test_filter1
+test_filter2
+test_filter3
+test_filter4
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+
+Warning: stream_filter_remove(): Unable to flush filter, not removing in %s
+test append all / read / close
+test_filter0
+test_filter1
+test_filter2
+test_filter3
+test_filter4
+
+Warning: stream_get_contents(): Unprocessed filter buckets remaining on input brigade in %s
diff --git a/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt b/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt
new file mode 100644
index 0000000..ebb3b21
--- /dev/null
+++ b/ext/standard/tests/filters/filter_errors_zlib_inflate.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Filter errors: zlib.inflate
+--SKIPIF--
+<?php require 'filter_errors.inc'; filter_errors_skipif('zlib.inflate'); ?>
+--FILE--
+<?php
+require 'filter_errors.inc';
+filter_errors_test('zlib.inflate', gzencode(b'42'));
+?>
+--EXPECTF--
+test filtering of buffered data
+
+Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
+test filtering of non buffered data
diff --git a/ext/standard/tests/filters/php_user_filter_01.phpt b/ext/standard/tests/filters/php_user_filter_01.phpt
new file mode 100644
index 0000000..e4a9c68
--- /dev/null
+++ b/ext/standard/tests/filters/php_user_filter_01.phpt
@@ -0,0 +1,17 @@
+--TEST--
+class php_user_filter#1
+--FILE--
+<?php
+class foo extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {}
+ function onCreate() {}
+ function onClose() {}
+}
+class bar extends php_user_filter {
+ function filter($in, $out, &$consumed) {}
+ function onCreate() {}
+ function onClose() {}
+}
+?>
+--EXPECTF--
+Strict Standards: Declaration of bar::filter() should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_02.phpt b/ext/standard/tests/filters/php_user_filter_02.phpt
new file mode 100644
index 0000000..2a1dbfd
--- /dev/null
+++ b/ext/standard/tests/filters/php_user_filter_02.phpt
@@ -0,0 +1,12 @@
+--TEST--
+class php_user_filter#2
+--FILE--
+<?php
+class foo extends php_user_filter {
+ function filter($in, $out, $consumed, $closing) {}
+ function onCreate() {}
+ function onClose() {}
+}
+?>
+--EXPECTF--
+Strict Standards: Declaration of foo::filter() should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_03.phpt b/ext/standard/tests/filters/php_user_filter_03.phpt
new file mode 100644
index 0000000..e9e0266
--- /dev/null
+++ b/ext/standard/tests/filters/php_user_filter_03.phpt
@@ -0,0 +1,12 @@
+--TEST--
+class php_user_filter#3
+--FILE--
+<?php
+class foo extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing) {}
+ function onCreate($var) {}
+ function onClose() {}
+}
+?>
+--EXPECTF--
+Strict Standards: Declaration of foo::onCreate() should be compatible with php_user_filter::onCreate() in %s on line %d
diff --git a/ext/standard/tests/filters/read.phpt b/ext/standard/tests/filters/read.phpt
new file mode 100644
index 0000000..a2372cf
--- /dev/null
+++ b/ext/standard/tests/filters/read.phpt
@@ -0,0 +1,72 @@
+--TEST--
+stream filter - reading
+--FILE--
+<?php
+echo "-TEST\n";
+class filter extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing)
+ {
+ $output = 0;
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $bucket->data = strtoupper($bucket->data);
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ $output = 1;
+ }
+ if ($closing) {
+ $bucket = stream_bucket_new($this->stream, "\n===close===\n");
+ stream_bucket_append($out, $bucket);
+ $output = 1;
+ }
+ return $output ? PSFS_PASS_ON : PSFS_FEED_ME;
+ }
+}
+stream_filter_register("strtoupper", "filter")
+ or die("Failed to register filter");
+
+if ($f = fopen(__FILE__, "rb")) {
+ stream_filter_append($f, "strtoupper");
+ while (!feof($f)) {
+ echo fread($f, 8192);
+ }
+ fclose($f);
+}
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+<?PHP
+ECHO "-TEST\N";
+CLASS FILTER EXTENDS PHP_USER_FILTER {
+ FUNCTION FILTER($IN, $OUT, &$CONSUMED, $CLOSING)
+ {
+ $OUTPUT = 0;
+ WHILE ($BUCKET = STREAM_BUCKET_MAKE_WRITEABLE($IN)) {
+ $BUCKET->DATA = STRTOUPPER($BUCKET->DATA);
+ $CONSUMED += $BUCKET->DATALEN;
+ STREAM_BUCKET_APPEND($OUT, $BUCKET);
+ $OUTPUT = 1;
+ }
+ IF ($CLOSING) {
+ $BUCKET = STREAM_BUCKET_NEW($THIS->STREAM, "\N===CLOSE===\N");
+ STREAM_BUCKET_APPEND($OUT, $BUCKET);
+ $OUTPUT = 1;
+ }
+ RETURN $OUTPUT ? PSFS_PASS_ON : PSFS_FEED_ME;
+ }
+}
+STREAM_FILTER_REGISTER("STRTOUPPER", "FILTER")
+ OR DIE("FAILED TO REGISTER FILTER");
+
+IF ($F = FOPEN(__FILE__, "RB")) {
+ STREAM_FILTER_APPEND($F, "STRTOUPPER");
+ WHILE (!FEOF($F)) {
+ ECHO FREAD($F, 8192);
+ }
+ FCLOSE($F);
+}
+ECHO "DONE\N";
+?>
+
+===close===
+Done
diff --git a/ext/standard/tests/filters/stream_filter_remove_basic.phpt b/ext/standard/tests/filters/stream_filter_remove_basic.phpt
new file mode 100644
index 0000000..6ca84fe
--- /dev/null
+++ b/ext/standard/tests/filters/stream_filter_remove_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test stream_filter_remove() function : basic functionality
+--SKIPIF--
+<?php
+$filters = stream_get_filters();
+if(! in_array( "string.rot13", $filters )) die( "skip rot13 filter not available." );
+?>
+--FILE--
+<?php
+/* Prototype : bool stream_filter_remove(resource stream_filter)
+ * Description: Flushes any data in the filter's internal buffer, removes it from the chain, and frees the resource
+ * Source code: ext/standard/streamsfuncs.c
+ * Alias to functions:
+ */
+
+echo "*** Testing stream_filter_remove() : basic functionality ***\n";
+
+$file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
+touch( $file );
+
+$fp = fopen( $file, 'w+' );
+
+$filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE );
+fwrite( $fp, "Testing the rot13 filter which shifts some things around." );
+
+var_dump( stream_filter_remove( $filter ) );
+fwrite( $fp, "\nadd some more un-filtered foobar\n" );
+
+rewind( $fp );
+fpassthru( $fp );
+fclose( $fp );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
+unlink( $file );
+
+?>
+--EXPECTF--
+*** Testing stream_filter_remove() : basic functionality ***
+bool(true)
+Grfgvat gur ebg13 svygre juvpu fuvsgf fbzr guvatf nebhaq.
+add some more un-filtered foobar
+===DONE===
diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt
new file mode 100644
index 0000000..9cbb925
--- /dev/null
+++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test stream_filter_remove() function : error conditions
+--SKIPIF--
+<?php
+$filters = stream_get_filters();
+if(! in_array( "string.rot13", $filters )) die( "skip rot13 filter not available." );
+?>
+--FILE--
+<?php
+/* Prototype : bool stream_filter_remove(resource stream_filter)
+ * Description: Flushes any data in the filter's internal buffer, removes it from the chain, and frees the resource
+ * Source code: ext/standard/streamsfuncs.c
+ * Alias to functions:
+ */
+
+$file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
+touch( $file );
+$fp = fopen( $file, 'w+' );
+$filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE );
+
+echo "*** Testing stream_filter_remove() : error conditions ***\n";
+
+echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n";
+var_dump( stream_filter_remove() );
+
+echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n";
+$arg = 'bogus arg';
+var_dump( stream_filter_remove( $filter, $arg ) );
+
+echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n";
+var_dump( stream_filter_remove( "fakefilter" ) );
+
+echo "\n-- Testing stream_filter_remove() function with bad resource --\n";
+var_dump( stream_filter_remove( $fp ) );
+
+echo "\n-- Testing stream_filter_remove() function with an already removed filter --\n";
+// Double remove it
+var_dump( stream_filter_remove( $filter ) );
+var_dump( stream_filter_remove( $filter ) );
+
+fclose( $fp );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
+unlink( $file );
+
+?>
+--EXPECTF--
+*** Testing stream_filter_remove() : error conditions ***
+
+-- Testing stream_filter_remove() function with Zero arguments --
+
+Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing stream_filter_remove() function with more than expected no. of arguments --
+
+Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing stream_filter_remove() function with unexisting stream filter --
+
+Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d
+bool(false)
+
+-- Testing stream_filter_remove() function with bad resource --
+
+Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d
+bool(false)
+
+-- Testing stream_filter_remove() function with an already removed filter --
+bool(true)
+
+Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
new file mode 100644
index 0000000..bfd82e5
--- /dev/null
+++ b/ext/standard/tests/general_functions/001.phpt
@@ -0,0 +1,67 @@
+--TEST--
+sprintf() function
+--FILE--
+<?php
+
+$agent = sprintf("%.5s", "James Bond, 007");
+
+echo("sprintf string truncate test: ");
+if ($agent == "James") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf padding and align test: ");
+$test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33);
+if ($test == "abc0020 fisketur !") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf octal and hex test: ");
+$test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925);
+if ($test == " 200 400 BFFF 0034c385") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf octal binary test: ");
+$test = sprintf("%b", 3457925);
+if ($test == "1101001100001110000101") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf float test: ");
+$test = sprintf("%0"."06.2f", 10000/3.0);
+if ($test == "003333.33") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo sprintf("%.2f\n", "99.00");
+echo sprintf("%.2f\n", 99.00);
+
+echo sprintf("%e\n", 1.234E-18);
+echo sprintf("%e\n", 1.234E+18);
+echo sprintf("%e\n", 9843243.12);
+echo sprintf("%e\n", -9843243.12);
+
+?>
+--EXPECT--
+sprintf string truncate test: passed
+sprintf padding and align test: passed
+sprintf octal and hex test: passed
+sprintf octal binary test: passed
+sprintf float test: passed
+99.00
+99.00
+1.234000e-18
+1.234000e+18
+9.843243e+6
+-9.843243e+6
diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt
new file mode 100644
index 0000000..58528da
--- /dev/null
+++ b/ext/standard/tests/general_functions/002.phpt
@@ -0,0 +1,11 @@
+--TEST--
+quoted_printable_decode() function test
+--FILE--
+<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=cf=D2=C7=CF=D7=D9=C5=
+=20=
+=D0=
+=D2=CF=C5=CB=D4=D9"); ?>
+--EXPECT--
+úwow-factorÁÐÕÝÅÎÎÙÅ
+ ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt
new file mode 100644
index 0000000..7ad90c8
--- /dev/null
+++ b/ext/standard/tests/general_functions/003.phpt
@@ -0,0 +1,58 @@
+--TEST--
+levenshtein() function test
+--FILE--
+<?php
+
+function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) {
+
+ if($cost1==0)
+ $result=levenshtein($text1,$text2);
+ else
+ $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
+
+ if($result==$expect) return 0;
+
+ echo "$title: result is $result instead of $expect ";
+ echo "for '$text1'/'$text2' ";
+ if($cost1) echo "($cost1:$cost2:$cost3)";
+ echo "\n";
+
+ return 1;
+}
+
+$n=0;
+
+$n += test_me("equal" , 0, "12345", "12345");
+$n += test_me("1st empty" , 3, "", "xzy");
+$n += test_me("2nd empty" , 3, "xzy", "");
+$n += test_me("both empty" , 0, "", "");
+$n += test_me("1 char" , 1, "1", "2");
+$n += test_me("2 char swap", 2, "12", "21");
+
+$n += test_me("inexpensive delete", 2, "2121", "11", 2, 1, 1);
+$n += test_me("expensive delete" , 10, "2121", "11", 2, 1, 5);
+$n += test_me("inexpensive insert", 2, "11", "2121", 1, 1, 1);
+$n += test_me("expensive insert" , 10, "11", "2121", 5, 1, 1);
+
+$n += test_me("expensive replace" , 3, "111", "121", 2, 3, 2);
+$n += test_me("very expensive replace", 4, "111", "121", 2, 9, 2);
+
+$n += test_me("bug #7368", 2, "13458", "12345");
+$n += test_me("bug #7368", 2, "1345", "1234");
+
+$n += test_me("bug #6562", 1, "debugg", "debug");
+$n += test_me("bug #6562", 1, "ddebug", "debug");
+$n += test_me("bug #6562", 2, "debbbug", "debug");
+$n += test_me("bug #6562", 1, "debugging", "debuging");
+
+$n += test_me("bug #16473", 2, "a", "bc");
+$n += test_me("bug #16473", 2, "xa", "xbc");
+$n += test_me("bug #16473", 2, "xax", "xbcx");
+$n += test_me("bug #16473", 2, "ax", "bcx");
+
+
+echo ($n==0)?"all passed\n":"$n failed\n";
+
+?>
+--EXPECT--
+all passed
diff --git a/ext/standard/tests/general_functions/004.data b/ext/standard/tests/general_functions/004.data
new file mode 100644
index 0000000..5dd0832
--- /dev/null
+++ b/ext/standard/tests/general_functions/004.data
@@ -0,0 +1,4 @@
+name value comment
+true 1 boolean true
+false 0 boolean false
+empty nothing
diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt
new file mode 100644
index 0000000..40b47cc
--- /dev/null
+++ b/ext/standard/tests/general_functions/004.phpt
@@ -0,0 +1,16 @@
+--TEST--
+fgetcsv() with tab delimited fields (BUG #8258)
+--FILE--
+<?php
+chdir(dirname(__FILE__));
+$fp=fopen("004.data","r");
+while($a=fgetcsv($fp,100,"\t")) {
+ echo join(",",$a)."\n";
+}
+fclose($fp);
+?>
+--EXPECT--
+name,value,comment
+true,1,boolean true
+false,0,boolean false
+empty,,nothing
diff --git a/ext/standard/tests/general_functions/005.phpt b/ext/standard/tests/general_functions/005.phpt
new file mode 100644
index 0000000..027d124
--- /dev/null
+++ b/ext/standard/tests/general_functions/005.phpt
@@ -0,0 +1,24 @@
+--TEST--
+is_scalar() function test
+--FILE--
+<?php
+class foo {}
+var_dump (is_scalar (TRUE));
+var_dump (is_scalar (1));
+var_dump (is_scalar (1.0));
+var_dump (is_scalar ("Hi!"));
+var_dump (is_scalar (NULL));
+var_dump (is_scalar (array ()));
+var_dump (is_scalar (new foo()));
+var_dump (is_scalar (opendir('.')));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt
new file mode 100644
index 0000000..6852286
--- /dev/null
+++ b/ext/standard/tests/general_functions/006.phpt
@@ -0,0 +1,11 @@
+--TEST--
+quoted_printable_decode() function test with CR/LF
+--FILE--
+<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=CF=D2=C7=CF=D7=D9=C5=
+=20=
+=D0=
+=D2=CF=C5=CB=D4=D9"); ?>
+--EXPECT--
+úwow-factorÁÐÕÝÅÎÎÙÅ
+ ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/007.phpt b/ext/standard/tests/general_functions/007.phpt
new file mode 100644
index 0000000..f755ab4
--- /dev/null
+++ b/ext/standard/tests/general_functions/007.phpt
@@ -0,0 +1,24 @@
+--TEST--
+MD5 / Base64
+--FILE--
+<?php
+function test($str) {
+ $res = md5(base64_decode(base64_encode($str)))."\n";
+ return $res;
+}
+echo test("");
+echo test("a");
+echo test("abc");
+echo test("message digest");
+echo test("abcdefghijklmnopqrstuvwxyz");
+echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
+?>
+--EXPECT--
+d41d8cd98f00b204e9800998ecf8427e
+0cc175b9c0f1b6a831c399e269772661
+900150983cd24fb0d6963f7d28e17f72
+f96b697d7cb7938d525a2f31aaf161d0
+c3fcd3d76192e4007dfb496cca67e13b
+d174ab98d277d9f5a5611c2c9f419d9f
+57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt
new file mode 100644
index 0000000..f76c735
--- /dev/null
+++ b/ext/standard/tests/general_functions/008.phpt
@@ -0,0 +1,40 @@
+--TEST--
+var_dump float test
+--INI--
+precision=12
+--FILE--
+<?php
+// this checks f,g,G conversion for snprintf/spprintf
+var_dump(array(ini_get('precision'),.012,-.012,.12,-.12,1.2,-1.2,12.,-12.,0.000123,.0000123,123456789012.0,1234567890123.0,12345678901234567890.0));
+?>
+--EXPECT--
+array(14) {
+ [0]=>
+ string(2) "12"
+ [1]=>
+ float(0.012)
+ [2]=>
+ float(-0.012)
+ [3]=>
+ float(0.12)
+ [4]=>
+ float(-0.12)
+ [5]=>
+ float(1.2)
+ [6]=>
+ float(-1.2)
+ [7]=>
+ float(12)
+ [8]=>
+ float(-12)
+ [9]=>
+ float(0.000123)
+ [10]=>
+ float(1.23E-5)
+ [11]=>
+ float(123456789012)
+ [12]=>
+ float(1.23456789012E+12)
+ [13]=>
+ float(1.23456789012E+19)
+} \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt
new file mode 100644
index 0000000..e80d361
--- /dev/null
+++ b/ext/standard/tests/general_functions/009.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SHA1
+--FILE--
+<?php
+function test($str) {
+ $res = sha1($str)."\n";
+ return $res;
+}
+echo test("");
+echo test("a");
+echo test("abc");
+echo test("message digest");
+echo test("abcdefghijklmnopqrstuvwxyz");
+echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
+?>
+--EXPECT--
+da39a3ee5e6b4b0d3255bfef95601890afd80709
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
+a9993e364706816aba3e25717850c26c9cd0d89d
+c12252ceda8be8994d5fa0290a47231c1d16aae3
+32d10c7b8cf96570ca04ce37f2a19d84240d3a89
+761c457bf73b14d27e9e9265c46f4b4dda11f940
+50abf5706a150990a08b2c5ea40fa0e585554732
diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt
new file mode 100644
index 0000000..f576c7e
--- /dev/null
+++ b/ext/standard/tests/general_functions/010.phpt
@@ -0,0 +1,19 @@
+--TEST--
+register_shutdown_function() & __call
+--FILE--
+<?php
+class test {
+ function _foo() {
+ throw new Exception('test');
+ }
+ function __call($name=null, $args=null) {
+ return test::_foo();
+ }
+}
+
+var_dump(register_shutdown_function(array("test","__call")));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d
diff --git a/ext/standard/tests/general_functions/bug25038.phpt b/ext/standard/tests/general_functions/bug25038.phpt
new file mode 100644
index 0000000..52fe032
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug25038.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #25038 (call_user_func issues warning if function throws exception)
+--FILE--
+<?php
+
+function bar($x='no argument')
+{
+ throw new Exception("This is an exception from bar({$x}).");
+}
+try
+{
+ bar('first try');
+}
+catch (Exception $e)
+{
+ print $e->getMessage()."\n";
+}
+try
+{
+ call_user_func('bar','second try');
+}
+catch (Exception $e)
+{
+ print $e->getMessage()."\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+This is an exception from bar(first try).
+This is an exception from bar(second try).
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug27678.phpt b/ext/standard/tests/general_functions/bug27678.phpt
new file mode 100644
index 0000000..6f95509
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug27678.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #27678 (number_format() crashes with large numbers)
+--FILE--
+<?php
+
+number_format(1e80, 0, '', ' ');
+number_format(1e300, 0, '', ' ');
+number_format(1e320, 0, '', ' ');
+$num = number_format(1e1000, 0, '', ' ');
+var_dump(strlen($num) == 3); // $num == 'inf'
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+Done
diff --git a/ext/standard/tests/general_functions/bug29038.phpt b/ext/standard/tests/general_functions/bug29038.phpt
new file mode 100644
index 0000000..0f79229
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug29038.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings)
+--FILE--
+<?php
+function f1() {
+ $c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f2() {
+ $a = 1;
+ $c = extract(array("a" => 1),EXTR_PREFIX_SAME,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f3() {
+ $a = 1;
+ $c = extract(array("a" => 1),EXTR_PREFIX_ALL,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f4() {
+ $c = extract(array("" => 1),EXTR_PREFIX_ALL,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f5() {
+ $c = extract(array("111" => 1),EXTR_PREFIX_ALL,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+
+f1();
+f2();
+f3();
+f4();
+f5();
+?>
+--EXPECT--
+Extracted:int(0)
+Array
+(
+ [c] => 0
+)
+Extracted:int(1)
+Array
+(
+ [a] => 1
+ [prefix_a] => 1
+ [c] => 1
+)
+Extracted:int(1)
+Array
+(
+ [a] => 1
+ [prefix_a] => 1
+ [c] => 1
+)
+Extracted:int(0)
+Array
+(
+ [c] => 0
+)
+Extracted:int(1)
+Array
+(
+ [prefix_111] => 1
+ [c] => 1
+)
diff --git a/ext/standard/tests/general_functions/bug31190.phpt b/ext/standard/tests/general_functions/bug31190.phpt
new file mode 100644
index 0000000..7d15470
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug31190.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #31190 (exception in call_user_func_array())
+--FILE--
+<?php
+
+class test {
+ function throwException() { throw new Exception("Hello World!\n");
+} }
+
+$array = array(new test(), 'throwException');
+try {
+ call_user_func($array, 1, 2);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+try {
+ call_user_func_array($array, array(1, 2));
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Hello World!
+Hello World!
+
diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt
new file mode 100644
index 0000000..8508597
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug32647.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
+--INI--
+error_reporting=4095
+display_errors=1
+--FILE--
+<?php
+
+function foo()
+{
+ echo "foo!\n";
+}
+
+class bar
+{
+ function barfoo ()
+ { echo "bar!\n"; }
+}
+
+unset($obj);
+register_shutdown_function(array($obj,"")); // Invalid
+register_shutdown_function(array($obj,"some string")); // Invalid
+register_shutdown_function(array(0,"")); // Invalid
+register_shutdown_function(array('bar','foo')); // Invalid
+register_shutdown_function(array(0,"some string")); // Invalid
+register_shutdown_function('bar'); // Invalid
+register_shutdown_function('foo'); // Valid
+register_shutdown_function(array('bar','barfoo')); // Invalid
+
+$obj = new bar;
+register_shutdown_function(array($obj,'foobar')); // Invalid
+register_shutdown_function(array($obj,'barfoo')); // Valid
+
+?>
+--EXPECTF--
+Notice: Undefined variable: obj in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Notice: Undefined variable: obj in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foo' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d
+
+Strict Standards: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
+foo!
+
+Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
+
+Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
+bar!
+bar!
diff --git a/ext/standard/tests/general_functions/bug34794.phpt b/ext/standard/tests/general_functions/bug34794.phpt
new file mode 100644
index 0000000..1b25bc2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug34794.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #34794 (proc_close() hangs when used with two processes)
+--SKIPIF--
+<?php
+if (!is_executable('/bin/cat')) echo 'skip cat not found';
+?>
+--FILE--
+<?php
+echo "Opening process 1\n";
+$process1 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes1);
+
+echo "Opening process 2\n";
+$process2 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes2);
+
+
+echo "Closing process 1\n";
+fclose($pipes1[0]);
+fclose($pipes1[1]);
+proc_close($process1);
+
+echo "Closing process 2\n";
+fclose($pipes2[0]);
+fclose($pipes2[1]);
+proc_close($process2);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Opening process 1
+Opening process 2
+Closing process 1
+Closing process 2
+Done
diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt
new file mode 100644
index 0000000..c3c273d
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug35229.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #35229 (call_user_func() crashes when argument stack is nearly full)
+--FILE--
+<?php
+class test2 {
+ static function use_stack() {
+ echo "OK\n";
+ }
+}
+
+function __autoload($class)
+{
+ eval('class test1 extends test2 {}');
+
+ test1::use_stack(
+ 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
+ );
+}
+
+call_user_func(array('test1', 'use_stack'),
+ 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
+);
+?>
+--EXPECT--
+OK
+OK
diff --git a/ext/standard/tests/general_functions/bug36011.phpt b/ext/standard/tests/general_functions/bug36011.phpt
new file mode 100644
index 0000000..08a4501
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug36011.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Bug #36011 (Strict errormsg wrong for call_user_func() and the likes)
+--FILE--
+<?php
+
+class TestClass
+{
+ static function test()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function whee()
+ {
+ array_map(array('TestClass', 'test'), array('array_value'));
+ }
+
+ function whee4()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+
+ static function whee5()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+}
+
+TestClass::test();
+
+$a = new TestClass();
+$a->whee();
+$a->whee4();
+$a->whee5();
+
+TestClass::whee5();
+
+?>
+===DONE===
+--EXPECTF--
+TestClass::test()
+TestClass::test()
+TestClass::test()
+TestClass::test()
+TestClass::test()
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug39322.phpt b/ext/standard/tests/general_functions/bug39322.phpt
new file mode 100644
index 0000000..a9f83c7
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug39322.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #39322 (proc_terminate() loosing process resource)
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (!is_executable('/bin/sleep')) echo 'skip sleep not found';
+?>
+--FILE--
+<?php
+$descriptors = array(
+ 0 => array('pipe', 'r'),
+ 1 => array('pipe', 'w'),
+ 2 => array('pipe', 'w'));
+
+$pipes = array();
+
+$process = proc_open('/bin/sleep 120', $descriptors, $pipes);
+
+proc_terminate($process, 9);
+sleep(1); // wait a bit to let the process finish
+var_dump(proc_get_status($process));
+
+echo "Done!\n";
+
+?>
+--EXPECTF--
+array(8) {
+ ["command"]=>
+ string(14) "/bin/sleep 120"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(false)
+ ["signaled"]=>
+ bool(true)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(9)
+ ["stopsig"]=>
+ int(0)
+}
+Done!
diff --git a/ext/standard/tests/general_functions/bug40398.phpt b/ext/standard/tests/general_functions/bug40398.phpt
new file mode 100644
index 0000000..11fdde2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug40398.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Bug #40398 (parent and self callback functions erroneously called statically)
+--FILE--
+<?php
+
+class Base
+{
+ function __construct($msg)
+ {
+ echo __METHOD__ . "($msg)\n";
+ }
+}
+
+class Derived_1 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'Base::__construct'), $args);
+ }
+}
+
+class Derived_2 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'parent::__construct'), $args);
+ }
+}
+
+class Derived_3 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('Base::__construct', $args);
+ }
+}
+
+class Derived_4 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('parent::__construct', $args);
+ }
+}
+
+class Derived_5 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('Base', '__construct'), $args);
+ }
+}
+
+class Derived_6 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('parent', '__construct'), $args);
+ }
+}
+
+new Derived_1('1');
+new Derived_2('2');
+new Derived_3('3');
+new Derived_4('4');
+new Derived_5('5');
+new Derived_6('6');
+
+?>
+===DONE===
+--EXPECTF--
+Base::__construct(1)
+Base::__construct(2)
+Base::__construct(3)
+Base::__construct(4)
+Base::__construct(5)
+Base::__construct(6)
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug40752.phpt b/ext/standard/tests/general_functions/bug40752.phpt
new file mode 100644
index 0000000..30ed8a4
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug40752.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #40752 (parse_ini_file() segfaults when a scalar setting is redeclared as an array)
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug40752.ini";
+file_put_contents($file, '
+foo = 1;
+foo[] = 1;
+');
+
+var_dump(parse_ini_file($file));
+
+file_put_contents($file, '
+foo[] = 1;
+foo = 1;
+');
+
+var_dump(parse_ini_file($file));
+
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(1) {
+ ["foo"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+array(1) {
+ ["foo"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt
new file mode 100644
index 0000000..eab2c33
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41037.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #41037 (unregister_tick_function() inside the tick function crash PHP)
+--FILE--
+<?php
+
+function a() {
+ echo "hello";
+ unregister_tick_function('a');
+}
+
+declare (ticks=1);
+register_tick_function('a');
+
+echo "Done\n";
+?>
+--EXPECTF--
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+Done
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
diff --git a/ext/standard/tests/general_functions/bug41445.phpt b/ext/standard/tests/general_functions/bug41445.phpt
new file mode 100644
index 0000000..23888df
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41445.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Bug #41445 (parse_ini_file() function parses octal numbers in section names)
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug41445.ini";
+
+$data = <<<DATA
+[001099030277]
+option1 = yes
+
+[011099030277]
+option2 = yes
+DATA;
+
+file_put_contents($file, $data);
+
+var_dump(parse_ini_file($file, TRUE));
+var_dump(parse_ini_file($file));
+
+$data = <<<DATA
+[23.44]
+option1 = yes
+
+[9633337363542736472364]
+option2 = yes
+DATA;
+
+file_put_contents($file, $data);
+
+var_dump(parse_ini_file($file, TRUE));
+var_dump(parse_ini_file($file));
+
+@unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(2) {
+ ["001099030277"]=>
+ array(1) {
+ ["option1"]=>
+ string(1) "1"
+ }
+ ["011099030277"]=>
+ array(1) {
+ ["option2"]=>
+ string(1) "1"
+ }
+}
+array(2) {
+ ["option1"]=>
+ string(1) "1"
+ ["option2"]=>
+ string(1) "1"
+}
+array(2) {
+ ["23.44"]=>
+ array(1) {
+ ["option1"]=>
+ string(1) "1"
+ }
+ ["9633337363542736472364"]=>
+ array(1) {
+ ["option2"]=>
+ string(1) "1"
+ }
+}
+array(2) {
+ ["option1"]=>
+ string(1) "1"
+ ["option2"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41445_1.phpt b/ext/standard/tests/general_functions/bug41445_1.phpt
new file mode 100644
index 0000000..e65e7af
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41445_1.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #41445 (parse_ini_file() function parses octal numbers in section names) - 2
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug41445.ini";
+
+$data = <<<DATA
+[2454.33]
+09 = yes
+
+[9876543]
+098765434567876543 = yes
+
+[09876543]
+987654345678765432456798765434567876543 = yes
+DATA;
+
+file_put_contents($file, $data);
+
+var_dump(parse_ini_file($file, TRUE));
+var_dump(parse_ini_file($file));
+
+@unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(3) {
+ ["2454.33"]=>
+ array(1) {
+ ["09"]=>
+ string(1) "1"
+ }
+ [9876543]=>
+ array(1) {
+ ["098765434567876543"]=>
+ string(1) "1"
+ }
+ ["09876543"]=>
+ array(1) {
+ ["987654345678765432456798765434567876543"]=>
+ string(1) "1"
+ }
+}
+array(3) {
+ ["09"]=>
+ string(1) "1"
+ ["098765434567876543"]=>
+ string(1) "1"
+ ["987654345678765432456798765434567876543"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41518.phpt b/ext/standard/tests/general_functions/bug41518.phpt
new file mode 100644
index 0000000..26e2413
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41518.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #41518 (file_exists() warns of open_basedir restriction on non-existent file)
+--SKIPIF--
+<?php
+$tmp_dir = __DIR__ . '/bug41518';
+mkdir($tmp_dir);
+if (!is_dir($tmp_dir)) {
+ die("skip");
+}
+@unlink($tmp_dir);
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+
+$tmp_dir = __DIR__ . "/bug41518/";
+@mkdir($tmp_dir);
+$tmp_file = $tmp_dir."/bug41418.tmp";
+
+touch($tmp_file);
+var_dump(file_exists($tmp_file)); //exists
+var_dump(file_exists($tmp_file."nosuchfile")); //doesn't exist
+
+@unlink($tmp_file);
+@rmdir($tmp_dir);
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$tmp_dir = __DIR__ . "/bug41518/";
+@unlink($tmp_dir);
+?>
+--EXPECT--
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt
new file mode 100644
index 0000000..4bce3ac
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41970.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #41970 (call_user_func_*() leaks on failure)
+--FILE--
+<?php
+
+$a = array(4,3,2);
+
+var_dump(call_user_func_array("sort", array($a)));
+var_dump(call_user_func_array("strlen", array($a)));
+var_dump(call_user_func("sort", $a));
+var_dump(call_user_func("strlen", $a));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5
+NULL
+
+Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6
+NULL
+
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7
+NULL
+
+Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/bug42272.phpt b/ext/standard/tests/general_functions/bug42272.phpt
new file mode 100644
index 0000000..8b8c248
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug42272.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #42272 (var_export() incorrectly escapes char(0))
+--FILE--
+<?php
+$foo = var_export("\0", true );
+echo $foo, "\n";
+var_export("a\0b");
+?>
+--EXPECT--
+'' . "\0" . ''
+'a' . "\0" . 'b'
diff --git a/ext/standard/tests/general_functions/bug43293_1.phpt b/ext/standard/tests/general_functions/bug43293_1.phpt
new file mode 100644
index 0000000..d2c7f10
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_1.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #43293 (Multiple segfaults in getopt())
+--INI--
+register_argc_argv=Off
+--FILE--
+<?php
+$argv = array(1, 2, 3);
+var_dump(getopt("abcd"));
+var_dump($argv);
+$argv = null;
+var_dump(getopt("abcd"));
+?>
+--EXPECT--
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(false)
+
diff --git a/ext/standard/tests/general_functions/bug43293_2.phpt b/ext/standard/tests/general_functions/bug43293_2.phpt
new file mode 100644
index 0000000..76a5956
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #43293 (Multiple segfaults in getopt())
+--INI--
+register_argc_argv=Off
+--FILE--
+<?php
+$argv = array(true, false);
+var_dump(getopt("abcd"));
+?>
+--EXPECT--
+array(0) {
+}
+
diff --git a/ext/standard/tests/general_functions/bug43293_3.phpt b/ext/standard/tests/general_functions/bug43293_3.phpt
new file mode 100644
index 0000000..6cf6529
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_3.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #43293 (Multiple segfaults in getopt())
+--ARGS--
+-f --f
+--INI--
+register_argc_argv=On
+--FILE--
+<?php
+$args = array(true, false, "f");
+var_dump(getopt("f", $args), $args);
+?>
+--EXPECT--
+array(1) {
+ ["f"]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+array(3) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ string(1) "f"
+}
+
diff --git a/ext/standard/tests/general_functions/bug44295-win.phpt b/ext/standard/tests/general_functions/bug44295-win.phpt
new file mode 100644
index 0000000..d210a54
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44295-win.phpt
@@ -0,0 +1,29 @@
+--TEST--
+user defined error handler + set_error_handling(EH_THROW)
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows only");
+ if (!extension_loaded("spl") || is_dir('c:\\not\\exists\\here')) die("skip");
+?>
+--FILE--
+<?php
+$dir = 'c:\\not\\exists\\here';
+
+set_error_handler('my_error_handler');
+function my_error_handler() {$a = func_get_args(); print "in error handler\n"; }
+
+try {
+ print "before\n";
+ $iter = new DirectoryIterator($dir);
+ print get_class($iter) . "\n";
+ print "after\n";
+} catch (Exception $e) {
+ print "in catch: ".$e->getMessage()."\n";
+}
+?>
+==DONE==
+<?php exit(0); ?>
+--EXPECT--
+before
+in catch: DirectoryIterator::__construct(c:\not\exists\here,c:\not\exists\here): The system cannot find the path specified. (code: 3)
+==DONE==
diff --git a/ext/standard/tests/general_functions/bug44295.phpt b/ext/standard/tests/general_functions/bug44295.phpt
new file mode 100644
index 0000000..a184719
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44295.phpt
@@ -0,0 +1,29 @@
+--TEST--
+user defined error handler + set_error_handling(EH_THROW)
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows");
+ if (!extension_loaded("spl") || is_dir('/this/path/does/not/exist')) die("skip");
+?>
+--FILE--
+<?php
+$dir = '/this/path/does/not/exist';
+
+set_error_handler('my_error_handler');
+function my_error_handler() {$a = func_get_args(); print "in error handler\n"; }
+
+try {
+ print "before\n";
+ $iter = new DirectoryIterator($dir);
+ print get_class($iter) . "\n";
+ print "after\n";
+} catch (Exception $e) {
+ print "in catch: ".$e->getMessage()."\n";
+}
+?>
+==DONE==
+<?php exit(0); ?>
+--EXPECT--
+before
+in catch: DirectoryIterator::__construct(/this/path/does/not/exist): failed to open dir: No such file or directory
+==DONE==
diff --git a/ext/standard/tests/general_functions/bug44394.phpt b/ext/standard/tests/general_functions/bug44394.phpt
new file mode 100644
index 0000000..26351a2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44394.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #44394 (Last two bytes missing from output)
+--FILE--
+<?php
+
+$string = "<a href='a?q=1'>asd</a>";
+
+output_add_rewrite_var('a', 'b');
+
+echo $string;
+
+ob_flush();
+
+ob_end_clean();
+
+?>
+--EXPECT--
+<a href='a?q=1&a=b'>asd</a>
diff --git a/ext/standard/tests/general_functions/bug44394_2.phpt b/ext/standard/tests/general_functions/bug44394_2.phpt
new file mode 100644
index 0000000..3ca5397
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44394_2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #44394 (Last two bytes missing from output) with session.use_trans_id
+--SKIPIF--
+<?php if (!extension_loaded("session")) print "skip"; ?>
+--INI--
+session.name=PHPSESSID
+session.use_only_cookies=0
+--FILE--
+<?php
+
+ini_set('session.use_trans_sid', 1);
+session_save_path(__DIR__);
+session_start();
+
+ob_start();
+
+$string = "<a href='a?q=1'>asd</a>";
+
+output_add_rewrite_var('a', 'b');
+
+echo $string;
+
+ob_flush();
+
+ob_end_clean();
+
+?>
+--CLEAN--
+<?php
+foreach (glob(__DIR__ . '/sess_*') as $filename) {
+ unlink($filename);
+}
+?>
+--EXPECTF--
+<a href='a?q=1&PHPSESSID=%s&a=b'>asd</a>
diff --git a/ext/standard/tests/general_functions/bug44461.phpt b/ext/standard/tests/general_functions/bug44461.phpt
new file mode 100644
index 0000000..6fa73ee
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44461.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #44461 (parse_ini_file crashes)
+--FILE--
+<?php
+file_put_contents(__DIR__ . 'bug44461.ini', <<<EOF
+[attachments]
+zip = "application/zip" ; MIME-type for ZIP files
+EOF
+);
+parse_ini_file(__DIR__ . 'bug44461.ini', true);
+?>
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . 'bug44461.ini');
+?>
+--EXPECT--
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/bug44487.phpt b/ext/standard/tests/general_functions/bug44487.phpt
new file mode 100644
index 0000000..10c52c6
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44487.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #44487 (call_user_method_array issues a warning when throwing an exception)
+--INI--
+error_reporting = E_ALL & ~E_DEPRECATED
+--FILE--
+<?php
+
+class Foo
+{
+ public function test()
+ {
+ print 'test';
+ throw new Exception();
+ }
+}
+
+try {
+ $bar = new Foo();
+ call_user_method_array('test', $bar, array()) ;
+} catch (Exception $e) {
+}
+?>
+--EXPECT--
+test
diff --git a/ext/standard/tests/general_functions/bug44667.phpt b/ext/standard/tests/general_functions/bug44667.phpt
new file mode 100644
index 0000000..49183cc
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44667.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly)
+--SKIPIF--
+<?php if (!is_executable('/bin/cat')) echo 'skip cat not found'; ?>
+--FILE--
+<?php
+
+$pipes = array();
+
+$descriptor_spec = array(
+ 0 => array('pipe', 'rb'),
+ 1 => array('pipe', 'wb'),
+);
+
+$proc = proc_open('cat', $descriptor_spec, $pipes);
+
+fwrite($pipes[0], 'Hello', 5);
+fflush($pipes[0]);
+fclose($pipes[0]);
+
+$result = fread($pipes[1], 5);
+fclose($pipes[1]);
+
+proc_close($proc);
+
+echo "Result is: ", $result, "\n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Result is: Hello
+Done
diff --git a/ext/standard/tests/general_functions/bug46587.phpt b/ext/standard/tests/general_functions/bug46587.phpt
new file mode 100644
index 0000000..becbde9
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug46587.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #46587 (mt_rand() does not check that max is greater than min).
+--FILE--
+<?php
+
+var_dump(mt_rand(3,8));
+var_dump(mt_rand(8,3));
+
+echo "Done.\n";
+?>
+--EXPECTF--
+int(%d)
+
+Warning: mt_rand(): max(3) is smaller than min(8) in %s on line %d
+bool(false)
+Done.
diff --git a/ext/standard/tests/general_functions/bug47027.phpt b/ext/standard/tests/general_functions/bug47027.phpt
new file mode 100644
index 0000000..e4f5aae
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug47027.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #47027 (var_export doesn't show numeric indices on ArrayObject)
+--FILE--
+<?php
+$ao = new ArrayObject(array (2 => "foo", "bar" => "baz"));
+var_export ($ao);
+?>
+--EXPECT--
+ArrayObject::__set_state(array(
+ 2 => 'foo',
+ 'bar' => 'baz',
+))
diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt
new file mode 100644
index 0000000..3bdf1c2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug47857.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #47851 (is_callable throws fatal error)
+--FILE--
+<?php
+class foo {
+ function bar() {
+ echo "ok\n";
+ }
+}
+var_dump(is_callable(array('foo','bar')));
+foo::bar();
+var_dump(is_callable(array('Exception','getMessage')));
+Exception::getMessage();
+?>
+--EXPECTF--
+bool(true)
+
+Strict Standards: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d
+ok
+bool(false)
+
+Fatal error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php on line %d
+
diff --git a/ext/standard/tests/general_functions/bug47859.phpt b/ext/standard/tests/general_functions/bug47859.phpt
new file mode 100644
index 0000000..458a116
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug47859.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #47859 (parse_ini_file() does not like asterisk (*) in key in the beginning)
+--FILE--
+<?php
+var_dump(parse_ini_string('*key = "*value"'));
+var_dump(parse_ini_string('-key = "-value"'));
+var_dump(parse_ini_string('_key = "_value"'));
+
+var_dump(parse_ini_string('key* = "value*"'));
+var_dump(parse_ini_string('key.*.* = "value.*.*"'));
+var_dump(parse_ini_string('*.*.key = "*.*.value"'));
+var_dump(parse_ini_string('k*e*y = "v*a*lue"'));
+?>
+--EXPECT--
+array(1) {
+ ["*key"]=>
+ string(6) "*value"
+}
+array(1) {
+ ["-key"]=>
+ string(6) "-value"
+}
+array(1) {
+ ["_key"]=>
+ string(6) "_value"
+}
+array(1) {
+ ["key*"]=>
+ string(6) "value*"
+}
+array(1) {
+ ["key.*.*"]=>
+ string(9) "value.*.*"
+}
+array(1) {
+ ["*.*.key"]=>
+ string(9) "*.*.value"
+}
+array(1) {
+ ["k*e*y"]=>
+ string(7) "v*a*lue"
+}
diff --git a/ext/standard/tests/general_functions/bug48660.phpt b/ext/standard/tests/general_functions/bug48660.phpt
new file mode 100644
index 0000000..4c1492a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug48660.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Bug #48660 (parse_ini_*(): dollar sign as last character of value fails)
+--FILE--
+<?php
+
+$ini_location = dirname(__FILE__) . '/bug48660.tmp';
+
+// Build ini data
+$ini_data = '
+[cases]
+
+Case.a = avalue
+Case.b = "$dollar_sign"
+Case.c = "dollar_sign$"
+Case.d = "$dollar_sign$"
+Case.e = 10
+';
+
+// Save ini data to file
+file_put_contents($ini_location, $ini_data);
+
+var_dump(parse_ini_file($ini_location, true, INI_SCANNER_RAW));
+var_dump(parse_ini_file($ini_location, true, INI_SCANNER_NORMAL));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48660.tmp'); ?>
+--EXPECTF--
+array(1) {
+ ["cases"]=>
+ array(5) {
+ ["Case.a"]=>
+ string(6) "avalue"
+ ["Case.b"]=>
+ string(12) "$dollar_sign"
+ ["Case.c"]=>
+ string(12) "dollar_sign$"
+ ["Case.d"]=>
+ string(13) "$dollar_sign$"
+ ["Case.e"]=>
+ string(2) "10"
+ }
+}
+array(1) {
+ ["cases"]=>
+ array(5) {
+ ["Case.a"]=>
+ string(6) "avalue"
+ ["Case.b"]=>
+ string(12) "$dollar_sign"
+ ["Case.c"]=>
+ string(12) "dollar_sign$"
+ ["Case.d"]=>
+ string(13) "$dollar_sign$"
+ ["Case.e"]=>
+ string(2) "10"
+ }
+}
diff --git a/ext/standard/tests/general_functions/bug48768.phpt b/ext/standard/tests/general_functions/bug48768.phpt
new file mode 100644
index 0000000..ae8329a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug48768.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #48768 (parse_ini_*() crashes with INI_SCANNER_RAW)
+--FILE--
+<?php
+
+$ini_location = dirname(__FILE__) . '/bug48768.tmp';
+
+// Build ini data
+$ini_data = <<< EOT
+equal = "="
+
+EOT;
+
+// Save ini data to file
+file_put_contents($ini_location, $ini_data);
+
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_RAW));
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_NORMAL));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48768.tmp'); ?>
+--EXPECT--
+array(1) {
+ ["equal"]=>
+ string(1) "="
+}
+array(1) {
+ ["equal"]=>
+ string(1) "="
+}
diff --git a/ext/standard/tests/general_functions/bug49056.phpt b/ext/standard/tests/general_functions/bug49056.phpt
new file mode 100644
index 0000000..208766c
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49056.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #49056 (parse_ini_*() regression in 5.3.0 when using non-ASCII strings as option keys)
+--FILE--
+<?php
+
+$string = <<<EOT
+Cooking_furniture="KÌchen Möbel (en)"
+KÌchen_Möbel="Cooking furniture (en)"
+EOT;
+
+$filename = dirname(__FILE__) . '/bug49056.tmp';
+
+file_put_contents( $filename, $string);
+
+var_dump(parse_ini_file($filename));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug49056.tmp'); ?>
+--EXPECT--
+array(2) {
+ ["Cooking_furniture"]=>
+ string(23) "KÌchen Möbel (en)"
+ ["KÌchen_Möbel"]=>
+ string(22) "Cooking furniture (en)"
+}
diff --git a/ext/standard/tests/general_functions/bug49692.ini b/ext/standard/tests/general_functions/bug49692.ini
new file mode 100644
index 0000000..5def69a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49692.ini
@@ -0,0 +1,4 @@
+//my.ini file
+[sitemap]
+/home = default:index
+/info = default:info
diff --git a/ext/standard/tests/general_functions/bug49692.phpt b/ext/standard/tests/general_functions/bug49692.phpt
new file mode 100644
index 0000000..80a1612
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49692.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #49692: parse_ini_file() throws errors when key contains '/' (forward slash)
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--FILE--
+<?php
+
+var_dump(parse_ini_file('bug49692.ini', true));
+
+?>
+--EXPECTF--
+array(1) {
+ ["sitemap"]=>
+ array(2) {
+ ["/home"]=>
+ string(13) "default:index"
+ ["/info"]=>
+ string(12) "default:info"
+ }
+}
diff --git a/ext/standard/tests/general_functions/bug49847.phpt b/ext/standard/tests/general_functions/bug49847.phpt
new file mode 100644
index 0000000..112592d
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49847.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #49847 (exec() fails on lines larger then 4095 bytes)
+--FILE--
+<?php
+$iswin = substr(PHP_OS, 0, 3) == "WIN";
+
+if ($iswin) {
+ $f = dirname(__FILE__) . '\\bug49847.tmp';
+ $s = str_repeat(' ', 4097);
+ $s .= '1';
+ file_put_contents($f, $s);
+ exec('type ' . $f, $output);
+} else {
+ exec("printf %4098d 1", $output);
+}
+var_dump($output);
+if ($iswin) {
+ unlink($f);
+}
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(4098) "%s 1"
+}
+
diff --git a/ext/standard/tests/general_functions/bug50690.phpt b/ext/standard/tests/general_functions/bug50690.phpt
new file mode 100644
index 0000000..4d9f0dc
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug50690.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+<?php
+putenv("foo=ab");
+putenv("bar=c");
+var_dump(getenv("foo"));
+var_dump(getenv("bar"));
+var_dump(getenv("thisvardoesnotexist"));
+?>
+--EXPECT--
+string(2) "ab"
+string(1) "c"
+bool(false)
diff --git a/ext/standard/tests/general_functions/bug50732.phpt b/ext/standard/tests/general_functions/bug50732.phpt
new file mode 100644
index 0000000..ed8341d
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug50732.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #50732 (exec() adds single byte twice to $output array)
+--FILE--
+<?php
+exec("echo x", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(1) "x"
+}
diff --git a/ext/standard/tests/general_functions/bug52138.data b/ext/standard/tests/general_functions/bug52138.data
new file mode 100644
index 0000000..4ce82e0
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug52138.data
@@ -0,0 +1,11 @@
+[MYCONST]
+MYCONST = MYCONST
+
+[M_PI]
+FOO=M_PI " test"
+
+[foo::bar]
+A=1
+B=A "A" A
+
+[MYCONST M_PI]
diff --git a/ext/standard/tests/general_functions/bug52138.phpt b/ext/standard/tests/general_functions/bug52138.phpt
new file mode 100644
index 0000000..d4f3873
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug52138.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #52138 (Constants are parsed into the ini file for section names)
+--FILE--
+<?php
+
+define('MYCONST', 1);
+define('A', 'B');
+
+$ini_file = dirname(__FILE__)."/bug52138.data";
+
+$ret = parse_ini_file($ini_file, true);
+var_dump($ret);
+
+?>
+--EXPECTF--
+array(4) {
+ ["MYCONST"]=>
+ array(1) {
+ ["MYCONST"]=>
+ string(1) "1"
+ }
+ ["M_PI"]=>
+ array(1) {
+ ["FOO"]=>
+ string(%d) "3.%d test"
+ }
+ ["foo::bar"]=>
+ array(2) {
+ ["A"]=>
+ string(1) "1"
+ ["B"]=>
+ string(3) "BAB"
+ }
+ ["MYCONST M_PI"]=>
+ array(0) {
+ }
+}
diff --git a/ext/standard/tests/general_functions/bug55371.phpt b/ext/standard/tests/general_functions/bug55371.phpt
new file mode 100644
index 0000000..179da01
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug55371.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning)
+--FILE--
+<?php
+
+get_magic_quotes_gpc();
+get_magic_quotes_runtime();
+
+?>
+--EXPECT--
diff --git a/ext/standard/tests/general_functions/bug60227_1.phpt b/ext/standard/tests/general_functions/bug60227_1.phpt
new file mode 100644
index 0000000..8efe222
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_1.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR)
+--FILE--
+<?php
+header("X-Foo1: a");
+header("X-Foo2: b\n ");
+header("X-Foo3: c\r\n ");
+header("X-Foo4: d\r ");
+header("X-Foo5: e\rSet-Cookie: ID=123");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected in %s on line %d
+foo
+--EXPECTHEADERS--
+X-Foo1: a
+X-Foo2: b
+X-Foo3: c
+X-Foo4: d
+
diff --git a/ext/standard/tests/general_functions/bug60227_2.phpt b/ext/standard/tests/general_functions/bug60227_2.phpt
new file mode 100644
index 0000000..995c364
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), \r before \n
+--FILE--
+<?php
+header("X-foo: e\n foo");
+header("X-Foo6: e\rSet-Cookie: ID=123\n d");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+foo
diff --git a/ext/standard/tests/general_functions/bug60227_3.phpt b/ext/standard/tests/general_functions/bug60227_3.phpt
new file mode 100644
index 0000000..8cba9b8
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_3.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), \0 before \n
+--FILE--
+<?php
+header("X-foo: e\n foo");
+header("X-Foo6: e\0Set-Cookie: ID=\n123\n d");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain NUL bytes in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+foo
diff --git a/ext/standard/tests/general_functions/bug60227_4.phpt b/ext/standard/tests/general_functions/bug60227_4.phpt
new file mode 100644
index 0000000..d5e2573
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_4.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), CRLF
+--FILE--
+<?php
+header("X-foo: e\r\n foo");
+header("X-foo: e\r\nfoo");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+ foo
diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt
new file mode 100644
index 0000000..07b801b
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #60723 (error_log error time has changed to UTC ignoring default timezo)
+--INI--
+date.timezone=ASIA/Chongqing
+log_errors=On
+--FILE--
+<?php
+$dir = dirname(__FILE__);
+$log = $dir . "/tmp.err";
+ini_set("error_log", $log);
+echo $aa;
+error_log("dummy");
+readfile($log);
+unlink($log);
+?>
+--EXPECTF--
+Notice: Undefined variable: aa in %sbug60723.php on line %d
+[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d
+[%s ASIA/Chongqing] dummy
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
new file mode 100644
index 0000000..c05a329
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
@@ -0,0 +1,59 @@
+--TEST--
+call_user_func_array() passes by reference if the array element is referenced, regardless of function signature.
+--FILE--
+<?php
+
+function by_val($arg) {
+ $arg = 'changed';
+}
+
+function by_ref(&$arg) {
+ $arg = 'changed';
+}
+
+echo "------ Calling by_val() with unreferenced argument ------\n";
+$arg = array('original');
+call_user_func_array('by_val', $arg);
+var_dump($arg);
+
+echo "------ Calling by_ref() with unreferenced argument ------\n";
+$arg = array('original');
+call_user_func_array('by_ref', $arg);
+var_dump($arg);
+
+echo "------ Calling by_val() with referenced argument ------\n";
+$arg = array('original');
+$ref = &$arg[0];
+call_user_func_array('by_val', $arg);
+var_dump($arg);
+
+echo "------ Calling by_ref() with referenced argument ------\n";
+$arg = array('original');
+$ref = &$arg[0];
+call_user_func_array('by_ref', $arg);
+var_dump($arg);
+
+?>
+--EXPECTF--
+------ Calling by_val() with unreferenced argument ------
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+------ Calling by_ref() with unreferenced argument ------
+
+Warning: Parameter 1 to by_ref() expected to be a reference, value given in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+------ Calling by_val() with referenced argument ------
+array(1) {
+ [0]=>
+ &string(8) "original"
+}
+------ Calling by_ref() with referenced argument ------
+array(1) {
+ [0]=>
+ &string(7) "changed"
+}
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt
new file mode 100644
index 0000000..4a4845a
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test call_user_func_array() function : first parameter variation
+--FILE--
+<?php
+/* Prototype : mixed call_user_func_array(string function_name, array parameters)
+ * Description: Call a user function which is the first parameter with the arguments contained in array
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing call_user_func_array() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$parameters = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 function_name
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( call_user_func_array($value, $parameters) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing call_user_func_array() : usage variation ***
+
+--int 0--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--empty array--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--lowercase null--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--lowercase true--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--unset var--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt
new file mode 100644
index 0000000..077d4f8
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test call_user_func_array() function : second parameter variation
+--FILE--
+<?php
+/* Prototype : mixed call_user_func_array(string function_name, array parameters)
+ * Description: Call a user function which is the first parameter with the arguments contained in array
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing call_user_func_array() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+function test_func() {
+}
+$function_name = 'test_func';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -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 parameters
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( call_user_func_array($function_name, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing call_user_func_array() : usage variation ***
+
+--int 0--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+
+--lowercase null--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+
+--lowercase true--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, object given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+
+--unset var--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_func_return.phpt b/ext/standard/tests/general_functions/call_user_func_return.phpt
new file mode 100644
index 0000000..929fdd7
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_return.phpt
@@ -0,0 +1,44 @@
+--TEST--
+call_user_func() and return value
+--FILE--
+<?php
+
+$t1 = 'test1';
+
+function test1($arg1, $arg2)
+{
+ global $t1;
+ echo "$arg1 $arg2\n";
+ return $t1;
+}
+
+$t2 = 'test2';
+
+function & test2($arg1, $arg2)
+{
+ global $t2;
+ echo "$arg1 $arg2\n";
+ return $t2;
+}
+
+function test($func)
+{
+ debug_zval_dump($func('Direct', 'Call'));
+ debug_zval_dump(call_user_func_array($func, array('User', 'Func')));
+}
+
+test('test1');
+test('test2');
+
+?>
+===DONE===
+--EXPECTF--
+Direct Call
+string(5) "test1" refcount(1)
+User Func
+string(5) "test1" refcount(1)
+Direct Call
+string(5) "test2" refcount(2)
+User Func
+string(5) "test2" refcount(1)
+===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_method.phpt b/ext/standard/tests/general_functions/call_user_method.phpt
new file mode 100644
index 0000000..cc54ff9
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_method.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Basic behaviour of call_user_method() test
+--CREDITS--
+Sebastian SchÃŒrmann
+sebs@php.net
+Testfest 2009 Munich
+--FILE--
+<?php
+class a {
+ static function b() {
+ return true;
+ }
+}
+$a = new a();
+$res = call_user_method('b', $a);
+var_dump($res);
+?>
+--EXPECTF--
+Deprecated: Function call_user_method() is deprecated in %s on line 8
+bool(true)
diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt
new file mode 100644
index 0000000..054bc3e
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_method_002.phpt
@@ -0,0 +1,12 @@
+--TEST--
+call_user_method() Invalid free
+--FILE--
+<?php
+
+call_user_method("1", $arr1);
+
+?>
+--EXPECTF--
+Deprecated: Function call_user_method() is deprecated in %s on line %d
+
+Warning: call_user_method(): Second argument is not an object or class name in %s on line %d
diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt
new file mode 100644
index 0000000..a58f19d
--- /dev/null
+++ b/ext/standard/tests/general_functions/callbacks_001.phpt
@@ -0,0 +1,108 @@
+--TEST--
+ZE2 Callbacks of static functions
+--FILE--
+<?php
+class A {
+ public static function who() {
+ echo "A\n";
+ }
+ public static function who2() {
+ echo "A\n";
+ }
+}
+
+class B extends A {
+ public static function who() {
+ echo "B\n";
+ }
+}
+
+class C extends B {
+ public function call($cb) {
+ echo join('|', $cb) . "\n";
+ call_user_func($cb);
+ }
+ public function test() {
+ $this->call(array('parent', 'who'));
+ $this->call(array('C', 'parent::who'));
+ $this->call(array('B', 'parent::who'));
+ $this->call(array('E', 'parent::who'));
+ $this->call(array('A', 'who'));
+ $this->call(array('C', 'who'));
+ $this->call(array('B', 'who2'));
+ }
+}
+
+class D {
+ public static function who() {
+ echo "D\n";
+ }
+}
+
+class E extends D {
+ public static function who() {
+ echo "E\n";
+ }
+}
+
+$o = new C;
+$o->test();
+
+class O {
+ public function who() {
+ echo "O\n";
+ }
+}
+
+class P extends O {
+ function __toString() {
+ return '$this';
+ }
+ public function who() {
+ echo "P\n";
+ }
+ public function call($cb) {
+ echo join('|', $cb) . "\n";
+ call_user_func($cb);
+ }
+ public function test() {
+ $this->call(array('parent', 'who'));
+ $this->call(array('P', 'parent::who'));
+ $this->call(array($this, 'O::who'));
+ $this->call(array($this, 'B::who'));
+ }
+}
+
+echo "===FOREIGN===\n";
+
+$o = new P;
+$o->test();
+
+?>
+===DONE===
+--EXPECTF--
+parent|who
+B
+C|parent::who
+B
+B|parent::who
+A
+E|parent::who
+D
+A|who
+A
+C|who
+B
+B|who2
+A
+===FOREIGN===
+parent|who
+O
+P|parent::who
+O
+$this|O::who
+O
+$this|B::who
+
+Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt
new file mode 100644
index 0000000..22130c5
--- /dev/null
+++ b/ext/standard/tests/general_functions/callbacks_002.phpt
@@ -0,0 +1,16 @@
+--TEST--
+call_user_func(): Wrong parameters
+--FILE--
+<?php
+
+call_user_func(array('Foo', 'bar'));
+call_user_func(array(NULL, 'bar'));
+call_user_func(array('stdclass', NULL));
+
+?>
+--EXPECTF--
+Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d
+
+Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
+
+Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d
diff --git a/ext/standard/tests/general_functions/closures_001.phpt b/ext/standard/tests/general_functions/closures_001.phpt
new file mode 100644
index 0000000..b4fc898
--- /dev/null
+++ b/ext/standard/tests/general_functions/closures_001.phpt
@@ -0,0 +1,11 @@
+--TEST--
+register_shutdown_function() & closure
+--FILE--
+<?php
+register_shutdown_function(function () { echo "Hello World!\n"; });
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done
+Hello World!
diff --git a/ext/standard/tests/general_functions/closures_002.phpt b/ext/standard/tests/general_functions/closures_002.phpt
new file mode 100644
index 0000000..6df389b
--- /dev/null
+++ b/ext/standard/tests/general_functions/closures_002.phpt
@@ -0,0 +1,25 @@
+--TEST--
+register_tick_function() & closure
+--FILE--
+<?php
+
+declare (ticks = 1);
+
+$i = 0;
+register_tick_function(function () use (&$i) { $i++; });
+
+echo "Test\n";
+echo "$i\n";
+echo "$i\n";
+var_dump ($i != 0);
+echo "$i\n";
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test
+%d
+%d
+bool(true)
+%d
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt
new file mode 100644
index 0000000..e83cdbf
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt
Binary files differ
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt
new file mode 100644
index 0000000..d6d8ae2
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt
Binary files differ
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_e.phpt b/ext/standard/tests/general_functions/debug_zval_dump_e.phpt
new file mode 100644
index 0000000..4929362
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_e.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test debug_zval_dump() function : error conditions
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value
+ to output.
+*/
+
+echo "*** Testing error conditions ***\n";
+
+/* passing zero argument */
+debug_zval_dump();
+
+echo "Done\n";
+
+?>
+
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: debug_zval_dump() expects at least %d parameter, %d given in %s on line %d
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
new file mode 100644
index 0000000..78f0f03
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
@@ -0,0 +1,841 @@
+--TEST--
+Test debug_zval_dump() function : working on objects
+--SKIPIF--
+<?php if (PHP_ZTS) { print "skip only for no-zts build"; }
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value to output.
+*/
+
+/* Prototype: void zval_dump( $value );
+ Description: use debug_zval_dump() to display the objects and its
+ reference count */
+function zval_dump( $values ) {
+ $counter = 1;
+ foreach( $values as $value ) {
+ echo "-- Iteration $counter --\n";
+ debug_zval_dump( $value );
+ $counter++;
+ }
+}
+
+/* checking on objects type */
+echo "*** Testing debug_zval_dump() on objects ***\n";
+class object_class {
+ var $value1 = 1;
+ private $value2 = 10;
+ protected $value3 = 20;
+ public $value4 = 30;
+
+ private function foo1() {
+ echo "function foo1\n";
+ }
+ protected function foo2() {
+ echo "function foo2\n";
+ }
+ public function foo3() {
+ echo "function foo3\n";
+ }
+ public $array_var = array( "key1" => 1, "key2 " => 3);
+
+ function object_class () {
+ $this->value1 = 5;
+ $this->object_class1 = $this;
+ }
+}
+
+class no_member_class{
+//no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ protected $p1 = 40;
+ private $p2 = 50;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* creating new object $obj */
+$obj = new contains_object_class();
+$obj1 = & $obj; //object $obj1 references object $obj
+$obj2 = & $obj;
+$obj3 = & $obj2;
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ @$temp_class_obj, //undefined object
+ $obj2->class_object1,
+ $obj3->class_object2,
+ $obj2->class_object1->value4,
+ @$unset_obj
+);
+/* using zval_dump() to dump out the objects and its reference count */
+zval_dump($objects);
+
+$int_var = 500;
+$obj = $int_var; //$obj is lost, $obj1,$obj2,$obj3,$obj4 = 500
+echo "\n-- Testing debug_zval_dump() on overwritten object variables --\n";
+debug_zval_dump($obj, $obj1, $obj2, $obj3);
+
+echo "\n-- Testing debug_zval_dump() on objects having circular reference --\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+debug_zval_dump($recursion_obj2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing debug_zval_dump() on objects ***
+-- Iteration 1 --
+object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 2 --
+object(no_member_class)#%d (0) refcount(4){
+}
+-- Iteration 3 --
+object(contains_object_class)#%d (9) refcount(4){
+ ["p"]=>
+ long(30) refcount(2)
+ ["p1":protected]=>
+ long(40) refcount(2)
+ ["p2":"contains_object_class":private]=>
+ long(50) refcount(2)
+ ["class_object1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object4":protected]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) refcount(3){
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (9) refcount(1){
+ ["p"]=>
+ long(30) refcount(2)
+ ["p1":protected]=>
+ long(40) refcount(2)
+ ["p2":"contains_object_class":private]=>
+ long(50) refcount(2)
+ ["class_object1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object4":protected]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) refcount(3){
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 4 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 5 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 6 --
+object(no_member_class)#%d (0) refcount(5){
+}
+-- Iteration 7 --
+NULL refcount(1)
+-- Iteration 8 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 9 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 10 --
+long(30) refcount(9)
+-- Iteration 11 --
+NULL refcount(1)
+
+-- Testing debug_zval_dump() on overwritten object variables --
+long(500) refcount(1)
+long(500) refcount(1)
+long(500) refcount(1)
+long(500) refcount(1)
+
+-- Testing debug_zval_dump() on objects having circular reference --
+object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
new file mode 100644
index 0000000..82ee2a6
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
@@ -0,0 +1,204 @@
+--TEST--
+Test debug_zval_dump() function : usage variations
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value
+ to output.
+*/
+
+echo "*** Testing debug_zval_dump() on functions ***\n";
+echo "--- Variation 1: global variable inside a function ---\n";
+$global_var = 10; //declaring global variable
+
+/* function to dump reference count of global variable,$global_var
+ and local variable,$local_var */
+function dump_globalvar( &$local_var ) {
+ global $global_var;
+ echo "\n-- Value of local variable inside dump_globalvar() --\n";
+ debug_zval_dump( $local_var );
+ echo "\n-- Value of global variable inside dump_globalvar() --\n";
+ debug_zval_dump( $global_var );
+}
+/* dump value and reference count of $global_var using debug_zval_dump() */
+echo "\n-- Value of global variable, before calling dump_globalvar() --\n";
+debug_zval_dump( $global_var );
+
+/* calling function dump_globalvar() to check the reference count of local
+ and global variables inside the function */
+dump_globalvar( $global_var );
+
+/* dump value and reference count of $global_var after exiting function
+ dump_globalvar();
+ expected: reference count of $global_var should remain the same as
+ before calling dump_globalvar() function */
+echo "\n-- Value of global variable, after exiting dump_globalvar() --\n";
+debug_zval_dump( $global_var );
+
+echo "\n--- Variation 2: one variable references another ---\n";
+$first_var = 10;
+/* dump value and reference count of $first_var */
+echo "\n-- Value of \$first_var: --\n";
+debug_zval_dump($first_var);
+
+/* $ref_first_var references $first_var */
+$ref_first_var = &$var_1;
+
+echo "\n-- Value of \$ref_first_var --\n";
+debug_zval_dump($ref_first_var);
+echo "\n-- Value of \$first_var --\n";
+debug_zval_dump($first_var);
+
+unset($ref_first_var);
+
+/* dump value and reference count of $first_var, $ref_first_var
+ here $ref_first_var is unset */
+echo "\n-- Value of \$ref_first_var --\n";
+debug_zval_dump($ref_first_var);
+echo "\n-- Value of \$first_var --\n";
+debug_zval_dump($first_var);
+
+echo "\n--- Variation 3: multiple references of variables ---\n";
+$var_1 = 10;
+$var_2 = &$var_1;
+$var_3 = &$var_2;
+echo "\n-- Value of \$var_1: (before referencing) --\n";
+debug_zval_dump($var_1);
+echo "\n-- Value of \$var_2: (referencing var_1) --\n";
+debug_zval_dump($var_2);
+echo "\n-- Value of \$var_3: (referencing var_2) --\n";
+debug_zval_dump($var_3);
+
+/* unsetting $var_3 */
+unset($var_3);
+echo "\n-- Value of \$var_3: (after unsetting var_3) --\n";
+debug_zval_dump($var_3);
+echo "\n-- Value of \$var_2: --\n";
+debug_zval_dump($var_2);
+echo "\n-- Value of \$var_3: --\n";
+debug_zval_dump($var_1);
+
+/* unsetting $var_1 */
+unset($var_1);
+echo "\n-- Value of \$var_1: (after unsetting variable_1) --\n";
+debug_zval_dump($var_1);
+echo "\n-- Value of \$var_2: --\n";
+debug_zval_dump($var_2);
+
+echo "\n*** Testing debug_zval_dump() on miscelleneous input arguments ***\n";
+/* unset a variable */
+$unset_var = 10.5;
+unset($unset_var);
+
+$misc_values = array (
+ /* nulls */
+ NULL,
+ null,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* undefined variable */
+ @$undef_var,
+
+ /* mixed types */
+ @TRUE123,
+ "123string",
+ "string123",
+ "NULLstring"
+);
+/* loop to display the variables and its reference count using
+ debug_zval_dump() */
+$counter = 1;
+foreach( $misc_values as $value ) {
+ echo "-- Iteration $counter --\n";
+ debug_zval_dump( $value );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+
+--EXPECTF--
+*** Testing debug_zval_dump() on functions ***
+--- Variation 1: global variable inside a function ---
+
+-- Value of global variable, before calling dump_globalvar() --
+long(10) refcount(2)
+
+-- Value of local variable inside dump_globalvar() --
+long(10) refcount(1)
+
+-- Value of global variable inside dump_globalvar() --
+long(10) refcount(1)
+
+-- Value of global variable, after exiting dump_globalvar() --
+long(10) refcount(2)
+
+--- Variation 2: one variable references another ---
+
+-- Value of $first_var: --
+long(10) refcount(2)
+
+-- Value of $ref_first_var --
+NULL refcount(1)
+
+-- Value of $first_var --
+long(10) refcount(2)
+
+-- Value of $ref_first_var --
+
+Notice: Undefined variable: ref_first_var in %s on line %d
+NULL refcount(1)
+
+-- Value of $first_var --
+long(10) refcount(2)
+
+--- Variation 3: multiple references of variables ---
+
+-- Value of $var_1: (before referencing) --
+long(10) refcount(1)
+
+-- Value of $var_2: (referencing var_1) --
+long(10) refcount(1)
+
+-- Value of $var_3: (referencing var_2) --
+long(10) refcount(1)
+
+-- Value of $var_3: (after unsetting var_3) --
+
+Notice: Undefined variable: var_3 in %s on line %d
+NULL refcount(1)
+
+-- Value of $var_2: --
+long(10) refcount(1)
+
+-- Value of $var_3: --
+long(10) refcount(1)
+
+-- Value of $var_1: (after unsetting variable_1) --
+
+Notice: Undefined variable: var_1 in %s on line %d
+NULL refcount(1)
+
+-- Value of $var_2: --
+long(10) refcount(2)
+
+*** Testing debug_zval_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL refcount(3)
+-- Iteration 2 --
+NULL refcount(3)
+-- Iteration 3 --
+NULL refcount(1)
+-- Iteration 4 --
+NULL refcount(1)
+-- Iteration 5 --
+string(7) "TRUE123" refcount(3)
+-- Iteration 6 --
+string(9) "123string" refcount(3)
+-- Iteration 7 --
+string(9) "string123" refcount(3)
+-- Iteration 8 --
+string(10) "NULLstring" refcount(3)
+Done
diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
new file mode 100644
index 0000000..e242d45
--- /dev/null
+++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
@@ -0,0 +1,12 @@
+--TEST--
+dl() filename length checks (CVE-2007-4887)
+--INI--
+enable_dl=1
+--FILE--
+<?php
+var_dump(dl(str_repeat("a", 8376757)));
+?>
+--EXPECTF--
+
+Warning: dl(): File name exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt
new file mode 100644
index 0000000..95a6cf4
--- /dev/null
+++ b/ext/standard/tests/general_functions/error_get_last.phpt
@@ -0,0 +1,43 @@
+--TEST--
+error_get_last() tests
+--FILE--
+<?php
+
+var_dump(error_get_last());
+var_dump(error_get_last(true));
+var_dump(error_get_last());
+
+$a = $b;
+
+var_dump(error_get_last());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+
+Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+array(4) {
+ ["type"]=>
+ int(2)
+ ["message"]=>
+ string(54) "error_get_last() expects exactly 0 parameters, 1 given"
+ ["file"]=>
+ string(%i) "%s"
+ ["line"]=>
+ int(4)
+}
+
+Notice: Undefined variable: b in %s on line %d
+array(4) {
+ ["type"]=>
+ int(8)
+ ["message"]=>
+ string(21) "Undefined variable: b"
+ ["file"]=>
+ string(%i) "%s"
+ ["line"]=>
+ int(7)
+}
+Done
diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt
new file mode 100644
index 0000000..8880056
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test escapeshellarg() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for escapeshellarg() function\n";
+
+var_dump(escapeshellarg("Mr O'Neil"));
+var_dump(escapeshellarg("Mr O\'Neil"));
+var_dump(escapeshellarg("%FILENAME"));
+var_dump(escapeshellarg(""));
+
+echo "Done\n";
+?>
+--EXPECT--
+Simple testcase for escapeshellarg() function
+string(11) ""Mr O'Neil""
+string(12) ""Mr O\'Neil""
+string(11) "" FILENAME""
+string(2) """"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic.phpt
new file mode 100644
index 0000000..c26915c
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test escapeshellarg() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for escapeshellarg() function\n";
+
+var_dump(escapeshellarg("Mr O'Neil"));
+var_dump(escapeshellarg("Mr O\'Neil"));
+var_dump(escapeshellarg("%FILENAME"));
+var_dump(escapeshellarg(""));
+
+echo "Done\n";
+?>
+--EXPECT--
+Simple testcase for escapeshellarg() function
+string(14) "'Mr O'\''Neil'"
+string(15) "'Mr O\'\''Neil'"
+string(11) "'%FILENAME'"
+string(2) "''"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/escapeshellarg_error.phpt b/ext/standard/tests/general_functions/escapeshellarg_error.phpt
new file mode 100644
index 0000000..139a445
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test escapeshellarg() function : error conditions - wrong numbers of parameters
+--FILE--
+<?php
+
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to escapeshellarg() to test behaviour
+ */
+
+echo "*** Testing escapeshellarg() : error conditions ***\n";
+
+
+echo "\n-- Testing escapeshellarg() function with no arguments --\n";
+var_dump( escapeshellarg() );
+
+echo "\n-- Testing escapeshellarg() function with more than expected no. of arguments --\n";
+$arg = "Mr O'Neil";
+$extra_arg = 10;
+var_dump( escapeshellarg($arg, $extra_arg) );
+
+echo "\n-- Testing escapeshellarg() function with a object supplied for argument --\n";
+
+class classA
+{
+}
+
+$arg = new classA();
+var_dump( escapeshellarg($arg));
+
+echo "\n-- Testing escapeshellarg() function with a resource supplied for argument --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( escapeshellarg($fp));
+fclose($fp);
+
+echo "\n-- Testing escapeshellarg() function with a array supplied for argument --\n";
+$arg = array(1,2,3);
+var_dump( escapeshellarg($arg));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing escapeshellarg() : error conditions ***
+
+-- Testing escapeshellarg() function with no arguments --
+
+Warning: escapeshellarg() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with more than expected no. of arguments --
+
+Warning: escapeshellarg() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with a object supplied for argument --
+
+Warning: escapeshellarg() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with a resource supplied for argument --
+
+Warning: escapeshellarg() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with a array supplied for argument --
+
+Warning: escapeshellarg() expects parameter 1 to be string, array given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
new file mode 100644
index 0000000..8f8bc19
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
@@ -0,0 +1,140 @@
+--TEST--
+Test escapeshellarg() function : usage variations - different data types as $arg arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only for Windows");
+?>
+--FILE--
+<?php
+
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ */
+
+echo "*** Testing escapeshellarg() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // undefined data
+/*19*/ @$undefined_var,
+
+ // unset data
+/*20*/ @$unset_var,
+
+);
+
+// loop through each element of $inputs to check the behaviour of escapeshellarg()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(escapeshellarg($input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECT--
+*** Testing escapeshellarg() : usage variations ***
+
+-- Iteration 1 --
+string(3) ""0""
+
+-- Iteration 2 --
+string(3) ""1""
+
+-- Iteration 3 --
+string(4) ""12""
+
+-- Iteration 4 --
+string(5) ""-12""
+
+-- Iteration 5 --
+string(12) ""2147483647""
+
+-- Iteration 6 --
+string(6) ""10.5""
+
+-- Iteration 7 --
+string(7) ""-10.5""
+
+-- Iteration 8 --
+string(10) ""123.4567""
+
+-- Iteration 9 --
+string(12) ""0.01234567""
+
+-- Iteration 10 --
+string(5) ""0.5""
+
+-- Iteration 11 --
+string(2) """"
+
+-- Iteration 12 --
+string(2) """"
+
+-- Iteration 13 --
+string(3) ""1""
+
+-- Iteration 14 --
+string(2) """"
+
+-- Iteration 15 --
+string(3) ""1""
+
+-- Iteration 16 --
+string(2) """"
+
+-- Iteration 17 --
+string(2) """"
+
+-- Iteration 18 --
+string(2) """"
+
+-- Iteration 19 --
+string(2) """"
+
+-- Iteration 20 --
+string(2) """"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
new file mode 100644
index 0000000..32431a5
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
@@ -0,0 +1,140 @@
+--TEST--
+Test escapeshellarg() function : usage variations - different data types as $y arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ */
+
+echo "*** Testing escapeshellarg() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // undefined data
+/*19*/ @$undefined_var,
+
+ // unset data
+/*20*/ @$unset_var,
+
+);
+
+// loop through each element of $inputs to check the behaviour of escapeshellarg()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(escapeshellarg($input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECT--
+*** Testing escapeshellarg() : usage variations ***
+
+-- Iteration 1 --
+string(3) "'0'"
+
+-- Iteration 2 --
+string(3) "'1'"
+
+-- Iteration 3 --
+string(4) "'12'"
+
+-- Iteration 4 --
+string(5) "'-12'"
+
+-- Iteration 5 --
+string(12) "'2147483647'"
+
+-- Iteration 6 --
+string(6) "'10.5'"
+
+-- Iteration 7 --
+string(7) "'-10.5'"
+
+-- Iteration 8 --
+string(10) "'123.4567'"
+
+-- Iteration 9 --
+string(12) "'0.01234567'"
+
+-- Iteration 10 --
+string(5) "'0.5'"
+
+-- Iteration 11 --
+string(2) "''"
+
+-- Iteration 12 --
+string(2) "''"
+
+-- Iteration 13 --
+string(3) "'1'"
+
+-- Iteration 14 --
+string(2) "''"
+
+-- Iteration 15 --
+string(3) "'1'"
+
+-- Iteration 16 --
+string(2) "''"
+
+-- Iteration 17 --
+string(2) "''"
+
+-- Iteration 18 --
+string(2) "''"
+
+-- Iteration 19 --
+string(2) "''"
+
+-- Iteration 20 --
+string(2) "''"
+===Done===
diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
new file mode 100644
index 0000000..9fcb991
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test escapeshellcmd() functionality on Windows
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Valid for Windows only');
+}
+?>
+--FILE--
+<?php
+echo "*** Testing escapeshellcmd() basic operations ***\n";
+$data = array(
+ '"abc',
+ "'abc",
+ '?<>',
+ '()[]{}$',
+ '%^',
+ '#&;`|*?',
+ '~<>\\',
+ '%NOENV%'
+);
+
+$count = 1;
+foreach ($data AS $value) {
+ echo "-- Test " . $count++ . " --\n";
+ var_dump(escapeshellcmd($value));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing escapeshellcmd() basic operations ***
+-- Test 1 --
+string(5) "^"abc"
+-- Test 2 --
+string(5) "^'abc"
+-- Test 3 --
+string(6) "^?^<^>"
+-- Test 4 --
+string(14) "^(^)^[^]^{^}^$"
+-- Test 5 --
+string(4) "^%^^"
+-- Test 6 --
+string(14) "^#^&^;^`^|^*^?"
+-- Test 7 --
+string(8) "^~^<^>^\"
+-- Test 8 --
+string(9) "^%NOENV^%"
+Done
diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt
new file mode 100644
index 0000000..b427bda
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Testing floatval() and its alias doubleval() Functions
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+echo "*** Testing floatval() with valid float values ***\n";
+// different valid float values
+$valid_floats = array(
+ 0.0,
+ 1.0,
+ -1.0,
+ 1.234,
+ -1.234,
+ 1.2e3,
+ -1.2e3,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-1,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ .5e+7,
+ -.5e+7
+);
+
+/* loop to check that floatval() recognizes different
+ float values, expected output:float value for valid floating point number */
+
+foreach ($valid_floats as $value ) {
+ var_dump( floatval($value) );
+}
+
+
+echo "\n*** Testing doubleval() with valid float values ***\n";
+/* loop to check that doubleval() also recognizes different
+ float values, expected output:float value for valid floating point number */
+
+foreach ($valid_floats as $value ) {
+ var_dump( doubleval($value) );
+}
+
+
+echo "\n*** Testing floatval() on non floating types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// other types in an array
+$not_float_types = array (
+ -2147483648, // max negative integer value
+ 2147483648, // max positive integer value
+ $fp, // resource
+ $dfp,
+ "0.0", // string
+ "1.0",
+ "-1.3e3",
+ "bob-1.3e3",
+ "10 Some dollars",
+ "10.2 Some Dollars",
+ "10.0 dollar" + 1,
+ "10.0 dollar" + 1.0,
+ "",
+ true,
+ NULL,
+ null,
+ );
+/* loop through the $not_float_types to see working of
+ floatval() on non float types, expected output: float value valid floating point numbers */
+foreach ($not_float_types as $type ) {
+ var_dump( floatval($type) );
+}
+
+
+echo "\n*** Testing doubleval() on non floating types ***\n";
+
+/* loop through the $not_float_types to see working of
+ doubleval() on non float types, expected output: float value valid floating point numbers */
+foreach ($not_float_types as $type ) {
+ var_dump( doubleval($type) );
+}
+
+
+
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( floatval() );
+var_dump( doubleval() );
+
+//arguments more than expected
+var_dump( floatval(TRUE, FALSE) );
+var_dump( doubleval(TRUE, FALSE) );
+
+echo "\nDone\n";
+
+
+?>
+--EXPECTF--
+*** Testing floatval() with valid float values ***
+float(0)
+float(1)
+float(-1)
+float(1.234)
+float(-1.234)
+float(1200)
+float(-1200)
+float(10)
+float(1050000)
+float(100000)
+float(-100000)
+float(1.0E-5)
+float(-0.1)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(5000000)
+float(-5000000)
+
+*** Testing doubleval() with valid float values ***
+float(0)
+float(1)
+float(-1)
+float(1.234)
+float(-1.234)
+float(1200)
+float(-1200)
+float(10)
+float(1050000)
+float(100000)
+float(-100000)
+float(1.0E-5)
+float(-0.1)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(5000000)
+float(-5000000)
+
+*** Testing floatval() on non floating types ***
+float(-2147483648)
+float(2147483648)
+float(5)
+float(6)
+float(0)
+float(1)
+float(-1300)
+float(0)
+float(10)
+float(10.2)
+float(11)
+float(11)
+float(0)
+float(1)
+float(0)
+float(0)
+
+*** Testing doubleval() on non floating types ***
+float(-2147483648)
+float(2147483648)
+float(5)
+float(6)
+float(0)
+float(1)
+float(-1300)
+float(0)
+float(10)
+float(10.2)
+float(11)
+float(11)
+float(0)
+float(1)
+float(0)
+float(0)
+
+*** Testing error conditions ***
+
+Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Done
diff --git a/ext/standard/tests/general_functions/floatval_basic.phpt b/ext/standard/tests/general_functions/floatval_basic.phpt
new file mode 100644
index 0000000..129aa87
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval_basic.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Testing floatval() and its alias doubleval() Functions
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+// different valid float values
+$valid_floats = array(
+ "0.0" => 0.0,
+ "1.0" => 1.0,
+ "-1.0" => -1.0,
+ "1.234" => 1.234,
+ "-1.234" => -1.234,
+ "1.2e3" => 1.2e3,
+ "-1.2e3" => -1.2e3,
+ "10.0000000000000000005" => 10.0000000000000000005,
+ "10.5e+5" => 10.5e+5,
+ "1e5" => 1e5,
+ "-1e5" => -1e5,
+ "1e5" => 1e-5,
+ "-1e-1" => -1e-1,
+ "1e+5" => 1e+5,
+ "-1e+5" =>-1e+5,
+ "1E5" => 1E5,
+ "-1E5" => -1E5,
+ "1E+5" => 1E+5,
+ "-1E5" => -1E+5,
+ ".5e+7" => .5e+7,
+ "-.5e+7" =>-.5e+7
+);
+
+/* loop to check that floatval() recognizes different
+ float values, expected output:float value for valid floating point number */
+echo "*** Testing floatval() with valid float values ***\n";
+foreach ($valid_floats as $key => $value ) {
+ echo "\n-- Iteration : $key -- \n";
+ var_dump( floatval($value) );
+}
+
+/* loop to check that doubleval() also recognizes different
+ float values, expected output:float value for valid floating point number */
+echo "\n*** Testing doubleval() with valid float values ***\n";
+foreach ($valid_floats as $key => $value ) {
+ echo "\n-- Iteration : $key -- \n";
+ var_dump( doubleval($value) );
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing floatval() with valid float values ***
+
+-- Iteration : 0.0 --
+float(0)
+
+-- Iteration : 1.0 --
+float(1)
+
+-- Iteration : -1.0 --
+float(-1)
+
+-- Iteration : 1.234 --
+float(1.234)
+
+-- Iteration : -1.234 --
+float(-1.234)
+
+-- Iteration : 1.2e3 --
+float(1200)
+
+-- Iteration : -1.2e3 --
+float(-1200)
+
+-- Iteration : 10.0000000000000000005 --
+float(10)
+
+-- Iteration : 10.5e+5 --
+float(1050000)
+
+-- Iteration : 1e5 --
+float(1.0E-5)
+
+-- Iteration : -1e5 --
+float(-100000)
+
+-- Iteration : -1e-1 --
+float(-0.1)
+
+-- Iteration : 1e+5 --
+float(100000)
+
+-- Iteration : -1e+5 --
+float(-100000)
+
+-- Iteration : 1E5 --
+float(100000)
+
+-- Iteration : -1E5 --
+float(-100000)
+
+-- Iteration : 1E+5 --
+float(100000)
+
+-- Iteration : .5e+7 --
+float(5000000)
+
+-- Iteration : -.5e+7 --
+float(-5000000)
+
+*** Testing doubleval() with valid float values ***
+
+-- Iteration : 0.0 --
+float(0)
+
+-- Iteration : 1.0 --
+float(1)
+
+-- Iteration : -1.0 --
+float(-1)
+
+-- Iteration : 1.234 --
+float(1.234)
+
+-- Iteration : -1.234 --
+float(-1.234)
+
+-- Iteration : 1.2e3 --
+float(1200)
+
+-- Iteration : -1.2e3 --
+float(-1200)
+
+-- Iteration : 10.0000000000000000005 --
+float(10)
+
+-- Iteration : 10.5e+5 --
+float(1050000)
+
+-- Iteration : 1e5 --
+float(1.0E-5)
+
+-- Iteration : -1e5 --
+float(-100000)
+
+-- Iteration : -1e-1 --
+float(-0.1)
+
+-- Iteration : 1e+5 --
+float(100000)
+
+-- Iteration : -1e+5 --
+float(-100000)
+
+-- Iteration : 1E5 --
+float(100000)
+
+-- Iteration : -1E5 --
+float(-100000)
+
+-- Iteration : 1E+5 --
+float(100000)
+
+-- Iteration : .5e+7 --
+float(5000000)
+
+-- Iteration : -.5e+7 --
+float(-5000000)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/floatval_error.phpt b/ext/standard/tests/general_functions/floatval_error.phpt
new file mode 100644
index 0000000..178713a
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Testing floatval() and its alias doubleval() : error conditions - wrong numbers of parametersns
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+echo "*** Testing floatval() and doubleval() : error conditions ***\n";
+
+
+echo "\n-- Testing floatval() and doubleval() function with no arguments --\n";
+var_dump( floatval() );
+var_dump( doubleval() );
+
+echo "\n-- Testing floatval() and doubleval() function with more than expected no. of arguments --\n";
+var_dump( floatval(10.5, FALSE) );
+var_dump( doubleval(10.5, FALSE) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing floatval() and doubleval() : error conditions ***
+
+-- Testing floatval() and doubleval() function with no arguments --
+
+Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing floatval() and doubleval() function with more than expected no. of arguments --
+
+Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: doubleval() 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/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt
new file mode 100644
index 0000000..83925b8
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval_variation1.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Testing floatval() and its alias doubleval() functions : usage variations - different data types as $y arg
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// other types in an array
+$not_float_types = array (
+ "-2147483648" => -2147483648, // max negative integer value
+ "2147483647" => 2147483648, // max positive integer value
+ "file resoruce" => $fp,
+ "directory resource" => $dfp,
+ "\"0.0\"" => "0.0", // string
+ "\"1.0\"" => "1.0",
+ "\"-1.3e3\"" => "-1.3e3",
+ "\"bob-1.3e3\"" => "bob-1.3e3",
+ "\"10 Some dollars\"" => "10 Some dollars",
+ "\"10.2 Some Dollars\"" => "10.2 Some Dollars",
+ "\"10.0 dollar\" + 1" => "10.0 dollar" + 1,
+ "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0,
+ "\"\"" => "",
+ "true" => true,
+ "NULL" => NULL,
+ "null" => null,
+ );
+/* loop through the $not_float_types to see working of
+ floatval() on non float types, expected output: float value valid floating point numbers */
+echo "\n*** Testing floatval() on non floating types ***\n";
+foreach ($not_float_types as $key => $type ) {
+ echo "\n-- Iteration : $key --\n";
+ var_dump( floatval($type) );
+}
+
+echo "\n*** Testing doubleval() on non floating types ***\n";
+
+/* loop through the $not_float_types to see working of
+ doubleval() on non float types, expected output: float value valid floating point numbers */
+foreach ($not_float_types as $key => $type ) {
+ echo "\n-- Iteration : $key --\n";
+ var_dump( doubleval($type) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing floatval() on non floating types ***
+
+-- Iteration : -2147483648 --
+float(-2147483648)
+
+-- Iteration : 2147483647 --
+float(2147483648)
+
+-- Iteration : file resoruce --
+float(%d)
+
+-- Iteration : directory resource --
+float(%d)
+
+-- Iteration : "0.0" --
+float(0)
+
+-- Iteration : "1.0" --
+float(1)
+
+-- Iteration : "-1.3e3" --
+float(-1300)
+
+-- Iteration : "bob-1.3e3" --
+float(0)
+
+-- Iteration : "10 Some dollars" --
+float(10)
+
+-- Iteration : "10.2 Some Dollars" --
+float(10.2)
+
+-- Iteration : "10.0 dollar" + 1 --
+float(11)
+
+-- Iteration : "10.0 dollar" + 1.0 --
+float(11)
+
+-- Iteration : "" --
+float(0)
+
+-- Iteration : true --
+float(1)
+
+-- Iteration : NULL --
+float(0)
+
+-- Iteration : null --
+float(0)
+
+*** Testing doubleval() on non floating types ***
+
+-- Iteration : -2147483648 --
+float(-2147483648)
+
+-- Iteration : 2147483647 --
+float(2147483648)
+
+-- Iteration : file resoruce --
+float(%d)
+
+-- Iteration : directory resource --
+float(%d)
+
+-- Iteration : "0.0" --
+float(0)
+
+-- Iteration : "1.0" --
+float(1)
+
+-- Iteration : "-1.3e3" --
+float(-1300)
+
+-- Iteration : "bob-1.3e3" --
+float(0)
+
+-- Iteration : "10 Some dollars" --
+float(10)
+
+-- Iteration : "10.2 Some Dollars" --
+float(10.2)
+
+-- Iteration : "10.0 dollar" + 1 --
+float(11)
+
+-- Iteration : "10.0 dollar" + 1.0 --
+float(11)
+
+-- Iteration : "" --
+float(0)
+
+-- Iteration : true --
+float(1)
+
+-- Iteration : NULL --
+float(0)
+
+-- Iteration : null --
+float(0)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_cfg_var_basic.phpt b/ext/standard/tests/general_functions/get_cfg_var_basic.phpt
new file mode 100644
index 0000000..3fb0056
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test function get_cfg_var() by calling it with its expected arguments
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with its expected arguments ***\n";
+var_dump(get_cfg_var( 'session.use_cookies' ) );
+var_dump(get_cfg_var( 'session.serialize_handler' ) );
+var_dump(get_cfg_var( 'session.save_handler' ) );
+
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments ***
+string(1) "0"
+string(3) "php"
+string(5) "files"
diff --git a/ext/standard/tests/general_functions/get_cfg_var_error.phpt b/ext/standard/tests/general_functions/get_cfg_var_error.phpt
new file mode 100644
index 0000000..1c319bf
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function get_cfg_var() by calling it more than or less than its expected arguments
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+var_dump(get_cfg_var( 'session.use_cookies', 'session.serialize_handler' ) );
+var_dump(get_cfg_var( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: get_cfg_var() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
new file mode 100644
index 0000000..4e59f28
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with array values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt
new file mode 100644
index 0000000..68495a1
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with boolean values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt
new file mode 100644
index 0000000..d1fb5e7
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with emptyUnsetUndefNull values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation4.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation4.phpt
new file mode 100644
index 0000000..8dac4f8
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation4.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with float values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation5.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation5.phpt
new file mode 100644
index 0000000..392abb3
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation5.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with int values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
new file mode 100644
index 0000000..d142621
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with object values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "session.use_cookies";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+string(1) "0"
+
+Warning: get_cfg_var() expects parameter 1 to be string, object given in %s.php on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt
new file mode 100644
index 0000000..3b5b08c
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with string values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with unknown string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with unknown string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
new file mode 100644
index 0000000..c7a72de
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test function get_cfg_var() by calling deprecated option
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+magic_quotes_gpc=1
+--SKIPIF--
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with deprecated option ***\n";
+var_dump(get_cfg_var( 'magic_quotes_gpc' ) );
+
+?>
+--EXPECTF--
+Fatal error: Directive 'magic_quotes_gpc' is no longer available in PHP in Unknown on line 0
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt
new file mode 100644
index 0000000..6e0ffc5
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function get_cfg_var() by substituting argument with array of valid parameters.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument with array of valid parameters ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'session.use_cookies',
+ 'session.serialize_handler',
+ 'session.save_handler'
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument with array of valid parameters ***
+string(1) "0"
+string(3) "php"
+string(5) "files"
diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
new file mode 100644
index 0000000..9e2e66c
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test get_defined_constants() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : basic functionality ***\n";
+
+var_dump(gettype(get_defined_constants(true)));
+var_dump(gettype(get_defined_constants()));
+
+$arr1 = get_defined_constants(false);
+$arr2 = get_defined_constants();
+var_dump(array_diff($arr1, $arr2));
+
+$n1 = count(get_defined_constants());
+define("USER_CONSTANT", "test");
+$arr2 = get_defined_constants();
+$n2 = count($arr2);
+
+if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_defined_constants() : basic functionality ***
+string(5) "array"
+string(5) "array"
+array(0) {
+}
+TEST PASSED
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_defined_constants_error.phpt b/ext/standard/tests/general_functions/get_defined_constants_error.phpt
new file mode 100644
index 0000000..1092712
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_defined_constants_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test get_defined_constants() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : error conditions ***\n";
+
+echo "\n-- Testing get_defined_constants() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( get_defined_constants(true, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_defined_constants() : error conditions ***
+
+-- Testing get_defined_constants() function with more than expected no. of arguments --
+
+Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line 11
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
new file mode 100644
index 0000000..3aa6e72
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
@@ -0,0 +1,152 @@
+--TEST--
+Test get_defined_vars() function
+--FILE--
+<?php
+/* Prototype: array get_defined_vars ( void )
+ Description: This function returns a multidimensional array containing a list of all defined
+ variables, be them environment, server or user-defined variables, within the scope that
+ get_defined_vars() is called.
+*/
+
+echo "Simple testcase for get_defined_vars() function\n\n";
+
+function f1() {
+ echo "\n-- Function f1() called --\n";
+ $vars = get_defined_vars();
+
+ if (count($vars) != 0) {
+ echo "TEST FAILED\n";
+ }
+
+ echo "\n-- ..define some local variables --\n";
+ $i = 123;
+ $f = 123.456;
+ $b = false;
+ $s = "Hello World";
+ $arr = array(1,2,3,4);
+ var_dump( get_defined_vars() );
+ f2();
+}
+
+function f2() {
+ echo "\n -- Function f2() called --\n";
+ $vars= get_defined_vars();
+
+ if (count($vars) != 0) {
+ echo "TEST FAILED\n";
+ }
+
+ echo "\n-- ...define some variables --\n";
+ $i = 456;
+ $f = 456.678;
+ $b = true;
+ $s = "Goodnight";
+ $arr = array("foo", "bar");
+ var_dump( get_defined_vars() );
+
+ echo "\n-- ...define some more variables --\n";
+ $i1 = 456;
+ $f1 = 456.678;
+ $b1 = true;
+ var_dump( get_defined_vars() );
+
+}
+
+echo "\n-- Get variables at global scope --\n";
+$vars = get_defined_vars();
+
+if (count($vars) == 0) {
+ echo "TEST FAILED - Global variables missing at global scope\n";
+}
+
+// call a function
+f1();
+
+?>
+===DONE===
+--EXPECT--
+Simple testcase for get_defined_vars() function
+
+
+-- Get variables at global scope --
+
+-- Function f1() called --
+
+-- ..define some local variables --
+array(6) {
+ ["vars"]=>
+ array(0) {
+ }
+ ["i"]=>
+ int(123)
+ ["f"]=>
+ float(123.456)
+ ["b"]=>
+ bool(false)
+ ["s"]=>
+ string(11) "Hello World"
+ ["arr"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+}
+
+ -- Function f2() called --
+
+-- ...define some variables --
+array(6) {
+ ["vars"]=>
+ array(0) {
+ }
+ ["i"]=>
+ int(456)
+ ["f"]=>
+ float(456.678)
+ ["b"]=>
+ bool(true)
+ ["s"]=>
+ string(9) "Goodnight"
+ ["arr"]=>
+ array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ }
+}
+
+-- ...define some more variables --
+array(9) {
+ ["vars"]=>
+ array(0) {
+ }
+ ["i"]=>
+ int(456)
+ ["f"]=>
+ float(456.678)
+ ["b"]=>
+ bool(true)
+ ["s"]=>
+ string(9) "Goodnight"
+ ["arr"]=>
+ array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ }
+ ["i1"]=>
+ int(456)
+ ["f1"]=>
+ float(456.678)
+ ["b1"]=>
+ bool(true)
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
new file mode 100644
index 0000000..d87eb4c
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test get_extension_funcs() function: basic test
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for get_extension_funcs() function\n";
+
+$result = get_extension_funcs("standard");
+var_dump(gettype($result));
+var_dump(in_array("cos", $result));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_extension_funcs() function
+string(5) "array"
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
new file mode 100644
index 0000000..33e32a6
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test get_extension_funcs() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_extension_funcs() : error conditions ***\n";
+
+echo "\n-- Too few arguments --\n";
+var_dump(get_extension_funcs());
+
+$extra_arg = 1;
+echo "\n-- Too many arguments --\n";
+var_dump(get_extension_funcs("standard", $extra_arg));
+
+echo "\n-- Invalid extension name --\n";
+var_dump(get_extension_funcs("foo"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_extension_funcs() : error conditions ***
+
+-- Too few arguments --
+
+Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Too many arguments --
+
+Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Invalid extension name --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt b/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt
new file mode 100644
index 0000000..c575737
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test get_extension_funcs() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $str
+$inputs = array (
+
+ // integer values
+ 0,
+ 1,
+ 255,
+ 256,
+ PHP_INT_MAX,
+ -PHP_INT_MAX,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test get_extension_funcs() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( get_extension_funcs($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' 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 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt
new file mode 100644
index 0000000..999862b
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test get_include_path() function
+--INI--
+include_path=.
+--FILE--
+<?php
+/* Prototype: string get_include_path ( void )
+ * Description: Gets the current include_path configuration option
+
+*/
+
+echo "*** Testing get_include_path()\n";
+
+var_dump(get_include_path());
+
+if (ini_get("include_path") == get_include_path()) {
+ echo "PASSED\n";
+} else {
+ echo "FAILED\n";
+}
+
+echo "\nError cases:\n";
+var_dump(get_include_path(TRUE));
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_include_path()
+string(1) "."
+PASSED
+
+Error cases:
+
+Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt
new file mode 100644
index 0000000..e7e1ed5
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test get_include_files() function
+--INI--
+include_path=.
+--FILE--
+<?php
+/* Prototype: array get_included_files ( void )
+ * Description: Returns an array with the names of included or required files
+
+*/
+
+echo "*** Testing get_included_files()\n";
+
+echo "\n-- List included files at start --\n";
+var_dump(get_included_files());
+
+include(dirname(__FILE__)."/get_included_files_inc1.inc");
+echo "\n-- List included files atfter including inc1 -\n";
+var_dump(get_included_files());
+
+include(dirname(__FILE__)."/get_included_files_inc2.inc");
+echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n";
+var_dump(get_included_files());
+
+echo "\n-- Error cases --\n";
+var_dump(get_included_files(true));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_included_files()
+
+-- List included files at start --
+array(1) {
+ [0]=>
+ string(%d) "%sget_included_files.php"
+}
+
+-- List included files atfter including inc1 -
+array(2) {
+ [0]=>
+ string(%d) "%sget_included_files.php"
+ [1]=>
+ string(%d) "%sget_included_files_inc1.inc"
+}
+
+-- List included files atfter including inc2 which will include inc3 which includes inc1 --
+array(4) {
+ [0]=>
+ string(%d) "%sget_included_files.php"
+ [1]=>
+ string(%d) "%sget_included_files_inc1.inc"
+ [2]=>
+ string(%d) "%sget_included_files_inc2.inc"
+ [3]=>
+ string(%d) "%sget_included_files_inc3.inc"
+}
+
+-- Error cases --
+
+Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_included_files_inc1.inc b/ext/standard/tests/general_functions/get_included_files_inc1.inc
new file mode 100644
index 0000000..344e300
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files_inc1.inc
@@ -0,0 +1,3 @@
+<?php
+/* dummy include*/
+?>
diff --git a/ext/standard/tests/general_functions/get_included_files_inc2.inc b/ext/standard/tests/general_functions/get_included_files_inc2.inc
new file mode 100644
index 0000000..318eba0
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files_inc2.inc
@@ -0,0 +1,4 @@
+<?php
+/* dummy include*/
+include(dirname(__FILE__)."/get_included_files_inc3.inc");
+?>
diff --git a/ext/standard/tests/general_functions/get_included_files_inc3.inc b/ext/standard/tests/general_functions/get_included_files_inc3.inc
new file mode 100644
index 0000000..f666edf
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files_inc3.inc
@@ -0,0 +1,4 @@
+<?php
+/* dummy include*/
+include(dirname(__FILE__)."/get_included_files_inc1.inc");
+?>
diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
new file mode 100644
index 0000000..4a8eceb
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test get_loaded_extensions() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : basic functionality ***\n";
+
+echo "Get loaded extensions\n";
+var_dump(get_loaded_extensions());
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_loaded_extensions() : basic functionality ***
+Get loaded extensions
+array(%d) {
+%a
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt
new file mode 100644
index 0000000..d731046
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test get_loaded_extensions() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : error conditions ***\n";
+
+echo "\n-- Testing get_loaded_extensions() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( get_resource_type(true, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_loaded_extensions() : error conditions ***
+
+-- Testing get_loaded_extensions() function with more than expected no. of arguments --
+
+Warning: get_resource_type() 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/general_functions/get_magic_quotes_gpc.phpt b/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
new file mode 100644
index 0000000..75cde18
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test get_magic_quotes_gpc() function
+--FILE--
+<?php
+/* Prototype: int get_magic_quotes_gpc ( void )
+ * This function is not supported anymore and will always return false
+ */
+
+echo "Simple testcase for get_magic_quotes_gpc() function\n";
+var_dump(get_magic_quotes_gpc());
+
+echo "\n-- Error cases --\n";
+// no checks on number of args
+var_dump(get_magic_quotes_gpc(true));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_magic_quotes_gpc() function
+bool(false)
+
+-- Error cases --
+
+Warning: get_magic_quotes_gpc() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt b/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
new file mode 100644
index 0000000..4106ee9
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test get_magic_quotes_runtime() function
+--FILE--
+<?php
+/* Prototype: int get_magic_quotes_runtime ( void )
+ * This function is not supported anymore and will always return false
+ */
+
+echo "Simple testcase for get_magic_quotes_runtime() function\n";
+
+var_dump(get_magic_quotes_runtime());
+
+echo "\n-- Error cases --\n";
+// no checks on number of args
+var_dump(get_magic_quotes_runtime(true));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_magic_quotes_runtime() function
+bool(false)
+
+-- Error cases --
+
+Warning: get_magic_quotes_runtime() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_resource_type_basic.phpt b/ext/standard/tests/general_functions/get_resource_type_basic.phpt
new file mode 100644
index 0000000..7ff4aec
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_resource_type_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test get_resource_type() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : basic functionality ***\n";
+
+$res = fopen(__FILE__, "r");
+var_dump(get_resource_type($res));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing get_resource_type() : basic functionality ***
+string(6) "stream"
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_resource_type_error.phpt b/ext/standard/tests/general_functions/get_resource_type_error.phpt
new file mode 100644
index 0000000..40dcf07
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_resource_type_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test get_resource_type() function : error conditions
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : error conditions ***\n";
+
+echo "\n-- Testing get_resource_type() function with Zero arguments --\n";
+var_dump( get_resource_type() );
+
+echo "\n-- Testing get_resource_type() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( get_resource_type($res, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_resource_type() : error conditions ***
+
+-- Testing get_resource_type() function with Zero arguments --
+
+Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing get_resource_type() function with more than expected no. of arguments --
+
+Warning: get_resource_type() 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/general_functions/get_resource_type_variation1.phpt b/ext/standard/tests/general_functions/get_resource_type_variation1.phpt
new file mode 100644
index 0000000..2c203af
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_resource_type_variation1.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test get_resource_type() function : usage variations - different data types as handle arg
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : variation test ***\n";
+
+class Hello {
+ public function SayHello($arg) {
+ echo "Hello\n";
+ }
+}
+
+$res = fopen(__FILE__, "r");
+
+$vars = array(
+ "bool"=>true,
+ "int 10"=>10,
+ "float 10.5"=>10.5,
+ "string"=>"Hello World",
+ "array"=>array(1,2,3,4,5),
+ "NULL"=>NULL,
+ "Object"=>new Hello()
+);
+
+foreach($vars as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump(get_resource_type($object));
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_resource_type() : variation test ***
+
+-- bool --
+
+Warning: get_resource_type() expects parameter 1 to be resource, boolean given in %s on line %d
+NULL
+
+-- int 10 --
+
+Warning: get_resource_type() expects parameter 1 to be resource, integer given in %s on line %d
+NULL
+
+-- float 10.5 --
+
+Warning: get_resource_type() expects parameter 1 to be resource, double given in %s on line %d
+NULL
+
+-- string --
+
+Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+-- array --
+
+Warning: get_resource_type() expects parameter 1 to be resource, array given in %s on line %d
+NULL
+
+-- NULL --
+
+Warning: get_resource_type() expects parameter 1 to be resource, null given in %s on line %d
+NULL
+
+-- Object --
+
+Warning: get_resource_type() expects parameter 1 to be resource, object given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/getmypid_basic.phpt b/ext/standard/tests/general_functions/getmypid_basic.phpt
new file mode 100644
index 0000000..869eb59
--- /dev/null
+++ b/ext/standard/tests/general_functions/getmypid_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test getmypid() function: basic test
+--FILE--
+<?php
+/* Prototype : int getmypid ( void )
+ * Description: Gets the current PHP process ID.
+ * Source code: ext/standard/pageinfo.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for getmypid() function\n";
+
+var_dump(getmypid());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Simple testcase for getmypid() function
+int(%d)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/getopt.phpt b/ext/standard/tests/general_functions/getopt.phpt
new file mode 100644
index 0000000..67864e9
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt.phpt
@@ -0,0 +1,24 @@
+--TEST--
+getopt
+--ARGS--
+-v -h -d test -m 1234 -t -j
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("d:m:j:vht"));
+?>
+--EXPECT--
+array(5) {
+ ["v"]=>
+ bool(false)
+ ["h"]=>
+ bool(false)
+ ["d"]=>
+ string(4) "test"
+ ["m"]=>
+ string(4) "1234"
+ ["t"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/general_functions/getopt_002.phpt b/ext/standard/tests/general_functions/getopt_002.phpt
new file mode 100644
index 0000000..3912ec8
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+getopt#002
+--ARGS--
+-vvv -a value -1111 -2 -v
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("2a:vcd1"));
+?>
+--EXPECT--
+array(4) {
+ ["v"]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ }
+ ["a"]=>
+ string(5) "value"
+ [1]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ }
+ [2]=>
+ bool(false)
+}
+
+
diff --git a/ext/standard/tests/general_functions/getopt_003.phpt b/ext/standard/tests/general_functions/getopt_003.phpt
new file mode 100644
index 0000000..fbb39b0
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_003.phpt
@@ -0,0 +1,57 @@
+--TEST--
+getopt#003
+--ARGS--
+-vvv --v -a value --another value -1111 -2 --12 --0 --0 --1 -v
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v")));
+?>
+--EXPECT--
+array(7) {
+ ["v"]=>
+ array(5) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(false)
+ }
+ ["a"]=>
+ string(5) "value"
+ ["another"]=>
+ string(5) "value"
+ [1]=>
+ array(5) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(false)
+ }
+ [2]=>
+ bool(false)
+ [12]=>
+ bool(false)
+ [0]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+
+
diff --git a/ext/standard/tests/general_functions/getopt_004.phpt b/ext/standard/tests/general_functions/getopt_004.phpt
new file mode 100644
index 0000000..193bd40
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_004.phpt
@@ -0,0 +1,29 @@
+--TEST--
+getopt#004 (Optional values)
+--ARGS--
+-v -v1 -v=10 --v --v=100
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("v::", array("v::")));
+?>
+--EXPECT--
+array(1) {
+ ["v"]=>
+ array(5) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(2) "10"
+ [3]=>
+ bool(false)
+ [4]=>
+ string(3) "100"
+ }
+}
+
+
diff --git a/ext/standard/tests/general_functions/getopt_005.phpt b/ext/standard/tests/general_functions/getopt_005.phpt
new file mode 100644
index 0000000..fe43a02
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_005.phpt
@@ -0,0 +1,32 @@
+--TEST--
+getopt#005 (Required values)
+--ARGS--
+--arg value --arg=value -avalue -a=value -a value
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("a:", array("arg:")));
+?>
+--EXPECT--
+array(2) {
+ ["arg"]=>
+ array(2) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ }
+ ["a"]=>
+ array(3) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ [2]=>
+ string(5) "value"
+ }
+}
+
+
diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt
new file mode 100644
index 0000000..55abbac
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage.phpt
@@ -0,0 +1,23 @@
+--TEST--
+getrusage() tests
+--SKIPIF--
+<?php if (!function_exists("getrusage")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gettype(getrusage()));
+var_dump(gettype(getrusage(1)));
+var_dump(gettype(getrusage(-1)));
+var_dump(getrusage(array()));
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+string(5) "array"
+string(5) "array"
+
+Warning: getrusage() expects parameter 1 to be long, array given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/getrusage_basic.phpt b/ext/standard/tests/general_functions/getrusage_basic.phpt
new file mode 100644
index 0000000..c9b3459
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test getrusage() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for getrusage() function\n";
+
+$dat = getrusage();
+
+if (!is_array($dat)) {
+ echo "TEST FAILED : getrusage shoudl return an array\n";
+}
+
+// echo the fields which are common to all platforms
+echo "User time used (seconds) " . $dat["ru_utime.tv_sec"] . "\n";
+echo "User time used (microseconds) " . $dat["ru_utime.tv_usec"] . "\n";
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for getrusage() function
+User time used (seconds) %d
+User time used (microseconds) %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/getrusage_error.phpt b/ext/standard/tests/general_functions/getrusage_error.phpt
new file mode 100644
index 0000000..b13d4f0
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test getrusage() function : error conditions - incorrect number of args
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass an incorrect number of arguments to getrusage() to test behaviour
+ */
+
+echo "*** Testing getrusage() : error conditions ***\n";
+
+echo "\n-- Testing getrusage() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+$dat = getrusage(1, $extra_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - non-numeric STRING--\n";
+$string_arg = "foo";
+$dat = getrusage($string_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - ARRAY--\n";
+$array_arg = array(1,2,3);
+$dat = getrusage($array_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - OBJECT --\n";
+class classA
+{
+ function __toString() {
+ return "ClassAObject";
+ }
+}
+$obj_arg = new classA();
+$dat = getrusage($obj_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - RESOURCE --\n";
+$file_handle=fopen(__FILE__, "r");
+$dat = getrusage($file_handle);
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getrusage() : error conditions ***
+
+-- Testing getrusage() function with more than expected no. of arguments --
+
+Warning: getrusage() expects at most 1 parameter, 2 given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - non-numeric STRING--
+
+Warning: getrusage() expects parameter 1 to be long, string given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - ARRAY--
+
+Warning: getrusage() expects parameter 1 to be long, array given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - OBJECT --
+
+Warning: getrusage() expects parameter 1 to be long, object given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - RESOURCE --
+
+Warning: getrusage() expects parameter 1 to be long, resource given in %s on line %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/getrusage_variation1.phpt b/ext/standard/tests/general_functions/getrusage_variation1.phpt
new file mode 100644
index 0000000..3daf9e5
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage_variation1.phpt
@@ -0,0 +1,142 @@
+--TEST--
+Test getrusage() function : usage variation - diff data types as $who arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+
+/*
+ * Pass different data types as $who argument to test behaviour of getrusage()
+ */
+
+echo "*** Testing getrusage() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// unexpected values to be passed to $stream_id argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string data
+/*16*/ "0",
+ '1',
+ "1232456",
+ "1.23E4",
+
+ // undefined data
+/*20*/ @$undefined_var,
+
+ // unset data
+/*21*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of getrusage()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $res = getrusage($input);
+ echo "User time used (microseconds) " . $res["ru_utime.tv_usec"] . "\n";
+ $iterator++;
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing getrusage() : usage variations ***
+
+-- Iteration 1 --
+User time used (microseconds) %d
+
+-- Iteration 2 --
+User time used (microseconds) %d
+
+-- Iteration 3 --
+User time used (microseconds) %d
+
+-- Iteration 4 --
+User time used (microseconds) %d
+
+-- Iteration 5 --
+User time used (microseconds) %d
+
+-- Iteration 6 --
+User time used (microseconds) %d
+
+-- Iteration 7 --
+User time used (microseconds) %d
+
+-- Iteration 8 --
+User time used (microseconds) %d
+
+-- Iteration 9 --
+User time used (microseconds) %d
+
+-- Iteration 10 --
+User time used (microseconds) %d
+
+-- Iteration 11 --
+User time used (microseconds) %d
+
+-- Iteration 12 --
+User time used (microseconds) %d
+
+-- Iteration 13 --
+User time used (microseconds) %d
+
+-- Iteration 14 --
+User time used (microseconds) %d
+
+-- Iteration 15 --
+User time used (microseconds) %d
+
+-- Iteration 16 --
+User time used (microseconds) %d
+
+-- Iteration 17 --
+User time used (microseconds) %d
+
+-- Iteration 18 --
+User time used (microseconds) %d
+
+-- Iteration 19 --
+User time used (microseconds) %d
+
+-- Iteration 20 --
+User time used (microseconds) %d
+
+-- Iteration 21 --
+User time used (microseconds) %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt
new file mode 100644
index 0000000..adaa7af
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function getservbyname()
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+
+ $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
+
+ foreach ($services as $service) {
+ $port = getservbyname($service, 'tcp');
+ var_dump($port);
+ }
+
+
+?>
+--EXPECTF--
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
diff --git a/ext/standard/tests/general_functions/getservbyname_error.phpt b/ext/standard/tests/general_functions/getservbyname_error.phpt
new file mode 100644
index 0000000..eaeec64
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test function getservbyname() by calling it more than or less than its expected arguments
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Danilo Sanchi (sanchi@grupporetina.com)
+--FILE--
+<?php
+$service = "www";
+$protocol = "tcp";
+$extra_arg = 12;
+var_dump(getservbyname($service, $protocol, $extra_arg ) );
+var_dump(getservbyname($service));
+?>
+--EXPECTF--
+Warning: getservbyname() expects exactly 2 parameters, %d given in %s on line %d
+NULL
+
+Warning: getservbyname() expects exactly 2 parameters, %d given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation1.phpt b/ext/standard/tests/general_functions/getservbyname_variation1.phpt
new file mode 100644
index 0000000..7dd01aa
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+$protocol = "tcp";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation10.phpt b/ext/standard/tests/general_functions/getservbyname_variation10.phpt
new file mode 100644
index 0000000..c7ed144
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation10.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+if(PHP_OS == 'Darwin') {
+ die("skip.. Mac OS X is fine with NULLs in getservbyname");
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with emptyUnsetUndefNull values ***\n";
+
+$service = "www";
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation11.phpt b/ext/standard/tests/general_functions/getservbyname_variation11.phpt
new file mode 100644
index 0000000..3c410c5
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation11.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with float values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with float values ***\n";
+
+$service = "www";
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation12.phpt b/ext/standard/tests/general_functions/getservbyname_variation12.phpt
new file mode 100644
index 0000000..7e5323c
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation12.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with int values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with int values ***\n";
+
+$service = "www";
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with int values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation13.phpt b/ext/standard/tests/general_functions/getservbyname_variation13.phpt
new file mode 100644
index 0000000..8dad8cd
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation13.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with object values ***\n";
+
+$service = "www";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 2 to be string, object given in %s.php on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation14.phpt b/ext/standard/tests/general_functions/getservbyname_variation14.phpt
new file mode 100644
index 0000000..d93b53e
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation14.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with string values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with string values ***\n";
+
+$service = "www";
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation2.phpt b/ext/standard/tests/general_functions/getservbyname_variation2.phpt
new file mode 100644
index 0000000..877c1d1
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation2.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with boolean values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+$protocol = "tcp";
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation3.phpt b/ext/standard/tests/general_functions/getservbyname_variation3.phpt
new file mode 100644
index 0000000..d34259d
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation3.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with emptyUnsetUndefNull values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+$protocol = "tcp";
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation4.phpt b/ext/standard/tests/general_functions/getservbyname_variation4.phpt
new file mode 100644
index 0000000..6033c94
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation4.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with float values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+$protocol = "tcp";
+
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation5.phpt b/ext/standard/tests/general_functions/getservbyname_variation5.phpt
new file mode 100644
index 0000000..1d3b8f6
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation5.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with int values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+$protocol = "tcp";
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation6.phpt b/ext/standard/tests/general_functions/getservbyname_variation6.phpt
new file mode 100644
index 0000000..0dfafa6
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation6.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+$protocol = "tcp";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 1 to be string, object given in %s.php on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation7.phpt b/ext/standard/tests/general_functions/getservbyname_variation7.phpt
new file mode 100644
index 0000000..a0e223c
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation7.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with string values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+$protocol = "tcp";
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation8.phpt b/ext/standard/tests/general_functions/getservbyname_variation8.phpt
new file mode 100644
index 0000000..69d1d77
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation8.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with array values ***\n";
+
+$service = "www";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with array values ***
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation9.phpt b/ext/standard/tests/general_functions/getservbyname_variation9.phpt
new file mode 100644
index 0000000..eef2744
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation9.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with boolean values.
+--SKIPIF--
+<?php
+if(PHP_OS == 'Darwin') {
+ die("skip.. Mac OS X is fine with NULLs in getservbyname");
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with boolean values ***\n";
+
+$service = "www";
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyport_basic.phpt b/ext/standard/tests/general_functions/getservbyport_basic.phpt
new file mode 100644
index 0000000..b9e0f83
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyport_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+ if (file_exists("/etc/services")) {
+ $file = "/etc/services";
+ }
+ elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services";
+ else die(PHP_OS. " unsupported");
+
+ if(file_exists($file)){
+ $services = file_get_contents($file);
+ $service = getservbyport( 80, "tcp" );
+ if(preg_match("/$service\s+80\/tcp/", $services)) {
+ echo "PASS\n";
+ }
+ }else{
+ echo "Services file not found in expected location\n";
+ }
+?>
+--EXPECT--
+PASS
diff --git a/ext/standard/tests/general_functions/getservbyport_error.phpt b/ext/standard/tests/general_functions/getservbyport_error.phpt
new file mode 100644
index 0000000..e2c245b
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyport_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+$port = 80;
+$protocol = "tcp";
+$extra_arg = 12;
+var_dump(getservbyport( $port, $protocol, $extra_arg ) );
+var_dump(getservbyport($port));
+?>
+--EXPECTF--
+Warning: getservbyport() expects exactly 2 parameters, %d given in %s on line %d
+NULL
+
+Warning: getservbyport() expects exactly 2 parameters, %d given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
new file mode 100644
index 0000000..3dd2d9a
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--DESCRIPTION--
+Test function passing invalid port number and invalid protocol name
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+ var_dump(getservbyport( -1, "tcp" ));
+ var_dump(getservbyport( 80, "ppp" ));
+ var_dump(getservbyport( null, null));
+ var_dump(getservbyport( array(), array()));
+ var_dump(getservbyport( array(80), array("tcp")));
+ var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2)));
+ var_dump(getservbyport( 2, 2));
+ var_dump(getservbyport( "80", "tcp"));
+ var_dump(getservbyport( new stdClass(), new stdClass()));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+bool(false)
+string(%d) "%s"
+
+Warning: getservbyport() expects parameter 1 to be long, object given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
new file mode 100644
index 0000000..d6fb0d4
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -0,0 +1,906 @@
+--TEST--
+Test gettype() & settype() functions : basic functionalities
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test the basic functionalities of settype() & gettype() functions.
+ Use the gettype() to get the type of regular data and use settype()
+ to change its type to other types */
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+echo "**** Testing gettype() and settype() functions ****\n";
+
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "Object";
+ }
+}
+
+$unset_var = 10;
+unset($unset_var);
+
+$values = array(
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ -20,
+ 2.54,
+ -2.54,
+ NULL,
+ false,
+ "some string",
+ 'string',
+ $fp,
+ $dfp,
+ new point(10,20)
+);
+
+$types = array(
+ "null",
+ "integer",
+ "int",
+ "float",
+ "double",
+ "boolean",
+ "bool",
+ "resource",
+ "array",
+ "object",
+ "string"
+);
+
+echo "\n*** Testing gettype(): basic operations ***\n";
+foreach ($values as $value) {
+ var_dump( gettype($value) );
+}
+
+echo "\n*** Testing settype(): basic operations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $loop_count = 1;
+ foreach ($values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count ++;
+ // set to new type
+ var_dump( settype($var, $type) );
+
+ // dump the var
+ var_dump( $var );
+
+ // check the new type
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+**** Testing gettype() and settype() functions ****
+
+*** Testing gettype(): basic operations ***
+string(5) "array"
+string(6) "string"
+string(5) "array"
+string(7) "integer"
+string(7) "integer"
+string(6) "double"
+string(6) "double"
+string(4) "NULL"
+string(7) "boolean"
+string(6) "string"
+string(6) "string"
+string(8) "resource"
+string(8) "resource"
+string(6) "object"
+
+*** Testing settype(): basic operations ***
+
+-- Setting type of data to null --
+-- Iteration 1 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 3 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 4 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 5 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 6 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 7 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 8 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 10 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 11 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 12 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 13 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 14 --
+bool(true)
+NULL
+string(4) "NULL"
+
+-- Setting type of data to integer --
+-- Iteration 1 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 2 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+bool(true)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+bool(true)
+int(2)
+string(7) "integer"
+-- Iteration 7 --
+bool(true)
+int(-2)
+string(7) "integer"
+-- Iteration 8 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+bool(true)
+int(5)
+string(7) "integer"
+-- Iteration 13 --
+bool(true)
+int(6)
+string(7) "integer"
+-- Iteration 14 --
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+
+-- Setting type of data to int --
+-- Iteration 1 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 2 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+bool(true)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+bool(true)
+int(2)
+string(7) "integer"
+-- Iteration 7 --
+bool(true)
+int(-2)
+string(7) "integer"
+-- Iteration 8 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+bool(true)
+int(5)
+string(7) "integer"
+-- Iteration 13 --
+bool(true)
+int(6)
+string(7) "integer"
+-- Iteration 14 --
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+
+-- Setting type of data to float --
+-- Iteration 1 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 2 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+bool(true)
+float(-20)
+string(6) "double"
+-- Iteration 6 --
+bool(true)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+bool(true)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+bool(true)
+float(5)
+string(6) "double"
+-- Iteration 13 --
+bool(true)
+float(6)
+string(6) "double"
+-- Iteration 14 --
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+
+-- Setting type of data to double --
+-- Iteration 1 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 2 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+bool(true)
+float(-20)
+string(6) "double"
+-- Iteration 6 --
+bool(true)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+bool(true)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+bool(true)
+float(5)
+string(6) "double"
+-- Iteration 13 --
+bool(true)
+float(6)
+string(6) "double"
+-- Iteration 14 --
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+
+-- Setting type of data to boolean --
+-- Iteration 1 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 2 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 3 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 13 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 14 --
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to bool --
+-- Iteration 1 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 2 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 3 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 13 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 14 --
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to resource --
+-- Iteration 1 --
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(5) "array"
+-- Iteration 2 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(14) "another string"
+string(6) "string"
+-- Iteration 3 --
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 4 --
+2: settype(): Cannot convert to resource type
+bool(false)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+2: settype(): Cannot convert to resource type
+bool(false)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(11) "some string"
+string(6) "string"
+-- Iteration 11 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(6) "string"
+string(6) "string"
+-- Iteration 12 --
+2: settype(): Cannot convert to resource type
+bool(false)
+resource(5) of type (stream)
+string(8) "resource"
+-- Iteration 13 --
+2: settype(): Cannot convert to resource type
+bool(false)
+resource(6) of type (stream)
+string(8) "resource"
+-- Iteration 14 --
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#1 (2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(6) "object"
+
+-- Setting type of data to array --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(5) "array"
+-- Iteration 2 --
+bool(true)
+array(1) {
+ [0]=>
+ string(14) "another string"
+}
+string(5) "array"
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 4 --
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+string(5) "array"
+-- Iteration 5 --
+bool(true)
+array(1) {
+ [0]=>
+ int(-20)
+}
+string(5) "array"
+-- Iteration 6 --
+bool(true)
+array(1) {
+ [0]=>
+ float(2.54)
+}
+string(5) "array"
+-- Iteration 7 --
+bool(true)
+array(1) {
+ [0]=>
+ float(-2.54)
+}
+string(5) "array"
+-- Iteration 8 --
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+string(5) "array"
+-- Iteration 10 --
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "some string"
+}
+string(5) "array"
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+string(5) "array"
+-- Iteration 12 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(5) of type (stream)
+}
+string(5) "array"
+-- Iteration 13 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(6) of type (stream)
+}
+string(5) "array"
+-- Iteration 14 --
+bool(true)
+array(2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(5) "array"
+
+-- Setting type of data to object --
+-- Iteration 1 --
+bool(true)
+object(stdClass)#2 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(6) "object"
+-- Iteration 2 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(14) "another string"
+}
+string(6) "object"
+-- Iteration 3 --
+bool(true)
+object(stdClass)#2 (3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 4 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ int(1)
+}
+string(6) "object"
+-- Iteration 5 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ int(-20)
+}
+string(6) "object"
+-- Iteration 6 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ float(2.54)
+}
+string(6) "object"
+-- Iteration 7 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ float(-2.54)
+}
+string(6) "object"
+-- Iteration 8 --
+bool(true)
+object(stdClass)#2 (0) {
+}
+string(6) "object"
+-- Iteration 9 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ bool(false)
+}
+string(6) "object"
+-- Iteration 10 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(11) "some string"
+}
+string(6) "object"
+-- Iteration 11 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(6) "string"
+}
+string(6) "object"
+-- Iteration 12 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ resource(5) of type (stream)
+}
+string(6) "object"
+-- Iteration 13 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ resource(6) of type (stream)
+}
+string(6) "object"
+-- Iteration 14 --
+bool(true)
+object(point)#1 (2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(6) "object"
+
+-- Setting type of data to string --
+-- Iteration 1 --
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 2 --
+bool(true)
+string(14) "another string"
+string(6) "string"
+-- Iteration 3 --
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 4 --
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 5 --
+bool(true)
+string(3) "-20"
+string(6) "string"
+-- Iteration 6 --
+bool(true)
+string(4) "2.54"
+string(6) "string"
+-- Iteration 7 --
+bool(true)
+string(5) "-2.54"
+string(6) "string"
+-- Iteration 8 --
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+bool(true)
+string(11) "some string"
+string(6) "string"
+-- Iteration 11 --
+bool(true)
+string(6) "string"
+string(6) "string"
+-- Iteration 12 --
+bool(true)
+string(14) "Resource id #5"
+string(6) "string"
+-- Iteration 13 --
+bool(true)
+string(14) "Resource id #6"
+string(6) "string"
+-- Iteration 14 --
+bool(true)
+string(6) "Object"
+string(6) "string"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt
new file mode 100644
index 0000000..2c6aac6
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test gettype() & settype() functions : error conditions
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test different error conditions of settype() and gettype() functions */
+
+echo "**** Testing gettype() and settype() functions ****\n";
+
+echo "\n*** Testing gettype(): error conditions ***\n";
+//Zero arguments
+var_dump( gettype() );
+// args more than expected
+var_dump( gettype( "1", "2" ) );
+
+echo "\n*** Testing settype(): error conditions ***\n";
+//Zero arguments
+var_dump( settype() );
+
+// args more than expected
+$var = 10.5;
+var_dump( settype( $var, $var, "int" ) );
+
+// passing an invalid type to set
+var_dump( settype( $var, "unknown" ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+**** Testing gettype() and settype() functions ****
+
+*** Testing gettype(): error conditions ***
+
+Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing settype(): error conditions ***
+
+Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: settype(): Invalid type in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
new file mode 100644
index 0000000..b8834d5
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
@@ -0,0 +1,589 @@
+--TEST--
+Test gettype() & settype() functions : usage variatoins
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to null type.
+ Set type of the data to "null" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to "null type"
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to null type */
+$type = "null";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to null --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
new file mode 100644
index 0000000..25bf22c
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
@@ -0,0 +1,1005 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+if ( strtoupper( substr(PHP_OS, 0, 3) ) == 'MAC' ) {
+ die('skip Do not run on MacOS');
+}
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to int/integer type.
+ Set type of the data to "int"/"integer" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to interger/int type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+// test conversion to these types
+$types = array(
+ "integer",
+ "int"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to integer --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+int(3)
+string(7) "integer"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+int(-2147483648)
+string(7) "integer"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+int(-2147483647)
+string(7) "integer"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+int(-508130303)
+string(7) "integer"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+int(1952002105)
+string(7) "integer"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+int(343000682)
+string(7) "integer"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+
+-- Setting type of data to int --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+int(3)
+string(7) "integer"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+int(-2147483648)
+string(7) "integer"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+int(-2147483647)
+string(7) "integer"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+int(-508130303)
+string(7) "integer"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+int(1952002105)
+string(7) "integer"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+int(343000682)
+string(7) "integer"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
new file mode 100644
index 0000000..35066b0
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
@@ -0,0 +1,1002 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to float/double type.
+ Set type of the data to "float"/"double" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to float/double type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+// test conversion to these types
+$types = array(
+ "float",
+ "double"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to float --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+float(3)
+string(6) "double"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+float(2147483647)
+string(6) "double"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+float(85)
+string(6) "double"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+float(-21903)
+string(6) "double"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+float(365)
+string(6) "double"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+float(-365)
+string(6) "double"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+
+-- Setting type of data to double --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+float(3)
+string(6) "double"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+float(2147483647)
+string(6) "double"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+float(85)
+string(6) "double"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+float(-21903)
+string(6) "double"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+float(365)
+string(6) "double"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+float(-365)
+string(6) "double"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
new file mode 100644
index 0000000..8b93e63
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
@@ -0,0 +1,1201 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to bool/boolean type.
+ Set type of the data to "bool"/"boolean" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to bool/boolean type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+class class_with_no_member {
+ // no member(s)
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ '0',
+
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ 0,
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 0.0,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+ new class_with_no_member,
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var,
+
+ /* binary strings */
+ b"0",
+ b'0',
+ b"10string",
+ b'10string',
+ b"+0123",
+ b'-0123',
+ b"0xff",
+ b'0x55',
+ b'1e2',
+ b'2974394749328742328432',
+ b"1e2",
+ b'10string',
+ b"10string"
+);
+
+// test conversion to these types
+$types = array(
+ "boolean",
+ "bool"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to boolean --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 43 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 44 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 48 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 49 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 50 --
+string(7) "integer"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 54 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 56 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 57 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 58 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 59 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 76 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 77 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 78 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 79 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 80 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 81 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 82 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 83 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 84 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 85 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 86 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 87 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 88 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 89 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 90 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 91 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 92 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 93 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 94 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 95 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 96 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 97 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 98 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to bool --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 43 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 44 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 48 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 49 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 50 --
+string(7) "integer"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 54 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 56 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 57 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 58 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 59 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 76 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 77 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 78 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 79 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 80 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 81 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 82 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 83 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 84 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 85 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 86 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 87 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 88 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 89 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 90 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 91 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 92 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 93 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 94 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 95 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 96 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 97 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 98 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
new file mode 100644
index 0000000..c9fa575
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
@@ -0,0 +1,714 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to resource type.
+ Set type of the data to "resource" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to resource type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to resource type */
+$type = "resource";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to resource --
+-- Iteration 1 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "ÿ"
+string(6) "string"
+-- Iteration 6 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "f"
+string(6) "string"
+-- Iteration 7 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "
+3"
+string(6) "string"
+-- Iteration 8 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) " "
+string(6) "string"
+-- Iteration 11 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) " "
+string(6) "string"
+-- Iteration 12 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "10"
+string(6) "string"
+-- Iteration 13 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "10"
+string(6) "string"
+-- Iteration 14 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "10string"
+string(6) "string"
+-- Iteration 15 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "10string"
+string(6) "string"
+-- Iteration 16 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "1"
+string(6) "string"
+-- Iteration 17 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "-1"
+string(6) "string"
+-- Iteration 18 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 19 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) " 1"
+string(6) "string"
+-- Iteration 20 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 21 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 22 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "1"
+string(6) "string"
+-- Iteration 23 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "-1"
+string(6) "string"
+-- Iteration 24 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 25 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) " 1"
+string(6) "string"
+-- Iteration 26 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 27 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 28 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0xff"
+string(6) "string"
+-- Iteration 29 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0x55"
+string(6) "string"
+-- Iteration 30 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "0XA55"
+string(6) "string"
+-- Iteration 31 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "0X123"
+string(6) "string"
+-- Iteration 32 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0123"
+string(6) "string"
+-- Iteration 33 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0123"
+string(6) "string"
+-- Iteration 34 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 35 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 36 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 37 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 38 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "-0x80001"
+string(6) "string"
+-- Iteration 39 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "+0x80001"
+string(6) "string"
+-- Iteration 40 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(10) "-0x80001.5"
+string(6) "string"
+-- Iteration 41 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(9) "0x80001.5"
+string(6) "string"
+-- Iteration 42 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(12) "@$%#$%^$%^&^"
+string(6) "string"
+-- Iteration 43 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(0) {
+}
+string(5) "array"
+-- Iteration 44 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(1) {
+ [0]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 45 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 46 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 47 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(5) "array"
+-- Iteration 48 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#1 (2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 77 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#2 (2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(6) "object"
+-- Iteration 78 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#3 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(6) "object"
+-- Iteration 79 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 80 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
new file mode 100644
index 0000000..0e99630
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
@@ -0,0 +1,846 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to array type.
+ Set type of the data to "array" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to array type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to array type */
+$type = "array";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to array --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+string(5) "array"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(true)
+}
+string(5) "array"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(true)
+}
+string(5) "array"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "ÿ"
+}
+string(5) "array"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+string(5) "array"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "
+3"
+}
+string(5) "array"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+string(5) "array"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+string(5) "array"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+string(5) "array"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+string(5) "array"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+string(5) "array"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+string(5) "array"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "10string"
+}
+string(5) "array"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "10string"
+}
+string(5) "array"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+string(5) "array"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+string(5) "array"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(3) "1e2"
+}
+string(5) "array"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) " 1"
+}
+string(5) "array"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(22) "2974394749328742328432"
+}
+string(5) "array"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-1e-2"
+}
+string(5) "array"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+string(5) "array"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+string(5) "array"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(3) "1e2"
+}
+string(5) "array"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) " 1"
+}
+string(5) "array"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(22) "2974394749328742328432"
+}
+string(5) "array"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-1e-2"
+}
+string(5) "array"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0xff"
+}
+string(5) "array"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0x55"
+}
+string(5) "array"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "0XA55"
+}
+string(5) "array"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "0X123"
+}
+string(5) "array"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0123"
+}
+string(5) "array"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0123"
+}
+string(5) "array"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-0123"
+}
+string(5) "array"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "+0123"
+}
+string(5) "array"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-0123"
+}
+string(5) "array"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "+0123"
+}
+string(5) "array"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "-0x80001"
+}
+string(5) "array"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "+0x80001"
+}
+string(5) "array"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(10) "-0x80001.5"
+}
+string(5) "array"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(9) "0x80001.5"
+}
+string(5) "array"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(12) "@$%#$%^$%^&^"
+}
+string(5) "array"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+array(3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(5) "array"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+string(5) "array"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+string(5) "array"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+string(5) "array"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(1232147483649)
+}
+string(5) "array"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(85)
+}
+string(5) "array"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(1058513956921)
+}
+string(5) "array"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(-21903)
+}
+string(5) "array"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(365)
+}
+string(5) "array"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(-365)
+}
+string(5) "array"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(80561044571754)
+}
+string(5) "array"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(100000)
+}
+string(5) "array"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-100000)
+}
+string(5) "array"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(100000)
+}
+string(5) "array"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-100000)
+}
+string(5) "array"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-1.5)
+}
+string(5) "array"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(0.5)
+}
+string(5) "array"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-0.5)
+}
+string(5) "array"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(500000)
+}
+string(5) "array"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-500000)
+}
+string(5) "array"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-5.0E-7)
+}
+string(5) "array"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(500000)
+}
+string(5) "array"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-500000)
+}
+string(5) "array"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(512000)
+}
+string(5) "array"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-512000)
+}
+string(5) "array"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(5.12E-7)
+}
+string(5) "array"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(5.12E-7)
+}
+string(5) "array"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(512000)
+}
+string(5) "array"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-512000)
+}
+string(5) "array"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(5) "array"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(5) "array"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
new file mode 100644
index 0000000..2da7bb2
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
@@ -0,0 +1,844 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to object type.
+ Set type of the data to "object" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to object type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to object type */
+$type = "object";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to object --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(false)
+}
+string(6) "object"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(true)
+}
+string(6) "object"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(true)
+}
+string(6) "object"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "ÿ"
+}
+string(6) "object"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "f"
+}
+string(6) "object"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "
+3"
+}
+string(6) "object"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(0) ""
+}
+string(6) "object"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(0) ""
+}
+string(6) "object"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) " "
+}
+string(6) "object"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) " "
+}
+string(6) "object"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "10"
+}
+string(6) "object"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "10"
+}
+string(6) "object"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "10string"
+}
+string(6) "object"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "10string"
+}
+string(6) "object"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "1"
+}
+string(6) "object"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "-1"
+}
+string(6) "object"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(3) "1e2"
+}
+string(6) "object"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) " 1"
+}
+string(6) "object"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(22) "2974394749328742328432"
+}
+string(6) "object"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-1e-2"
+}
+string(6) "object"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "1"
+}
+string(6) "object"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "-1"
+}
+string(6) "object"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(3) "1e2"
+}
+string(6) "object"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) " 1"
+}
+string(6) "object"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(22) "2974394749328742328432"
+}
+string(6) "object"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-1e-2"
+}
+string(6) "object"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0xff"
+}
+string(6) "object"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0x55"
+}
+string(6) "object"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "0XA55"
+}
+string(6) "object"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "0X123"
+}
+string(6) "object"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0123"
+}
+string(6) "object"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0123"
+}
+string(6) "object"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-0123"
+}
+string(6) "object"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "+0123"
+}
+string(6) "object"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-0123"
+}
+string(6) "object"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "+0123"
+}
+string(6) "object"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "-0x80001"
+}
+string(6) "object"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "+0x80001"
+}
+string(6) "object"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(10) "-0x80001.5"
+}
+string(6) "object"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(9) "0x80001.5"
+}
+string(6) "object"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(12) "@$%#$%^$%^&^"
+}
+string(6) "object"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (1) {
+ [0]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(6) "object"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-2147483648)
+}
+string(6) "object"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(2147483647)
+}
+string(6) "object"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(2147483649)
+}
+string(6) "object"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(1232147483649)
+}
+string(6) "object"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(85)
+}
+string(6) "object"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(1058513956921)
+}
+string(6) "object"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(-21903)
+}
+string(6) "object"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(365)
+}
+string(6) "object"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(-365)
+}
+string(6) "object"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(80561044571754)
+}
+string(6) "object"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(100000)
+}
+string(6) "object"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-100000)
+}
+string(6) "object"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(100000)
+}
+string(6) "object"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-100000)
+}
+string(6) "object"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-1.5)
+}
+string(6) "object"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(0.5)
+}
+string(6) "object"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-0.5)
+}
+string(6) "object"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(500000)
+}
+string(6) "object"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-500000)
+}
+string(6) "object"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-5.0E-7)
+}
+string(6) "object"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(500000)
+}
+string(6) "object"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-500000)
+}
+string(6) "object"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(512000)
+}
+string(6) "object"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-512000)
+}
+string(6) "object"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(5.12E-7)
+}
+string(6) "object"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(5.12E-7)
+}
+string(6) "object"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(512000)
+}
+string(6) "object"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-512000)
+}
+string(6) "object"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+object(point)#1 (2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+object(point)#2 (2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(6) "object"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+object(point)#3 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(6) "object"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
new file mode 100644
index 0000000..54fb9c1
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
@@ -0,0 +1,595 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to string type.
+ Set type of the data to "string" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to string type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to string type */
+$type = "string";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to string --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+string(1) "ÿ"
+string(6) "string"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+string(1) "f"
+string(6) "string"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+string(2) "
+3"
+string(6) "string"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+string(1) " "
+string(6) "string"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+string(1) " "
+string(6) "string"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+string(2) "10"
+string(6) "string"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+string(2) "10"
+string(6) "string"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+string(8) "10string"
+string(6) "string"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+string(8) "10string"
+string(6) "string"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+string(2) "-1"
+string(6) "string"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+string(2) " 1"
+string(6) "string"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+string(2) "-1"
+string(6) "string"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+string(2) " 1"
+string(6) "string"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+string(4) "0xff"
+string(6) "string"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+string(4) "0x55"
+string(6) "string"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+string(5) "0XA55"
+string(6) "string"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+string(5) "0X123"
+string(6) "string"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+string(4) "0123"
+string(6) "string"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+string(4) "0123"
+string(6) "string"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+string(8) "-0x80001"
+string(6) "string"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+string(8) "+0x80001"
+string(6) "string"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+string(10) "-0x80001.5"
+string(6) "string"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+string(9) "0x80001.5"
+string(6) "string"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+string(12) "@$%#$%^$%^&^"
+string(6) "string"
+-- Iteration 43 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 44 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 45 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 46 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 47 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+string(11) "-2147483648"
+string(6) "string"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+string(10) "2147483647"
+string(6) "string"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+string(10) "2147483649"
+string(6) "string"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+string(13) "1232147483649"
+string(6) "string"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+string(2) "85"
+string(6) "string"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+string(13) "1058513956921"
+string(6) "string"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+string(6) "-21903"
+string(6) "string"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+string(3) "365"
+string(6) "string"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+string(4) "-365"
+string(6) "string"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+string(14) "80561044571754"
+string(6) "string"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+string(6) "100000"
+string(6) "string"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+string(7) "-100000"
+string(6) "string"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+string(6) "100000"
+string(6) "string"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+string(7) "-100000"
+string(6) "string"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+string(4) "-1.5"
+string(6) "string"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+string(3) "0.5"
+string(6) "string"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+string(4) "-0.5"
+string(6) "string"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+string(6) "500000"
+string(6) "string"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+string(7) "-500000"
+string(6) "string"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+string(7) "-5.0E-7"
+string(6) "string"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+string(6) "500000"
+string(6) "string"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+string(7) "-500000"
+string(6) "string"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+string(6) "512000"
+string(6) "string"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+string(7) "-512000"
+string(6) "string"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+string(7) "5.12E-7"
+string(6) "string"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+string(7) "5.12E-7"
+string(6) "string"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+string(6) "512000"
+string(6) "string"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+string(7) "-512000"
+string(6) "string"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+Done
diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt
new file mode 100644
index 0000000..e83bbf6
--- /dev/null
+++ b/ext/standard/tests/general_functions/head.phpt
@@ -0,0 +1,53 @@
+--TEST--
+header() and friends
+--SKIPIF--
+<?php
+if (php_sapi_name() != "cli") {
+ die("skip this test is for CLI");
+}
+?>
+--FILE--
+<?php
+
+$v1 = headers_sent();
+$v2 = headers_list();
+var_dump(header("HTTP 1.0", true, 200));
+
+var_dump($v1);
+var_dump($v2);
+
+var_dump(header(""));
+var_dump(header("", true));
+var_dump(headers_sent());
+var_dump(headers_list());
+var_dump(header("HTTP blah"));
+var_dump(header("HTTP blah", true));
+var_dump(headers_sent());
+var_dump(headers_list());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+bool(false)
+array(0) {
+}
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+bool(true)
+array(0) {
+}
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+bool(true)
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/general_functions/highlight_heredoc.phpt b/ext/standard/tests/general_functions/highlight_heredoc.phpt
new file mode 100644
index 0000000..ee4e2e8
--- /dev/null
+++ b/ext/standard/tests/general_functions/highlight_heredoc.phpt
@@ -0,0 +1,21 @@
+--TEST--
+highlight_string() handling of heredoc
+--INI--
+highlight.html=#000000
+--FILE--
+<?php
+$str = '
+$x=<<<DD
+jhdsjkfhjdsh
+DD
+."";
+$a=<<<DDDD
+jhdsjkfhjdsh
+DDDD;
+';
+highlight_string($str);
+?>
+--EXPECT--
+<code><span style="color: #000000">
+<br />$x=&lt;&lt;&lt;DD<br />jhdsjkfhjdsh<br />DD<br />."";<br />$a=&lt;&lt;&lt;DDDD<br />jhdsjkfhjdsh<br />DDDD;<br /></span>
+</code>
diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
new file mode 100644
index 0000000..4a791c7
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request.phpt
@@ -0,0 +1,76 @@
+--TEST--
+import_request_variables() tests
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm
+--POST--
+ap=25&bp=test&cp=blah3&dp[]=ar
+--FILE--
+<?php
+
+var_dump(import_request_variables());
+var_dump(import_request_variables(""));
+var_dump(import_request_variables("", ""));
+
+var_dump(import_request_variables("g", ""));
+var_dump($a, $b, $c, $ap);
+
+var_dump(import_request_variables("g", "g_"));
+var_dump($g_a, $g_b, $g_c, $g_ap, $g_1);
+
+var_dump(import_request_variables("GP", "i_"));
+var_dump($i_a, $i_b, $i_c, $i_ap, $i_bp, $i_cp, $i_dp);
+
+var_dump(import_request_variables("gGg", "r_"));
+var_dump($r_a, $r_b, $r_c, $r_ap);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: import_request_variables() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+bool(false)
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+
+Warning: import_request_variables(): Attempted GLOBALS variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Numeric key detected - possible security hazard in %s on line %d
+bool(true)
+
+Notice: Undefined variable: ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+bool(true)
+
+Notice: Undefined variable: g_ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+string(2) "hm"
+bool(true)
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+string(2) "25"
+string(4) "test"
+string(5) "blah3"
+array(1) {
+ [0]=>
+ string(2) "ar"
+}
+bool(true)
+
+Notice: Undefined variable: r_ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/import_request1.phpt b/ext/standard/tests/general_functions/import_request1.phpt
new file mode 100644
index 0000000..f592088
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request1.phpt
@@ -0,0 +1,101 @@
+--TEST--
+import_request_variables() test (overwrite super-globals)
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+GET=0&POST=1&COOKIE=2&FILES=3&REQUEST=4
+--POST--
+GET=5&POST=6&COOKIE=7&FILES=8&REQUEST=9
+--COOKIE--
+GET=10;POST=11;COOKIE=12;FILES=13;REQUEST=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gpc", "_");
+var_dump($_GET, $_POST, $_COOKIE, $_FILES, $_REQUEST);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+array(5) {
+ ["GET"]=>
+ string(1) "0"
+ ["POST"]=>
+ string(1) "1"
+ ["COOKIE"]=>
+ string(1) "2"
+ ["FILES"]=>
+ string(1) "3"
+ ["REQUEST"]=>
+ string(1) "4"
+}
+array(5) {
+ ["GET"]=>
+ string(1) "5"
+ ["POST"]=>
+ string(1) "6"
+ ["COOKIE"]=>
+ string(1) "7"
+ ["FILES"]=>
+ string(1) "8"
+ ["REQUEST"]=>
+ string(1) "9"
+}
+array(5) {
+ ["GET"]=>
+ string(2) "10"
+ ["POST"]=>
+ string(2) "11"
+ ["COOKIE"]=>
+ string(2) "12"
+ ["FILES"]=>
+ string(2) "13"
+ ["REQUEST"]=>
+ string(2) "14"
+}
+array(0) {
+}
+array(5) {
+ ["GET"]=>
+ string(1) "5"
+ ["POST"]=>
+ string(1) "6"
+ ["COOKIE"]=>
+ string(1) "7"
+ ["FILES"]=>
+ string(1) "8"
+ ["REQUEST"]=>
+ string(1) "9"
+}
+Done
diff --git a/ext/standard/tests/general_functions/import_request2.phpt b/ext/standard/tests/general_functions/import_request2.phpt
new file mode 100644
index 0000000..c290602
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request2.phpt
@@ -0,0 +1,27 @@
+--TEST--
+import_request_variables() test (numeric keys)
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+1=0&2=1&3=2&4=3&5=4
+--POST--
+1=5&2=6&3=7&4=8&5=9
+--COOKIE--
+1=10;2=11;3=12;4=13;5=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gpc", "_");
+var_dump($_1, $_2, $_3, $_4, $_5);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+Done
diff --git a/ext/standard/tests/general_functions/import_request3.phpt b/ext/standard/tests/general_functions/import_request3.phpt
new file mode 100644
index 0000000..a8cbf56
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request3.phpt
@@ -0,0 +1,27 @@
+--TEST--
+import_request_variables() test (numeric keys, different order)
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+1=0&2=1&3=2&4=3&5=4
+--POST--
+1=5&2=6&3=7&4=8&5=9
+--COOKIE--
+1=10;2=11;3=12;4=13;5=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gcp", "_");
+var_dump($_1, $_2, $_3, $_4, $_5);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+Done
diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt
new file mode 100644
index 0000000..0392307
--- /dev/null
+++ b/ext/standard/tests/general_functions/include_path.phpt
@@ -0,0 +1,75 @@
+--TEST--
+*_include_path() tests
+--INI--
+include_path=.
+--FILE--
+<?php
+
+var_dump(get_include_path());
+var_dump(get_include_path("var"));
+
+var_dump(restore_include_path());
+var_dump(restore_include_path(""));
+
+
+var_dump(set_include_path());
+var_dump(get_include_path());
+var_dump(set_include_path("var"));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(".:/path/to/dir"));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(""));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(array()));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "."
+
+Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+NULL
+
+Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+string(1) "."
+string(1) "."
+string(3) "var"
+NULL
+string(1) "."
+string(1) "."
+string(14) ".:/path/to/dir"
+NULL
+string(1) "."
+bool(false)
+string(1) "."
+NULL
+string(1) "."
+
+Warning: set_include_path() expects parameter 1 to be string, array given in %s on line %d
+NULL
+string(1) "."
+NULL
+string(1) "."
+Done
diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt
new file mode 100644
index 0000000..60cd38a
--- /dev/null
+++ b/ext/standard/tests/general_functions/ini_get_all.phpt
@@ -0,0 +1,64 @@
+--TEST--
+ini_get_all() tests
+--INI--
+pcre.backtrack_limit=1000000
+pcre.recursion_limit=100000
+--SKIPIF--
+<?php if (!extension_loaded("reflection")) die("skip"); ?>
+--FILE--
+<?php
+
+var_dump(gettype(ini_get_all()));
+var_dump(ini_get_all(""));
+var_dump(ini_get_all("nosuchextension"));
+var_dump(ini_get_all("reflection"));
+var_dump(ini_get_all("pcre"));
+var_dump(ini_get_all("pcre", false));
+var_dump(ini_get_all("reflection", false));
+
+var_dump(ini_get_all("", ""));
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+
+Warning: ini_get_all(): Unable to find extension '' in %s on line %d
+bool(false)
+
+Warning: ini_get_all(): Unable to find extension 'nosuchextension' in %s on line %d
+bool(false)
+array(0) {
+}
+array(2) {
+ ["pcre.backtrack_limit"]=>
+ array(3) {
+ ["global_value"]=>
+ string(7) "1000000"
+ ["local_value"]=>
+ string(7) "1000000"
+ ["access"]=>
+ int(7)
+ }
+ ["pcre.recursion_limit"]=>
+ array(3) {
+ ["global_value"]=>
+ string(6) "100000"
+ ["local_value"]=>
+ string(6) "100000"
+ ["access"]=>
+ int(7)
+ }
+}
+array(2) {
+ ["pcre.backtrack_limit"]=>
+ string(7) "1000000"
+ ["pcre.recursion_limit"]=>
+ string(6) "100000"
+}
+array(0) {
+}
+
+Warning: ini_get_all(): Unable to find extension '' in %sini_get_all.php on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt
new file mode 100644
index 0000000..7986e2d
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval.phpt
@@ -0,0 +1,306 @@
+--TEST--
+Test intval() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: int intval( mixed $var [.int $base] );
+ * Description: Returns the integer value of var, using the specified base for the conversion(the default is base 10).
+ */
+
+echo "*** Testing intval() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ '0',
+ '1',
+ '-1',
+ '-2147483648', // max negative integer value
+ '-2147483647',
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ '0x12ab',
+ '0Xfff',
+ '0XFA',
+ -0x80000000, // max negative integer as hexadecimal
+ '0x7fffffff', // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ '0123', // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ );
+
+/* loop to check that intval() recognizes different
+ integer values, expected output:integer value in decimal notation for valid integer */
+
+echo "\n***Output with default base value ie 10 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value) );
+}
+
+
+echo "\n***Output with base value of 10( explicitly passed as argument) ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 10) );
+}
+
+
+echo "\n***Output with base value of 16 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 16) );
+}
+
+echo "\n***Output with base value of 8 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 8) );
+}
+
+echo "\n*** Testing intval() on non integer types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ '-2147483649', // float value
+ '2147483648', // float value
+ '-0x80000001', // float value, beyond max negative int
+ '0x800000001', // float value, beyond max positive int
+ '020000000001', // float value, beyond max positive int
+ '-020000000001', // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+
+
+/* loop through the $not_int_types to see working of
+ intval() on non integer types, expected output: integer value in decimal notation for valid integers */
+foreach ($not_int_types as $type ) {
+ var_dump( intval($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( intval() );
+
+//arguments more than expected
+var_dump( intval(TRUE, FALSE, TRUE) );
+
+echo "\n--- Done ---\n";
+
+
+?>
+--EXPECTF--
+*** Testing intval() with valid integer values ***
+
+***Output with default base value ie 10 ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483647)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(123)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 10( explicitly passed as argument) ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483647)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(123)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 16 ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483648)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(4779)
+int(4095)
+int(250)
+int(-2147483648)
+int(2147483647)
+int(2147483647)
+int(291)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 8 ***
+int(0)
+int(1)
+int(-1)
+int(-9020)
+int(-9020)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(83)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+*** Testing intval() on non integer types ***
+int(-2147483648)
+int(2147483647)
+int(0)
+int(0)
+int(2147483647)
+int(-2147483648)
+int(0)
+int(0)
+int(1)
+int(100000)
+int(-1000000)
+int(100000000)
+int(-1000000000)
+int(10)
+int(1050000)
+int(%d)
+int(%d)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for intval() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for intval() in %s on line %d
+NULL
+
+--- Done ---
diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt
new file mode 100644
index 0000000..bf88c7c
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval_variation1.phpt
@@ -0,0 +1,203 @@
+--TEST--
+Test intval() function : usage variation
+--FILE--
+<?php
+/* Prototype : int intval(mixed var [, int base])
+ * Description: Get the integer value of a variable using the optional base for the conversion
+ * Source code: ext/standard/type.c
+ * Alias to functions:
+ */
+
+echo "*** Testing intval() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$base = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// 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' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789e5' => 12.3456789e5,
+ 'float -12.3456789e5' => -12.3456789e5,
+ '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 var
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( intval($value, $base) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing intval() : usage variation ***
+
+--int 0--
+int(0)
+
+--int 1--
+int(1)
+
+--int 12345--
+int(12345)
+
+--int -12345--
+int(-2345)
+
+--float 10.5--
+int(10)
+
+--float -10.5--
+int(-10)
+
+--float 12.3456789e5--
+int(1234567)
+
+--float -12.3456789e5--
+int(-1234567)
+
+--float .5--
+int(0)
+
+--empty array--
+int(0)
+
+--int indexed array--
+int(1)
+
+--associative array--
+int(1)
+
+--nested arrays--
+int(1)
+
+--uppercase NULL--
+int(0)
+
+--lowercase null--
+int(0)
+
+--lowercase true--
+int(1)
+
+--lowercase false--
+int(0)
+
+--uppercase TRUE--
+int(1)
+
+--uppercase FALSE--
+int(0)
+
+--empty string DQ--
+int(0)
+
+--empty string SQ--
+int(0)
+
+--string DQ--
+int(0)
+
+--string SQ--
+int(0)
+
+--mixed case string--
+int(0)
+
+--heredoc--
+int(0)
+
+--instance of classWithToString--
+Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
+int(1)
+
+--instance of classWithoutToString--
+Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
+int(1)
+
+--undefined var--
+int(0)
+
+--unset var--
+int(0)
+===DONE===
diff --git a/ext/standard/tests/general_functions/intval_variation2.phpt b/ext/standard/tests/general_functions/intval_variation2.phpt
new file mode 100644
index 0000000..65bc584
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval_variation2.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test intval() function : usage variation
+--FILE--
+<?php
+/* Prototype : int intval(mixed var [, int base])
+ * Description: Get the integer value of a variable using the optional base for the conversion
+ * Source code: ext/standard/type.c
+ * Alias to functions:
+ */
+
+echo "*** Testing intval() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+$var = 1;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 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 base
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( intval($var, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing intval() : usage variation ***
+
+--float 10.5--
+int(1)
+
+--float -10.5--
+int(1)
+
+--float 12.3456789000e10--
+int(1)
+
+--float -12.3456789000e10--
+int(1)
+
+--float .5--
+int(1)
+
+--empty array--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+int(1)
+
+--lowercase null--
+int(1)
+
+--lowercase true--
+int(1)
+
+--lowercase false--
+int(1)
+
+--uppercase TRUE--
+int(1)
+
+--uppercase FALSE--
+int(1)
+
+--empty string DQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - intval() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - intval() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+int(1)
+
+--unset var--
+int(1)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt
new file mode 100644
index 0000000..469a8ec
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_array.phpt
@@ -0,0 +1,213 @@
+--TEST--
+Test is_array() function
+--FILE--
+<?php
+/* Prototype: bool is_array ( mixed $var );
+ * Description: Finds whether the given variable is an array
+ */
+
+echo "*** Testing is_array() on different type of arrays ***\n";
+/* different types of arrays */
+$arrays = array(
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test')
+);
+/* loop to check that is_array() recognizes different
+ type of arrays, expected output bool(true) */
+$loop_counter = 1;
+foreach ($arrays as $var_array ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_array ($var_array) );
+}
+
+echo "\n*** Testing is_array() on non array types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variables
+$unset_array = array(10);
+unset($unset_array);
+
+// other types in a array
+$varient_arrays = array (
+ /* integers */
+ 543915,
+ -5322,
+ 0x55F,
+ -0xCCF,
+ 123,
+ -0654,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ 'string',
+ "string",
+
+ /* floats */
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* nulls */
+ null,
+ NULL,
+
+ /* boolean */
+ true,
+ TRUE,
+ FALSE,
+ false,
+
+ /* unset/undefined arrays */
+ @$unset_array,
+ @$undefined_array
+);
+/* loop through the $varient_array to see working of
+ is_array() on non array types, expected output bool(false) */
+$loop_counter = 1;
+foreach ($varient_arrays as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_array ($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_array() );
+
+//arguments more than expected
+var_dump( is_array ($fp, $fp) );
+
+echo "Done\n";
+/* close resources */
+fclose($fp);
+closedir($dfp);
+?>
+--EXPECTF--
+*** Testing is_array() on different type of arrays ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+
+*** Testing is_array() on non array types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt
new file mode 100644
index 0000000..250385a
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_bool.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Test is_bool() function
+--FILE--
+<?php
+/* Prototype: bool is_bool ( mixed $var );
+ * Description: Finds whether the given variable is a boolean
+ */
+
+echo "*** Testing is_bool() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bools = array(
+ TRUE,
+ FALSE,
+ true,
+ false,
+);
+/* loop to check that is_bool() recognizes different
+ bool values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_bools as $bool_val ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_bool($bool_val) );
+}
+
+echo "\n*** Testing is_bool() on non boolean values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_bool1 = true;
+$unset_bool2 = false;
+$unset_var = 0;
+unset ($unset_bool1);
+unset ($unset_bool2);
+unset ($unset_var);
+
+// other types in a array
+$not_bool_types = array (
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ 'string',
+ "string",
+ "true",
+ "false",
+ "FALSE",
+ "TRUE",
+ 'true',
+ 'false',
+ 'FALSE',
+ 'TRUE',
+ "NULL",
+ "null",
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* nulls */
+ null,
+ NULL,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* unset bool vars and undefined var */
+ @$unset_bool1,
+ @$unset_bool2,
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_bool_types to see working of
+ is_bool() on non bull types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_bool_types as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_bool($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_bool() );
+
+//arguments more than expected
+var_dump( is_bool(TRUE, FALSE) );
+
+echo "Done\n";
+
+// close resources
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_bool() with valid boolean values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+*** Testing is_bool() on non boolean values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+-- Iteration 46 --
+bool(false)
+-- Iteration 47 --
+bool(false)
+-- Iteration 48 --
+bool(false)
+-- Iteration 49 --
+bool(false)
+-- Iteration 50 --
+bool(false)
+-- Iteration 51 --
+bool(false)
+-- Iteration 52 --
+bool(false)
+-- Iteration 53 --
+bool(false)
+-- Iteration 54 --
+bool(false)
+-- Iteration 55 --
+bool(false)
+-- Iteration 56 --
+bool(false)
+-- Iteration 57 --
+bool(false)
+-- Iteration 58 --
+bool(false)
+-- Iteration 59 --
+bool(false)
+-- Iteration 60 --
+bool(false)
+-- Iteration 61 --
+bool(false)
+-- Iteration 62 --
+bool(false)
+-- Iteration 63 --
+bool(false)
+-- Iteration 64 --
+bool(false)
+-- Iteration 65 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_callable_basic1.phpt b/ext/standard/tests/general_functions/is_callable_basic1.phpt
new file mode 100644
index 0000000..fe4d6e2
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_basic1.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test is_callable() function : usage variations - defined functions
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ * Description: Verify that the contents of a variable can be called as a function
+ * Source code: ext/imap/php_imap.c
+ */
+
+/* Prototype: void check_iscallable( $functions );
+ Description: use iscallable() on given string to check for valid function name
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable( $functions ) {
+ $counter = 1;
+ foreach($functions as $func) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_callable($func) ); //given only $var argument
+ var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, TRUE, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, FALSE, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on defined functions ***\n";
+/* function name with simple string */
+function someFunction() {
+}
+
+/* function name with mixed string and integer */
+function x123() {
+}
+
+/* function name as NULL */
+function NULL() {
+}
+
+/* function name with boolean name */
+function false() {
+}
+
+/* function name with string and special character */
+function Hello_World() {
+}
+
+$defined_functions = array (
+ $functionVar1 = 'someFunction',
+ $functionVar2 = 'x123',
+ $functionVar3 = 'NULL',
+ $functionVar4 = 'false',
+ $functionVar5 = "Hello_World"
+);
+/* use check_iscallable() to check whether given string is valid function name
+ * expected: true as it is valid callback
+ */
+check_iscallable($defined_functions);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing is_callable() on defined functions ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+someFunction
+bool(true)
+bool(true)
+someFunction
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+x123
+bool(true)
+bool(true)
+x123
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+NULL
+bool(true)
+bool(true)
+NULL
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+false
+bool(true)
+bool(true)
+false
+-- Iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+Hello_World
+bool(true)
+bool(true)
+Hello_World
+===DONE===
diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt
new file mode 100644
index 0000000..c900032
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt
@@ -0,0 +1,787 @@
+--TEST--
+Test is_callable() function : usage variations - on objects
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+/* Prototype: void check_iscallable_objects( $methods );
+ Description: use is_callable() on given $method to check if the array
+ contains a valid method name;
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable_objects( $methods ) {
+ global $loop_counter;
+ $counter = 1;
+ foreach($methods as $method) {
+ echo "-- Innerloop iteration $counter of Outerloop iteration $loop_counter --\n";
+ var_dump( is_callable($method) );
+ var_dump( is_callable($method, true) );
+ var_dump( is_callable($method, false) );
+ var_dump( is_callable($method, true, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($method, false, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on objects ***\n";
+class object_class
+{
+ public $value = 100;
+
+ /* static method */
+ static public function foo() {
+ }
+
+ public function foo1() {
+ }
+ /* function name with mixed string and integer */
+ public function x123() {
+ }
+ /* function name as NULL */
+ public function null() {
+ }
+ /* function name having boolean value */
+ public function TRUE() {
+ }
+
+ protected function foo2() {
+ }
+ private function foo3() {
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+/* class with member as object of other class */
+class contains_object_class
+{
+ public $class_object1;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->no_member_class_object = new no_member_class();
+ }
+}
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+/* check is_callable() on static method */
+echo "\n** Testing behavior of is_callable() on static methods **\n";
+var_dump( is_callable('object_class::foo()', true) ); //expected: true
+var_dump( is_callable('object_class::foo()') ); //expected: false
+
+echo "\n** Testing normal operations of is_callable() on objects **\n";
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+
+/* loop to check whether given object/string has valid given method name
+ * expected: true if valid callback
+ * false otherwise
+ */
+$loop_counter = 1;
+foreach($objects as $object) {
+ echo "--- Outerloop iteration $loop_counter ---\n";
+ $methods = array (
+ array( $object, 'foo1' ),
+ array( $object, 'foo2' ),
+ array( $object, 'foo3' ),
+ array( $object, 'x123' ),
+ array( $object, 'null' ),
+ array( $object, 'TRUE' ),
+ array( $object, '123' ),
+ array( @$temp_class_obj->value, 100 ),
+ array( $object, 'func' ),
+ array( 'object_class', 'foo1' ),
+ );
+ /* use check_iscallable_objects() to check whether given object/string
+ has valid method name */
+ check_iscallable_objects($methods);
+ $loop_counter++;
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_callable() on objects ***
+
+** Testing behavior of is_callable() on static methods **
+bool(true)
+bool(false)
+
+** Testing normal operations of is_callable() on objects **
+--- Outerloop iteration 1 ---
+-- Innerloop iteration 1 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo2
+bool(false)
+object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo3
+bool(false)
+object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::x123
+bool(true)
+object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::null
+bool(true)
+object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::TRUE
+bool(true)
+object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::123
+bool(false)
+object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::func
+bool(false)
+object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 2 ---
+-- Innerloop iteration 1 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo1
+bool(false)
+no_member_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo2
+bool(false)
+no_member_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo3
+bool(false)
+no_member_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::x123
+bool(false)
+no_member_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::null
+bool(false)
+no_member_class::null
+-- Innerloop iteration 6 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::TRUE
+bool(false)
+no_member_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::123
+bool(false)
+no_member_class::123
+-- Innerloop iteration 8 of Outerloop iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::func
+bool(false)
+no_member_class::func
+-- Innerloop iteration 10 of Outerloop iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 3 ---
+-- Innerloop iteration 1 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo1
+bool(false)
+contains_object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo2
+bool(false)
+contains_object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo3
+bool(false)
+contains_object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::x123
+bool(false)
+contains_object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::null
+bool(false)
+contains_object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::TRUE
+bool(false)
+contains_object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::123
+bool(false)
+contains_object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+contains_object_class::func
+bool(true)
+contains_object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 4 ---
+-- Innerloop iteration 1 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo1
+bool(false)
+contains_object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo2
+bool(false)
+contains_object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo3
+bool(false)
+contains_object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::x123
+bool(false)
+contains_object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::null
+bool(false)
+contains_object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::TRUE
+bool(false)
+contains_object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::123
+bool(false)
+contains_object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+contains_object_class::func
+bool(true)
+contains_object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 5 ---
+-- Innerloop iteration 1 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo2
+bool(false)
+object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo3
+bool(false)
+object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::x123
+bool(true)
+object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::null
+bool(true)
+object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::TRUE
+bool(true)
+object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::123
+bool(false)
+object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::func
+bool(false)
+object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 6 ---
+-- Innerloop iteration 1 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo1
+bool(false)
+no_member_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo2
+bool(false)
+no_member_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo3
+bool(false)
+no_member_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::x123
+bool(false)
+no_member_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::null
+bool(false)
+no_member_class::null
+-- Innerloop iteration 6 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::TRUE
+bool(false)
+no_member_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::123
+bool(false)
+no_member_class::123
+-- Innerloop iteration 8 of Outerloop iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::func
+bool(false)
+no_member_class::func
+-- Innerloop iteration 10 of Outerloop iteration 6 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 7 ---
+-- Innerloop iteration 1 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo2
+bool(false)
+object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo3
+bool(false)
+object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::x123
+bool(true)
+object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::null
+bool(true)
+object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::TRUE
+bool(true)
+object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::123
+bool(false)
+object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::func
+bool(false)
+object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 8 ---
+-- Innerloop iteration 1 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 2 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 3 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 4 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 5 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 6 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 7 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 8 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 10 of Outerloop iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_callable_error.phpt b/ext/standard/tests/general_functions/is_callable_error.phpt
new file mode 100644
index 0000000..ac23b8a
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test is_callable() function
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing is_callable() function with less than expected no. of arguments --\n";
+var_dump( is_callable() );
+
+echo "\n-- Testing is_callable() function with more than expected no. of arguments --\n";
+var_dump( is_callable("string", TRUE, $callable_name, "EXTRA") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing error conditions ***
+
+-- Testing is_callable() function with less than expected no. of arguments --
+
+Warning: is_callable() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing is_callable() function with more than expected no. of arguments --
+
+Warning: is_callable() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_callable_variation1.phpt b/ext/standard/tests/general_functions/is_callable_variation1.phpt
new file mode 100644
index 0000000..cfc14bb
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_variation1.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test is_callable() function : usage variations - undefined functions
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+/* Prototype: void check_iscallable( $functions );
+ Description: use iscallable() on given string to check for valid function name
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable( $functions ) {
+ $counter = 1;
+ foreach($functions as $func) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_callable($func) ); //given only $var argument
+ var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, TRUE, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, FALSE, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on undefined functions ***\n";
+$undef_functions = array (
+ "", //empty string
+ '',
+ " ", //string with a space
+ ' ',
+ "12356",
+ "\0",
+ '\0',
+ "hello world",
+ 'hello world',
+ "welcome\0",
+ 'welcome\0',
+ "==%%%***$$$@@@!!",
+ "false",
+ "\070",
+ '\t', //escape character
+ '\007',
+ '123',
+ 'echo()'
+);
+
+/* use check_iscallable() to check whether given string is valid function name
+ * expected: true with $syntax = TRUE
+ * false with $syntax = FALSE
+ */
+check_iscallable($undef_functions);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_callable() on undefined functions ***
+-- Iteration 1 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+bool(true)
+bool(true)
+12356
+bool(false)
+bool(false)
+12356
+-- Iteration 6 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+bool(true)
+bool(true)
+\0
+bool(false)
+bool(false)
+\0
+-- Iteration 8 --
+bool(false)
+bool(true)
+bool(true)
+hello world
+bool(false)
+bool(false)
+hello world
+-- Iteration 9 --
+bool(false)
+bool(true)
+bool(true)
+hello world
+bool(false)
+bool(false)
+hello world
+-- Iteration 10 --
+bool(false)
+bool(true)
+bool(true)
+welcome
+bool(false)
+bool(false)
+welcome
+-- Iteration 11 --
+bool(false)
+bool(true)
+bool(true)
+welcome\0
+bool(false)
+bool(false)
+welcome\0
+-- Iteration 12 --
+bool(false)
+bool(true)
+bool(true)
+==%%%***$$$@@@!!
+bool(false)
+bool(false)
+==%%%***$$$@@@!!
+-- Iteration 13 --
+bool(false)
+bool(true)
+bool(true)
+false
+bool(false)
+bool(false)
+false
+-- Iteration 14 --
+bool(false)
+bool(true)
+bool(true)
+8
+bool(false)
+bool(false)
+8
+-- Iteration 15 --
+bool(false)
+bool(true)
+bool(true)
+\t
+bool(false)
+bool(false)
+\t
+-- Iteration 16 --
+bool(false)
+bool(true)
+bool(true)
+\007
+bool(false)
+bool(false)
+\007
+-- Iteration 17 --
+bool(false)
+bool(true)
+bool(true)
+123
+bool(false)
+bool(false)
+123
+-- Iteration 18 --
+bool(false)
+bool(true)
+bool(true)
+echo()
+bool(false)
+bool(false)
+echo()
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_callable_variation2.phpt b/ext/standard/tests/general_functions/is_callable_variation2.phpt
new file mode 100644
index 0000000..b94a446
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_variation2.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Test is_callable() function : usage variations - on invalid function names
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+/* Prototype: void check_iscallable( $functions );
+ Description: use iscallable() on given string to check for valid function name
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable( $functions ) {
+ $counter = 1;
+ foreach($functions as $func) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_callable($func) ); //given only $var argument
+ var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, TRUE, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, FALSE, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on invalid function names ***\n";
+/* check on unset variables */
+$unset_var = 10;
+unset ($unset_var);
+
+/* opening file resource type */
+$file_handle = fopen (__FILE__, "r");
+
+$variants = array (
+ NULL, // NULL as argument
+ 0, // zero as argument
+ 1234567890, // positive value
+ -100123456782, // negative value
+ -2.000000, // negative float value
+ .567, // positive float value
+ FALSE, // boolean value
+ array(1, 2, 3), // array
+ @$unset_var,
+ @$undef_var, //undefined variable
+ $file_handle
+);
+
+/* use check_iscallable() to check whether given variable is valid function name
+ * expected: false
+ */
+check_iscallable($variants);
+
+/* closing resources used */
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_callable() on invalid function names ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+0
+bool(false)
+bool(false)
+0
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+1234567890
+bool(false)
+bool(false)
+1234567890
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+-100123456782
+bool(false)
+bool(false)
+-100123456782
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-2
+bool(false)
+bool(false)
+-2
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+0.567
+bool(false)
+bool(false)
+0.567
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+bool(false)
+Array
+-- Iteration 9 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+bool(false)
+bool(false)
+Resource id #%d
+bool(false)
+bool(false)
+Resource id #%d
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt
new file mode 100644
index 0000000..f6bbdaa
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_float.phpt
@@ -0,0 +1,440 @@
+--TEST--
+Test is_float() & it's FALIASes: is_double() & is_real() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: bool is_float ( mixed $var );
+ * Description: Finds whether the given variable is a float
+ */
+
+echo "*** Testing is_float(), is_double() and is_real() with float values***\n";
+// different valid float vlaues
+$floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+/* loop to check that is_float(), is_double() & is_real() recognizes
+ different float values, expected: bool(true) */
+$loop_counter = 1;
+foreach ($floats as $float ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_float($float) );
+ var_dump( is_double($float) );
+ var_dump( is_real($float) );
+}
+
+echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ var $array = array(10.5);
+};
+$object = new foo();
+
+$not_floats = array (
+ new foo, //object
+ $object,
+
+ $fp, // resource
+ $dfp,
+
+ array(), // arrays
+ array(NULL),
+ array(0.5e10),
+ array(1,2,3,4),
+ array("string"),
+
+ NULL, // nulls
+ null,
+
+ true, // boolean
+ TRUE,
+ false,
+ FALSE,
+
+ "", // strings
+ '',
+ "0",
+ '0',
+ "0.0",
+ '0.0',
+ '0.5',
+ "-0.5",
+ "1e5",
+ '1e5',
+ '1.5e6_string',
+ "1.5e6_string",
+
+ 1, // integers, hex and octal
+ -1,
+ 0,
+ 12345,
+ 0xFF55,
+ -0x673,
+ 0123,
+ -0123,
+
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_floats to see working of
+ is_float(), is_double() & is_real() on objects,
+ arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_floats as $value ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_float($value) );
+ var_dump( is_double($value) );
+ var_dump( is_real($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_float() );
+var_dump( is_double() );
+var_dump( is_real() );
+
+//arguments more than expected
+var_dump( is_float( $floats[0], $floats[1]) );
+var_dump( is_double( $floats[0], $floats[1]) );
+var_dump( is_real( $floats[0], $floats[1]) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_float(), is_double() and is_real() with float values***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 28 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 29 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_float(), is_double() & is_real() with non float values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt
new file mode 100644
index 0000000..05dd1c3
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_float_64bit.phpt
@@ -0,0 +1,437 @@
+--TEST--
+Test is_float() & it's FALIASes: is_double() & is_real() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool is_float ( mixed $var );
+ * Description: Finds whether the given variable is a float
+ */
+
+echo "*** Testing is_float(), is_double() and is_real() with float values***\n";
+// different valid float vlaues
+$floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+/* loop to check that is_float(), is_double() & is_real() recognizes
+ different float values, expected: bool(true) */
+$loop_counter = 1;
+foreach ($floats as $float ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_float($float) );
+ var_dump( is_double($float) );
+ var_dump( is_real($float) );
+}
+
+echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ var $array = array(10.5);
+};
+$object = new foo();
+
+$not_floats = array (
+ new foo, //object
+ $object,
+
+ $fp, // resource
+ $dfp,
+
+ array(), // arrays
+ array(NULL),
+ array(0.5e10),
+ array(1,2,3,4),
+ array("string"),
+
+ NULL, // nulls
+ null,
+
+ true, // boolean
+ TRUE,
+ false,
+ FALSE,
+
+ "", // strings
+ '',
+ "0",
+ '0',
+ "0.0",
+ '0.0',
+ '0.5',
+ "-0.5",
+ "1e5",
+ '1e5',
+ '1.5e6_string',
+ "1.5e6_string",
+
+ 1, // integers, hex and octal
+ -1,
+ 0,
+ 12345,
+ 0xFF55,
+ -0x673,
+ 0123,
+ -0123,
+
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_floats to see working of
+ is_float(), is_double() & is_real() on objects,
+ arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_floats as $value ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_float($value) );
+ var_dump( is_double($value) );
+ var_dump( is_real($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_float() );
+var_dump( is_double() );
+var_dump( is_real() );
+
+//arguments more than expected
+var_dump( is_float( $floats[0], $floats[1]) );
+var_dump( is_double( $floats[0], $floats[1]) );
+var_dump( is_real( $floats[0], $floats[1]) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_float(), is_double() and is_real() with float values***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 28 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 29 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_float(), is_double() & is_real() with non float values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt
new file mode 100644
index 0000000..7cc3f3b
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_int.phpt
@@ -0,0 +1,465 @@
+--TEST--
+Test is_int() & it's FALIASes: is_long() & is_integer() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: bool is_int ( mixed $var );
+ * Description: Finds whether the given variable is an integer
+ */
+
+echo "*** Testing is_int(), is_integer() & is_long() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+);
+/* loop to check that is_int() recognizes different
+ integer values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_ints as $int_val ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($int_val) );
+ var_dump( is_integer($int_val) );
+ var_dump( is_long($int_val) );
+}
+
+echo "\n*** Testing is_int(), is_integer() & is_long() with non integer values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_int_types to see working of
+ is_int() on non integer types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_int_types as $type ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($type) );
+ var_dump( is_integer($type) );
+ var_dump( is_long($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_int() );
+var_dump( is_integer() );
+var_dump( is_long() );
+
+//arguments more than expected
+var_dump( is_int(TRUE, FALSE) );
+var_dump( is_integer(TRUE, FALSE) );
+var_dump( is_long(TRUE, FALSE) );
+
+echo "Done\n";
+
+// close the resources
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_int(), is_integer() & is_long() with valid integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 8--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 9--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 10--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 11--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 14--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 15--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 16--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_int(), is_integer() & is_long() with non integer values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 38--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 39--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 40--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 41--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 42--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 43--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 44--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 45--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 46--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 47--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 48--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 49--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 50--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 51--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 52--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 53--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 54--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt
new file mode 100644
index 0000000..9de376e
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_int_64bit.phpt
@@ -0,0 +1,462 @@
+--TEST--
+Test is_int() & it's FALIASes: is_long() & is_integer() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool is_int ( mixed $var );
+ * Description: Finds whether the given variable is an integer
+ */
+
+echo "*** Testing is_int(), is_integer() & is_long() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+);
+/* loop to check that is_int() recognizes different
+ integer values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_ints as $int_val ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($int_val) );
+ var_dump( is_integer($int_val) );
+ var_dump( is_long($int_val) );
+}
+
+echo "\n*** Testing is_int(), is_integer() & is_long() with non integer values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_int_types to see working of
+ is_int() on non integer types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_int_types as $type ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($type) );
+ var_dump( is_integer($type) );
+ var_dump( is_long($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_int() );
+var_dump( is_integer() );
+var_dump( is_long() );
+
+//arguments more than expected
+var_dump( is_int(TRUE, FALSE) );
+var_dump( is_integer(TRUE, FALSE) );
+var_dump( is_long(TRUE, FALSE) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_int(), is_integer() & is_long() with valid integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 8--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 9--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 10--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 11--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 12--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 13--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 14--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 15--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 16--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 17--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 18--
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_int(), is_integer() & is_long() with non integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 38--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 39--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 40--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 41--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 42--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 43--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 44--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 45--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 46--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 47--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 48--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 49--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 50--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 51--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 52--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 53--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 54--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt
new file mode 100644
index 0000000..b01b195
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_null.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test is_null() function
+--FILE--
+<?php
+/* Prototype: bool is_null ( mixed $var );
+ * Description: Finds whether the given variable is NULL
+ */
+
+echo "*** Testing is_null() with valid null values ***\n";
+// different valid null vlaues
+$unset_array = array();
+$unset_int = 10;
+$unset_float = 10.5;
+$unset_bool = true;
+$unset_object = new stdclass;
+$unset_resource = fopen(__FILE__, "r");
+// unset them to make it null.
+unset ($unset_array, $unset_int, $unset_float, $unset_bool, $unset_object, $unset_resource);
+$null_var1 = NULL;
+$null_var2 = null;
+
+$valid_nulls = array(
+ NULL,
+ null,
+ @$null_var1,
+ @$null_var2,
+ @$unset_array,
+ @$unset_int,
+ @$unset_float,
+ @$unset_bool,
+ @$unset_object,
+ @$unset_resource,
+ @$undefined_var,
+);
+/* loop to check that is_null() recognizes different
+ null values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_nulls as $null_val ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_null($null_val) );
+}
+
+echo "\n*** Testing is_bool() on non null values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// other types in a array
+$not_null_types = array (
+/* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ 'string',
+ "string",
+ "true",
+ "false",
+ "FALSE",
+ "TRUE",
+ 'true',
+ 'false',
+ 'FALSE',
+ 'TRUE',
+ "NULL",
+ "null",
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+);
+/* loop through the $not_null_types to see working of
+ is_null() on non null types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_null_types as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_null($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_null() );
+
+//arguments more than expected
+var_dump( is_null(NULL, null) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_null() with valid null values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+
+*** Testing is_bool() on non null values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+-- Iteration 46 --
+bool(false)
+-- Iteration 47 --
+bool(false)
+-- Iteration 48 --
+bool(false)
+-- Iteration 49 --
+bool(false)
+-- Iteration 50 --
+bool(false)
+-- Iteration 51 --
+bool(false)
+-- Iteration 52 --
+bool(false)
+-- Iteration 53 --
+bool(false)
+-- Iteration 54 --
+bool(false)
+-- Iteration 55 --
+bool(false)
+-- Iteration 56 --
+bool(false)
+-- Iteration 57 --
+bool(false)
+-- Iteration 58 --
+bool(false)
+-- Iteration 59 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt
new file mode 100644
index 0000000..e6edffd
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_numeric.phpt
@@ -0,0 +1,387 @@
+--TEST--
+Test is_numeric() function
+--FILE--
+<?php
+/* Prototype: bool is_numeric ( mixed $var );
+ * Description: Finds whether a variable is a number or a numeric string
+ */
+
+echo "*** Testing is_numeric() with valid numeric values ***\n";
+// different valid numeric vlaues
+$numerics = array(
+ 0,
+ 1,
+ -1,
+ -0,
+ +0,
+ 0.0,
+ -0.0,
+ +0.0,
+ 1.0,
+ -1.0,
+ +1.0,
+ .5,
+ -.5,
+ +.5,
+ -.5e-2,
+ .5e-2,
+ +.5e-2,
+ +.5E+2,
+ 0.70000000,
+ +0.70000000,
+ -0.70000000,
+ 1234567890123456,
+ -1234567890123456,
+ 984847472827282718178,
+ -984847472827282718178,
+ 123.56e30,
+ 123.56E30,
+ 426.45e-30,
+ 5657.3E-40,
+ 3486.36e+40,
+ 3486.36E+90,
+ -3486.36E+10,
+ -3486.36e+80,
+ -426.45e-50,
+ -426.45E-99,
+ 1e2,
+ -1e2,
+ -1e-2,
+ +1e2,
+ +1e+2,
+ +1e-2,
+ +1e+2,
+ 2245555555555555.444,
+ 1.444444444444444444,
+ 0xff, // hexa decimal numbers
+ 0xFF,
+ //0x1111111111111111111111,
+ -0x1111111,
+ +0x6698319,
+ 01000000000000000000000,
+ 0123,
+ 0345900,
+ -0200001,
+ -0200001.7,
+ 0200001.7,
+ +0200001,
+ +0200001.7,
+ +0200001.7,
+ 2.00000000000000000000001, // a float value with more precision points
+ "1", // numeric in the form of string
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0xff',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123'
+);
+/* loop to check that is_numeric() recognizes different
+ numeric values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($numerics as $num ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_numeric($num) );
+}
+
+echo "\n*** Testing is_numeric() on non numeric types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10.5;
+unset ($unset_var);
+
+// other types in a array
+$not_numerics = array(
+ "-0x80001",
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ new stdclass, // object
+ $fp, // resource
+ $dfp,
+ array(),
+ array("string"),
+ "",
+ "1 ",
+ "- 1",
+ "1.2.4",
+ "1e7.6",
+ "3FF",
+ "20 test",
+ "3.6test",
+ "1,000",
+ "NULL",
+ "true",
+ true,
+ NULL,
+ null,
+ TRUE,
+ FALSE,
+ false,
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_numerics to see working of
+ is_numeric() on non numeric values, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_numerics as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_numeric($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_numeric() );
+
+//arguments more than expected
+var_dump( is_numeric("10", "20") );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_numeric() with valid numeric values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+-- Iteration 23 --
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+-- Iteration 26 --
+bool(true)
+-- Iteration 27 --
+bool(true)
+-- Iteration 28 --
+bool(true)
+-- Iteration 29 --
+bool(true)
+-- Iteration 30 --
+bool(true)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(true)
+-- Iteration 33 --
+bool(true)
+-- Iteration 34 --
+bool(true)
+-- Iteration 35 --
+bool(true)
+-- Iteration 36 --
+bool(true)
+-- Iteration 37 --
+bool(true)
+-- Iteration 38 --
+bool(true)
+-- Iteration 39 --
+bool(true)
+-- Iteration 40 --
+bool(true)
+-- Iteration 41 --
+bool(true)
+-- Iteration 42 --
+bool(true)
+-- Iteration 43 --
+bool(true)
+-- Iteration 44 --
+bool(true)
+-- Iteration 45 --
+bool(true)
+-- Iteration 46 --
+bool(true)
+-- Iteration 47 --
+bool(true)
+-- Iteration 48 --
+bool(true)
+-- Iteration 49 --
+bool(true)
+-- Iteration 50 --
+bool(true)
+-- Iteration 51 --
+bool(true)
+-- Iteration 52 --
+bool(true)
+-- Iteration 53 --
+bool(true)
+-- Iteration 54 --
+bool(true)
+-- Iteration 55 --
+bool(true)
+-- Iteration 56 --
+bool(true)
+-- Iteration 57 --
+bool(true)
+-- Iteration 58 --
+bool(true)
+-- Iteration 59 --
+bool(true)
+-- Iteration 60 --
+bool(true)
+-- Iteration 61 --
+bool(true)
+-- Iteration 62 --
+bool(true)
+-- Iteration 63 --
+bool(true)
+-- Iteration 64 --
+bool(true)
+-- Iteration 65 --
+bool(true)
+-- Iteration 66 --
+bool(true)
+-- Iteration 67 --
+bool(true)
+-- Iteration 68 --
+bool(true)
+-- Iteration 69 --
+bool(true)
+-- Iteration 70 --
+bool(true)
+-- Iteration 71 --
+bool(true)
+-- Iteration 72 --
+bool(true)
+-- Iteration 73 --
+bool(true)
+-- Iteration 74 --
+bool(true)
+-- Iteration 75 --
+bool(true)
+-- Iteration 76 --
+bool(true)
+-- Iteration 77 --
+bool(true)
+-- Iteration 78 --
+bool(true)
+
+*** Testing is_numeric() on non numeric types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt
new file mode 100644
index 0000000..33fd422
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_object.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test is_object() function
+--FILE--
+<?php
+/* Prototype: bool is_object ( mixed $var );
+ * Description: Finds whether the given variable is an object
+ */
+
+echo "*** Testing is_object() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface IValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+
+// implement the interface
+class Value implements IValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_dump ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ new stdclass,
+ new foo,
+ new concreteClass,
+ new Value,
+ new myClass,
+ $myClass_object,
+ $myClass_object->foo_object,
+ $myClass_object->public_var1,
+ $foo_object,
+ $Value_object,
+ $concreteClass_object
+);
+
+/* loop to check that is_object() recognizes different
+ objects, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_objects as $object ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_object($object) );
+}
+
+echo "\n*** Testing is_object() on non object types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset object
+$unset_object = new foo();
+unset ($unset_object);
+
+// other types in a array
+$not_objects = array (
+ 0,
+ -1,
+ 0.1,
+ -10.0000000000000000005,
+ 10.5e+5,
+ 0xFF,
+ 0123,
+ $fp, // resource
+ $dfp,
+ array(),
+ array("string"),
+ "0",
+ "1",
+ "",
+ true,
+ NULL,
+ null,
+ @$unset_object, // unset object
+ @$undefined_var, // undefined variable
+);
+/* loop through the $not_objects to see working of
+ is_object() on non object types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_objects as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_object($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_object() );
+
+//arguments more than expected
+var_dump( is_object($myClass_object, $myClass_object) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_object() with valid objects ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+
+*** Testing is_object() on non object types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt
new file mode 100644
index 0000000..2717e3f
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_resource.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #27822 (is_resource() returns TRUE for closed resources)
+--FILE--
+<?php
+ $f = fopen(__FILE__, 'r');
+ fclose($f);
+ var_dump(is_resource($f));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/general_functions/is_resource_basic.phpt b/ext/standard/tests/general_functions/is_resource_basic.phpt
new file mode 100644
index 0000000..27583d3
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_resource_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test is_resource() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool is_resource ( mixed $var )
+ * Description: Finds whether a variable is a resource
+ * Source code: ext/standard/type.c
+ */
+
+echo "*** Testing is_resource() : basic functionality ***\n";
+
+class Hello {
+ public function SayHello($arg) {
+ echo "Hello\n";
+ }
+}
+
+
+$vars = array(
+ false,
+ true,
+ 10,
+ 10.5,
+ "Helo World",
+ array(1,2,3,4,5),
+ NULL,
+ new Hello());
+
+$types = array(
+ "bool=false",
+ "bool=true",
+ "integer",
+ "double",
+ "string",
+ "array",
+ "NULL",
+ "object");
+
+echo "\nNon-resource type cases\n";
+
+for ($i=0; $i < count($vars); $i++) {
+ if (is_resource($vars[$i])) {
+ echo $types[$i]. " test returns TRUE\n";
+ } else {
+ echo $types[$i]. " test returns FALSE\n";
+ }
+}
+
+$res = fopen(__FILE__, "r");
+echo "\nResource type..var_dump after file open returns\n";
+var_dump($res);
+echo "Resource type..after file open is_resource() returns";
+if (is_resource($res)) {
+ echo " TRUE\n";
+} else {
+ echo " FALSE\n";
+}
+
+fclose($res);
+echo "\nResource type..var_dump after file close returns\n";
+var_dump($res);
+echo "Resource type..after file close is_resource() returns";
+if (is_resource($res)) {
+ echo " TRUE\n";
+} else {
+ echo " FALSE\n";
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_resource() : basic functionality ***
+
+Non-resource type cases
+bool=false test returns FALSE
+bool=true test returns FALSE
+integer test returns FALSE
+double test returns FALSE
+string test returns FALSE
+array test returns FALSE
+NULL test returns FALSE
+object test returns FALSE
+
+Resource type..var_dump after file open returns
+resource(%d) of type (%s)
+Resource type..after file open is_resource() returns TRUE
+
+Resource type..var_dump after file close returns
+resource(%d) of type (Unknown)
+Resource type..after file close is_resource() returns FALSE
+===DONE===
diff --git a/ext/standard/tests/general_functions/is_resource_error.phpt b/ext/standard/tests/general_functions/is_resource_error.phpt
new file mode 100644
index 0000000..acb3cb6
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_resource_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test is_resource() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool is_resource ( mixed $var )
+ * Description: Finds whether a variable is a resource
+ * Source code: ext/standard/type.c
+ */
+
+echo "*** Testing is_resource() : error conditions ***\n";
+
+echo "\n-- Testing is_resource() function with Zero arguments --\n";
+var_dump( is_resource() );
+
+echo "\n-- Testing is_resource() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( is_resource($res, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_resource() : error conditions ***
+
+-- Testing is_resource() function with Zero arguments --
+
+Warning: is_resource() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing is_resource() function with more than expected no. of arguments --
+
+Warning: is_resource() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt
new file mode 100644
index 0000000..d3e2fa5
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_scalar.phpt
@@ -0,0 +1,240 @@
+--TEST--
+Test is_scalar() function
+--FILE--
+<?php
+/* Prototype: bool is_scalar ( mixed $var );
+ * Description: Finds whether a variable is a scalar (i.e integer, float, string or boolean)
+ */
+
+echo "*** Testing basic operations ***\n";
+$scalar_variables = array(
+ 0, // integers
+ 1,
+ -45678,
+ 0x5FF, // hexadecimal as integer
+ 0X566,
+ -0xAAF,
+ -0XCCF,
+ 01234, // octal as integer
+ -0126,
+
+ 0.0, // floats
+ -1.0,
+ 1e5,
+ -1e7,
+ 1.6E7,
+ 475.e-8,
+ 784.e+30,
+ 98.45E+40,
+ .5E-40,
+
+ "", // strings
+ '',
+ " ",
+ ' ',
+ "string",
+ 'string',
+ "0", // numeric as string
+ "40",
+ "50.696",
+ "0x534",
+ "0X534",
+
+ TRUE, // boolean
+ FALSE,
+ true,
+ false
+);
+/* loop through each valid scalar variables in $scalar_variables
+ and see the working of is_scalar(), expected output: bool(true)
+*/
+$loop_counter = 1;
+foreach($scalar_variables as $scalar) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_scalar($scalar) );
+}
+
+echo "\n*** Testing possible variations ***\n";
+// different scalar variables which are unset
+$int_var = 10;
+$float_var = 1e5;
+$string_var = "string";
+$boolean_var = true;
+$object = new stdclass;
+$array = array(10);
+$resource = opendir('.');
+unset($int_var, $float_var, $string_var, $boolean_var, $object, $array, $resource);
+
+// resources
+$fp = fopen(__FILE__, "r");
+$dfp = opendir(".");
+
+$variation_array = array(
+ NULL,
+ null,
+
+ array(), // arrays
+ array(NULL),
+ array(true),
+ array(0),
+ array(1,2,3,4),
+
+ $fp, // resources
+ $dfp,
+
+ new stdclass, // object
+
+ @$int_var, // scalars that are unset
+ @$float_var,
+ @$string_var,
+ @$boolean_var,
+
+ @$array, // non scalars that are unset
+ @$object,
+ @$resource,
+
+ @$undefined_var // undefined variable
+);
+
+/* loop through each element of $variation_array to see the
+ working of is_scalar on non-scalar values, expected output: bool(false)
+*/
+$loop_counter = 1;
+foreach( $variation_array as $value ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_scalar($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+// Zero arguments
+var_dump( is_scalar() );
+
+// Arguments more than expected
+var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) );
+var_dump( is_scalar( new stdclass, new stdclass) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing basic operations ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+-- Iteration 23 --
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+-- Iteration 26 --
+bool(true)
+-- Iteration 27 --
+bool(true)
+-- Iteration 28 --
+bool(true)
+-- Iteration 29 --
+bool(true)
+-- Iteration 30 --
+bool(true)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(true)
+-- Iteration 33 --
+bool(true)
+
+*** Testing possible variations ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt
new file mode 100644
index 0000000..b8c82b1
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_string.phpt
@@ -0,0 +1,303 @@
+--TEST--
+Test is_string() function
+--FILE--
+<?php
+/* Prototype: bool is_string ( mixed $var );
+ * Description: Finds whether the given variable is a string
+ */
+
+echo "*** Testing is_string() with valid string values ***\n";
+// different valid strings
+
+/* string created using Heredoc (<<<) */
+$heredoc_string = <<<EOT
+This is string defined
+using heredoc.
+EOT;
+/* heredoc string with only numerics */
+$heredoc_numeric_string = <<<EOT
+123456 3993
+4849 string
+EOT;
+/* null heardoc string */
+$heredoc_empty_string = <<<EOT
+EOT;
+$heredoc_null_string = <<<EOT
+NULL
+EOT;
+
+$strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'true',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070",
+ "0x55F",
+ "055",
+ "@#$#$%%$^^$%^%^$^&",
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string,
+ $heredoc_null_string
+);
+/* loop to check that is_string() recognizes different
+ strings, expected output bool(true) */
+$loop_counter = 1;
+foreach ($strings as $string ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_string($string) );
+}
+
+echo "\n*** Testing is_string() on non string values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset vars
+$unset_string1 = "string";
+$unset_string2 = 'string';
+$unset_heredoc = <<<EOT
+this is heredoc string
+EOT;
+// unset the vars
+unset($unset_string1, $unset_string2, $unset_heredoc);
+
+// other types in a array
+$not_strings = array (
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* undefined and unset vars */
+ @$unset_string1,
+ @$unset_string2,
+ @$unset_heredoc,
+ @$undefined_var
+);
+/* loop through the $not_strings to see working of
+ is_string() on non string types, expected output bool(false) */
+$loop_counter = 1;
+foreach ($not_strings as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_string($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_string() );
+
+//arguments more than expected
+var_dump( is_string("string", "test") );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_string() with valid string values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+
+*** Testing is_string() on non string values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/isset_basic1.phpt b/ext/standard/tests/general_functions/isset_basic1.phpt
new file mode 100644
index 0000000..4c03210
--- /dev/null
+++ b/ext/standard/tests/general_functions/isset_basic1.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test isset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] )
+ * Description: Determine if a variable is set and is not NULL
+ */
+
+class foo {}
+
+echo "*** Testing isset() : basic functionality ***\n";
+
+$i = 10;
+$f = 10.5;
+$s = "Hello";
+$a = array(1,2,3,4,5);
+$b = true;
+$n = NULL;
+$obj = new foo;
+$res = fopen(__FILE__, "r");
+
+echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n";
+echo "Float test: " . (isset($f) ? "YES": "NO") . "\n";
+echo "String test: " . (isset($s) ? "YES": "NO") . "\n";
+echo "Array test: " . (isset($a) ? "YES": "NO") . "\n";
+echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n";
+echo "Null test: " . (isset($n) ? "YES": "NO") . "\n";
+echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n";
+echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n";
+
+echo "\n\nUnset the variables\n\n";
+unset($i, $f, $s, $a, $b, $n, $obj, $res);
+
+echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n";
+echo "Float test: " . (isset($f) ? "YES": "NO") . "\n";
+echo "String test: " . (isset($s) ? "YES": "NO") . "\n";
+echo "Array test: " . (isset($a) ? "YES": "NO") . "\n";
+echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n";
+echo "Null test: " . (isset($n) ? "YES": "NO") . "\n";
+echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n";
+echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n";
+?>
+===DONE===
+--EXPECT--
+*** Testing isset() : basic functionality ***
+Integer test: YES
+Float test: YES
+String test: YES
+Array test: YES
+Boolean test: YES
+Null test: NO
+Object test: YES
+Resource test: YES
+
+
+Unset the variables
+
+Integer test: NO
+Float test: NO
+String test: NO
+Array test: NO
+Boolean test: NO
+Null test: NO
+Object test: NO
+Resource test: NO
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/isset_basic2.phpt b/ext/standard/tests/general_functions/isset_basic2.phpt
new file mode 100644
index 0000000..9137aeb
--- /dev/null
+++ b/ext/standard/tests/general_functions/isset_basic2.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test isset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] )
+ * Description: Determine if a variable is set and is not NULL
+ */
+
+class foo {}
+
+echo "*** Testing isset() : basic functionality ***\n";
+
+$i = 10;
+$f = 10.5;
+$s = "Hello";
+$b = true;
+$n = NULL;
+
+echo "Test multiple scalar variables in a group\n";
+var_dump(isset($i, $f, $s, $b));
+var_dump(isset($i, $f, $s, $b, $n));
+
+echo "Unset a few\n";
+unset($i, $b);
+
+echo "Test again\n";
+var_dump(isset($i, $f, $s, $b));
+
+echo "\n\nArray test:\n";
+$arr = array();
+var_dump(isset($var));
+var_dump(isset($var[1]));
+var_dump(isset($var, $var[1]));
+echo "..now set\n";
+$var[1] = 10;
+var_dump(isset($var));
+var_dump(isset($var[1]));
+var_dump(isset($var, $var[1]));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing isset() : basic functionality ***
+Test multiple scalar variables in a group
+bool(true)
+bool(false)
+Unset a few
+Test again
+bool(false)
+
+
+Array test:
+bool(false)
+bool(false)
+bool(false)
+..now set
+bool(true)
+bool(true)
+bool(true)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/ob_get_flush_basic.phpt b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
new file mode 100644
index 0000000..dbda1d9
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test ob_get_flush() function : basic functionality
+--INI--
+output_buffering=0
+--FILE--
+<?php
+/* Prototype : bool ob_get_flush(void)
+ * Description: Get current buffer contents, flush (send) the output buffer, and delete current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_get_flush() : basic functionality ***\n";
+
+ob_start();
+
+echo "testing ob_get_flush() with some\nNewlines too\n";
+$string = ob_get_flush();
+
+var_dump( "this is printed before returning the string" );
+var_dump( $string );
+var_dump( ob_list_handlers() );
+
+// Empty string expected
+ob_start();
+$string = ob_get_flush();
+var_dump($string)
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ob_get_flush() : basic functionality ***
+testing ob_get_flush() with some
+Newlines too
+string(43) "this is printed before returning the string"
+string(46) "testing ob_get_flush() with some
+Newlines too
+"
+array(0) {
+}
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
new file mode 100644
index 0000000..1d35381
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test ob_get_flush() function : error conditions
+--INI--
+output_buffering=0
+--FILE--
+<?php
+/* Prototype : bool ob_get_flush(void)
+ * Description: Get current buffer contents, flush (send) the output buffer, and delete current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_get_flush() : error conditions ***\n";
+
+// One extra argument
+$extra_arg = 10;
+var_dump( ob_get_flush( $extra_arg ) );
+
+// No ob_start() executed
+var_dump( ob_get_flush() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ob_get_flush() : error conditions ***
+
+Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
new file mode 100644
index 0000000..9b3e8fb
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test ob_get_length() function : basic functionality
+--INI--
+output_buffering=0
+--FILE--
+<?php
+/* Prototype : int ob_get_length(void)
+ * Description: Return the length of the output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+function dump_string_length( $string )
+{
+ ob_start();
+ echo $string;
+ $len = ob_get_length();
+ ob_end_clean();
+ var_dump( $len );
+}
+
+echo "*** Testing ob_get_length() : basic functionality ***\n";
+
+// No buffering active
+var_dump( ob_get_length() );
+
+dump_string_length( 'foo bar length of a string' );
+dump_string_length( 'plus one' );
+dump_string_length( "\0" );
+dump_string_length( ' lsf' );
+dump_string_length( '' );
+dump_string_length( null );
+
+// Extra argument
+var_dump( ob_get_length( 'foobar' ) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ob_get_length() : basic functionality ***
+bool(false)
+int(26)
+int(8)
+int(1)
+int(15)
+int(0)
+int(0)
+
+Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/ob_start_closures.phpt b/ext/standard/tests/general_functions/ob_start_closures.phpt
new file mode 100644
index 0000000..ba73096
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_start_closures.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ob_start() function : closures as output handlers
+--INI--
+output_buffering=0
+--FILE--
+<?php
+echo "*** Testing ob_start() : closures as output handlers ***\n";
+
+ob_start(function ($output) {
+ return 'Output (1): ' . $output;
+});
+
+ob_start(function ($output) {
+ return 'Output (2): ' . $output;
+});
+
+echo "Test\nWith newlines\n";
+
+$str1 = ob_get_contents ();
+
+ob_end_flush();
+
+$str2 = ob_get_contents ();
+
+ob_end_flush();
+
+echo $str1, $str2;
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ob_start() : closures as output handlers ***
+Output (1): Output (2): Test
+With newlines
+Test
+With newlines
+Output (2): Test
+With newlines
+===DONE===
diff --git a/ext/standard/tests/general_functions/parse_ini_basic.data b/ext/standard/tests/general_functions/parse_ini_basic.data
new file mode 100644
index 0000000..cafbb15
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_basic.data
@@ -0,0 +1,132 @@
+[basic]
+basicval = bar
+longval = 12345
+with.dot = fooobar
+boolon = on
+booltrue = true
+boolyes = yes
+booloff = off
+boolfalse = false
+boolnone = none
+boolno = no
+string = asdadfsdjkslkj ¡@£$$ { }[ ]/%#€
+sqstring = 'adsasdadasdasd'
+dqstring = "asdadfsdjkslkj ¡@£$$ { } !^~|¥¥{[()/)&/% € # #"
+php_constant = E_WARNING
+user_constant = TEST_CONSTANT
+
+[basic with whitespace]
+basicval = bar
+longval = 12345
+with.dot = fooobar
+boolon = on
+booltrue = true
+boolyes = yes
+booloff = off
+boolfalse = false
+boolnone = none
+boolno = no
+sqstring = 'adsasdadasdasd'
+dqstring = "asdadfsdjkslkj ¡@£$$€¥¥{[()/)&/%#€"
+php_constant = E_WARNING
+
+[comments]
+; some comment
+ ; some comment with whitespace
+somecomment = comment follows;aaa@bbb ; comment here
+;
+
+[variables]
+var1 = ${basicval}
+var2 = ${basicval}/foo
+var3 = foo/${basicval}
+var4 = foo/${basicval}/foo
+quoted_var1 = "${basicqval}"
+quoted_var2 = "${basicqval}/foo"
+quoted_var3 = "foo/${basicqval}"
+quoted_var4 = "foo/${basicqval}/foo"
+
+[offset values]
+foo1[] = "basic offset 1"
+foo1[ ] = "basic offset 2"
+foo2[123] = "long offset"
+foo3[abc] = "string offset"
+foo4[""] = "quoted offset 1"
+foo4[" "] = "quoted offset 2"
+foo4["sqfoobar"] = "quoted string offset"
+foo4['dqfoobar'] = "single quoted offset"
+foo6[${basicval}] = "variable"
+foo6[${basicval}/foo] = "variable with string 1"
+foo6[foo/${basicval}] = "variable with string 2"
+foo6[foo/${basicval}/foo] = "variable with string 3"
+foo7["${basicqval}"] = "quoted variable 1"
+foo7["${basicqval}/foo"] = "quoted variable 2"
+foo7["foo/${basicqval}"] = "quoted variable 3"
+foo7[ "foo/${basicqval}/foo" ] = "quoted variable 4"
+
+[non value]
+novalue_option1 =
+novalue_option2=
+novalue_option3 =
+novalue_option4=
+novalue_option4[] =
+novalue_option4[]=
+novalue_option4[]=
+
+["Quoted strings and variables in sections"]
+
+[${basicval}]
+[${basicval}/foo]
+[foo/${basicval}]
+[foo/${basicval}/foo]
+
+["${basicqval}"]
+["${basicqval}/foo"]
+["foo/${basicqval}"]
+["foo/${basicqval}/foo"]
+
+[PATH=${basicval}/no/quotes]
+; Invalid!
+;[PATH="${basicval}/path/quoted"]
+["PATH=${basicval}/all/quoted"]
+
+; This is test for bug #29306
+[01]
+e=e
+f=f
+[02]
+g=g
+h=h
+[1]
+a=a
+b=b
+[2]
+c=c
+d=d
+[0815]
+bla=bla
+
+;Test for bug #43923
+[bug #43923]
+curly1 = {
+curly2 = "{"
+curly3 = '{'
+
+;Test for bug #44019
+[bug #44019]
+concatenation_before = TEST_CONSTANT "+some_text_after"
+concatenation_middle = "some_text_before+" TEST_CONSTANT "+some_text_after"
+concatenation_after = "some_text_before+" TEST_CONSTANT
+concatenation_nows_before = TEST_CONSTANT"+some_text_after"
+concatenation_nows_middle = "some_text_before+"TEST_CONSTANT"+some_text_after"
+concatenation_nows_after = "some_text_before+"TEST_CONSTANT
+
+;Test for bug #43915
+[bug #43915]
+ini_with-hyphen = with hyphen and underscore
+ini.with-hyphen = dot and hyphen
+ini-with.hyphen = hyphen and dot
+
+[windows paths]
+winpath1="c:\some windows\path\test\new\r\quote \" here\single ' quote\some more"
+winpath2="special case\"
diff --git a/ext/standard/tests/general_functions/parse_ini_basic.phpt b/ext/standard/tests/general_functions/parse_ini_basic.phpt
new file mode 100644
index 0000000..0c0591e
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_basic.phpt
@@ -0,0 +1,283 @@
+--TEST--
+parse_ini_file() tests
+--ENV--
+basicval=FUBAR_VARIABLE
+basicqval=FUBAR_QUOTES_VARIABLE
+--FILE--
+<?php
+
+$ini_file = dirname(__FILE__)."/parse_ini_basic.data";
+
+define('TEST_CONSTANT', 'this_is_test_constant');
+
+var_dump(parse_ini_file($ini_file, 1));
+
+echo "Done.\n";
+?>
+--EXPECTF--
+array(26) {
+ ["basic"]=>
+ array(15) {
+ ["basicval"]=>
+ string(3) "bar"
+ ["longval"]=>
+ string(5) "12345"
+ ["with.dot"]=>
+ string(7) "fooobar"
+ ["boolon"]=>
+ string(1) "1"
+ ["booltrue"]=>
+ string(1) "1"
+ ["boolyes"]=>
+ string(1) "1"
+ ["booloff"]=>
+ string(0) ""
+ ["boolfalse"]=>
+ string(0) ""
+ ["boolnone"]=>
+ string(0) ""
+ ["boolno"]=>
+ string(0) ""
+ ["string"]=>
+ string(34) "asdadfsdjkslkj ¡@£$$ { }[ ]/%#€"
+ ["sqstring"]=>
+ string(14) "adsasdadasdasd"
+ ["dqstring"]=>
+ string(51) "asdadfsdjkslkj ¡@£$$ { } !^~|¥¥{[()/)&/% € # #"
+ ["php_constant"]=>
+ string(1) "2"
+ ["user_constant"]=>
+ string(21) "this_is_test_constant"
+ }
+ ["basic with whitespace"]=>
+ array(13) {
+ ["basicval"]=>
+ string(3) "bar"
+ ["longval"]=>
+ string(5) "12345"
+ ["with.dot"]=>
+ string(7) "fooobar"
+ ["boolon"]=>
+ string(1) "1"
+ ["booltrue"]=>
+ string(1) "1"
+ ["boolyes"]=>
+ string(1) "1"
+ ["booloff"]=>
+ string(0) ""
+ ["boolfalse"]=>
+ string(0) ""
+ ["boolnone"]=>
+ string(0) ""
+ ["boolno"]=>
+ string(0) ""
+ ["sqstring"]=>
+ string(14) "adsasdadasdasd"
+ ["dqstring"]=>
+ string(41) "asdadfsdjkslkj ¡@£$$€¥¥{[()/)&/%#€"
+ ["php_constant"]=>
+ string(1) "2"
+ }
+ ["comments"]=>
+ array(1) {
+ ["somecomment"]=>
+ string(15) "comment follows"
+ }
+ ["variables"]=>
+ array(8) {
+ ["var1"]=>
+ string(14) "FUBAR_VARIABLE"
+ ["var2"]=>
+ string(18) "FUBAR_VARIABLE/foo"
+ ["var3"]=>
+ string(18) "foo/FUBAR_VARIABLE"
+ ["var4"]=>
+ string(22) "foo/FUBAR_VARIABLE/foo"
+ ["quoted_var1"]=>
+ string(21) "FUBAR_QUOTES_VARIABLE"
+ ["quoted_var2"]=>
+ string(25) "FUBAR_QUOTES_VARIABLE/foo"
+ ["quoted_var3"]=>
+ string(25) "foo/FUBAR_QUOTES_VARIABLE"
+ ["quoted_var4"]=>
+ string(29) "foo/FUBAR_QUOTES_VARIABLE/foo"
+ }
+ ["offset values"]=>
+ array(6) {
+ ["foo1"]=>
+ array(2) {
+ [0]=>
+ string(14) "basic offset 1"
+ [1]=>
+ string(14) "basic offset 2"
+ }
+ ["foo2"]=>
+ array(1) {
+ [123]=>
+ string(11) "long offset"
+ }
+ ["foo3"]=>
+ array(1) {
+ ["abc"]=>
+ string(13) "string offset"
+ }
+ ["foo4"]=>
+ array(4) {
+ [0]=>
+ string(15) "quoted offset 1"
+ [" "]=>
+ string(15) "quoted offset 2"
+ ["sqfoobar"]=>
+ string(20) "quoted string offset"
+ ["dqfoobar"]=>
+ string(20) "single quoted offset"
+ }
+ ["foo6"]=>
+ array(4) {
+ ["FUBAR_VARIABLE"]=>
+ string(8) "variable"
+ ["FUBAR_VARIABLE/foo"]=>
+ string(22) "variable with string 1"
+ ["foo/FUBAR_VARIABLE"]=>
+ string(22) "variable with string 2"
+ ["foo/FUBAR_VARIABLE/foo"]=>
+ string(22) "variable with string 3"
+ }
+ ["foo7"]=>
+ array(4) {
+ ["FUBAR_QUOTES_VARIABLE"]=>
+ string(17) "quoted variable 1"
+ ["FUBAR_QUOTES_VARIABLE/foo"]=>
+ string(17) "quoted variable 2"
+ ["foo/FUBAR_QUOTES_VARIABLE"]=>
+ string(17) "quoted variable 3"
+ ["foo/FUBAR_QUOTES_VARIABLE/foo"]=>
+ string(17) "quoted variable 4"
+ }
+ }
+ ["non value"]=>
+ array(4) {
+ ["novalue_option1"]=>
+ string(0) ""
+ ["novalue_option2"]=>
+ string(0) ""
+ ["novalue_option3"]=>
+ string(0) ""
+ ["novalue_option4"]=>
+ array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ }
+ }
+ ["Quoted strings and variables in sections"]=>
+ array(0) {
+ }
+ ["FUBAR_VARIABLE"]=>
+ array(0) {
+ }
+ ["FUBAR_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_VARIABLE"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["FUBAR_QUOTES_VARIABLE"]=>
+ array(0) {
+ }
+ ["FUBAR_QUOTES_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_QUOTES_VARIABLE"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_QUOTES_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["PATH=FUBAR_VARIABLE/no/quotes"]=>
+ array(0) {
+ }
+ ["PATH=FUBAR_VARIABLE/all/quoted"]=>
+ array(0) {
+ }
+ ["01"]=>
+ array(2) {
+ ["e"]=>
+ string(1) "e"
+ ["f"]=>
+ string(1) "f"
+ }
+ ["02"]=>
+ array(2) {
+ ["g"]=>
+ string(1) "g"
+ ["h"]=>
+ string(1) "h"
+ }
+ [1]=>
+ array(2) {
+ ["a"]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(2) {
+ ["c"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "d"
+ }
+ ["0815"]=>
+ array(1) {
+ ["bla"]=>
+ string(3) "bla"
+ }
+ ["bug #43923"]=>
+ array(3) {
+ ["curly1"]=>
+ string(1) "{"
+ ["curly2"]=>
+ string(1) "{"
+ ["curly3"]=>
+ string(1) "{"
+ }
+ ["bug #44019"]=>
+ array(6) {
+ ["concatenation_before"]=>
+ string(37) "this_is_test_constant+some_text_after"
+ ["concatenation_middle"]=>
+ string(54) "some_text_before+this_is_test_constant+some_text_after"
+ ["concatenation_after"]=>
+ string(38) "some_text_before+this_is_test_constant"
+ ["concatenation_nows_before"]=>
+ string(37) "this_is_test_constant+some_text_after"
+ ["concatenation_nows_middle"]=>
+ string(54) "some_text_before+this_is_test_constant+some_text_after"
+ ["concatenation_nows_after"]=>
+ string(38) "some_text_before+this_is_test_constant"
+ }
+ ["bug #43915"]=>
+ array(3) {
+ ["ini_with-hyphen"]=>
+ string(26) "with hyphen and underscore"
+ ["ini.with-hyphen"]=>
+ string(14) "dot and hyphen"
+ ["ini-with.hyphen"]=>
+ string(14) "hyphen and dot"
+ }
+ ["windows paths"]=>
+ array(2) {
+ ["winpath1"]=>
+ string(69) "c:\some windows\path\test\new\r\quote " here\single ' quote\some more"
+ ["winpath2"]=>
+ string(13) "special case\"
+ }
+}
+Done.
diff --git a/ext/standard/tests/general_functions/parse_ini_booleans.data b/ext/standard/tests/general_functions/parse_ini_booleans.data
new file mode 100644
index 0000000..d408577
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_booleans.data
@@ -0,0 +1,27 @@
+[error_reporting values]
+foo = E_ALL E_NOTICE
+error_reporting = E_ALL
+error_reporting1 = E_COMPILE_ERROR|E_RECOVERABLE_ERROR |E_ERROR|E_CORE_ERROR
+error_reporting2 = E_ALL&~E_NOTICE
+error_reporting3 = E_ALL & ~E_NOTICE
+error_reporting4 = E_ALL & ~E_NOTICE | E_STRICT
+
+['true or false']
+bool_true = true
+bool_yes = yes
+bool_on = on
+bool_false=false
+bool_off =Off
+bool_no=No
+bool_none= NoNe
+bool_null = NULl
+
+[strings]
+string_true = "true"
+string_yes = " yes"
+string_on = " on "
+string_false="false"
+string_off ="Off "
+string_no="No "
+string_none=" NoNe"
+string_null = "NULl"
diff --git a/ext/standard/tests/general_functions/parse_ini_booleans.phpt b/ext/standard/tests/general_functions/parse_ini_booleans.phpt
new file mode 100644
index 0000000..7b012c5
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_booleans.phpt
@@ -0,0 +1,69 @@
+--TEST--
+parse_ini_file() boolean operators
+--FILE--
+<?php
+
+$ini_file = dirname(__FILE__)."/parse_ini_booleans.data";
+
+var_dump(parse_ini_file($ini_file, 1));
+
+echo "Done.\n";
+
+?>
+--EXPECTF--
+array(3) {
+ ["error_reporting values"]=>
+ array(6) {
+ ["foo"]=>
+ string(7) "32767 8"
+ ["error_reporting"]=>
+ string(5) "32767"
+ ["error_reporting1"]=>
+ string(4) "4177"
+ ["error_reporting2"]=>
+ string(5) "32759"
+ ["error_reporting3"]=>
+ string(5) "32759"
+ ["error_reporting4"]=>
+ string(5) "32759"
+ }
+ ["true or false"]=>
+ array(8) {
+ ["bool_true"]=>
+ string(1) "1"
+ ["bool_yes"]=>
+ string(1) "1"
+ ["bool_on"]=>
+ string(1) "1"
+ ["bool_false"]=>
+ string(0) ""
+ ["bool_off"]=>
+ string(0) ""
+ ["bool_no"]=>
+ string(0) ""
+ ["bool_none"]=>
+ string(0) ""
+ ["bool_null"]=>
+ string(0) ""
+ }
+ ["strings"]=>
+ array(8) {
+ ["string_true"]=>
+ string(4) "true"
+ ["string_yes"]=>
+ string(4) " yes"
+ ["string_on"]=>
+ string(5) " on "
+ ["string_false"]=>
+ string(5) "false"
+ ["string_off"]=>
+ string(4) "Off "
+ ["string_no"]=>
+ string(4) "No "
+ ["string_none"]=>
+ string(5) " NoNe"
+ ["string_null"]=>
+ string(4) "NULl"
+ }
+}
+Done.
diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt
new file mode 100644
index 0000000..240b0f3
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_file.phpt
@@ -0,0 +1,218 @@
+--TEST--
+parse_ini_file() multiple calls
+--SKIPIF--
+<?php if( substr(PHP_OS, 0, 3) == 'WIN' ) die("skip Windows has different error message");?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/parse_ini_file.dat";
+@unlink($filename); /* Make sure the file really does not exist! */
+
+var_dump(parse_ini_file());
+var_dump(parse_ini_file(1,1,1,1));
+var_dump(parse_ini_file($filename));
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+test =
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+$ini = "
+test==
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test=test=
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test= \"new
+line\"
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+define("TEST_CONST", "test const value");
+$ini = "
+test=TEST_CONST
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+[section]
+test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, false));
+
+$ini = "
+section.test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+section.test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+1=2
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+1=2
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+$ini = "
+test=test2
+test=test3
+test=test4
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+/* From bug #44574 */
+$ini = "[section1]\nname = value";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+/* #44842, labels starting with underscore */
+$ini = <<<'INI'
+foo=bar1
+_foo=bar2
+foo_=bar3
+INI;
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+/* #44575, comments starting with '#' */
+$ini = <<<'INI'
+foo=bar1
+; comment
+_foo=bar2
+# comment
+foo_=bar3
+INI;
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6
+bool(false)
+
+Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7
+bool(false)
+
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8
+bool(false)
+
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9
+bool(false)
+array(1) {
+ ["test"]=>
+ string(0) ""
+}
+
+Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
+ in %sparse_ini_file.php on line 20
+bool(false)
+
+Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
+ in %sparse_ini_file.php on line 26
+bool(false)
+array(1) {
+ ["test"]=>
+ string(8) "new
+line"
+}
+array(1) {
+ ["test"]=>
+ string(16) "test const value"
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ ["test"]=>
+ string(5) "hello"
+ }
+}
+array(1) {
+ ["test"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["section.test"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ ["section.test"]=>
+ string(5) "hello"
+ }
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ [1]=>
+ string(1) "2"
+ }
+}
+array(1) {
+ [1]=>
+ string(1) "2"
+}
+array(1) {
+ ["test"]=>
+ string(5) "test4"
+}
+array(1) {
+ ["section1"]=>
+ array(1) {
+ ["name"]=>
+ string(5) "value"
+ }
+}
+array(3) {
+ ["foo"]=>
+ string(4) "bar1"
+ ["_foo"]=>
+ string(4) "bar2"
+ ["foo_"]=>
+ string(4) "bar3"
+}
+
+Deprecated: Comments starting with '#' are deprecated in %s
+array(3) {
+ ["foo"]=>
+ string(4) "bar1"
+ ["_foo"]=>
+ string(4) "bar2"
+ ["foo_"]=>
+ string(4) "bar3"
+}
+Done
diff --git a/ext/standard/tests/general_functions/parse_ini_string_001.phpt b/ext/standard/tests/general_functions/parse_ini_string_001.phpt
new file mode 100644
index 0000000..e135210
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_string_001.phpt
@@ -0,0 +1,479 @@
+--TEST--
+Test parse_ini_string() function
+--FILE--
+<?php
+/* Prototype: array parse_ini_string(string $string [,bool $process_sections]);
+ Description: parse_ini_string() loads in the ini file specified in filename,
+ and returns the settings in it in an associative array.
+*/
+
+$parse_string = <<<EOD
+; Comment starts with semi-colon(;)
+; Section starts with [<section name>]
+
+; start of ini file
+
+[Constans]
+one = 1
+five = 5
+animal = BIRD
+Language = PHP
+PHP_CONSTANT = 1.2345678
+10 = Ten
+HELLO = HELLO
+
+[date]
+date =
+time =
+
+[paths]
+path = /usr/local/bin
+URL = http://www.php.net
+
+[Decimal]
+Decimal_value1 = 100
+Decimal_value2 = -100
+Decimal_value3 = -2147483647
+Decimal_value4 = 2147483647
+Decimal_value5 = -2147483648
+Decimal_value6 = 2147483648
+
+[Octal]
+Octal_value = 0100
+
+[Hex]
+Hex_value1 = 0x101
+Hex_Value2 = 0x102
+Hex_Value2 = 0x103
+
+[Non-alphanumerics_as_values]
+;Non-alpha numeric chars without quotes
+Non_alpha1 = ;
+Non_alpha2 = +
+Non_alpha3 = *
+Non_alpha4 = %
+Non_alpha5 = <>
+Non_alpha6 = @
+Non_alpha7 = #
+Non_alpha8 = ^
+Non_alpha9 = -
+Non_alpha10 = :
+Non_alpha11 = ?
+Non_alpha12 = /
+Non_alpha13 = \
+;These chars have a special meaning when used in the value,
+; hence parser throws an error
+;Non_alpha14 = &
+;Non_alpha15 = {}
+;Non_alpha16 = |
+;Non_alpha17 = ~
+;Non_alpha18 = !
+;Non_alpha19 = $
+;Non_alpha20 = ()
+
+Non_alpha1_quotes = ";"
+Non_alpha2_quotes = "+"
+Non_alpha3_quotes = "*"
+Non_alpha4_quotes = "%"
+Non_alpha5_quotes = "<>"
+Non_alpha6_quotes = "@"
+Non_alpha7_quotes = "#"
+Non_alpha8_quotes = "^"
+Non_alpha9_quotes = "-"
+Non_alpha10_quotes = "="
+Non_alpha11_quotes = ":"
+Non_alpha12_quotes = "?"
+Non_alpha13_quotes = "/"
+;Non_alpha14_quotes = "\"
+Non_alpha15_quotes = "&"
+Non_alpha16_quotes = "{}"
+Non_alpha17_quotes = "|"
+Non_alpha18_quotes = "~"
+Non_alpha19_quotes = "!"
+;Non_alpha20_quotes = "$"
+Non_alpha21_quotes = "()"
+
+[Non-alpha numerics in strings]
+;expected error, as the non-alphanumeric chars not enclosed in double quotes("")
+Non_alpha_string1 = Hello@world
+;Non_alpha_string2 = Hello!world
+;Non_alpha_string3 = Hello#world
+;Non_alpha_string4 = Hello%world
+;Non_alpha_string5 = Hello&world
+;Non_alpha_string6 = Hello*world
+;Non_alpha_string7 = Hello+world
+;Non_alpha_string8 = Hello-world
+;Non_alpha_string9 = Hello'world
+;Non_alpha_string10 = Hello:world
+;Non_alpha_string11 = Hello;world
+;Non_alpha_string12 = Hello<world
+;Non_alpha_string13 = Hello>world
+;Non_alpha_string14 = Hello>world
+;Non_alpha_string15 = Hello?world
+;Non_alpha_string16 = Hello\world
+;Non_alpha_string17 = Hello^world
+;Non_alpha_string18 = Hello_world
+;Non_alpha_string19 = Hello|world
+;Non_alpha_string20 = Hello~world
+;Non_alpha_string21 = Hello`world
+;Non_alpha_string22 = Hello(world)
+
+[Non-alpha numerics in strings -with quotes]
+Non_alpha_string1_quotes = "Hello@world"
+Non_alpha_string2_quotes = "Hello!world"
+Non_alpha_string3_quotes = "Hello#world"
+Non_alpha_string4_quotes = "Hello&world"
+Non_alpha_string5_quotes = "Hello*world"
+Non_alpha_string6_quotes = "Hello+world"
+Non_alpha_string7_quotes = "Hello-world"
+Non_alpha_string8_quotes = "Hello'world"
+Non_alpha_string9_quotes = "Hello:world"
+Non_alpha_string10_quotes = "Hello;world"
+Non_alpha_string11_quotes = "Hello<world"
+Non_alpha_string12_quotes = "Hello>world"
+Non_alpha_string13_quotes = "Hello>world"
+Non_alpha_string14_quotes = "Hello?world"
+Non_alpha_string15_quotes = "Hello\world"
+Non_alpha_string16_quotes = "Hello^world"
+Non_alpha_string17_quotes = "Hello_world"
+Non_alpha_string18_quotes = "Hello|world"
+Non_alpha_string19_quotes = "Hello~world"
+Non_alpha_string20_quotes = "Hello`world"
+Non_alpha_string21_quotes = "Hello(world)"
+
+[Newlines_in_Values]
+String1 = "Hello, world\nGood Morning"
+String2 = "\nHello, world
+ Good Morning\n"
+String3 = 'Hello, world\tGood Morning'
+String4 = "\n"
+String5 = "\n\n"
+String6 = Hello, world\tGood Morning
+
+[ReservedKeys_as_Values]
+Key1 = YES
+Key2 = Yes
+Key3 = yEs
+Key4 = NO
+Key5 = No
+Key6 = nO
+Key7 = TRUE
+Key8 = True
+Key9 = tRUE
+Key10 = true
+Key11 = FALSE
+Key12 = False
+Key13 = false
+Key14 = fAlSE
+Key15 = NULL
+Key16 = Null
+Key17 = nuLL
+Key18 = null
+
+[ReservedKeys_as_Keys]
+; Expected:error, reserved key words must not be used as keys for ini file
+;YES = 1
+;Yes = 2
+;yEs = 1.2
+;YES = YES
+;NO = ""
+;No = "string"
+;nO = "\0"
+;TRUE = 1.1
+;True = 1
+;tRUE = 5
+;true = TRUE
+;FALSE = FALSE
+;False = ""
+;false = "hello"
+;fAlSE = ""
+;NULL = ""
+;Null = 0
+;nuLL = "\0"
+;null = NULL
+
+; end of ini file
+EOD;
+
+echo "*** Test parse_ini_string() function: with various keys and values given in string ***\n";
+echo "-- ini string without process_sections optional arg --\n";
+define('BIRD', 'Humming bird');
+$ini_array = parse_ini_string($parse_string);
+print_r($ini_array);
+
+echo "\n-- ini string with process_sections as TRUE --\n";
+$ini_array = parse_ini_string($parse_string, TRUE);
+print_r($ini_array);
+
+echo "*** Done **\n";
+?>
+--EXPECTF--
+*** Test parse_ini_string() function: with various keys and values given in string ***
+-- ini string without process_sections optional arg --
+Array
+(
+ [one] => 1
+ [five] => 5
+ [animal] => Humming bird
+ [Language] => PHP
+ [PHP_CONSTANT] => 1.2345678
+ [10] => Ten
+ [HELLO] => HELLO
+ [date] =>
+ [time] =>
+ [path] => /usr/local/bin
+ [URL] => http://www.php.net
+ [Decimal_value1] => 100
+ [Decimal_value2] => -100
+ [Decimal_value3] => -2147483647
+ [Decimal_value4] => 2147483647
+ [Decimal_value5] => -2147483648
+ [Decimal_value6] => 2147483648
+ [Octal_value] => 0100
+ [Hex_value1] => 0x101
+ [Hex_Value2] => 0x103
+ [Non_alpha1] =>
+ [Non_alpha2] => +
+ [Non_alpha3] => *
+ [Non_alpha4] => %
+ [Non_alpha5] => <>
+ [Non_alpha6] => @
+ [Non_alpha7] => #
+ [Non_alpha8] => ^
+ [Non_alpha9] => -
+ [Non_alpha10] => :
+ [Non_alpha11] => ?
+ [Non_alpha12] => /
+ [Non_alpha13] => \
+ [Non_alpha1_quotes] => ;
+ [Non_alpha2_quotes] => +
+ [Non_alpha3_quotes] => *
+ [Non_alpha4_quotes] => %
+ [Non_alpha5_quotes] => <>
+ [Non_alpha6_quotes] => @
+ [Non_alpha7_quotes] => #
+ [Non_alpha8_quotes] => ^
+ [Non_alpha9_quotes] => -
+ [Non_alpha10_quotes] => =
+ [Non_alpha11_quotes] => :
+ [Non_alpha12_quotes] => ?
+ [Non_alpha13_quotes] => /
+ [Non_alpha15_quotes] => &
+ [Non_alpha16_quotes] => {}
+ [Non_alpha17_quotes] => |
+ [Non_alpha18_quotes] => ~
+ [Non_alpha19_quotes] => !
+ [Non_alpha21_quotes] => ()
+ [Non_alpha_string1] => Hello@world
+ [Non_alpha_string1_quotes] => Hello@world
+ [Non_alpha_string2_quotes] => Hello!world
+ [Non_alpha_string3_quotes] => Hello#world
+ [Non_alpha_string4_quotes] => Hello&world
+ [Non_alpha_string5_quotes] => Hello*world
+ [Non_alpha_string6_quotes] => Hello+world
+ [Non_alpha_string7_quotes] => Hello-world
+ [Non_alpha_string8_quotes] => Hello'world
+ [Non_alpha_string9_quotes] => Hello:world
+ [Non_alpha_string10_quotes] => Hello;world
+ [Non_alpha_string11_quotes] => Hello<world
+ [Non_alpha_string12_quotes] => Hello>world
+ [Non_alpha_string13_quotes] => Hello>world
+ [Non_alpha_string14_quotes] => Hello?world
+ [Non_alpha_string15_quotes] => Hello\world
+ [Non_alpha_string16_quotes] => Hello^world
+ [Non_alpha_string17_quotes] => Hello_world
+ [Non_alpha_string18_quotes] => Hello|world
+ [Non_alpha_string19_quotes] => Hello~world
+ [Non_alpha_string20_quotes] => Hello`world
+ [Non_alpha_string21_quotes] => Hello(world)
+ [String1] => Hello, world
+Good Morning
+ [String2] =>
+Hello, world
+ Good Morning
+
+ [String3] => Hello, world Good Morning
+ [String4] =>
+
+ [String5] =>
+
+
+ [String6] => Hello, world Good Morning
+ [Key1] => 1
+ [Key2] => 1
+ [Key3] => 1
+ [Key4] =>
+ [Key5] =>
+ [Key6] =>
+ [Key7] => 1
+ [Key8] => 1
+ [Key9] => 1
+ [Key10] => 1
+ [Key11] =>
+ [Key12] =>
+ [Key13] =>
+ [Key14] =>
+ [Key15] =>
+ [Key16] =>
+ [Key17] =>
+ [Key18] =>
+)
+
+-- ini string with process_sections as TRUE --
+Array
+(
+ [Constans] => Array
+ (
+ [one] => 1
+ [five] => 5
+ [animal] => Humming bird
+ [Language] => PHP
+ [PHP_CONSTANT] => 1.2345678
+ [10] => Ten
+ [HELLO] => HELLO
+ )
+
+ [date] => Array
+ (
+ [date] =>
+ [time] =>
+ )
+
+ [paths] => Array
+ (
+ [path] => /usr/local/bin
+ [URL] => http://www.php.net
+ )
+
+ [Decimal] => Array
+ (
+ [Decimal_value1] => 100
+ [Decimal_value2] => -100
+ [Decimal_value3] => -2147483647
+ [Decimal_value4] => 2147483647
+ [Decimal_value5] => -2147483648
+ [Decimal_value6] => 2147483648
+ )
+
+ [Octal] => Array
+ (
+ [Octal_value] => 0100
+ )
+
+ [Hex] => Array
+ (
+ [Hex_value1] => 0x101
+ [Hex_Value2] => 0x103
+ )
+
+ [Non-alphanumerics_as_values] => Array
+ (
+ [Non_alpha1] =>
+ [Non_alpha2] => +
+ [Non_alpha3] => *
+ [Non_alpha4] => %
+ [Non_alpha5] => <>
+ [Non_alpha6] => @
+ [Non_alpha7] => #
+ [Non_alpha8] => ^
+ [Non_alpha9] => -
+ [Non_alpha10] => :
+ [Non_alpha11] => ?
+ [Non_alpha12] => /
+ [Non_alpha13] => \
+ [Non_alpha1_quotes] => ;
+ [Non_alpha2_quotes] => +
+ [Non_alpha3_quotes] => *
+ [Non_alpha4_quotes] => %
+ [Non_alpha5_quotes] => <>
+ [Non_alpha6_quotes] => @
+ [Non_alpha7_quotes] => #
+ [Non_alpha8_quotes] => ^
+ [Non_alpha9_quotes] => -
+ [Non_alpha10_quotes] => =
+ [Non_alpha11_quotes] => :
+ [Non_alpha12_quotes] => ?
+ [Non_alpha13_quotes] => /
+ [Non_alpha15_quotes] => &
+ [Non_alpha16_quotes] => {}
+ [Non_alpha17_quotes] => |
+ [Non_alpha18_quotes] => ~
+ [Non_alpha19_quotes] => !
+ [Non_alpha21_quotes] => ()
+ )
+
+ [Non-alpha numerics in strings] => Array
+ (
+ [Non_alpha_string1] => Hello@world
+ )
+
+ [Non-alpha numerics in strings -with quotes] => Array
+ (
+ [Non_alpha_string1_quotes] => Hello@world
+ [Non_alpha_string2_quotes] => Hello!world
+ [Non_alpha_string3_quotes] => Hello#world
+ [Non_alpha_string4_quotes] => Hello&world
+ [Non_alpha_string5_quotes] => Hello*world
+ [Non_alpha_string6_quotes] => Hello+world
+ [Non_alpha_string7_quotes] => Hello-world
+ [Non_alpha_string8_quotes] => Hello'world
+ [Non_alpha_string9_quotes] => Hello:world
+ [Non_alpha_string10_quotes] => Hello;world
+ [Non_alpha_string11_quotes] => Hello<world
+ [Non_alpha_string12_quotes] => Hello>world
+ [Non_alpha_string13_quotes] => Hello>world
+ [Non_alpha_string14_quotes] => Hello?world
+ [Non_alpha_string15_quotes] => Hello\world
+ [Non_alpha_string16_quotes] => Hello^world
+ [Non_alpha_string17_quotes] => Hello_world
+ [Non_alpha_string18_quotes] => Hello|world
+ [Non_alpha_string19_quotes] => Hello~world
+ [Non_alpha_string20_quotes] => Hello`world
+ [Non_alpha_string21_quotes] => Hello(world)
+ )
+
+ [Newlines_in_Values] => Array
+ (
+ [String1] => Hello, world
+Good Morning
+ [String2] =>
+Hello, world
+ Good Morning
+
+ [String3] => Hello, world Good Morning
+ [String4] =>
+
+ [String5] =>
+
+
+ [String6] => Hello, world Good Morning
+ )
+
+ [ReservedKeys_as_Values] => Array
+ (
+ [Key1] => 1
+ [Key2] => 1
+ [Key3] => 1
+ [Key4] =>
+ [Key5] =>
+ [Key6] =>
+ [Key7] => 1
+ [Key8] => 1
+ [Key9] => 1
+ [Key10] => 1
+ [Key11] =>
+ [Key12] =>
+ [Key13] =>
+ [Key14] =>
+ [Key15] =>
+ [Key16] =>
+ [Key17] =>
+ [Key18] =>
+ )
+
+ [ReservedKeys_as_Keys] => Array
+ (
+ )
+
+)
+*** Done **
diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
new file mode 100644
index 0000000..733409c
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
@@ -0,0 +1,168 @@
+--TEST--
+parse_ini_string() multiple calls
+--FILE--
+<?php
+
+var_dump(parse_ini_string());
+var_dump(parse_ini_string(1,1,1,1));
+
+$ini = "
+test =
+";
+var_dump(parse_ini_string($ini));
+$ini = "
+test==
+";
+var_dump(parse_ini_string($ini));
+
+$ini = "
+test=test=
+";
+var_dump(parse_ini_string($ini));
+
+$ini = "
+test= \"new
+line\"
+";
+var_dump(parse_ini_string($ini));
+
+define("TEST_CONST", "test const value");
+$ini = "
+test=TEST_CONST
+";
+var_dump(parse_ini_string($ini));
+
+$ini = "
+[section]
+test=hello
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+[section]
+test=hello
+";
+var_dump(parse_ini_string($ini, false));
+
+$ini = "
+section.test=hello
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+[section]
+section.test=hello
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+[section]
+1=2
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+1=2
+";
+var_dump(parse_ini_string($ini, true));
+$ini = "
+test=test2
+test=test3
+test=test4
+";
+var_dump(parse_ini_string($ini, true));
+
+/* From bug #44574 */
+$ini = "[section1]\nname = value";
+var_dump(parse_ini_string($ini, true));
+
+/* #44842, labels starting with underscore */
+$ini = <<<'INI'
+foo=bar1
+_foo=bar2
+foo_=bar3
+INI;
+var_dump(parse_ini_string($ini, true));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s
+bool(false)
+
+Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s
+bool(false)
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(0) ""
+}
+
+Warning: syntax error, unexpected '='%sin Unknown on line 2
+ in %s
+bool(false)
+
+Warning: syntax error, unexpected '='%sin Unknown on line 2
+ in %s
+bool(false)
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(8) "new
+line"
+}
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(16) "test const value"
+}
+array(1) {
+ [%u|b%"section"]=>
+ array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(5) "hello"
+ }
+}
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(5) "hello"
+}
+array(1) {
+ [%u|b%"section.test"]=>
+ %unicode|string%(5) "hello"
+}
+array(1) {
+ [%u|b%"section"]=>
+ array(1) {
+ [%u|b%"section.test"]=>
+ %unicode|string%(5) "hello"
+ }
+}
+array(1) {
+ [%u|b%"section"]=>
+ array(1) {
+ [1]=>
+ %unicode|string%(1) "2"
+ }
+}
+array(1) {
+ [1]=>
+ %unicode|string%(1) "2"
+}
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(5) "test4"
+}
+array(1) {
+ [%u|b%"section1"]=>
+ array(1) {
+ [%u|b%"name"]=>
+ %unicode|string%(5) "value"
+ }
+}
+array(3) {
+ [%u|b%"foo"]=>
+ %unicode|string%(4) "bar1"
+ [%u|b%"_foo"]=>
+ %unicode|string%(4) "bar2"
+ [%u|b%"foo_"]=>
+ %unicode|string%(4) "bar3"
+}
+Done
diff --git a/ext/standard/tests/general_functions/php_uname_basic.phpt b/ext/standard/tests/general_functions/php_uname_basic.phpt
new file mode 100644
index 0000000..629318d
--- /dev/null
+++ b/ext/standard/tests/general_functions/php_uname_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test php_uname() function - basic test
+--FILE--
+<?php
+/* Prototype: string php_uname ([ string $mode ] )
+ * Description: Returns information about the operating system PHP is running on
+*/
+
+echo "*** Testing php_uname() - basic test\n";
+
+var_dump(php_uname());
+
+echo "\n-- Try all the defined mode's --\n";
+
+var_dump(php_uname('a'));
+var_dump(php_uname('s'));
+var_dump(php_uname('n'));
+var_dump(php_uname('r'));
+var_dump(php_uname('v'));
+var_dump(php_uname('m'));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing php_uname() - basic test
+string(%d) "%s"
+
+-- Try all the defined mode's --
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+===DONE===
diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt
new file mode 100644
index 0000000..5e221b7
--- /dev/null
+++ b/ext/standard/tests/general_functions/php_uname_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test php_uname() function - error conditions - pass function incorrect arguments
+--FILE--
+<?php
+/* Prototype: string php_uname ([ string $mode ] )
+ * Description: Returns information about the operating system PHP is running on
+*/
+
+echo "*** Testing php_uname() - error test\n";
+
+echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n";
+var_dump( php_uname('a', true) );
+
+echo "\n-- Testing php_uname() function with invalid mode --\n";
+// am invalid mode shoudl result in same o/p as mode 'a'
+var_dump( php_uname('z') == php_uname('z') );
+
+class barClass {
+}
+
+$fp = fopen(__FILE__, "r");
+
+echo "\n-- Testing php_uname() function with invalid argument types --\n";
+var_dump(php_uname(array()));
+var_dump(php_uname(array('color' => 'red', 'item' => 'pen')));
+var_dump(php_uname(new barClass()));
+var_dump(php_uname($fp));
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing php_uname() - error test
+
+-- Testing php_uname() function with more than expected no. of arguments --
+
+Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing php_uname() function with invalid mode --
+bool(true)
+
+-- Testing php_uname() function with invalid argument types --
+
+Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: php_uname() 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/general_functions/php_uname_variation1.phpt b/ext/standard/tests/general_functions/php_uname_variation1.phpt
new file mode 100644
index 0000000..d94fd80
--- /dev/null
+++ b/ext/standard/tests/general_functions/php_uname_variation1.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test php_uname() function - usage variations
+--FILE--
+<?php
+/* Prototype: string php_uname ([ string $mode ] )
+ * Description: Returns information about the operating system PHP is running on
+*/
+
+echo "*** Testing php_uname() - usage variations\n";
+// Prevent notices about undefines variables
+error_reporting(E_ALL & ~E_NOTICE);
+
+$unset_var = 10;
+unset ($unset_var);
+
+class fooClass {
+ function __toString() {
+ return "m";
+ }
+}
+
+$values = array(
+
+ // int data
+ "0" => 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,
+
+ // null data
+ "NULL" => NULL,
+ "null" => null,
+
+ // boolean data
+ "true" => true,
+ "false" => false,
+ "TRUE" => TRUE,
+ "FALSE" => FALSE,
+
+ // empty data
+ "\"\"" => "",
+ "''" => '',
+
+ // object data
+ "new fooClass()" => new fooClass(),
+
+ // undefined data
+ "undefined var" => $undefined_var,
+
+ // unset data
+ "unset var" => $unset_var,
+);
+
+// loop through each element of the array for data
+
+foreach($values as $key => $value) {
+ echo "-- Iterator $key --\n";
+ var_dump( php_uname($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing php_uname() - usage variations
+-- Iterator 0 --
+string(%d) "%s"
+-- Iterator 1 --
+string(%d) "%s"
+-- Iterator 12345 --
+string(%d) "%s"
+-- Iterator -2345 --
+string(%d) "%s"
+-- Iterator 10.5 --
+string(%d) "%s"
+-- Iterator -10.5 --
+string(%d) "%s"
+-- Iterator 10.1234567e10 --
+string(%d) "%s"
+-- Iterator 10.7654321E-10 --
+string(%d) "%s"
+-- Iterator .5 --
+string(%d) "%s"
+-- Iterator NULL --
+string(%d) "%s"
+-- Iterator null --
+string(%d) "%s"
+-- Iterator true --
+string(%d) "%s"
+-- Iterator false --
+string(%d) "%s"
+-- Iterator TRUE --
+string(%d) "%s"
+-- Iterator FALSE --
+string(%d) "%s"
+-- Iterator "" --
+string(%d) "%s"
+-- Iterator '' --
+string(%d) "%s"
+-- Iterator new fooClass() --
+string(%d) "%s"
+-- Iterator undefined var --
+string(%d) "%s"
+-- Iterator unset var --
+string(%d) "%s"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt
new file mode 100644
index 0000000..0aff614
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpcredits.phpt
@@ -0,0 +1,54 @@
+--TEST--
+phpcredits()
+--FILE--
+<?php
+
+var_dump(phpcredits());
+var_dump(phpcredits(array()));
+
+echo "--\n";
+var_dump(phpcredits(0));
+
+echo "--\n";
+var_dump(phpcredits(CREDITS_GROUP));
+
+?>
+--EXPECTF--
+PHP Credits
+
+PHP Group
+%a
+
+Language Design & Concept
+%a
+
+%wPHP Authors%w
+%a
+
+%wSAPI Modules%w
+%a
+
+%wModule Authors%w
+%a
+
+%wPHP Documentation%w
+%a
+
+PHP Quality Assurance Team
+%a
+
+%wWebsites and Infrastructure team%w
+%a
+bool(true)
+
+Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits.php on line 4
+NULL
+--
+PHP Credits
+bool(true)
+--
+PHP Credits
+
+PHP Group
+%a
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt
new file mode 100644
index 0000000..ee17f59
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpcredits2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+phpcredits() CGI
+--POST--
+dummy=x
+--FILE--
+<?php
+
+var_dump(phpcredits());
+var_dump(phpcredits(array()));
+
+echo "--\n";
+var_dump(phpcredits(0));
+
+echo "--\n";
+var_dump(phpcredits(CREDITS_GROUP));
+
+?>
+--EXPECTF--
+<!DOCTYPE %a>%s</html>
+bool(true)
+
+Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits2.php on line 4
+NULL
+--
+<h1>PHP Credits</h1>
+bool(true)
+--
+<h1>PHP Credits</h1>
+%aPHP Group%a
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
new file mode 100644
index 0000000..01b0c62
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -0,0 +1,76 @@
+--TEST--
+phpinfo()
+--FILE--
+<?php
+var_dump(phpinfo());
+
+echo "--\n";
+var_dump(phpinfo(array()));
+
+echo "--\n";
+var_dump(phpinfo(0));
+
+echo "--\n";
+var_dump(phpinfo(INFO_LICENSE));
+
+?>
+--EXPECTF--
+phpinfo()
+PHP Version => %s
+
+System => %s
+Build Date => %s%a
+Configure Command => %s
+Server API => Command Line Interface
+Virtual Directory Support => %s
+Configuration File (php.ini) Path => %s
+Loaded Configuration File => %a
+Scan this dir for additional .ini files => %a
+Additional .ini files parsed => %a
+PHP API => %d
+PHP Extension => %d
+Zend Extension => %d
+Zend Extension Build => API%s
+PHP Extension Build => API%s
+Debug Build => %s
+Thread Safety => %s
+Zend Signal Handling => %s
+Zend Memory Manager => %s
+Zend Multibyte Support => %s
+IPv6 Support => %s
+DTrace Support => %s
+
+Registered PHP Streams => %s
+Registered Stream Socket Transports => %s
+Registered Stream Filters => %s
+
+%a
+ _______________________________________________________________________
+
+
+Configuration
+%A
+Core
+%A
+Additional Modules
+%A
+Environment
+%A
+PHP Variables
+%A
+PHP License
+%A
+bool(true)
+--
+
+Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo.php on line 5
+NULL
+--
+phpinfo()
+bool(true)
+--
+phpinfo()
+
+PHP License
+%a
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt
new file mode 100644
index 0000000..891867f
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpinfo2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+phpinfo() CGI
+--POST--
+dummy=x
+--FILE--
+<?php
+var_dump(phpinfo());
+
+echo "--\n";
+var_dump(phpinfo(array()));
+
+echo "--\n";
+var_dump(phpinfo(0));
+
+echo "--\n";
+var_dump(phpinfo(INFO_LICENSE));
+
+?>
+--EXPECTF--
+<!DOCTYPE %s>
+%a</html>bool(true)
+--
+
+Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo2.php on line 5
+NULL
+--
+<!DOCTYPE %s>
+%a</html>bool(true)
+--
+<!DOCTYPE %s>
+%a</html>bool(true)
diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt
new file mode 100644
index 0000000..81a523a
--- /dev/null
+++ b/ext/standard/tests/general_functions/print_r.phpt
@@ -0,0 +1,1736 @@
+--TEST--
+Test print_r() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool print_r ( mixed $expression [, bool $return] );
+ Description: Prints human-readable information about a variable
+*/
+
+/* Prototype: void check_printr( $variables )
+ Description: use print_r() to print variables */
+function check_printr( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "\n-- Iteration $counter --\n";
+ //default = false, prints output to screen
+ print_r($variable);
+ //$return=TRUE, print_r() will return its output, instead of printing it
+ $ret_string = print_r($variable, true); //$ret_string captures the output
+ echo "\n$ret_string\n";
+ //$return=false, print_r() prints the output; default behavior
+ print_r($variable, false);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing print_r() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_printr() to display contents of integer variables
+ using print_r() */
+check_printr($integers);
+
+echo "\n*** Testing print_r() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_printr() to display contents of float variables
+ using print_r() */
+check_printr($floats);
+
+echo "\n*** Testing print_r() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_printr() to display contents of strings using print_r() */
+check_printr($strings);
+
+echo "\n*** Testing print_r() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_printr() to display boolean variables using print_r() */
+check_printr($booleans);
+var_dump( reset($booleans) );
+echo "\n";
+var_dump( current($booleans) );
+
+echo "\n*** Testing print_r() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_printr() to display contents of $arrays */
+check_printr($arrays);
+
+echo "\n*** Testing print_r() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_printr() to display contents of the objects using print_r() */
+check_printr($objects);
+
+echo "\n** Testing print_r() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+print_r($recursion_obj2);
+
+echo "\n*** Testing print_r() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_printr() to display the resource content type
+ using print_r() */
+check_printr($resources);
+
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_printr() to display combinations of scalar and
+ non-scalar variables using print_r() */
+check_printr($variations);
+
+echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_printr() to display miscelleneous data using print_r() */
+check_printr($misc_values);
+
+/* checking print_r() on functions */
+echo "\n*** Testing print_r() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+print_r( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump( print_r() );
+
+//passing more than required no. of arguments
+var_dump( print_r(123, true, "abc") );
+
+// check when second arg is given other than boolean TRUE
+var_dump( print_r ($value, "string") );
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing print_r() on integer variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+83
+83
+83
+-- Iteration 3 --
+123000000
+123000000
+123000000
+-- Iteration 4 --
+-83
+-83
+-83
+-- Iteration 5 --
+-12300000
+-12300000
+-12300000
+-- Iteration 6 --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+-- Iteration 8 --
+2147483647
+2147483647
+2147483647
+-- Iteration 9 --
+2147483648
+2147483648
+2147483648
+-- Iteration 10 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 11 --
+-2147483647
+-2147483647
+-2147483647
+-- Iteration 12 --
+2147483647
+2147483647
+2147483647
+-- Iteration 13 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 14 --
+2147483647
+2147483647
+2147483647
+-- Iteration 15 --
+-2147483648
+-2147483648
+-2147483648
+*** Testing print_r() on float variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+0
+0
+0
+-- Iteration 3 --
+1.234
+1.234
+1.234
+-- Iteration 4 --
+-1.234
+-1.234
+-1.234
+-- Iteration 5 --
+-2
+-2
+-2
+-- Iteration 6 --
+2
+2
+2
+-- Iteration 7 --
+-0.5
+-0.5
+-0.5
+-- Iteration 8 --
+0.567
+0.567
+0.567
+-- Iteration 9 --
+-0.00067
+-0.00067
+-0.00067
+-- Iteration 10 --
+-670
+-670
+-670
+-- Iteration 11 --
+670
+670
+670
+-- Iteration 12 --
+670
+670
+670
+-- Iteration 13 --
+-0.00410003
+-0.00410003
+-0.00410003
+-- Iteration 14 --
+-4100.03
+-4100.03
+-4100.03
+-- Iteration 15 --
+0.004100003
+0.004100003
+0.004100003
+-- Iteration 16 --
+4100.003
+4100.003
+4100.003
+-- Iteration 17 --
+100000
+100000
+100000
+-- Iteration 18 --
+-100000
+-100000
+-100000
+-- Iteration 19 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 20 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 21 --
+100000
+100000
+100000
+-- Iteration 22 --
+-100000
+-100000
+-100000
+-- Iteration 23 --
+100000
+100000
+100000
+-- Iteration 24 --
+-100000
+-100000
+-100000
+-- Iteration 25 --
+100000
+100000
+100000
+-- Iteration 26 --
+-100000
+-100000
+-100000
+-- Iteration 27 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 28 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 29 --
+-2147483649
+-2147483649
+-2147483649
+-- Iteration 30 --
+2147483649
+2147483649
+2147483649
+-- Iteration 31 --
+2147483649
+2147483649
+2147483649
+-- Iteration 32 --
+-2147483649
+-2147483649
+-2147483649
+*** Testing print_r() on string variables ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+-- Iteration 5 --
+0
+0
+0
+-- Iteration 6 --
+
+
+
+-- Iteration 7 --
+\0
+\0
+\0
+-- Iteration 8 --
+
+
+
+-- Iteration 9 --
+\t
+\t
+\t
+-- Iteration 10 --
+PHP
+PHP
+PHP
+-- Iteration 11 --
+PHP
+PHP
+PHP
+-- Iteration 12 --
+abcd
+abcd
+abcd
+-- Iteration 13 --
+abcd
+abcd
+abcd
+-- Iteration 14 --
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+*** Testing print_r() on boolean variables ***
+
+-- Iteration 1 --
+1
+1
+1
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+1
+1
+1
+-- Iteration 4 --
+
+
+bool(true)
+
+bool(true)
+
+*** Testing print_r() on array variables ***
+
+-- Iteration 1 --
+Array
+(
+)
+
+Array
+(
+)
+
+Array
+(
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+-- Iteration 8 --
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+-- Iteration 9 --
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+-- Iteration 10 --
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+-- Iteration 11 --
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+-- Iteration 12 --
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+-- Iteration 13 --
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+-- Iteration 14 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+-- Iteration 15 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+*** Testing print_r() on object variables ***
+
+-- Iteration 1 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 2 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 3 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 4 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 5 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 6 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 7 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 8 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 9 --
+
+
+
+** Testing print_r() on objects having circular reference **
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ *RECURSION*
+ )
+
+)
+
+*** Testing print_r() on resources ***
+
+-- Iteration 1 --
+Resource id #5
+Resource id #5
+Resource id #5
+-- Iteration 2 --
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
+
+-- Iteration 1 --
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+*** Testing print_r() on miscelleneous input arguments ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+*** Testing print_r() on anonymous functions ***
+New anonymous function:
+2 * 3 = 6
+
+*** Testing error conditions ***
+
+Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: value in %s on line %d
+string(0) ""
+Done
diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt
new file mode 100644
index 0000000..f3ebd58
--- /dev/null
+++ b/ext/standard/tests/general_functions/print_r_64bit.phpt
@@ -0,0 +1,1737 @@
+--TEST--
+Test print_r() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+
+<?php
+/* Prototype: bool print_r ( mixed $expression [, bool $return] );
+ Description: Prints human-readable information about a variable
+*/
+
+/* Prototype: void check_printr( $variables )
+ Description: use print_r() to print variables */
+function check_printr( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "\n-- Iteration $counter --\n";
+ //default = false, prints output to screen
+ print_r($variable);
+ //$return=TRUE, print_r() will return its output, instead of printing it
+ $ret_string = print_r($variable, true); //$ret_string captures the output
+ echo "\n$ret_string\n";
+ //$return=false, print_r() prints the output; default behavior
+ print_r($variable, false);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing print_r() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_printr() to display contents of integer variables
+ using print_r() */
+check_printr($integers);
+
+echo "\n*** Testing print_r() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_printr() to display contents of float variables
+ using print_r() */
+check_printr($floats);
+
+echo "\n*** Testing print_r() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_printr() to display contents of strings using print_r() */
+check_printr($strings);
+
+echo "\n*** Testing print_r() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_printr() to display boolean variables using print_r() */
+check_printr($booleans);
+var_dump( reset($booleans) );
+echo "\n";
+var_dump( current($booleans) );
+
+echo "\n*** Testing print_r() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_printr() to display contents of $arrays */
+check_printr($arrays);
+
+echo "\n*** Testing print_r() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_printr() to display contents of the objects using print_r() */
+check_printr($objects);
+
+echo "\n** Testing print_r() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+print_r($recursion_obj2);
+
+echo "\n*** Testing print_r() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_printr() to display the resource content type
+ using print_r() */
+check_printr($resources);
+
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_printr() to display combinations of scalar and
+ non-scalar variables using print_r() */
+check_printr($variations);
+
+echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_printr() to display miscelleneous data using print_r() */
+check_printr($misc_values);
+
+/* checking print_r() on functions */
+echo "\n*** Testing print_r() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+print_r( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump( print_r() );
+
+//passing more than required no. of arguments
+var_dump( print_r(123, true, "abc") );
+
+// check when second arg is given other than boolean TRUE
+var_dump( print_r ($value, "string") );
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing print_r() on integer variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+83
+83
+83
+-- Iteration 3 --
+123000000
+123000000
+123000000
+-- Iteration 4 --
+-83
+-83
+-83
+-- Iteration 5 --
+-12300000
+-12300000
+-12300000
+-- Iteration 6 --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+-- Iteration 8 --
+2147483647
+2147483647
+2147483647
+-- Iteration 9 --
+2147483648
+2147483648
+2147483648
+-- Iteration 10 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 11 --
+-2147483647
+-2147483647
+-2147483647
+-- Iteration 12 --
+2147483647
+2147483647
+2147483647
+-- Iteration 13 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 14 --
+2147483647
+2147483647
+2147483647
+-- Iteration 15 --
+-2147483648
+-2147483648
+-2147483648
+*** Testing print_r() on float variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+0
+0
+0
+-- Iteration 3 --
+1.234
+1.234
+1.234
+-- Iteration 4 --
+-1.234
+-1.234
+-1.234
+-- Iteration 5 --
+-2
+-2
+-2
+-- Iteration 6 --
+2
+2
+2
+-- Iteration 7 --
+-0.5
+-0.5
+-0.5
+-- Iteration 8 --
+0.567
+0.567
+0.567
+-- Iteration 9 --
+-0.00067
+-0.00067
+-0.00067
+-- Iteration 10 --
+-670
+-670
+-670
+-- Iteration 11 --
+670
+670
+670
+-- Iteration 12 --
+670
+670
+670
+-- Iteration 13 --
+-0.00410003
+-0.00410003
+-0.00410003
+-- Iteration 14 --
+-4100.03
+-4100.03
+-4100.03
+-- Iteration 15 --
+0.004100003
+0.004100003
+0.004100003
+-- Iteration 16 --
+4100.003
+4100.003
+4100.003
+-- Iteration 17 --
+100000
+100000
+100000
+-- Iteration 18 --
+-100000
+-100000
+-100000
+-- Iteration 19 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 20 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 21 --
+100000
+100000
+100000
+-- Iteration 22 --
+-100000
+-100000
+-100000
+-- Iteration 23 --
+100000
+100000
+100000
+-- Iteration 24 --
+-100000
+-100000
+-100000
+-- Iteration 25 --
+100000
+100000
+100000
+-- Iteration 26 --
+-100000
+-100000
+-100000
+-- Iteration 27 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 28 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 29 --
+-2147483649
+-2147483649
+-2147483649
+-- Iteration 30 --
+2147483649
+2147483649
+2147483649
+-- Iteration 31 --
+2147483649
+2147483649
+2147483649
+-- Iteration 32 --
+-2147483649
+-2147483649
+-2147483649
+*** Testing print_r() on string variables ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+-- Iteration 5 --
+0
+0
+0
+-- Iteration 6 --
+
+
+
+-- Iteration 7 --
+\0
+\0
+\0
+-- Iteration 8 --
+
+
+
+-- Iteration 9 --
+\t
+\t
+\t
+-- Iteration 10 --
+PHP
+PHP
+PHP
+-- Iteration 11 --
+PHP
+PHP
+PHP
+-- Iteration 12 --
+abcd
+abcd
+abcd
+-- Iteration 13 --
+abcd
+abcd
+abcd
+-- Iteration 14 --
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+*** Testing print_r() on boolean variables ***
+
+-- Iteration 1 --
+1
+1
+1
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+1
+1
+1
+-- Iteration 4 --
+
+
+bool(true)
+
+bool(true)
+
+*** Testing print_r() on array variables ***
+
+-- Iteration 1 --
+Array
+(
+)
+
+Array
+(
+)
+
+Array
+(
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+-- Iteration 8 --
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+-- Iteration 9 --
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+-- Iteration 10 --
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+-- Iteration 11 --
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+-- Iteration 12 --
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+-- Iteration 13 --
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+-- Iteration 14 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+-- Iteration 15 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+*** Testing print_r() on object variables ***
+
+-- Iteration 1 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 2 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 3 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 4 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 5 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 6 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 7 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 8 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 9 --
+
+
+
+** Testing print_r() on objects having circular reference **
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ *RECURSION*
+ )
+
+)
+
+*** Testing print_r() on resources ***
+
+-- Iteration 1 --
+Resource id #5
+Resource id #5
+Resource id #5
+-- Iteration 2 --
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
+
+-- Iteration 1 --
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+*** Testing print_r() on miscelleneous input arguments ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+*** Testing print_r() on anonymous functions ***
+New anonymous function:
+2 * 3 = 6
+
+*** Testing error conditions ***
+
+Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: value in %s on line %d
+string(0) ""
+Done
diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt
new file mode 100644
index 0000000..83b5165
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+proc_nice() basic behaviour
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+ function getNice($id)
+ {
+ $res = shell_exec('ps -p ' . $id .' -o "pid,nice"');
+ preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches);
+ if (count($matches) > 2)
+ return $matches[2];
+ else
+ return -1;
+ }
+ $delta = 10;
+ $pid = getmypid();
+ $niceBefore = getNice($pid);
+ proc_nice($delta);
+ $niceAfter = getNice($pid);
+ var_dump($niceBefore == ($niceAfter - $delta));
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/standard/tests/general_functions/proc_nice_error.phpt b/ext/standard/tests/general_functions/proc_nice_error.phpt
new file mode 100644
index 0000000..a05a182
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_error.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test function proc_nice() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$priority = 1;
+
+$extra_arg = 1;
+
+var_dump(proc_nice( $priority, $extra_arg) );
+
+var_dump(proc_nice( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: proc_nice() expects exactly 1 parameter, 2 given in %s line %d
+bool(false)
+
+Warning: proc_nice() expects exactly 1 parameter, 0 given in %s line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation1.phpt b/ext/standard/tests/general_functions/proc_nice_variation1.phpt
new file mode 100644
index 0000000..8c2bdf0
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with array values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation2.phpt b/ext/standard/tests/general_functions/proc_nice_variation2.phpt
new file mode 100644
index 0000000..42cbf9e
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with boolean values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation3.phpt b/ext/standard/tests/general_functions/proc_nice_variation3.phpt
new file mode 100644
index 0000000..46b4443
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation3.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with emptyUnsetUndefNull values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(true)
+bool(true)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation5.phpt b/ext/standard/tests/general_functions/proc_nice_variation5.phpt
new file mode 100644
index 0000000..c22ca56
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation5.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with int values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+ if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(true)
+bool(true)
+bool(true)
+
+Warning: proc_nice(): Only a super user may attempt to increase the priority of a process in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation6.phpt b/ext/standard/tests/general_functions/proc_nice_variation6.phpt
new file mode 100644
index 0000000..d52c0c0
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation6.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with object values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+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 classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+Error: 2 - proc_nice() expects parameter 1 to be long, object given, %s(%d)
+bool(false)
+Error: 2 - proc_nice() expects parameter 1 to be long, object given, %s(%d)
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation7.phpt b/ext/standard/tests/general_functions/proc_nice_variation7.phpt
new file mode 100644
index 0000000..26dbab5
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation7.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with string values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt
new file mode 100644
index 0000000..ecf8d8a
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_open.phpt
@@ -0,0 +1,28 @@
+--TEST--
+proc_open
+--SKIPIF--
+<?php # vim:syn=php
+if (!is_executable("/bin/cat")) echo "skip";
+if (!function_exists("proc_open")) echo "skip proc_open() is not available";
+?>
+--FILE--
+<?php
+$ds = array(
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w")
+ );
+
+$cat = proc_open(
+ "/bin/cat",
+ $ds,
+ $pipes
+ );
+
+proc_close($cat);
+
+echo "I didn't segfault!\n";
+
+?>
+--EXPECT--
+I didn't segfault!
diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt
new file mode 100644
index 0000000..d5d878e
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_open02.phpt
@@ -0,0 +1,72 @@
+--TEST--
+proc_open
+--SKIPIF--
+<?php
+if (!is_executable('/bin/sleep')) echo 'skip no sleep';
+if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
+?>
+--FILE--
+<?php
+$ds = array(array('pipe', 'r'));
+
+$cat = proc_open(
+ '/bin/sleep 2',
+ $ds,
+ $pipes
+);
+
+usleep(20000); // let the OS run the sleep process before sending the signal
+
+var_dump(proc_terminate($cat, 0)); // status check
+usleep(20000);
+var_dump(proc_get_status($cat));
+
+var_dump(proc_terminate($cat)); // now really quit it
+usleep(20000);
+var_dump(proc_get_status($cat));
+
+proc_close($cat);
+
+echo "Done!\n";
+
+?>
+--EXPECTF--
+bool(true)
+array(8) {
+ ["command"]=>
+ string(12) "/bin/sleep 2"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(true)
+ ["signaled"]=>
+ bool(false)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(0)
+ ["stopsig"]=>
+ int(0)
+}
+bool(true)
+array(8) {
+ ["command"]=>
+ string(12) "/bin/sleep 2"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(false)
+ ["signaled"]=>
+ bool(true)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(15)
+ ["stopsig"]=>
+ int(0)
+}
+Done!
diff --git a/ext/standard/tests/general_functions/putenv.phpt b/ext/standard/tests/general_functions/putenv.phpt
new file mode 100644
index 0000000..afe1bad
--- /dev/null
+++ b/ext/standard/tests/general_functions/putenv.phpt
@@ -0,0 +1,28 @@
+--TEST--
+putenv() basic tests
+--FILE--
+<?php
+
+$var_name="SUCHVARSHOULDNOTEXIST";
+
+var_dump(getenv($var_name));
+var_dump(putenv($var_name."=value"));
+var_dump(getenv($var_name));
+
+var_dump(putenv($var_name."="));
+var_dump(getenv($var_name));
+
+var_dump(putenv($var_name));
+var_dump(getenv($var_name));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+bool(true)
+string(5) "value"
+bool(true)
+string(0) ""
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt
new file mode 100644
index 0000000..e3ad8de
--- /dev/null
+++ b/ext/standard/tests/general_functions/rand.phpt
@@ -0,0 +1,63 @@
+--TEST--
+rand() and mt_rand() tests
+--FILE--
+<?php
+
+var_dump(mt_rand());
+var_dump(mt_rand(-1));
+var_dump(mt_rand(-1,1));
+var_dump(mt_rand(0,3));
+
+var_dump(rand());
+var_dump(rand(-1));
+var_dump(rand(-1,1));
+var_dump(rand(0,3));
+
+var_dump(srand());
+var_dump(srand(-1));
+var_dump(srand(array()));
+
+var_dump(mt_srand());
+var_dump(mt_srand(-1));
+var_dump(mt_srand(array()));
+
+var_dump(getrandmax());
+var_dump(getrandmax(1));
+
+var_dump(mt_getrandmax());
+var_dump(mt_getrandmax(1));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+
+Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+int(%i)
+int(%d)
+int(%d)
+
+Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+int(%i)
+int(%d)
+NULL
+NULL
+
+Warning: srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+NULL
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+int(%d)
+
+Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+int(%d)
+
+Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt b/ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt
new file mode 100644
index 0000000..ad786fb
--- /dev/null
+++ b/ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test set_magic_quotes_runtime() function - basic test
+--INI--
+magic_quotes_runtime = 0
+--FILE--
+<?php
+/* Prototype: bool set_magic_quotes_runtime ( int $new_setting )
+ * Description: Sets the current active configuration setting of magic_quotes_runtime
+*/
+
+echo "Simple testcase for set_magic_quotes_runtime() function - basic test\n";
+
+$g = get_magic_quotes_runtime();
+echo "\n-- magic quotes runtime set in INI file: " . $g . "--\n";
+
+echo "\n-- Set magic quotes runtime to 0: --\n";
+var_dump(set_magic_quotes_runtime(0));
+$g = get_magic_quotes_runtime();
+echo "\n-- magic quotes runtime after set: " . $g . " --\n";
+
+echo "\n-- Set magic quotes runtime to 1: --\n";
+var_dump(set_magic_quotes_runtime(1));
+$g = get_magic_quotes_runtime();
+echo "\n-- magic quotes runtime after set: " . $g . " --\n";
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for set_magic_quotes_runtime() function - basic test
+
+-- magic quotes runtime set in INI file: --
+
+-- Set magic quotes runtime to 0: --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+bool(false)
+
+-- magic quotes runtime after set: --
+
+-- Set magic quotes runtime to 1: --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+
+Fatal error: set_magic_quotes_runtime(): magic_quotes_runtime is not supported anymore in Unknown on line 0
+
+
diff --git a/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt b/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt
new file mode 100644
index 0000000..c54846c
--- /dev/null
+++ b/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test set_magic_quotes_runtime() function - error conditions - pass function incorrect arguments
+--FILE--
+<?php
+/* Prototype: bool set_magic_quotes_runtime ( int $new_setting )
+ * Description: Sets the current active configuration setting of magic_quotes_runtime
+*/
+
+echo "Simple testcase for set_magic_quotes_runtime() - error test\n";
+
+//Note: No error msgs on invalid input; just a return value of FALSE
+
+echo "\n-- Testing set_magic_quotes_runtime() function with less than expected no. of arguments --\n";
+var_dump(set_magic_quotes_runtime());
+
+echo "\n-- Testing set_magic_quotes_runtime() function with more than expected no. of arguments --\n";
+var_dump(set_magic_quotes_runtime(1, true));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for set_magic_quotes_runtime() - error test
+
+-- Testing set_magic_quotes_runtime() function with less than expected no. of arguments --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+
+Warning: set_magic_quotes_runtime() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing set_magic_quotes_runtime() function with more than expected no. of arguments --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+
+Warning: set_magic_quotes_runtime() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt
new file mode 100644
index 0000000..5d7fe53
--- /dev/null
+++ b/ext/standard/tests/general_functions/sleep_basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sleep() function : basic functionality
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--FILE--
+<?php
+/* Prototype : int sleep ( int $seconds )
+ * Description: Delays the program execution for the given number of seconds .
+ * Source code: ext/standard/basic_functions.c
+ */
+
+echo "*** Testing sleep() : basic functionality ***\n";
+
+$sleeptime = 5; // sleep for 5 seconds
+
+set_time_limit(20);
+
+$time_start = microtime(true);
+
+// Sleep for a while
+sleep($sleeptime);
+
+// Test passes if sleeps for at least 98% of specified time
+$sleeplow = $sleeptime - ($sleeptime * 2 /100);
+
+$time_end = microtime(true);
+$time = $time_end - $time_start;
+
+echo "Thread slept for " . $time . " seconds\n";
+
+if ($time >= $sleeplow) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing sleep() : basic functionality ***
+Thread slept for %f seconds
+TEST PASSED
+===DONE===
diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt
new file mode 100644
index 0000000..199bd8e
--- /dev/null
+++ b/ext/standard/tests/general_functions/sleep_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sleep() function : error conditions
+--FILE--
+<?php
+/* Prototype : int sleep ( int $seconds )
+ * Description: Delays the program execution for the given number of seconds .
+ * Source code: ext/standard/basic_functions.c
+ */
+ set_time_limit(20);
+
+echo "*** Testing sleep() : error conditions ***\n";
+
+echo "\n-- Testing sleep() function with zero arguments --\n";
+var_dump( sleep() );
+
+echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
+$seconds = 10;
+$extra_arg = 10;
+var_dump( sleep($seconds, $extra_arg) );
+
+echo "\n-- Testing sleep() function with negative interval --\n";
+$seconds = -10;
+var_dump( sleep($seconds) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sleep() : error conditions ***
+
+-- Testing sleep() function with zero arguments --
+
+Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing sleep() function with more than expected no. of arguments --
+
+Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing sleep() function with negative interval --
+
+Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt
new file mode 100644
index 0000000..b92be41
--- /dev/null
+++ b/ext/standard/tests/general_functions/strval.phpt
@@ -0,0 +1,317 @@
+--TEST--
+Test strval() function
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string strval ( mixed $var );
+ * Description: Returns the string value of var
+ */
+
+echo "*** Testing str_val() with scalar values***\n";
+$heredoc_string = <<<EOD
+This is a multiline heredoc
+string. Numeric = 1232455.
+EOD;
+/* heredoc string with only numeric values */
+$heredoc_numeric_string = <<<EOD
+12345
+2345
+EOD;
+/* null heredoc string */
+$heredoc_empty_string = <<<EOD
+EOD;
+/* heredoc string with NULL */
+$heredoc_NULL_string = <<<EOD
+NULL
+EOD;
+
+// different valid scalar vlaues
+$scalars = array(
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+
+ /* floats */
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e-5,
+ .5e+7,
+ .6e-19,
+ .05E+44,
+ .0034E-30,
+
+ /* booleans */
+ true,
+ TRUE,
+ FALSE,
+ false,
+
+ /* strings */
+ "",
+ '',
+ " ",
+ ' ',
+ '0',
+ "0",
+ "testing",
+ "0x564",
+ "0123",
+ "new\n",
+ 'new\n',
+ "@#$$%^&&*()",
+ " ",
+ "null",
+ 'null',
+ 'true',
+ "true",
+ /*"\0123",
+ "\0x12FF",*/
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string
+);
+/* loop to check that strval() recognizes different
+ scalar values and retuns the string conversion of same */
+$loop_counter = 1;
+foreach ($scalars as $scalar ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( strval($scalar) );
+}
+
+echo "\n*** Testing strval() with non_scalar values ***\n";
+// get a resource type variable
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+
+$not_scalars = array (
+ new foo, //object
+ $fp, // resource
+ $dfp,
+ array(), // arrays
+ array(NULL),
+ array(1,2,3,4),
+ array("string"),
+ NULL, // nulls
+ null,
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_scalars to see working of
+ strval() on objects, arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_scalars as $value ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( strval($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( strval() );
+
+//arguments more than expected
+var_dump( strval( $scalars[0], $scalars[1]) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing str_val() with scalar values***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(2) "-1"
+-- Iteration 4 --
+string(11) "-2147483648"
+-- Iteration 5 --
+string(11) "-2147483647"
+-- Iteration 6 --
+string(10) "2147483647"
+-- Iteration 7 --
+string(10) "2147483640"
+-- Iteration 8 --
+string(4) "4667"
+-- Iteration 9 --
+string(4) "4779"
+-- Iteration 10 --
+string(4) "4095"
+-- Iteration 11 --
+string(3) "250"
+-- Iteration 12 --
+string(11) "-2147483648"
+-- Iteration 13 --
+string(10) "2147483647"
+-- Iteration 14 --
+string(10) "2147483647"
+-- Iteration 15 --
+string(2) "83"
+-- Iteration 16 --
+string(1) "1"
+-- Iteration 17 --
+string(11) "-2147483648"
+-- Iteration 18 --
+string(10) "2147483647"
+-- Iteration 19 --
+string(11) "-2147483649"
+-- Iteration 20 --
+string(10) "2147483648"
+-- Iteration 21 --
+string(11) "-2147483649"
+-- Iteration 22 --
+string(11) "34359738369"
+-- Iteration 23 --
+string(10) "2147483649"
+-- Iteration 24 --
+string(11) "-2147483649"
+-- Iteration 25 --
+string(1) "0"
+-- Iteration 26 --
+string(4) "-0.1"
+-- Iteration 27 --
+string(2) "10"
+-- Iteration 28 --
+string(7) "1050000"
+-- Iteration 29 --
+string(6) "1.0E-5"
+-- Iteration 30 --
+string(7) "5000000"
+-- Iteration 31 --
+string(7) "6.0E-20"
+-- Iteration 32 --
+string(7) "5.0E+42"
+-- Iteration 33 --
+string(7) "3.4E-33"
+-- Iteration 34 --
+string(1) "1"
+-- Iteration 35 --
+string(1) "1"
+-- Iteration 36 --
+string(0) ""
+-- Iteration 37 --
+string(0) ""
+-- Iteration 38 --
+string(0) ""
+-- Iteration 39 --
+string(0) ""
+-- Iteration 40 --
+string(1) " "
+-- Iteration 41 --
+string(1) " "
+-- Iteration 42 --
+string(1) "0"
+-- Iteration 43 --
+string(1) "0"
+-- Iteration 44 --
+string(7) "testing"
+-- Iteration 45 --
+string(5) "0x564"
+-- Iteration 46 --
+string(4) "0123"
+-- Iteration 47 --
+string(4) "new
+"
+-- Iteration 48 --
+string(5) "new\n"
+-- Iteration 49 --
+string(11) "@#$$%^&&*()"
+-- Iteration 50 --
+string(8) " "
+-- Iteration 51 --
+string(4) "null"
+-- Iteration 52 --
+string(4) "null"
+-- Iteration 53 --
+string(4) "true"
+-- Iteration 54 --
+string(4) "true"
+-- Iteration 55 --
+string(5%d) "This is a multiline heredoc
+string. Numeric = 1232455."
+-- Iteration 56 --
+string(1%d) "12345
+2345"
+-- Iteration 57 --
+string(0) ""
+
+*** Testing strval() with non_scalar values ***
+-- Iteration 1 --
+string(6) "Object"
+-- Iteration 2 --
+string(14) "Resource id #5"
+-- Iteration 3 --
+string(14) "Resource id #6"
+-- Iteration 4 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 5 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 6 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 8 --
+string(0) ""
+-- Iteration 9 --
+string(0) ""
+-- Iteration 10 --
+string(0) ""
+-- Iteration 11 --
+string(0) ""
+
+*** Testing error conditions ***
+
+Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt
new file mode 100644
index 0000000..a788e32
--- /dev/null
+++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt
@@ -0,0 +1,27 @@
+--TEST--
+sys_getloadavg() tests
+--SKIPIF--
+<?php
+if (!function_exists("sys_getloadavg")) die("skip");
+?>
+--FILE--
+<?php
+
+var_dump(sys_getloadavg(""));
+var_dump(sys_getloadavg());
+
+echo "Done\n";
+?>
+--EXPECTF--
+
+Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s
+NULL
+array(3) {
+ [0]=>
+ float(%f)
+ [1]=>
+ float(%f)
+ [2]=>
+ float(%f)
+}
+Done
diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt
new file mode 100644
index 0000000..98eccbb
--- /dev/null
+++ b/ext/standard/tests/general_functions/type.phpt
@@ -0,0 +1,351 @@
+--TEST--
+gettype(), settype() and friends
+--FILE--
+<?php
+
+function foo($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
+}
+
+set_error_handler("foo");
+
+$fp = fopen(__FILE__, "r");
+fclose($fp);
+$fp1 = fopen(__FILE__, "r");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+$array = array(
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ 2.0,
+ NULL,
+ false,
+ "some string",
+ $fp,
+ $fp1,
+ new stdclass,
+);
+
+$types = array(
+ "null",
+ "integer",
+ "double",
+ "boolean",
+ "resource",
+ "array",
+ "object",
+ "string"
+ );
+
+foreach ($array as $var) {
+ var_dump(gettype($var));
+}
+
+foreach ($types as $type) {
+ foreach ($array as $var) {
+ var_dump(settype($var, $type));
+ var_dump($var);
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+string(6) "string"
+string(5) "array"
+string(7) "integer"
+string(6) "double"
+string(4) "NULL"
+string(7) "boolean"
+string(6) "string"
+string(12) "unknown type"
+string(8) "resource"
+string(6) "object"
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+int(1)
+bool(true)
+int(0)
+bool(true)
+int(1)
+bool(true)
+int(1)
+bool(true)
+int(2)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(5)
+bool(true)
+int(6)
+string(54) "Object of class stdClass could not be converted to int"
+bool(true)
+int(%d)
+bool(true)
+float(1)
+bool(true)
+float(0)
+bool(true)
+float(1)
+bool(true)
+float(1)
+bool(true)
+float(2)
+bool(true)
+float(0)
+bool(true)
+float(0)
+bool(true)
+float(0)
+bool(true)
+float(5)
+bool(true)
+float(6)
+string(57) "Object of class stdClass could not be converted to double"
+bool(true)
+float(%d)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+string(14) "another string"
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+int(1)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+float(2)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+NULL
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+bool(false)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+string(11) "some string"
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+resource(%d) of type (Unknown)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+resource(%d) of type (stream)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+object(stdClass)#%d (0) {
+}
+bool(true)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(14) "another string"
+}
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ float(2)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "some string"
+}
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (Unknown)
+}
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+object(stdClass)#%d (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ string(14) "another string"
+}
+bool(true)
+object(stdClass)#%d (3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ int(1)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ float(2)
+}
+bool(true)
+object(stdClass)#%d (0) {
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ bool(false)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ string(11) "some string"
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ resource(%d) of type (Unknown)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ resource(%d) of type (stream)
+}
+bool(true)
+object(stdClass)#%d (0) {
+}
+string(26) "Array to string conversion"
+bool(true)
+string(5) "Array"
+bool(true)
+string(14) "another string"
+string(26) "Array to string conversion"
+bool(true)
+string(5) "Array"
+bool(true)
+string(1) "1"
+bool(true)
+string(1) "2"
+bool(true)
+string(0) ""
+bool(true)
+string(0) ""
+bool(true)
+string(11) "some string"
+bool(true)
+string(14) "Resource id #%d"
+bool(true)
+string(14) "Resource id #%d"
+string(57) "Object of class stdClass could not be converted to string"
+string(45) "Object of class stdClass to string conversion"
+bool(true)
+string(6) "Object"
+Done
diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt
new file mode 100644
index 0000000..2da832b
--- /dev/null
+++ b/ext/standard/tests/general_functions/uniqid_basic.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test uniqid() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : basic functionality ***\n";
+
+echo "\nuniqid() without a prefix\n";
+var_dump(uniqid());
+var_dump(uniqid(null, true));
+var_dump(uniqid(null, false));
+echo "\n\n";
+
+echo "uniqid() with a prefix\n";
+
+// Use a fixed prefix so we can ensure length of o/p id is fixed
+$prefix = array (
+ 99999,
+ "99999",
+ 10.5e2,
+ null,
+ true,
+ false
+ );
+
+for ($i = 0; $i < count($prefix); $i++) {
+ var_dump(uniqid($prefix[$i]));
+ var_dump(uniqid($prefix[$i], true));
+ var_dump(uniqid($prefix[$i], false));
+ echo "\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uniqid() : basic functionality ***
+
+uniqid() without a prefix
+string(13) "%s"
+string(23) "%s.%s"
+string(13) "%s"
+
+
+uniqid() with a prefix
+string(18) "99999%s"
+string(28) "99999%s.%s"
+string(18) "99999%s"
+
+string(18) "99999%s"
+string(28) "99999%s.%s"
+string(18) "99999%s"
+
+string(17) "1050%s"
+string(27) "1050%s.%s"
+string(17) "1050%s"
+
+string(13) "%s"
+string(23) "%s.%s"
+string(13) "%s"
+
+string(14) "1%s"
+string(24) "1%s.%s"
+string(14) "1%s"
+
+string(13) "%s"
+string(23) "%s.%s"
+string(13) "%s"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/uniqid_error.phpt b/ext/standard/tests/general_functions/uniqid_error.phpt
new file mode 100644
index 0000000..9608431
--- /dev/null
+++ b/ext/standard/tests/general_functions/uniqid_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test uniqid() function : error conditions
+--FILE--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : error conditions ***\n";
+
+echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
+$prefix = null;
+$more_entropy = false;
+$extra_arg = false;
+var_dump(uniqid($prefix, $more_entropy, $extra_arg));
+
+echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
+class class1{}
+$obj = new class1();
+$res = fopen(__FILE__, "r");
+$array = array(1,2,3);
+
+uniqid($array, false);
+uniqid($res, false);
+uniqid($obj, false);
+
+fclose($res);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uniqid() : error conditions ***
+
+-- Testing uniqid() function with more than expected no. of arguments --
+
+Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing uniqid() function with invalid values for $prefix --
+
+Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt
new file mode 100644
index 0000000..d6f312e
--- /dev/null
+++ b/ext/standard/tests/general_functions/usleep_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test usleep() function
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--FILE--
+<?php
+/* Prototype : void usleep ( int $micro_seconds )
+ * Description: Delays program execution for the given number of micro seconds.
+ * Source code: ext/standard/basic_functions.c
+ */
+
+set_time_limit(20);
+
+echo "*** Testing usleep() : basic functionality ***\n";
+
+$sleeptime = 5000000; // == 5 seconds
+// Test passes if sleeps for at least 98% of specified time
+$sleeplow = $sleeptime - ($sleeptime * 2 /100);
+
+$time_start = microtime(true);
+
+// Sleep for a while
+usleep($sleeptime);
+
+$time_end = microtime(true);
+$time = ($time_end - $time_start) * 1000 * 1000;
+
+echo "Thread slept for " . $time . " micro-seconds\n";
+
+if ($time >= $sleeplow) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing usleep() : basic functionality ***
+Thread slept for %f micro-seconds
+TEST PASSED
+===DONE===
diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt
new file mode 100644
index 0000000..bdd120c
--- /dev/null
+++ b/ext/standard/tests/general_functions/usleep_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test usleep() function : error conditions
+--FILE--
+<?php
+/* Prototype : void usleep ( int $micro_seconds )
+ * Description: Delays program execution for the given number of micro seconds.
+ * Source code: ext/standard/basic_functions.c
+ */
+
+set_time_limit(20);
+
+echo "*** Testing usleep() : error conditions ***\n";
+
+echo "\n-- Testing usleep() function with zero arguments --\n";
+var_dump( usleep() );
+
+echo "\n-- Testing usleep() function with more than expected no. of arguments --\n";
+$seconds = 10;
+$extra_arg = 10;
+var_dump( usleep($seconds, $extra_arg) );
+
+echo "\n-- Testing usleep() function with negative interval --\n";
+$seconds = -10;
+var_dump( usleep($seconds) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing usleep() : error conditions ***
+
+-- Testing usleep() function with zero arguments --
+
+Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing usleep() function with more than expected no. of arguments --
+
+Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing usleep() function with negative interval --
+
+Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt
new file mode 100644
index 0000000..09e9f3b
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_dump.phpt
@@ -0,0 +1,1574 @@
+--TEST--
+Test var_dump() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: void var_dump ( mixed $expression [, mixed $expression [, $...]] );
+ Description: Displays structured information about one or more expressions that includes its type and value.
+*/
+
+/* Prototype: void check_vardump( $variables );
+ Description: use var_dump() to display the variables */
+function check_vardump( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "-- Iteration $counter --\n";
+ var_dump($variable);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing var_dump() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_vardump() to display contents of integer variables
+ using var_dump() */
+check_vardump($integers);
+
+echo "\n*** Testing var_dump() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_vardump() to display contents of float variables
+ using var_dump() */
+check_vardump($floats);
+
+echo "\n*** Testing var_dump() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_vardump() to display contents of strings
+ using var_dump() */
+check_vardump($strings);
+
+echo "\n*** Testing var_dump() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_vardump() to display boolean variables
+ using var_dump() */
+check_vardump($booleans);
+
+echo "\n*** Testing var_dump() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_vardump() to display contents of an array
+ using var_dump() */
+check_vardump($arrays);
+
+echo "\n*** Testing var_dump() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_vardump() to display contents of the objects
+ using var_dump() */
+check_vardump($objects);
+
+echo "\n** Testing var_dump() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+var_dump($recursion_obj2);
+
+echo "\n*** Testing var_dump() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_vardump() to display the resource content type
+ using var_dump() */
+check_vardump($resources);
+
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_vardump() to display combinations of scalar and
+ non-scalar variables using var_dump() */
+check_vardump($variations);
+
+echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_vardump() to display miscelleneous data using var_dump() */
+check_vardump($misc_values);
+
+echo "\n*** Testing var_dump() on multiple arguments ***\n";
+var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
+ $objects, $misc_values, $variations );
+
+/* checking var_dump() on functions */
+echo "\n*** Testing var_dump() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+var_dump( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump();
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing var_dump() on integer variables ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(83)
+-- Iteration 3 --
+int(123000000)
+-- Iteration 4 --
+int(-83)
+-- Iteration 5 --
+int(-12300000)
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+}
+-- Iteration 8 --
+int(2147483647)
+-- Iteration 9 --
+float(2147483648)
+-- Iteration 10 --
+float(-2147483648)
+-- Iteration 11 --
+int(-2147483647)
+-- Iteration 12 --
+int(2147483647)
+-- Iteration 13 --
+float(-2147483648)
+-- Iteration 14 --
+int(2147483647)
+-- Iteration 15 --
+float(-2147483648)
+
+*** Testing var_dump() on float variables ***
+-- Iteration 1 --
+float(0)
+-- Iteration 2 --
+float(0)
+-- Iteration 3 --
+float(1.234)
+-- Iteration 4 --
+float(-1.234)
+-- Iteration 5 --
+float(-2)
+-- Iteration 6 --
+float(2)
+-- Iteration 7 --
+float(-0.5)
+-- Iteration 8 --
+float(0.567)
+-- Iteration 9 --
+float(-0.00067)
+-- Iteration 10 --
+float(-670)
+-- Iteration 11 --
+float(670)
+-- Iteration 12 --
+float(670)
+-- Iteration 13 --
+float(-0.00410003)
+-- Iteration 14 --
+float(-4100.03)
+-- Iteration 15 --
+float(0.004100003)
+-- Iteration 16 --
+float(4100.003)
+-- Iteration 17 --
+float(100000)
+-- Iteration 18 --
+float(-100000)
+-- Iteration 19 --
+float(1.0E-5)
+-- Iteration 20 --
+float(-1.0E-5)
+-- Iteration 21 --
+float(100000)
+-- Iteration 22 --
+float(-100000)
+-- Iteration 23 --
+float(100000)
+-- Iteration 24 --
+float(-100000)
+-- Iteration 25 --
+float(100000)
+-- Iteration 26 --
+float(-100000)
+-- Iteration 27 --
+float(1.0E-5)
+-- Iteration 28 --
+float(-1.0E-5)
+-- Iteration 29 --
+float(-2147483649)
+-- Iteration 30 --
+float(2147483649)
+-- Iteration 31 --
+float(2147483649)
+-- Iteration 32 --
+float(-2147483649)
+
+*** Testing var_dump() on string variables ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(1) " "
+-- Iteration 4 --
+string(1) " "
+-- Iteration 5 --
+string(1) "0"
+-- Iteration 6 --
+string(1) "
+-- Iteration 7 --
+string(2) "\0"
+-- Iteration 8 --
+string(1) " "
+-- Iteration 9 --
+string(2) "\t"
+-- Iteration 10 --
+string(3) "PHP"
+-- Iteration 11 --
+string(3) "PHP"
+-- Iteration 12 --
+string(29) "abcd
+-- Iteration 13 --
+string(34) "abcd
+-- Iteration 14 --
+string(22) "1234
+5678
+ 9100 abcda"
+
+*** Testing var_dump() on boolean variables ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+
+*** Testing var_dump() on array variables ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+-- Iteration 9 --
+array(1) {
+ [1]=>
+ string(3) "One"
+}
+-- Iteration 10 --
+array(1) {
+ ["test"]=>
+ string(8) "is_array"
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ int(-1)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+
+*** Testing var_dump() on object variables ***
+-- Iteration 1 --
+object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 2 --
+object(no_member_class)#7 (0) {
+}
+-- Iteration 3 --
+object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 4 --
+object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 5 --
+object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 6 --
+object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 7 --
+object(no_member_class)#4 (0) {
+}
+-- Iteration 8 --
+object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 9 --
+NULL
+
+** Testing var_dump() on objects having circular reference **
+object(object_class)#13 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#12 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ *RECURSION*
+ }
+}
+
+*** Testing var_dump() on resources ***
+-- Iteration 1 --
+resource(5) of type (stream)
+-- Iteration 2 --
+resource(6) of type (stream)
+
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+}
+
+*** Testing var_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL
+-- Iteration 2 --
+NULL
+-- Iteration 3 --
+NULL
+-- Iteration 4 --
+NULL
+
+*** Testing var_dump() on multiple arguments ***
+array(15) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(83)
+ [2]=>
+ int(123000000)
+ [3]=>
+ int(-83)
+ [4]=>
+ int(-12300000)
+ [5]=>
+ array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+ }
+ [6]=>
+ array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+ }
+ [7]=>
+ int(2147483647)
+ [8]=>
+ float(2147483648)
+ [9]=>
+ float(-2147483648)
+ [10]=>
+ int(-2147483647)
+ [11]=>
+ int(2147483647)
+ [12]=>
+ float(-2147483648)
+ [13]=>
+ int(2147483647)
+ [14]=>
+ float(-2147483648)
+}
+array(32) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(0)
+ [2]=>
+ float(1.234)
+ [3]=>
+ float(-1.234)
+ [4]=>
+ float(-2)
+ [5]=>
+ float(2)
+ [6]=>
+ float(-0.5)
+ [7]=>
+ float(0.567)
+ [8]=>
+ float(-0.00067)
+ [9]=>
+ float(-670)
+ [10]=>
+ float(670)
+ [11]=>
+ float(670)
+ [12]=>
+ float(-0.00410003)
+ [13]=>
+ float(-4100.03)
+ [14]=>
+ float(0.004100003)
+ [15]=>
+ float(4100.003)
+ [16]=>
+ float(100000)
+ [17]=>
+ float(-100000)
+ [18]=>
+ float(1.0E-5)
+ [19]=>
+ float(-1.0E-5)
+ [20]=>
+ float(100000)
+ [21]=>
+ float(-100000)
+ [22]=>
+ float(100000)
+ [23]=>
+ float(-100000)
+ [24]=>
+ float(100000)
+ [25]=>
+ float(-100000)
+ [26]=>
+ float(1.0E-5)
+ [27]=>
+ float(-1.0E-5)
+ [28]=>
+ float(-2147483649)
+ [29]=>
+ float(2147483649)
+ [30]=>
+ float(2147483649)
+ [31]=>
+ float(-2147483649)
+}
+array(14) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(1) "
+ [6]=>
+ string(2) "\0"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(3) "PHP"
+ [10]=>
+ string(3) "PHP"
+ [11]=>
+ string(29) "abcd
+ [12]=>
+ string(34) "abcd
+ [13]=>
+ string(22) "1234
+5678
+ 9100 abcda"
+}
+array(15) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ bool(true)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [5]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [6]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ }
+ [7]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ }
+ [8]=>
+ array(1) {
+ [1]=>
+ string(3) "One"
+ }
+ [9]=>
+ array(1) {
+ ["test"]=>
+ string(8) "is_array"
+ }
+ [10]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [11]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [12]=>
+ array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+ }
+ [13]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+ [14]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(2) {
+ [0]=>
+ resource(5) of type (stream)
+ [1]=>
+ resource(6) of type (stream)
+}
+array(9) {
+ [0]=>
+ object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [1]=>
+ object(no_member_class)#7 (0) {
+ }
+ [2]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [3]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [4]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [5]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [6]=>
+ object(no_member_class)#4 (0) {
+ }
+ [7]=>
+ object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [8]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+ }
+ [3]=>
+ array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+ }
+ [4]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+ }
+ [5]=>
+ array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+ }
+}
+
+*** Testing var_dump() on anonymous functions ***
+New anonymous function:
+string(9) "2 * 3 = 6"
+string(9) "
+
+*** Testing error conditions ***
+
+Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
+Done
+
diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt
new file mode 100644
index 0000000..a81980c
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt
@@ -0,0 +1,1574 @@
+--TEST--
+Test var_dump() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: void var_dump ( mixed $expression [, mixed $expression [, $...]] );
+ Description: Displays structured information about one or more expressions that includes its type and value.
+*/
+
+/* Prototype: void check_vardump( $variables );
+ Description: use var_dump() to display the variables */
+function check_vardump( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "-- Iteration $counter --\n";
+ var_dump($variable);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing var_dump() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_vardump() to display contents of integer variables
+ using var_dump() */
+check_vardump($integers);
+
+echo "\n*** Testing var_dump() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_vardump() to display contents of float variables
+ using var_dump() */
+check_vardump($floats);
+
+echo "\n*** Testing var_dump() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_vardump() to display contents of strings
+ using var_dump() */
+check_vardump($strings);
+
+echo "\n*** Testing var_dump() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_vardump() to display boolean variables
+ using var_dump() */
+check_vardump($booleans);
+
+echo "\n*** Testing var_dump() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_vardump() to display contents of an array
+ using var_dump() */
+check_vardump($arrays);
+
+echo "\n*** Testing var_dump() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_vardump() to display contents of the objects
+ using var_dump() */
+check_vardump($objects);
+
+echo "\n** Testing var_dump() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+var_dump($recursion_obj2);
+
+echo "\n*** Testing var_dump() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_vardump() to display the resource content type
+ using var_dump() */
+check_vardump($resources);
+
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_vardump() to display combinations of scalar and
+ non-scalar variables using var_dump() */
+check_vardump($variations);
+
+echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_vardump() to display miscelleneous data using var_dump() */
+check_vardump($misc_values);
+
+echo "\n*** Testing var_dump() on multiple arguments ***\n";
+var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
+ $objects, $misc_values, $variations );
+
+/* checking var_dump() on functions */
+echo "\n*** Testing var_dump() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+var_dump( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump();
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing var_dump() on integer variables ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(83)
+-- Iteration 3 --
+int(123000000)
+-- Iteration 4 --
+int(-83)
+-- Iteration 5 --
+int(-12300000)
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+}
+-- Iteration 8 --
+int(2147483647)
+-- Iteration 9 --
+int(2147483648)
+-- Iteration 10 --
+int(-2147483648)
+-- Iteration 11 --
+int(-2147483647)
+-- Iteration 12 --
+int(2147483647)
+-- Iteration 13 --
+int(-2147483648)
+-- Iteration 14 --
+int(2147483647)
+-- Iteration 15 --
+int(-2147483648)
+
+*** Testing var_dump() on float variables ***
+-- Iteration 1 --
+float(0)
+-- Iteration 2 --
+float(0)
+-- Iteration 3 --
+float(1.234)
+-- Iteration 4 --
+float(-1.234)
+-- Iteration 5 --
+float(-2)
+-- Iteration 6 --
+float(2)
+-- Iteration 7 --
+float(-0.5)
+-- Iteration 8 --
+float(0.567)
+-- Iteration 9 --
+float(-0.00067)
+-- Iteration 10 --
+float(-670)
+-- Iteration 11 --
+float(670)
+-- Iteration 12 --
+float(670)
+-- Iteration 13 --
+float(-0.00410003)
+-- Iteration 14 --
+float(-4100.03)
+-- Iteration 15 --
+float(0.004100003)
+-- Iteration 16 --
+float(4100.003)
+-- Iteration 17 --
+float(100000)
+-- Iteration 18 --
+float(-100000)
+-- Iteration 19 --
+float(1.0E-5)
+-- Iteration 20 --
+float(-1.0E-5)
+-- Iteration 21 --
+float(100000)
+-- Iteration 22 --
+float(-100000)
+-- Iteration 23 --
+float(100000)
+-- Iteration 24 --
+float(-100000)
+-- Iteration 25 --
+float(100000)
+-- Iteration 26 --
+float(-100000)
+-- Iteration 27 --
+float(1.0E-5)
+-- Iteration 28 --
+float(-1.0E-5)
+-- Iteration 29 --
+int(-2147483649)
+-- Iteration 30 --
+int(2147483649)
+-- Iteration 31 --
+int(2147483649)
+-- Iteration 32 --
+int(-2147483649)
+
+*** Testing var_dump() on string variables ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(1) " "
+-- Iteration 4 --
+string(1) " "
+-- Iteration 5 --
+string(1) "0"
+-- Iteration 6 --
+string(1) "
+-- Iteration 7 --
+string(2) "\0"
+-- Iteration 8 --
+string(1) " "
+-- Iteration 9 --
+string(2) "\t"
+-- Iteration 10 --
+string(3) "PHP"
+-- Iteration 11 --
+string(3) "PHP"
+-- Iteration 12 --
+string(29) "abcd
+-- Iteration 13 --
+string(34) "abcd
+-- Iteration 14 --
+string(22) "1234
+5678
+ 9100 abcda"
+
+*** Testing var_dump() on boolean variables ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+
+*** Testing var_dump() on array variables ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+-- Iteration 9 --
+array(1) {
+ [1]=>
+ string(3) "One"
+}
+-- Iteration 10 --
+array(1) {
+ ["test"]=>
+ string(8) "is_array"
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ int(-1)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+
+*** Testing var_dump() on object variables ***
+-- Iteration 1 --
+object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 2 --
+object(no_member_class)#7 (0) {
+}
+-- Iteration 3 --
+object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 4 --
+object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 5 --
+object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 6 --
+object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 7 --
+object(no_member_class)#4 (0) {
+}
+-- Iteration 8 --
+object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 9 --
+NULL
+
+** Testing var_dump() on objects having circular reference **
+object(object_class)#13 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#12 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ *RECURSION*
+ }
+}
+
+*** Testing var_dump() on resources ***
+-- Iteration 1 --
+resource(5) of type (stream)
+-- Iteration 2 --
+resource(6) of type (stream)
+
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+}
+
+*** Testing var_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL
+-- Iteration 2 --
+NULL
+-- Iteration 3 --
+NULL
+-- Iteration 4 --
+NULL
+
+*** Testing var_dump() on multiple arguments ***
+array(15) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(83)
+ [2]=>
+ int(123000000)
+ [3]=>
+ int(-83)
+ [4]=>
+ int(-12300000)
+ [5]=>
+ array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+ }
+ [6]=>
+ array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+ }
+ [7]=>
+ int(2147483647)
+ [8]=>
+ int(2147483648)
+ [9]=>
+ int(-2147483648)
+ [10]=>
+ int(-2147483647)
+ [11]=>
+ int(2147483647)
+ [12]=>
+ int(-2147483648)
+ [13]=>
+ int(2147483647)
+ [14]=>
+ int(-2147483648)
+}
+array(32) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(0)
+ [2]=>
+ float(1.234)
+ [3]=>
+ float(-1.234)
+ [4]=>
+ float(-2)
+ [5]=>
+ float(2)
+ [6]=>
+ float(-0.5)
+ [7]=>
+ float(0.567)
+ [8]=>
+ float(-0.00067)
+ [9]=>
+ float(-670)
+ [10]=>
+ float(670)
+ [11]=>
+ float(670)
+ [12]=>
+ float(-0.00410003)
+ [13]=>
+ float(-4100.03)
+ [14]=>
+ float(0.004100003)
+ [15]=>
+ float(4100.003)
+ [16]=>
+ float(100000)
+ [17]=>
+ float(-100000)
+ [18]=>
+ float(1.0E-5)
+ [19]=>
+ float(-1.0E-5)
+ [20]=>
+ float(100000)
+ [21]=>
+ float(-100000)
+ [22]=>
+ float(100000)
+ [23]=>
+ float(-100000)
+ [24]=>
+ float(100000)
+ [25]=>
+ float(-100000)
+ [26]=>
+ float(1.0E-5)
+ [27]=>
+ float(-1.0E-5)
+ [28]=>
+ int(-2147483649)
+ [29]=>
+ int(2147483649)
+ [30]=>
+ int(2147483649)
+ [31]=>
+ int(-2147483649)
+}
+array(14) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(1) "
+ [6]=>
+ string(2) "\0"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(3) "PHP"
+ [10]=>
+ string(3) "PHP"
+ [11]=>
+ string(29) "abcd
+ [12]=>
+ string(34) "abcd
+ [13]=>
+ string(22) "1234
+5678
+ 9100 abcda"
+}
+array(15) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ bool(true)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [5]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [6]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ }
+ [7]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ }
+ [8]=>
+ array(1) {
+ [1]=>
+ string(3) "One"
+ }
+ [9]=>
+ array(1) {
+ ["test"]=>
+ string(8) "is_array"
+ }
+ [10]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [11]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [12]=>
+ array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+ }
+ [13]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+ [14]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(2) {
+ [0]=>
+ resource(5) of type (stream)
+ [1]=>
+ resource(6) of type (stream)
+}
+array(9) {
+ [0]=>
+ object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [1]=>
+ object(no_member_class)#7 (0) {
+ }
+ [2]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [3]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [4]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [5]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [6]=>
+ object(no_member_class)#4 (0) {
+ }
+ [7]=>
+ object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [8]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+ }
+ [3]=>
+ array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+ }
+ [4]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+ }
+ [5]=>
+ array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+ }
+}
+
+*** Testing var_dump() on anonymous functions ***
+New anonymous function:
+string(9) "2 * 3 = 6"
+string(9) "
+
+*** Testing error conditions ***
+
+Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
+Done
+
diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt
new file mode 100644
index 0000000..37142cf
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export-locale.phpt
@@ -0,0 +1,1061 @@
+--TEST--
+Test var_export() function with locale
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (!setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8")) {
+ die("skip locale needed for this test is not supported on this platform");
+}
+?>
+--FILE--
+<?php
+setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8");
+/* Prototype: mixed var_export( mixed expression [, bool return]);
+ * Description: Returns the variable representation when the return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL.
+
+*/
+
+echo "*** Testing var_export() with integer values ***\n";
+// different integer vlaues
+$valid_ints = array(
+ '0',
+ '1',
+ '-1',
+ '-2147483648', // max negative integer value
+ '-2147483647',
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ '0x12ab',
+ '0Xfff',
+ '0XFA',
+ -0x80000000, // max negative integer as hexadecimal
+ '0x7fffffff', // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ '0123', // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ );
+$counter = 1;
+/* Loop to check for above integer values with var_export() */
+echo "\n*** Output for integer values ***\n";
+foreach($valid_ints as $int_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $int_value );
+echo "\n";
+var_export( $int_value, FALSE);
+echo "\n";
+var_dump( var_export( $int_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bool = array(
+ 1,
+ TRUE,
+ true,
+ 0,
+ FALSE,
+ false
+ );
+$counter = 1;
+/* Loop to check for above boolean values with var_export() */
+echo "\n*** Output for boolean values ***\n";
+foreach($valid_bool as $bool_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $bool_value );
+echo "\n";
+var_export( $bool_value, FALSE);
+echo "\n";
+var_dump( var_export( $bool_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid float values ***\n";
+// different valid float vlaues
+$valid_floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ 1e-5,
+ 1e+5,
+ 1E5,
+ 1E+5,
+ 1E-5,
+ .5e+7,
+ .6e-19,
+ .05E+44,
+ .0034E-30
+);
+$counter = 1;
+/* Loop to check for above float values with var_export() */
+echo "\n*** Output for float values ***\n";
+foreach($valid_bool as $float_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $float_value );
+echo "\n";
+var_export( $float_value, FALSE);
+echo "\n";
+var_dump( var_export( $float_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid strings ***\n";
+// different valid string
+$valid_strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'false',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070"
+ );
+$counter = 1;
+/* Loop to check for above strings with var_export() */
+echo "\n*** Output for strings ***\n";
+foreach($valid_strings as $str) {
+echo "\nIteration ".$counter."\n";
+var_export( $str );
+echo "\n";
+var_export( $str, FALSE);
+echo "\n";
+var_dump( var_export( $str, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid arrays ***\n";
+// different valid arrays
+$valid_arrays = array(
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test')
+ );
+$counter = 1;
+/* Loop to check for above arrays with var_export() */
+echo "\n*** Output for arrays ***\n";
+foreach($valid_arrays as $arr) {
+echo "\nIteration ".$counter."\n";
+var_export( $arr );
+echo "\n";
+var_export( $arr, FALSE);
+echo "\n";
+var_dump( var_export( $arr, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface iValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+// implement the interface
+class Value implements iValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_export ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ new stdclass,
+ new foo,
+ new concreteClass,
+ new Value,
+ new myClass,
+ $myClass_object,
+ $myClass_object->foo_object,
+ $myClass_object->public_var1,
+ $foo_object,
+ $Value_object,
+ $concreteClass_object
+ );
+ $counter = 1;
+/* Loop to check for above objects with var_export() */
+echo "\n*** Output for objects ***\n";
+foreach($valid_objects as $obj) {
+echo "\nIteration ".$counter."\n";
+var_export( $obj );
+echo "\n";
+var_export( $obj, FALSE);
+echo "\n";
+var_dump( var_export( $obj, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid null values ***\n";
+// different valid null vlaues
+$unset_var = array();
+unset ($unset_var); // now a null
+$null_var = NULL;
+
+$valid_nulls = array(
+ NULL,
+ null,
+ $null_var,
+ );
+ $counter = 1;
+/* Loop to check for above null values with var_export() */
+echo "\n*** Output for null values ***\n";
+foreach($valid_nulls as $null_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $null_value );
+echo "\n";
+var_export( $null_value, FALSE);
+echo "\n";
+var_dump( var_export( $null_value, true) );
+echo "\n";
+$counter++;
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_export( var_export() );
+
+//arguments more than expected
+var_export( var_export(TRUE, FALSE, TRUE) );
+
+echo "\n\nDone";
+
+
+?>
+--EXPECTF--
+*** Testing var_export() with integer values ***
+
+*** Output for integer values ***
+
+Iteration 1
+'0'
+'0'
+string(3) "'0'"
+
+
+Iteration 2
+'1'
+'1'
+string(3) "'1'"
+
+
+Iteration 3
+'-1'
+'-1'
+string(4) "'-1'"
+
+
+Iteration 4
+'-2147483648'
+'-2147483648'
+string(13) "'-2147483648'"
+
+
+Iteration 5
+'-2147483647'
+'-2147483647'
+string(13) "'-2147483647'"
+
+
+Iteration 6
+2147483647
+2147483647
+string(10) "2147483647"
+
+
+Iteration 7
+2147483640
+2147483640
+string(10) "2147483640"
+
+
+Iteration 8
+4667
+4667
+string(4) "4667"
+
+
+Iteration 9
+'0x12ab'
+'0x12ab'
+string(8) "'0x12ab'"
+
+
+Iteration 10
+'0Xfff'
+'0Xfff'
+string(7) "'0Xfff'"
+
+
+Iteration 11
+'0XFA'
+'0XFA'
+string(6) "'0XFA'"
+
+
+Iteration 12
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+
+Iteration 13
+'0x7fffffff'
+'0x7fffffff'
+string(12) "'0x7fffffff'"
+
+
+Iteration 14
+2147483647
+2147483647
+string(10) "2147483647"
+
+
+Iteration 15
+'0123'
+'0123'
+string(6) "'0123'"
+
+
+Iteration 16
+1
+1
+string(1) "1"
+
+
+Iteration 17
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+
+Iteration 18
+2147483647
+2147483647
+string(10) "2147483647"
+
+*** Testing var_export() with valid boolean values ***
+
+*** Output for boolean values ***
+
+Iteration 1
+1
+1
+string(1) "1"
+
+
+Iteration 2
+true
+true
+string(4) "true"
+
+
+Iteration 3
+true
+true
+string(4) "true"
+
+
+Iteration 4
+0
+0
+string(1) "0"
+
+
+Iteration 5
+false
+false
+string(5) "false"
+
+
+Iteration 6
+false
+false
+string(5) "false"
+
+*** Testing var_export() with valid float values ***
+
+*** Output for float values ***
+
+Iteration 1
+1
+1
+string(1) "1"
+
+
+Iteration 2
+true
+true
+string(4) "true"
+
+
+Iteration 3
+true
+true
+string(4) "true"
+
+
+Iteration 4
+0
+0
+string(1) "0"
+
+
+Iteration 5
+false
+false
+string(5) "false"
+
+
+Iteration 6
+false
+false
+string(5) "false"
+
+*** Testing var_export() with valid strings ***
+
+*** Output for strings ***
+
+Iteration 1
+''
+''
+string(2) "''"
+
+
+Iteration 2
+' '
+' '
+string(3) "' '"
+
+
+Iteration 3
+''
+''
+string(2) "''"
+
+
+Iteration 4
+' '
+' '
+string(3) "' '"
+
+
+Iteration 5
+'string'
+'string'
+string(8) "'string'"
+
+
+Iteration 6
+'string'
+'string'
+string(8) "'string'"
+
+
+Iteration 7
+'NULL'
+'NULL'
+string(6) "'NULL'"
+
+
+Iteration 8
+'null'
+'null'
+string(6) "'null'"
+
+
+Iteration 9
+'FALSE'
+'FALSE'
+string(7) "'FALSE'"
+
+
+Iteration 10
+'false'
+'false'
+string(7) "'false'"
+
+
+Iteration 11
+' '
+' '
+string(3) "' '"
+
+
+Iteration 12
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
+
+
+Iteration 13
+'\\0'
+'\\0'
+string(5) "'\\0'"
+
+
+Iteration 14
+'\\060'
+'\\060'
+string(7) "'\\060'"
+
+
+Iteration 15
+'8'
+'8'
+string(3) "'8'"
+
+*** Testing var_export() with valid arrays ***
+
+*** Output for arrays ***
+
+Iteration 1
+array (
+)
+array (
+)
+string(9) "array (
+)"
+
+
+Iteration 2
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+Iteration 3
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+Iteration 4
+array (
+ 0 => true,
+)
+array (
+ 0 => true,
+)
+string(22) "array (
+ 0 => true,
+)"
+
+
+Iteration 5
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+Iteration 6
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+Iteration 7
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+string(55) "array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)"
+
+
+Iteration 8
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+string(107) "array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)"
+
+
+Iteration 9
+array (
+ 1 => 'One',
+)
+array (
+ 1 => 'One',
+)
+string(23) "array (
+ 1 => 'One',
+)"
+
+
+Iteration 10
+array (
+ 'test' => 'is_array',
+)
+array (
+ 'test' => 'is_array',
+)
+string(33) "array (
+ 'test' => 'is_array',
+)"
+
+
+Iteration 11
+array (
+ 0 => 0,
+)
+array (
+ 0 => 0,
+)
+string(19) "array (
+ 0 => 0,
+)"
+
+
+Iteration 12
+array (
+ 0 => -1,
+)
+array (
+ 0 => -1,
+)
+string(20) "array (
+ 0 => -1,
+)"
+
+
+Iteration 13
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+string(34) "array (
+ 0 => 10.5,
+ 1 => 5.6,
+)"
+
+
+Iteration 14
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+
+Iteration 15
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+*** Testing var_export() with valid objects ***
+
+*** Output for objects ***
+
+Iteration 1
+stdClass::__set_state(array(
+))
+stdClass::__set_state(array(
+))
+string(31) "stdClass::__set_state(array(
+))"
+
+
+Iteration 2
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 3
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+
+Iteration 4
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+Iteration 5
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+Iteration 6
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+Iteration 7
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 8
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 9
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 10
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+Iteration 11
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+*** Testing var_export() with valid null values ***
+
+*** Output for null values ***
+
+Iteration 1
+NULL
+NULL
+string(4) "NULL"
+
+
+Iteration 2
+NULL
+NULL
+string(4) "NULL"
+
+
+Iteration 3
+NULL
+NULL
+string(4) "NULL"
+
+
+*** Testing error conditions ***
+
+Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Done
diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt
new file mode 100644
index 0000000..3a734c7
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic1.phpt
@@ -0,0 +1,141 @@
+--TEST--
+Test var_export() function with integer values
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with integer values ***\n";
+// different integer vlaues
+$valid_ints = array(
+ '0' => '0',
+ '1' => '1',
+ '-1' => '-1',
+ '-2147483648' => '-2147483648', // max negative integer value
+ '-2147483647' => '-2147483647',
+ '2147483647' => 2147483647, // max positive integer value
+ '2147483640' => 2147483640,
+ '0x123B' => 0x123B, // integer as hexadecimal
+ "'0x12ab'" => '0x12ab',
+ "'0Xfff'" => '0Xfff',
+ "'0XFA'" => '0XFA',
+ "-0x80000000" => -0x80000000, // max negative integer as hexadecimal
+ "'0x7fffffff'" => '0x7fffffff', // max postive integer as hexadecimal
+ "0x7FFFFFFF" => 0x7FFFFFFF, // max postive integer as hexadecimal
+ "'0123'" => '0123', // integer as octal
+ "01912" => 01912, // should be quivalent to octal 1
+ "-020000000000" => -020000000000, // max negative integer as octal
+ "017777777777" => 017777777777, // max positive integer as octal
+);
+
+/* Loop to check for above integer values with var_export() */
+echo "\n*** Output for integer values ***\n";
+foreach($valid_ints as $key => $int_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $int_value );
+ echo "\n";
+ var_export( $int_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $int_value, TRUE) );
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with integer values ***
+
+*** Output for integer values ***
+
+-- Iteration: 0 --
+'0'
+'0'
+string(3) "'0'"
+
+-- Iteration: 1 --
+'1'
+'1'
+string(3) "'1'"
+
+-- Iteration: -1 --
+'-1'
+'-1'
+string(4) "'-1'"
+
+-- Iteration: -2147483648 --
+'-2147483648'
+'-2147483648'
+string(13) "'-2147483648'"
+
+-- Iteration: -2147483647 --
+'-2147483647'
+'-2147483647'
+string(13) "'-2147483647'"
+
+-- Iteration: 2147483647 --
+2147483647
+2147483647
+string(10) "2147483647"
+
+-- Iteration: 2147483640 --
+2147483640
+2147483640
+string(10) "2147483640"
+
+-- Iteration: 0x123B --
+4667
+4667
+string(4) "4667"
+
+-- Iteration: '0x12ab' --
+'0x12ab'
+'0x12ab'
+string(8) "'0x12ab'"
+
+-- Iteration: '0Xfff' --
+'0Xfff'
+'0Xfff'
+string(7) "'0Xfff'"
+
+-- Iteration: '0XFA' --
+'0XFA'
+'0XFA'
+string(6) "'0XFA'"
+
+-- Iteration: -0x80000000 --
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+-- Iteration: '0x7fffffff' --
+'0x7fffffff'
+'0x7fffffff'
+string(12) "'0x7fffffff'"
+
+-- Iteration: 0x7FFFFFFF --
+2147483647
+2147483647
+string(10) "2147483647"
+
+-- Iteration: '0123' --
+'0123'
+'0123'
+string(6) "'0123'"
+
+-- Iteration: 01912 --
+1
+1
+string(1) "1"
+
+-- Iteration: -020000000000 --
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+-- Iteration: 017777777777 --
+2147483647
+2147483647
+string(10) "2147483647"
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic2.phpt b/ext/standard/tests/general_functions/var_export_basic2.phpt
new file mode 100644
index 0000000..33ca400
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic2.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test var_export() function with valid boolean values
+--FILE--
+<?php
+
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bool = array(
+ "1" => 1,
+ "TRUE" => TRUE,
+ "true" => true,
+ "0" => 0,
+ "FALSE" => FALSE,
+ "false" => false
+);
+
+/* Loop to check for above boolean values with var_export() */
+echo "\n*** Output for boolean values ***\n";
+foreach($valid_bool as $key => $bool_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $bool_value );
+ echo "\n";
+ var_export( $bool_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $bool_value, TRUE) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid boolean values ***
+
+*** Output for boolean values ***
+
+-- Iteration: 1 --
+1
+1
+string(1) "1"
+
+
+-- Iteration: TRUE --
+true
+true
+string(4) "true"
+
+
+-- Iteration: true --
+true
+true
+string(4) "true"
+
+
+-- Iteration: 0 --
+0
+0
+string(1) "0"
+
+
+-- Iteration: FALSE --
+false
+false
+string(5) "false"
+
+
+-- Iteration: false --
+false
+false
+string(5) "false"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt
new file mode 100644
index 0000000..2997215
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic3.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test var_export() function with valid float values
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid float values ***\n";
+// different valid float vlaues
+$valid_floats = array(
+ "-2147483649" => -2147483649, // float value
+ "2147483648" => 2147483648, // float value
+ "-0x80000001" => -0x80000001, // float value, beyond max negative int
+ "0x800000001" => 0x800000001, // float value, beyond max positive int
+ "020000000001" => 020000000001, // float value, beyond max positive int
+ "-020000000001" => -020000000001, // float value, beyond max negative int
+ "0.0" => 0.0,
+ "-0.1" => -0.1,
+ "10.0000000000000000005" => 10.0000000000000000005,
+ "10.5e+5" => 10.5e+5,
+ "1e5" => 1e5,
+ "1e-5" => 1e-5,
+ "1e+5" => 1e+5,
+ "1E5" => 1E5,
+ "1E+5" => 1E+5,
+ "1E-5" => 1E-5,
+ ".5e+7" => .5e+7,
+ ".6e-19" => .6e-19,
+ ".05E+44" => .05E+44,
+ ".0034E-30" => .0034E-30
+);
+/* Loop to check for above float values with var_export() */
+echo "\n*** Output for float values ***\n";
+foreach($valid_floats as $key => $float_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $float_value );
+ echo "\n";
+ var_export( $float_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $float_value, TRUE) );
+ echo "\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid float values ***
+
+*** Output for float values ***
+
+-- Iteration: -2147483649 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 2147483648 --
+2147483648
+2147483648
+string(10) "2147483648"
+
+
+-- Iteration: -0x80000001 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 0x800000001 --
+34359738369
+34359738369
+string(11) "34359738369"
+
+
+-- Iteration: 020000000001 --
+2147483649
+2147483649
+string(10) "2147483649"
+
+
+-- Iteration: -020000000001 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 0.0 --
+0
+0
+string(1) "0"
+
+
+-- Iteration: -0.1 --
+-0.1
+-0.1
+string(4) "-0.1"
+
+
+-- Iteration: 10.0000000000000000005 --
+10
+10
+string(2) "10"
+
+
+-- Iteration: 10.5e+5 --
+1050000
+1050000
+string(7) "1050000"
+
+
+-- Iteration: 1e5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1e-5 --
+1.0E-5
+1.0E-5
+string(6) "1.0E-5"
+
+
+-- Iteration: 1e+5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E+5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E-5 --
+1.0E-5
+1.0E-5
+string(6) "1.0E-5"
+
+
+-- Iteration: .5e+7 --
+5000000
+5000000
+string(7) "5000000"
+
+
+-- Iteration: .6e-19 --
+6.0E-20
+6.0E-20
+string(7) "6.0E-20"
+
+
+-- Iteration: .05E+44 --
+5.0E+42
+5.0E+42
+string(7) "5.0E+42"
+
+
+-- Iteration: .0034E-30 --
+3.4E-33
+3.4E-33
+string(7) "3.4E-33"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic4.phpt b/ext/standard/tests/general_functions/var_export_basic4.phpt
new file mode 100644
index 0000000..4668ace
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic4.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test var_export() function with valid strings
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing var_export() with valid strings ***\n";
+// different valid string
+$valid_strings = array(
+ "\"\"" => "",
+ "\" \"" => " ",
+ "''" => '',
+ "' '" => ' ',
+ "\"string\"" => "string",
+ "'string'" => 'string',
+ "\"\\0Hello\\0 World\\0\"" => "\0Hello\0 World\0",
+ "\"NULL\"" => "NULL",
+ "'null'" => 'null',
+ "\"FALSE\"" => "FALSE",
+ "'false'" => 'false',
+ "\"\\x0b\"" => "\x0b",
+ "\"\\0\"" => "\0",
+ "'\\0'" => '\0',
+ "'\\060'" => '\060',
+ "\"\\070\"" => "\070"
+);
+
+/* Loop to check for above strings with var_export() */
+echo "\n*** Output for strings ***\n";
+foreach($valid_strings as $key => $str) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $str );
+ echo "\n";
+ var_export( $str, FALSE);
+ echo "\n";
+ var_dump( var_export( $str, TRUE) );
+ echo "\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid strings ***
+
+*** Output for strings ***
+
+-- Iteration: "" --
+''
+''
+string(2) "''"
+
+
+-- Iteration: " " --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: '' --
+''
+''
+string(2) "''"
+
+
+-- Iteration: ' ' --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: "string" --
+'string'
+'string'
+string(8) "'string'"
+
+
+-- Iteration: 'string' --
+'string'
+'string'
+string(8) "'string'"
+
+
+-- Iteration: "\0Hello\0 World\0" --
+'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
+'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
+string(49) "'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''"
+
+
+-- Iteration: "NULL" --
+'NULL'
+'NULL'
+string(6) "'NULL'"
+
+
+-- Iteration: 'null' --
+'null'
+'null'
+string(6) "'null'"
+
+
+-- Iteration: "FALSE" --
+'FALSE'
+'FALSE'
+string(7) "'FALSE'"
+
+
+-- Iteration: 'false' --
+'false'
+'false'
+string(7) "'false'"
+
+
+-- Iteration: "\x0b" --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: "\0" --
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
+
+
+-- Iteration: '\0' --
+'\\0'
+'\\0'
+string(5) "'\\0'"
+
+
+-- Iteration: '\060' --
+'\\060'
+'\\060'
+string(7) "'\\060'"
+
+
+-- Iteration: "\070" --
+'8'
+'8'
+string(3) "'8'"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt
new file mode 100644
index 0000000..96b3f54
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic5.phpt
@@ -0,0 +1,277 @@
+--TEST--
+Test var_export() function with valid arrays
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing var_export() with valid arrays ***\n";
+// different valid arrays
+$valid_arrays = array(
+ "array()" => array(),
+ "array(NULL)" => array(NULL),
+ "array(null)" => array(null),
+ "array(true)" => array(true),
+ "array(\"\")" => array(""),
+ "array('')" => array(''),
+ "array(array(), array())" => array(array(), array()),
+ "array(array(1, 2), array('a', 'b'))" => array(array(1, 2), array('a', 'b')),
+ "array(1 => 'One')" => array(1 => 'One'),
+ "array(\"test\" => \"is_array\")" => array("test" => "is_array"),
+ "array(0)" => array(0),
+ "array(-1)" => array(-1),
+ "array(10.5, 5.6)" => array(10.5, 5.6),
+ "array(\"string\", \"test\")" => array("string", "test"),
+ "array('string', 'test')" => array('string', 'test')
+);
+
+/* Loop to check for above arrays with var_export() */
+echo "\n*** Output for arrays ***\n";
+foreach($valid_arrays as $key => $arr) {
+ echo "\n--Iteration: $key --\n";
+ var_export( $arr );
+ echo "\n";
+ var_export( $arr, FALSE);
+ echo "\n";
+ var_dump( var_export( $arr, TRUE) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid arrays ***
+
+*** Output for arrays ***
+
+--Iteration: array() --
+array (
+)
+array (
+)
+string(9) "array (
+)"
+
+
+--Iteration: array(NULL) --
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+--Iteration: array(null) --
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+--Iteration: array(true) --
+array (
+ 0 => true,
+)
+array (
+ 0 => true,
+)
+string(22) "array (
+ 0 => true,
+)"
+
+
+--Iteration: array("") --
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+--Iteration: array('') --
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+--Iteration: array(array(), array()) --
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+string(55) "array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)"
+
+
+--Iteration: array(array(1, 2), array('a', 'b')) --
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+string(107) "array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)"
+
+
+--Iteration: array(1 => 'One') --
+array (
+ 1 => 'One',
+)
+array (
+ 1 => 'One',
+)
+string(23) "array (
+ 1 => 'One',
+)"
+
+
+--Iteration: array("test" => "is_array") --
+array (
+ 'test' => 'is_array',
+)
+array (
+ 'test' => 'is_array',
+)
+string(33) "array (
+ 'test' => 'is_array',
+)"
+
+
+--Iteration: array(0) --
+array (
+ 0 => 0,
+)
+array (
+ 0 => 0,
+)
+string(19) "array (
+ 0 => 0,
+)"
+
+
+--Iteration: array(-1) --
+array (
+ 0 => -1,
+)
+array (
+ 0 => -1,
+)
+string(20) "array (
+ 0 => -1,
+)"
+
+
+--Iteration: array(10.5, 5.6) --
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+string(34) "array (
+ 0 => 10.5,
+ 1 => 5.6,
+)"
+
+
+--Iteration: array("string", "test") --
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+
+--Iteration: array('string', 'test') --
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_export_basic6.phpt b/ext/standard/tests/general_functions/var_export_basic6.phpt
new file mode 100644
index 0000000..8935d0e
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic6.phpt
@@ -0,0 +1,310 @@
+--TEST--
+Test var_export() function with valid objects
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface iValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+// implement the interface
+class Value implements iValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_export ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ "new stdclass" => new stdclass,
+ "new foo" => new foo,
+ "new concreteClass" => new concreteClass,
+ "new Value" => new Value,
+ "new myClass" => new myClass,
+ "myClass_object" => $myClass_object,
+ "myClass_object->foo_object" => $myClass_object->foo_object,
+ "myClass_object->public_var1" => $myClass_object->public_var1,
+ "foo_object" => $foo_object,
+ "Value_object" => $Value_object,
+ "concreteClass_object" => $concreteClass_object
+ );
+/* Loop to check for above objects with var_export() */
+echo "\n*** Output for objects ***\n";
+foreach($valid_objects as $key => $obj) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $obj );
+ echo "\n";
+ var_export( $obj, FALSE);
+ echo "\n";
+ var_dump( var_export( $obj, TRUE) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid objects ***
+
+*** Output for objects ***
+
+-- Iteration: new stdclass --
+stdClass::__set_state(array(
+))
+stdClass::__set_state(array(
+))
+string(31) "stdClass::__set_state(array(
+))"
+
+
+-- Iteration: new foo --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: new concreteClass --
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+
+-- Iteration: new Value --
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+-- Iteration: new myClass --
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+-- Iteration: myClass_object --
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+-- Iteration: myClass_object->foo_object --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: myClass_object->public_var1 --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: foo_object --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: Value_object --
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+-- Iteration: concreteClass_object --
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic7.phpt b/ext/standard/tests/general_functions/var_export_basic7.phpt
new file mode 100644
index 0000000..10dc032
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic7.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test var_export() function with valid null values
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid null values ***\n";
+
+// different valid null vlaues
+$unset_var = array();
+unset ($unset_var); // now a null
+$null_var = NULL;
+
+$valid_nulls = array(
+ "NULL" => NULL,
+ "null" => null,
+ "null_var" => $null_var,
+);
+
+/* Loop to check for above null values with var_export() */
+echo "\n*** Output for null values ***\n";
+foreach($valid_nulls as $key => $null_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $null_value );
+ echo "\n";
+ var_export( $null_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $null_value, true) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid null values ***
+
+*** Output for null values ***
+
+-- Iteration: NULL --
+NULL
+NULL
+string(4) "NULL"
+
+
+-- Iteration: null --
+NULL
+NULL
+string(4) "NULL"
+
+
+-- Iteration: null_var --
+NULL
+NULL
+string(4) "NULL"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic8.phpt b/ext/standard/tests/general_functions/var_export_basic8.phpt
new file mode 100644
index 0000000..6e6263d
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic8.phpt
@@ -0,0 +1,71 @@
+--TEST--
+var_export(): simple test with arrays and objects
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n\n-- Var export on a simple object --\n";
+$o1 = new stdclass;
+$o1->p = '22';
+$o2 = new stdclass;
+$o2->a = 1;
+$o2->b = array('k'=>2);
+$o2->x = $o1;
+var_export($o2);
+
+echo "\n\n-- Var export on an simple array --\n";
+$a = array(1,2,3,4);
+var_export($a);
+
+echo "\n\n-- Var export on an nested array --\n";
+$a = array('one' => 'first');
+$b = array('foo' => $a, 'bar' => $o2);
+var_export($b);
+
+?>
+===DONE===
+--EXPECTF--
+-- Var export on a simple object --
+stdClass::__set_state(array(
+ 'a' => 1,
+ 'b' =>
+ array (
+ 'k' => 2,
+ ),
+ 'x' =>
+ stdClass::__set_state(array(
+ 'p' => '22',
+ )),
+))
+
+-- Var export on an simple array --
+array (
+ 0 => 1,
+ 1 => 2,
+ 2 => 3,
+ 3 => 4,
+)
+
+-- Var export on an nested array --
+array (
+ 'foo' =>
+ array (
+ 'one' => 'first',
+ ),
+ 'bar' =>
+ stdClass::__set_state(array(
+ 'a' => 1,
+ 'b' =>
+ array (
+ 'k' => 2,
+ ),
+ 'x' =>
+ stdClass::__set_state(array(
+ 'p' => '22',
+ )),
+ )),
+)===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic9.phpt b/ext/standard/tests/general_functions/var_export_basic9.phpt
new file mode 100644
index 0000000..3c9706e
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic9.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #55082: var_export() doesn't escape properties properly
+--FILE--
+<?php
+ $x = new stdClass();
+ $x->{'\'\\'} = 7;
+ echo var_export($x);
+--EXPECT--
+stdClass::__set_state(array(
+ '\'\\' => 7,
+))
diff --git a/ext/standard/tests/general_functions/var_export_error1.phpt b/ext/standard/tests/general_functions/var_export_error1.phpt
new file mode 100644
index 0000000..d9c5eee
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_error1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test var_export() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing var_export() function with Zero arguments --\n";
+var_dump( var_export() );
+
+//Test var_export with one more than the expected number of arguments
+echo "\n-- Testing var_export() function with more than expected no. of arguments --\n";
+$var = 1;
+$return = true;
+$extra_arg = 10;
+var_dump( var_export($var, $return, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing var_export() : error conditions ***
+
+-- Testing var_export() function with Zero arguments --
+
+Warning: var_export() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing var_export() function with more than expected no. of arguments --
+
+Warning: var_export() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt
new file mode 100644
index 0000000..a6403e6
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_error2.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test var_export() function : error conditions - recursive object
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+@$obj->p =& $obj;
+var_export($obj, true);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: var_export does not handle circular references in %s on line 9
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt
new file mode 100644
index 0000000..c862691
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_error3.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test var_export() function : error conditions - recursive array
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$a[] =& $a;
+var_export($a, true);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: var_export does not handle circular references in %s on line 9
+===DONE===
diff --git a/ext/standard/tests/http/bug38802.phpt b/ext/standard/tests/http/bug38802.phpt
new file mode 100644
index 0000000..73b4118
--- /dev/null
+++ b/ext/standard/tests/http/bug38802.phpt
@@ -0,0 +1,174 @@
+--TEST--
+Bug #38802 (ignore_errors and max_redirects)
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
+--FILE--
+<?php
+require 'server.inc';
+
+function do_test($context_options) {
+
+ $context = stream_context_create(array('http' => $context_options));
+
+ $responses = array(
+ "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1",
+ "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n",
+ "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3",
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.",
+ );
+
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+
+ $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
+ var_dump($fd);
+
+ if ($fd) {
+ $meta_data = stream_get_meta_data($fd);
+ var_dump($meta_data['wrapper_data']);
+
+ var_dump(stream_get_contents($fd));
+ }
+
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+
+ http_server_kill($pid);
+}
+
+echo "-- Test: follow all redirections --\n";
+
+do_test(array(), 4);
+
+echo "-- Test: fail after 2 redirections --\n";
+
+do_test(array('max_redirects' => 2), 2);
+
+echo "-- Test: fail at first redirection --\n";
+
+do_test(array('max_redirects' => 0), 1);
+
+echo "-- Test: fail at first redirection (2) --\n";
+
+do_test(array('max_redirects' => 1), 1);
+
+echo "-- Test: return at first redirection --\n";
+
+do_test(array('max_redirects' => 0, 'ignore_errors' => 1), 1);
+
+echo "-- Test: return at first redirection (2) --\n";
+
+do_test(array('max_redirects' => 1, 'ignore_errors' => 1), 1);
+
+echo "-- Test: return at second redirection --\n";
+
+do_test(array('max_redirects' => 2, 'ignore_errors' => 1), 2);
+
+?>
+--EXPECTF--
+-- Test: follow all redirections --
+resource(%d) of type (stream)
+array(7) {
+ [0]=>
+ string(30) "HTTP/1.0 302 Moved Temporarily"
+ [1]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar2"
+ [2]=>
+ string(30) "HTTP/1.0 301 Moved Permanently"
+ [3]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar3"
+ [4]=>
+ string(30) "HTTP/1.0 302 Moved Temporarily"
+ [5]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar4"
+ [6]=>
+ string(15) "HTTP/1.0 200 OK"
+}
+string(5) "done."
+string(195) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+GET /foo/bar2 HTTP/1.0
+Host: 127.0.0.1:12342
+
+GET /foo/bar3 HTTP/1.0
+Host: 127.0.0.1:12342
+
+GET /foo/bar4 HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: fail after 2 redirections --
+
+Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
+bool(false)
+string(97) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+GET /foo/bar2 HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: fail at first redirection --
+
+Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
+bool(false)
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: fail at first redirection (2) --
+
+Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
+bool(false)
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: return at first redirection --
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(30) "HTTP/1.0 302 Moved Temporarily"
+ [1]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar2"
+}
+string(1) "1"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: return at first redirection (2) --
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(30) "HTTP/1.0 302 Moved Temporarily"
+ [1]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar2"
+}
+string(1) "1"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: return at second redirection --
+resource(%d) of type (stream)
+array(4) {
+ [0]=>
+ string(30) "HTTP/1.0 302 Moved Temporarily"
+ [1]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar2"
+ [2]=>
+ string(30) "HTTP/1.0 301 Moved Permanently"
+ [3]=>
+ string(41) "Location: http://127.0.0.1:12342/foo/bar3"
+}
+string(0) ""
+string(97) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+GET /foo/bar2 HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
diff --git a/ext/standard/tests/http/bug43510.phpt b/ext/standard/tests/http/bug43510.phpt
new file mode 100644
index 0000000..d973612
--- /dev/null
+++ b/ext/standard/tests/http/bug43510.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #43510 (stream_get_meta_data() does not return same mode as used in fopen)
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
+--FILE--
+<?php
+require 'server.inc';
+
+$responses = array(
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+);
+
+$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+
+foreach(array('r', 'rb') as $mode) {
+ $fd = fopen('http://127.0.0.1:12342/', $mode, false);
+ $meta = stream_get_meta_data($fd);
+ var_dump($meta['mode']);
+ fclose($fd);
+}
+
+http_server_kill($pid);
+
+?>
+--EXPECT--
+string(1) "r"
+string(2) "rb"
diff --git a/ext/standard/tests/http/bug48929.phpt b/ext/standard/tests/http/bug48929.phpt
new file mode 100644
index 0000000..2d1e459
--- /dev/null
+++ b/ext/standard/tests/http/bug48929.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Bug #48929 (duplicate \r\n sent after last header line)
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
+--FILE--
+<?php
+require 'server.inc';
+
+function do_test($context_options) {
+
+ $context = stream_context_create(array('http' => $context_options));
+
+ $responses = array(
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ );
+
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+
+ foreach($responses as $r) {
+
+ $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context);
+
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ }
+
+ http_server_kill($pid);
+}
+
+echo "-- Test: requests with 'header' as array --\n";
+
+do_test(array('header' => array('X-Foo: bar', 'Content-Type: text/plain'), 'method' => 'POST', 'content' => 'ohai'));
+
+echo "-- Test: requests with 'header' as string --\n";
+
+do_test(array('header' => "X-Foo: bar\r\nContent-Type: text/plain", 'method' => 'POST', 'content' => 'ohai'));
+
+?>
+--EXPECT--
+-- Test: requests with 'header' as array --
+string(103) "POST / HTTP/1.0
+Host: 127.0.0.1:12342
+Content-Length: 4
+X-Foo: bar
+Content-Type: text/plain
+
+ohai"
+-- Test: requests with 'header' as string --
+string(103) "POST / HTTP/1.0
+Host: 127.0.0.1:12342
+Content-Length: 4
+X-Foo: bar
+Content-Type: text/plain
+
+ohai"
diff --git a/ext/standard/tests/http/bug53198.phpt b/ext/standard/tests/http/bug53198.phpt
new file mode 100644
index 0000000..3c640fa
--- /dev/null
+++ b/ext/standard/tests/http/bug53198.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Bug #53198 (From: header cannot be changed with ini_set)
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
+--INI--
+allow_url_fopen=1
+from=teste@teste.pt
+--FILE--
+<?php
+require 'server.inc';
+
+function do_test() {
+
+ $responses = array(
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ );
+
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+
+ foreach($responses as $r) {
+
+ $fd = fopen('http://127.0.0.1:12342/', 'rb', false);
+
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ }
+
+ http_server_kill($pid);
+
+}
+
+echo "-- Test: leave default --\n";
+
+do_test();
+
+echo "-- Test: after ini_set --\n";
+
+ini_set('from', 'junk@junk.com');
+
+do_test();
+
+?>
+--EXPECT--
+-- Test: leave default --
+string(63) "GET / HTTP/1.0
+From: teste@teste.pt
+Host: 127.0.0.1:12342
+
+"
+-- Test: after ini_set --
+string(62) "GET / HTTP/1.0
+From: junk@junk.com
+Host: 127.0.0.1:12342
+
+"
+
diff --git a/ext/standard/tests/http/bug60570.phpt b/ext/standard/tests/http/bug60570.phpt
new file mode 100644
index 0000000..d1784b0
--- /dev/null
+++ b/ext/standard/tests/http/bug60570.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Bug #60570 (Stream context leaks when http request fails)
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
+--INI--
+allow_url_fopen=1
+allow_url_include=1
+--FILE--
+<?php
+require 'server.inc';
+
+function do_test() {
+
+ $responses = array(
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n"
+ );
+
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+
+ $a = $b = null;
+
+ $i = 3;
+ while ($i--) {
+ $context = stream_context_create(array('http'=>array('timeout'=>1)));
+ file_get_contents('http://127.0.0.1:12342/', 0, $context);
+ unset($context);
+
+ $b = $a;
+ $a = memory_get_usage();
+ }
+
+ http_server_kill($pid);
+
+ echo "leak? penultimate iteration: $b, last one: $a\n";
+ var_dump($a == $b);
+}
+
+do_test();
+
+--EXPECTF--
+Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+ in %s on line %d
+
+Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+ in %s on line %d
+
+Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+ in %s on line %d
+leak? penultimate iteration: %d, last one: %d
+bool(true)
+
diff --git a/ext/standard/tests/http/ignore_errors.phpt b/ext/standard/tests/http/ignore_errors.phpt
new file mode 100644
index 0000000..ab54218
--- /dev/null
+++ b/ext/standard/tests/http/ignore_errors.phpt
@@ -0,0 +1,126 @@
+--TEST--
+http:// and ignore_errors
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
+--FILE--
+<?php
+require 'server.inc';
+
+function do_test($context_options) {
+
+ $context = stream_context_create(array('http' => $context_options));
+
+ $responses = array(
+ "data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1",
+ "data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2",
+ );
+
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+
+ foreach($responses as $r) {
+
+ $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
+ var_dump($fd);
+
+ if ($fd) {
+ $meta_data = stream_get_meta_data($fd);
+ var_dump($meta_data['wrapper_data']);
+
+ var_dump(stream_get_contents($fd));
+ }
+
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ }
+
+ http_server_kill($pid);
+}
+
+echo "-- Test: requests without ignore_errors --\n";
+
+do_test(array());
+
+echo "-- Test: requests with ignore_errors --\n";
+
+do_test(array('ignore_errors' => true));
+
+echo "-- Test: requests with ignore_errors (2) --\n";
+
+do_test(array('ignore_errors' => 1));
+
+?>
+--EXPECTF--
+-- Test: requests without ignore_errors --
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(15) "HTTP/1.0 200 Ok"
+ [1]=>
+ string(10) "X-Foo: bar"
+}
+string(1) "1"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+
+Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: HTTP request failed! HTTP/1.0 404 Not found
+ in %s on line %d
+bool(false)
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: requests with ignore_errors --
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(15) "HTTP/1.0 200 Ok"
+ [1]=>
+ string(10) "X-Foo: bar"
+}
+string(1) "1"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(22) "HTTP/1.0 404 Not found"
+ [1]=>
+ string(10) "X-bar: baz"
+}
+string(1) "2"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+-- Test: requests with ignore_errors (2) --
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(15) "HTTP/1.0 200 Ok"
+ [1]=>
+ string(10) "X-Foo: bar"
+}
+string(1) "1"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
+resource(%d) of type (stream)
+array(2) {
+ [0]=>
+ string(22) "HTTP/1.0 404 Not found"
+ [1]=>
+ string(10) "X-bar: baz"
+}
+string(1) "2"
+string(48) "GET /foo/bar HTTP/1.0
+Host: 127.0.0.1:12342
+
+"
diff --git a/ext/standard/tests/http/server.inc b/ext/standard/tests/http/server.inc
new file mode 100644
index 0000000..b9ade0e
--- /dev/null
+++ b/ext/standard/tests/http/server.inc
@@ -0,0 +1,92 @@
+<?php
+
+function http_server_skipif($socket_string) {
+
+ if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available');
+ if (!function_exists('posix_kill')) die('skip posix_kill() not available');
+ if (!stream_socket_server($socket_string)) die('skip stream_socket_server() failed');
+}
+
+/* Minimal HTTP server with predefined responses.
+ *
+ * $socket_string is the socket to create and listen on (e.g. tcp://127.0.0.1:1234)
+ * $files is an array of files containing N responses for N expected requests. Server dies after N requests.
+ * $output is a stream on which everything sent by clients is written to
+ */
+function http_server($socket_string, array $files, &$output = null) {
+
+ pcntl_alarm(60);
+
+ $server = stream_socket_server($socket_string, $errno, $errstr);
+ if (!$server) {
+ return false;
+ }
+
+ if ($output === null) {
+ $output = tmpfile();
+ if ($output === false) {
+ return false;
+ }
+ }
+
+ $pid = pcntl_fork();
+ if ($pid == -1) {
+ die('could not fork');
+ } else if ($pid) {
+ return $pid;
+ }
+
+ foreach($files as $file) {
+
+ $sock = stream_socket_accept($server);
+ if (!$sock) {
+ exit(1);
+ }
+
+ // read headers
+
+ $content_length = 0;
+
+ stream_set_blocking($sock, 0);
+ while (!feof($sock)) {
+
+ list($r, $w, $e) = array(array($sock), null, null);
+ if (!stream_select($r, $w, $e, 1)) continue;
+
+ $line = stream_get_line($sock, 8192, "\r\n");
+ if ($line === b'') {
+ fwrite($output, b"\r\n");
+ break;
+ } else if ($line !== false) {
+ fwrite($output, b"$line\r\n");
+
+ if (preg_match(b'#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) {
+ $content_length = (int) $matches[1];
+ }
+ }
+ }
+ stream_set_blocking($sock, 1);
+
+ // read content
+
+ if ($content_length > 0) {
+ stream_copy_to_stream($sock, $output, $content_length);
+ }
+
+ // send response
+
+ $fd = fopen($file, 'rb');
+ stream_copy_to_stream($fd, $sock);
+
+ fclose($sock);
+ }
+
+ exit(0);
+}
+
+function http_server_kill($pid) {
+ posix_kill($pid, SIGTERM);
+ pcntl_waitpid($pid, $status);
+}
+
+?>
diff --git a/ext/standard/tests/image/200x100.bmp b/ext/standard/tests/image/200x100.bmp
new file mode 100644
index 0000000..ac71f4f
--- /dev/null
+++ b/ext/standard/tests/image/200x100.bmp
Binary files differ
diff --git a/ext/standard/tests/image/200x100.gif b/ext/standard/tests/image/200x100.gif
new file mode 100644
index 0000000..1fc8f9b
--- /dev/null
+++ b/ext/standard/tests/image/200x100.gif
Binary files differ
diff --git a/ext/standard/tests/image/200x100.jpg b/ext/standard/tests/image/200x100.jpg
new file mode 100644
index 0000000..8e7c88d
--- /dev/null
+++ b/ext/standard/tests/image/200x100.jpg
Binary files differ
diff --git a/ext/standard/tests/image/200x100.png b/ext/standard/tests/image/200x100.png
new file mode 100644
index 0000000..e4fc891
--- /dev/null
+++ b/ext/standard/tests/image/200x100.png
Binary files differ
diff --git a/ext/standard/tests/image/200x100.swf b/ext/standard/tests/image/200x100.swf
new file mode 100644
index 0000000..c6ca322
--- /dev/null
+++ b/ext/standard/tests/image/200x100.swf
Binary files differ
diff --git a/ext/standard/tests/image/200x100.tif b/ext/standard/tests/image/200x100.tif
new file mode 100644
index 0000000..31d9b33
--- /dev/null
+++ b/ext/standard/tests/image/200x100.tif
Binary files differ
diff --git a/ext/standard/tests/image/200x100_unknown.unknown b/ext/standard/tests/image/200x100_unknown.unknown
new file mode 100644
index 0000000..0ebce72
--- /dev/null
+++ b/ext/standard/tests/image/200x100_unknown.unknown
@@ -0,0 +1 @@
+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ \ No newline at end of file
diff --git a/ext/standard/tests/image/246x247.png b/ext/standard/tests/image/246x247.png
new file mode 100644
index 0000000..648a64e
--- /dev/null
+++ b/ext/standard/tests/image/246x247.png
Binary files differ
diff --git a/ext/standard/tests/image/2x2mm.tif b/ext/standard/tests/image/2x2mm.tif
new file mode 100644
index 0000000..8b95242
--- /dev/null
+++ b/ext/standard/tests/image/2x2mm.tif
Binary files differ
diff --git a/ext/standard/tests/image/384x385.png b/ext/standard/tests/image/384x385.png
new file mode 100644
index 0000000..843ddfa
--- /dev/null
+++ b/ext/standard/tests/image/384x385.png
Binary files differ
diff --git a/ext/standard/tests/image/75x50.wbmp b/ext/standard/tests/image/75x50.wbmp
new file mode 100644
index 0000000..8442432
--- /dev/null
+++ b/ext/standard/tests/image/75x50.wbmp
Binary files differ
diff --git a/ext/standard/tests/image/75x50.xbm b/ext/standard/tests/image/75x50.xbm
new file mode 100644
index 0000000..fea4426
--- /dev/null
+++ b/ext/standard/tests/image/75x50.xbm
@@ -0,0 +1,59 @@
+#define Xbitmap_width 75
+#define Xbitmap_height 50
+static unsigned char Xbitmap_bits[] = {
+ 0xfd, 0xdb, 0xf5, 0xbf, 0xef, 0x7b, 0xbb, 0xae, 0xaa,
+ 0x07, 0xff, 0x77, 0xbf, 0xea, 0xba, 0xee, 0xef, 0xfb,
+ 0xff, 0x06, 0xff, 0xdf, 0xed, 0xbf, 0xdf, 0xbb, 0xba,
+ 0x5e, 0x55, 0x05, 0xff, 0x77, 0xbf, 0xf5, 0xe2, 0xee,
+ 0xef, 0xeb, 0x55, 0x03, 0xff, 0xdf, 0x75, 0x1f, 0xc0,
+ 0x7b, 0xfb, 0xfe, 0xaa, 0x06, 0xff, 0x77, 0xdf, 0x07,
+ 0xe8, 0xdf, 0xae, 0xaf, 0xa5, 0x06, 0x5f, 0xdf, 0xeb,
+ 0x81, 0xe2, 0xff, 0xf7, 0xfa, 0x92, 0x06, 0xff, 0xf7,
+ 0x7e, 0x20, 0xf5, 0xff, 0xbe, 0x6f, 0xab, 0x06, 0xff,
+ 0x7f, 0x5b, 0x90, 0xe0, 0xff, 0xdb, 0xf6, 0x55, 0x05,
+ 0xff, 0xc7, 0x3f, 0x54, 0xf4, 0xff, 0xff, 0x1f, 0x29,
+ 0x07, 0xdf, 0x3d, 0x09, 0x02, 0xea, 0xff, 0x57, 0xf2,
+ 0xd6, 0x05, 0x7d, 0xff, 0x84, 0xea, 0xff, 0xff, 0x0f,
+ 0xf9, 0x7d, 0x07, 0xd7, 0x8d, 0x47, 0xf5, 0xc3, 0xfe,
+ 0xff, 0xdf, 0xdd, 0x05, 0x7b, 0xcd, 0xc7, 0xfa, 0xe8,
+ 0xfe, 0x7f, 0x9f, 0x75, 0x07, 0xdd, 0xab, 0xa0, 0x1a,
+ 0x00, 0xe1, 0x3b, 0xf0, 0xdf, 0x06, 0x6f, 0x3d, 0x11,
+ 0x0c, 0xab, 0xf6, 0xff, 0xf7, 0xf4, 0x03, 0xfd, 0xb3,
+ 0xa1, 0x86, 0x4b, 0xfe, 0xff, 0x6d, 0xbf, 0x06, 0xb7,
+ 0xba, 0x10, 0xc3, 0x22, 0x6d, 0xff, 0xe7, 0xea, 0x07,
+ 0xed, 0xbb, 0x88, 0xf2, 0x57, 0xf7, 0xff, 0x6b, 0xbe,
+ 0x02, 0x7f, 0xb3, 0xa4, 0x81, 0x00, 0xfc, 0xff, 0x6f,
+ 0xef, 0x07, 0xd5, 0xbb, 0x90, 0x08, 0x72, 0xff, 0xff,
+ 0x6b, 0xfa, 0x06, 0x7f, 0x33, 0x48, 0x09, 0xa8, 0xf7,
+ 0xff, 0x6f, 0xaf, 0x03, 0x2d, 0xb5, 0xa4, 0x08, 0x00,
+ 0xfc, 0xff, 0xef, 0xe6, 0x06, 0x97, 0x3a, 0xc8, 0xac,
+ 0xad, 0x76, 0xff, 0x67, 0x90, 0x07, 0x4d, 0x34, 0xa4,
+ 0x58, 0x77, 0xa9, 0xff, 0xef, 0xaa, 0x06, 0x97, 0xb2,
+ 0xff, 0x5f, 0xdb, 0xd2, 0x59, 0x71, 0x84, 0x03, 0xad,
+ 0xb4, 0xfe, 0x57, 0xa5, 0xec, 0x28, 0x61, 0x55, 0x07,
+ 0x17, 0xba, 0xff, 0xff, 0xff, 0xb6, 0x94, 0x70, 0xa2,
+ 0x05, 0xdd, 0xb3, 0xfd, 0x07, 0x52, 0xff, 0x28, 0x61,
+ 0xab, 0x07, 0xb7, 0xba, 0xff, 0xbf, 0x88, 0xea, 0x94,
+ 0xe8, 0xfe, 0x02, 0xfd, 0x3b, 0xff, 0xff, 0x57, 0x00,
+ 0x9a, 0x70, 0xba, 0x07, 0xb7, 0xb3, 0xff, 0xdf, 0x26,
+ 0x6f, 0x44, 0x6c, 0xef, 0x06, 0xed, 0xba, 0xfe, 0xbf,
+ 0x93, 0x1a, 0x2b, 0x68, 0xb5, 0x03, 0xdf, 0xb5, 0xfb,
+ 0xff, 0x49, 0x1f, 0x45, 0xe4, 0xfe, 0x06, 0xb5, 0x97,
+ 0xff, 0xff, 0x97, 0x86, 0x22, 0x0e, 0xaf, 0x07, 0x7f,
+ 0x23, 0x60, 0x1f, 0x20, 0xc0, 0x12, 0xa8, 0xf6, 0x05,
+ 0xd5, 0x85, 0xf7, 0xff, 0x5b, 0xf0, 0x2a, 0x0b, 0x5d,
+ 0x07, 0x7f, 0x81, 0xff, 0xff, 0x3b, 0x7e, 0x1d, 0x8f,
+ 0xfc, 0x05, 0xd5, 0xa3, 0xd6, 0xff, 0xff, 0xbf, 0x8a,
+ 0x4e, 0x55, 0x07, 0xff, 0x8a, 0x00, 0xff, 0xbf, 0x44,
+ 0x02, 0xa8, 0xfe, 0x05, 0xb5, 0xd5, 0xff, 0xff, 0xbf,
+ 0x12, 0xc1, 0x9f, 0xaa, 0x02, 0xee, 0xbb, 0x6b, 0xff,
+ 0x5f, 0xa4, 0xf0, 0x76, 0x55, 0x05, 0xb5, 0xee, 0xfd,
+ 0xf7, 0x3f, 0x29, 0xa8, 0xdd, 0xad, 0x00, 0xfe, 0x7b,
+ 0xaf, 0xfe, 0xbf, 0x04, 0xfc, 0xfb, 0x75, 0x01, 0xf5,
+ 0xad, 0xfd, 0xdb, 0x3f, 0x01, 0xb7, 0x56, 0xbd, 0x02,
+ 0x7c, 0xff, 0xb7, 0xfe, 0x37, 0x60, 0xed, 0xff, 0x6d,
+ 0x01, 0xee, 0x55, 0xed, 0x57, 0x1f, 0xaa, 0x7f, 0x55,
+ 0x55, 0x01, 0xbb, 0xff, 0x7f, 0xfd, 0xb5, 0xfa, 0xd5,
+ 0xff, 0x55, 0x05, 0x55, 0x54, 0xd5, 0x6f, 0xdf, 0x6f,
+ 0xff, 0xaa, 0x2a, 0x02, 0x57, 0xff, 0x7f, 0xb5, 0x75,
+ 0xb5, 0x55, 0xff, 0x81, 0x07};
diff --git a/ext/standard/tests/image/blank_file.bmp b/ext/standard/tests/image/blank_file.bmp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ext/standard/tests/image/blank_file.bmp
diff --git a/ext/standard/tests/image/bug13213.jpg b/ext/standard/tests/image/bug13213.jpg
new file mode 100644
index 0000000..b90c7a4
--- /dev/null
+++ b/ext/standard/tests/image/bug13213.jpg
Binary files differ
diff --git a/ext/standard/tests/image/bug13213.phpt b/ext/standard/tests/image/bug13213.phpt
new file mode 100644
index 0000000..c97b701
--- /dev/null
+++ b/ext/standard/tests/image/bug13213.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #13213 (GetImageSize and wrong JPEG Comments)
+--FILE--
+<?php
+var_dump(GetImageSize(dirname(__FILE__).'/bug13213.jpg'));
+?>
+--EXPECT--
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(10) "image/jpeg"
+}
diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt
new file mode 100644
index 0000000..6cd8275
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize.phpt
@@ -0,0 +1,211 @@
+--TEST--
+GetImageSize()
+--SKIPIF--
+<?php
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+ // Note: SWC requires zlib
+ $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(dirname(__FILE__)."/$file");
+ }
+ var_dump($result);
+?>
+--EXPECT--
+array(12) {
+ ["test1bpix.bmp"]=>
+ array(6) {
+ [0]=>
+ int(500)
+ [1]=>
+ int(345)
+ [2]=>
+ int(6)
+ [3]=>
+ string(24) "width="500" height="345""
+ ["bits"]=>
+ int(32)
+ ["mime"]=>
+ string(14) "image/x-ms-bmp"
+ }
+ ["test1pix.bmp"]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(6)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(24)
+ ["mime"]=>
+ string(14) "image/x-ms-bmp"
+ }
+ ["test1pix.jp2"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(10)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/jp2"
+ }
+ ["test1pix.jpc"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(9)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(24) "application/octet-stream"
+ }
+ ["test1pix.jpg"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(10) "image/jpeg"
+ }
+ ["test2pix.gif"]=>
+ array(7) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ string(20) "width="2" height="1""
+ ["bits"]=>
+ int(1)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/gif"
+ }
+ ["test4pix.gif"]=>
+ array(7) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ string(20) "width="4" height="1""
+ ["bits"]=>
+ int(2)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/gif"
+ }
+ ["test4pix.iff"]=>
+ array(6) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(1)
+ [2]=>
+ int(14)
+ [3]=>
+ string(20) "width="4" height="1""
+ ["bits"]=>
+ int(4)
+ ["mime"]=>
+ string(9) "image/iff"
+ }
+ ["test4pix.png"]=>
+ array(6) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(1)
+ [2]=>
+ int(3)
+ [3]=>
+ string(20) "width="4" height="1""
+ ["bits"]=>
+ int(4)
+ ["mime"]=>
+ string(9) "image/png"
+ }
+ ["test4pix.psd"]=>
+ array(5) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(1)
+ [2]=>
+ int(5)
+ [3]=>
+ string(20) "width="4" height="1""
+ ["mime"]=>
+ string(9) "image/psd"
+ }
+ ["test4pix.swf"]=>
+ array(5) {
+ [0]=>
+ int(550)
+ [1]=>
+ int(400)
+ [2]=>
+ int(4)
+ [3]=>
+ string(24) "width="550" height="400""
+ ["mime"]=>
+ string(29) "application/x-shockwave-flash"
+ }
+ ["test4pix.tif"]=>
+ array(5) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(1)
+ [2]=>
+ int(7)
+ [3]=>
+ string(20) "width="4" height="1""
+ ["mime"]=>
+ string(10) "image/tiff"
+ }
+}
diff --git a/ext/standard/tests/image/getimagesize_246x247.phpt b/ext/standard/tests/image/getimagesize_246x247.phpt
new file mode 100644
index 0000000..e5a0aea
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_246x247.phpt
@@ -0,0 +1,42 @@
+--TEST--
+GetImageSize() with 246x247 pixels
+--SKIPIF--
+<?php
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+ // Note: SWC requires zlib
+ $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^246x247\./',$file)) {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(dirname(__FILE__)."/$file");
+ }
+ var_dump($result);
+?>
+--EXPECT--
+array(1) {
+ ["246x247.png"]=>
+ array(6) {
+ [0]=>
+ int(246)
+ [1]=>
+ int(247)
+ [2]=>
+ int(3)
+ [3]=>
+ string(24) "width="246" height="247""
+ ["bits"]=>
+ int(4)
+ ["mime"]=>
+ string(9) "image/png"
+ }
+}
diff --git a/ext/standard/tests/image/getimagesize_384x385.phpt b/ext/standard/tests/image/getimagesize_384x385.phpt
new file mode 100644
index 0000000..0051df7
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_384x385.phpt
@@ -0,0 +1,42 @@
+--TEST--
+GetImageSize() with 384x385 pixels
+--SKIPIF--
+<?php
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+ // Note: SWC requires zlib
+ $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^384x385\./',$file)) {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(dirname(__FILE__)."/$file");
+ }
+ var_dump($result);
+?>
+--EXPECT--
+array(1) {
+ ["384x385.png"]=>
+ array(6) {
+ [0]=>
+ int(384)
+ [1]=>
+ int(385)
+ [2]=>
+ int(3)
+ [3]=>
+ string(24) "width="384" height="385""
+ ["bits"]=>
+ int(1)
+ ["mime"]=>
+ string(9) "image/png"
+ }
+}
diff --git a/ext/standard/tests/image/getimagesize_basic.phpt b/ext/standard/tests/image/getimagesize_basic.phpt
new file mode 100644
index 0000000..4d47225
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_basic.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test getimagesize() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ */
+
+$imagetype_filenames = array(
+ // GIF file
+ "GIF image file" => "200x100.gif",
+
+ //JPEG file
+ "JPEG image file" => "200x100.jpg",
+
+ //PNG file
+ "PNG image file" => "200x100.png",
+
+ //SWF file
+ "SWF image file" => "200x100.swf",
+
+ //BMP file
+ "BMP image file" => "200x100.bmp",
+
+ //TIFF intel byte order
+ "TIFF intel byte order image file" => "200x100.tif",
+
+ //JPC file
+ "JPC image file" => "test1pix.jpc",
+
+ //JP2 file
+ "JP2 image file" => "test1pix.jp2",
+
+ //IFF file
+ "IFF image file" => "test4pix.iff"
+);
+
+echo "*** Testing getimagesize() : basic functionality ***\n";
+
+// loop through each element of the array for imagetype
+foreach($imagetype_filenames as $key => $filename) {
+ echo "\n-- $key ($filename) --\n";
+ var_dump( getimagesize(dirname(__FILE__)."/$filename", $info) );
+ var_dump( $info );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : basic functionality ***
+
+-- GIF image file (200x100.gif) --
+array(7) {
+ [0]=>
+ int(200)
+ [1]=>
+ int(100)
+ [2]=>
+ int(1)
+ [3]=>
+ string(24) "width="200" height="100""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/gif"
+}
+array(0) {
+}
+
+-- JPEG image file (200x100.jpg) --
+array(7) {
+ [0]=>
+ int(200)
+ [1]=>
+ int(100)
+ [2]=>
+ int(2)
+ [3]=>
+ string(24) "width="200" height="100""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(10) "image/jpeg"
+}
+array(1) {
+ ["APP0"]=>
+ string(%d)%s
+}
+
+-- PNG image file (200x100.png) --
+array(6) {
+ [0]=>
+ int(200)
+ [1]=>
+ int(100)
+ [2]=>
+ int(3)
+ [3]=>
+ string(24) "width="200" height="100""
+ ["bits"]=>
+ int(8)
+ ["mime"]=>
+ string(9) "image/png"
+}
+array(0) {
+}
+
+-- SWF image file (200x100.swf) --
+array(5) {
+ [0]=>
+ int(200)
+ [1]=>
+ int(100)
+ [2]=>
+ int(4)
+ [3]=>
+ string(24) "width="200" height="100""
+ ["mime"]=>
+ string(29) "application/x-shockwave-flash"
+}
+array(0) {
+}
+
+-- BMP image file (200x100.bmp) --
+array(6) {
+ [0]=>
+ int(200)
+ [1]=>
+ int(100)
+ [2]=>
+ int(6)
+ [3]=>
+ string(24) "width="200" height="100""
+ ["bits"]=>
+ int(24)
+ ["mime"]=>
+ string(14) "image/x-ms-bmp"
+}
+array(0) {
+}
+
+-- TIFF intel byte order image file (200x100.tif) --
+array(5) {
+ [0]=>
+ int(200)
+ [1]=>
+ int(100)
+ [2]=>
+ int(7)
+ [3]=>
+ string(24) "width="200" height="100""
+ ["mime"]=>
+ string(10) "image/tiff"
+}
+array(0) {
+}
+
+-- JPC image file (test1pix.jpc) --
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(9)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(24) "application/octet-stream"
+}
+array(0) {
+}
+
+-- JP2 image file (test1pix.jp2) --
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(10)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(8)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/jp2"
+}
+array(0) {
+}
+
+-- IFF image file (test4pix.iff) --
+array(6) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(1)
+ [2]=>
+ int(14)
+ [3]=>
+ string(20) "width="4" height="1""
+ ["bits"]=>
+ int(4)
+ ["mime"]=>
+ string(9) "image/iff"
+}
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_error1.phpt b/ext/standard/tests/image/getimagesize_error1.phpt
new file mode 100644
index 0000000..947379d
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_error1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test getimagesize() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getimagesize() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing getimagesize() function with Zero arguments --\n";
+var_dump( getimagesize() );
+
+//Test getimagesize with one more than the expected number of arguments
+echo "\n-- Testing getimagesize() function with more than expected no. of arguments --\n";
+$imagefile = 'string_val';
+$info = array(1, 2);
+$extra_arg = 10;
+var_dump( getimagesize($imagefile, $info, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : error conditions ***
+
+-- Testing getimagesize() function with Zero arguments --
+
+Warning: getimagesize() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing getimagesize() function with more than expected no. of arguments --
+
+Warning: getimagesize() 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/image/getimagesize_jpgapp.phpt b/ext/standard/tests/image/getimagesize_jpgapp.phpt
new file mode 100644
index 0000000..8e179d2
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_jpgapp.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test getimagesize() function : basic functionality - load APP info from jpeg.
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_JPEG")) {
+ die("skip jpeg format is not available");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+/*
+ * Load APP info from jpeg
+ */
+
+$arr['this'] = "will";
+$arr['all'] = "be destroyed!";
+$arr['APP1'] = "and this too";
+
+getimagesize( dirname(__FILE__)."/testAPP.jpg", $arr);
+
+foreach ($arr as $key => $value) {
+ echo "$key - length: ". strlen($value) ."; md5: " . md5($value) . "\n" ;
+}
+
+?>
+===DONE===
+--EXPECTF--
+APP1 - length: 1717; md5: 02cbf4ba6640c131422483138c968516
+APP2 - length: 7275; md5: f5036ccca2031e8bf932bcbd4aca4355
+APP13 - length: 42; md5: 2202998bd05e78bcb419f08c070d6f61
+===DONE===
diff --git a/ext/standard/tests/image/getimagesize_swc.phpt b/ext/standard/tests/image/getimagesize_swc.phpt
new file mode 100644
index 0000000..f8c7449
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_swc.phpt
@@ -0,0 +1,25 @@
+--TEST--
+GetImageSize() for compressed swf files
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_SWC") || !extension_loaded('zlib')) {
+ die("skip zlib extension is not available");
+ }
+?>
+--FILE--
+<?php
+ var_dump(getimagesize(dirname(__FILE__) . "/test13pix.swf"));
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ int(550)
+ [1]=>
+ int(400)
+ [2]=>
+ int(13)
+ [3]=>
+ string(24) "width="550" height="400""
+ ["mime"]=>
+ string(29) "application/x-shockwave-flash"
+}
diff --git a/ext/standard/tests/image/getimagesize_tif_mm.phpt b/ext/standard/tests/image/getimagesize_tif_mm.phpt
new file mode 100644
index 0000000..8bc88fd
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_tif_mm.phpt
@@ -0,0 +1,39 @@
+--TEST--
+GetImageSize() for tiff format with big-endian (aka Motorola, aka MM) ordering
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_TIFF_MM")) {
+ die("skip tiff_mm file format is not available");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getimagesize() : tiff_mm format ***\n";
+var_dump(getimagesize(dirname(__FILE__) . "/2x2mm.tif", $arr));
+var_dump($arr);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing getimagesize() : tiff_mm format ***
+array(5) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ [2]=>
+ int(8)
+ [3]=>
+ string(20) "width="2" height="2""
+ ["mime"]=>
+ string(10) "image/tiff"
+}
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_variation1.phpt b/ext/standard/tests/image/getimagesize_variation1.phpt
new file mode 100644
index 0000000..78795f7
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_variation1.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test getimagesize() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing getimagesize() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$info = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ "0" => 0,
+ "1" => 1,
+ "12345" => 12345,
+ "-2345" => -2345,
+
+ // float data
+ "10.5" => 10.5,
+ "-10.5" => -10.5,
+ "10.1234567e5" => 10.1234567e10,
+ "10.7654321e-5" => 10.7654321E-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
+ "new stdclass()" => new stdclass(),
+
+ // undefined data
+ "undefined_var" => $undefined_var,
+
+ // unset data
+ "unset_var" => $unset_var,
+);
+
+// loop through each element of the array for imagefile
+
+foreach($values as $key => $value) {
+ echo "\n-- Arg value: $key --\n";
+ var_dump( getimagesize($value, $info) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(%d)
+Error: 8 - Undefined variable: unset_var, %s(%d)
+
+-- Arg value: 0 --
+Error: 2 - getimagesize(0): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: 1 --
+Error: 2 - getimagesize(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: 12345 --
+Error: 2 - getimagesize(12345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: -2345 --
+Error: 2 - getimagesize(-2345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: 10.5 --
+Error: 2 - getimagesize(10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: -10.5 --
+Error: 2 - getimagesize(-10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: 10.1234567e5 --
+Error: 2 - getimagesize(101234567000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: 10.7654321e-5 --
+Error: 2 - getimagesize(0.000107654321): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: 12346 --
+Error: 2 - getimagesize(0.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: array() --
+Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+-- Arg value: array(0) --
+Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+-- Arg value: array(1) --
+Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+-- Arg value: array(1, 2) --
+Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+-- Arg value: array('color' => 'red', 'item' => 'pen') --
+Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+-- Arg value: NULL --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: null --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: true --
+Error: 2 - getimagesize(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: false --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: TRUE --
+Error: 2 - getimagesize(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+-- Arg value: FALSE --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: "" --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: '' --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: new stdclass() --
+Error: 2 - getimagesize() expects parameter 1 to be string, object given, %s(%d)
+NULL
+
+-- Arg value: undefined_var --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+
+-- Arg value: unset_var --
+Error: 2 - getimagesize(): Filename cannot be empty, %s(%d)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt
new file mode 100644
index 0000000..9e8c16b
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_variation2.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test getimagesize() function : usage variations - unexpected type for arg 2
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_JPEG")) {
+ die("skip jpeg format is not available");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing getimagesize() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$imagefile = dirname(__FILE__)."/test1pix.jpg";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ "0" => 0,
+ "1" => 1,
+ "12345" => 12345,
+ "-2345" => -2345,
+
+ // float data
+ "10.5" => 10.5,
+ "-10.5" => -10.5,
+ "10.1234567e5" => 10.1234567e10,
+ "10.7654321e-5" => 10.7654321E-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
+ "new stdclass()" => new stdclass(),
+
+ // undefined data
+ "undefined_var" => $undefined_var,
+
+ // unset data
+ "unset_var" => $unset_var,
+);
+
+// loop through each element of the array for info
+
+foreach($values as $key => $value) {
+ echo "\n-- Arg value $key --\n";
+ getimagesize($imagefile, $value);
+ var_dump(bin2hex($value["APP0"]));
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(%d)
+Error: 8 - Undefined variable: unset_var, %s(%d)
+
+-- Arg value 0 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value 1 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value 12345 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value -2345 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value 10.5 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value -10.5 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value 10.1234567e5 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value 10.7654321e-5 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value 12346 --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value array() --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value array(0) --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value array(1) --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value array(1, 2) --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value array('color' => 'red', 'item' => 'pen') --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value NULL --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value null --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value true --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value false --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value TRUE --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value FALSE --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value "" --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value '' --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value new stdclass() --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value undefined_var --
+string(28) "4a46494600010201006000600000"
+
+-- Arg value unset_var --
+string(28) "4a46494600010201006000600000"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_variation3.phpt b/ext/standard/tests/image/getimagesize_variation3.phpt
new file mode 100644
index 0000000..9db2b5e
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_variation3.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test getimagesize() function : variation - Passing non image files
+--FILE--
+<?php
+/* Prototype : array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ */
+
+
+$file_types_array = array (
+ //File containing text string
+ "File with text data" => "test.txt",
+
+ //File containing forcibly corrupted bmp image
+ "File with corrupted BMP data" => "200x100_unknown.unknown",
+
+ //File which doesn't exist
+ "Non-existent file" => "nofile.ext",
+
+ //File having no data
+ "Empty File" => "blank_file.bmp"
+);
+
+echo "*** Testing getimagesize() : variation ***\n";
+
+//loop through each element of the array for filename
+foreach($file_types_array as $key => $filename) {
+ echo "\n-- $key ($filename) --\n";
+ var_dump( getimagesize(dirname(__FILE__)."/$filename" ) );
+ var_dump( getimagesize(dirname(__FILE__)."/$filename", $info) );
+ var_dump( $info );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : variation ***
+
+-- File with text data (test.txt) --
+bool(false)
+bool(false)
+array(0) {
+}
+
+-- File with corrupted BMP data (200x100_unknown.unknown) --
+bool(false)
+bool(false)
+array(0) {
+}
+
+-- Non-existent file (nofile.ext) --
+
+Warning: getimagesize(%snofile.ext): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: getimagesize(%snofile.ext): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+array(0) {
+}
+
+-- Empty File (blank_file.bmp) --
+
+Notice: getimagesize(): Read error! in %s on line %d
+bool(false)
+
+Notice: getimagesize(): Read error! in %s on line %d
+bool(false)
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_variation4.phpt b/ext/standard/tests/image/getimagesize_variation4.phpt
new file mode 100644
index 0000000..8fa690c
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_variation4.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test getimagesize() function : variation - For shockwave-flash format
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_SWC") || !extension_loaded('zlib')) {
+ die("skip zlib extension is not available");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing getimagesize() : variation ***\n";
+
+var_dump( getimagesize(dirname(__FILE__)."/test13pix.swf", $info) );
+var_dump( $info );
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : variation ***
+array(5) {
+ [0]=>
+ int(550)
+ [1]=>
+ int(400)
+ [2]=>
+ int(13)
+ [3]=>
+ string(24) "width="550" height="400""
+ ["mime"]=>
+ string(29) "application/x-shockwave-flash"
+}
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_variation_003.phpt b/ext/standard/tests/image/getimagesize_variation_003.phpt
new file mode 100644
index 0000000..1de9850
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_variation_003.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test getimagesize() function : variation - Passing non image files
+--FILE--
+<?php
+/* Prototype : array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ */
+
+
+$file_types_array = array (
+ //File containing text string
+ "File with text data" => "test.txt",
+
+ //File containing forcibly corrupted bmp image
+ "File with corrupted BMP data" => "200x100_unknown.unknown",
+
+ //File which doesn't exist
+ "Non-existent file" => "nofile.ext",
+
+ //File having no data
+ "Empty File" => "blank_file.bmp"
+);
+
+echo "*** Testing getimagesize() : variation ***\n";
+
+//loop through each element of the array for filename
+foreach($file_types_array as $key => $filename) {
+ echo "\n-- $key ($filename) --\n";
+ var_dump( getimagesize(dirname(__FILE__)."/$filename" ) );
+ var_dump( getimagesize(dirname(__FILE__)."/$filename", $info) );
+ var_dump( $info );
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : variation ***
+
+-- File with text data (test.txt) --
+bool(false)
+bool(false)
+array(0) {
+}
+
+-- File with corrupted BMP data (200x100_unknown.unknown) --
+bool(false)
+bool(false)
+array(0) {
+}
+
+-- Non-existent file (nofile.ext) --
+
+Warning: getimagesize(%s): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: getimagesize(%s): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+array(0) {
+}
+
+-- Empty File (blank_file.bmp) --
+
+Notice: getimagesize(): Read error! in %s on line %d
+bool(false)
+
+Notice: getimagesize(): Read error! in %s on line %d
+bool(false)
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/getimagesize_variation_005.phpt b/ext/standard/tests/image/getimagesize_variation_005.phpt
new file mode 100644
index 0000000..6f0ad8f
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_variation_005.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test getimagesize() function : basic functionality for shockwave-flash
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_SWC") || !extension_loaded('zlib')) {
+ die("skip zlib extension is not available or SWC not supported");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing getimagesize() : basic functionality ***\n";
+
+var_dump( getimagesize(dirname(__FILE__)."/test13pix.swf", $info) );
+var_dump( $info );
+?>
+===DONE===
+--EXPECTF--
+*** Testing getimagesize() : basic functionality ***
+array(5) {
+ [0]=>
+ int(550)
+ [1]=>
+ int(400)
+ [2]=>
+ int(13)
+ [3]=>
+ string(24) "width="550" height="400""
+ ["mime"]=>
+ string(29) "application/x-shockwave-flash"
+}
+array(0) {
+}
+===DONE===
diff --git a/ext/standard/tests/image/getimagesize_wbmp.phpt b/ext/standard/tests/image/getimagesize_wbmp.phpt
new file mode 100644
index 0000000..503b5f1
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_wbmp.phpt
@@ -0,0 +1,39 @@
+--TEST--
+GetImageSize() for wbmp format
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_WBMP")) {
+ die("skip wbmp file format is not available");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getimagesize() : wbmp format ***\n";
+var_dump(getimagesize(dirname(__FILE__) . "/75x50.wbmp", $arr));
+var_dump($arr);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing getimagesize() : wbmp format ***
+array(5) {
+ [0]=>
+ int(75)
+ [1]=>
+ int(50)
+ [2]=>
+ int(15)
+ [3]=>
+ string(22) "width="75" height="50""
+ ["mime"]=>
+ string(18) "image/vnd.wap.wbmp"
+}
+array(0) {
+}
+===DONE===
diff --git a/ext/standard/tests/image/getimagesize_xbm.phpt b/ext/standard/tests/image/getimagesize_xbm.phpt
new file mode 100644
index 0000000..53406a8
--- /dev/null
+++ b/ext/standard/tests/image/getimagesize_xbm.phpt
@@ -0,0 +1,39 @@
+--TEST--
+GetImageSize() for xbm format
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_XBM")) {
+ die("skip xbm file format is not available");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : proto array getimagesize(string imagefile [, array info])
+ * Description: Get the size of an image as 4-element array
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "*** Testing getimagesize() : xbm format ***\n";
+var_dump(getimagesize(dirname(__FILE__) . "/75x50.xbm", $arr));
+var_dump($arr);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing getimagesize() : xbm format ***
+array(5) {
+ [0]=>
+ int(75)
+ [1]=>
+ int(50)
+ [2]=>
+ int(16)
+ [3]=>
+ string(22) "width="75" height="50""
+ ["mime"]=>
+ string(9) "image/xbm"
+}
+array(0) {
+}
+===DONE===
diff --git a/ext/standard/tests/image/getimagesizefromstring1.phpt b/ext/standard/tests/image/getimagesizefromstring1.phpt
new file mode 100644
index 0000000..df75be5
--- /dev/null
+++ b/ext/standard/tests/image/getimagesizefromstring1.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Compare getimagesize and getimagesizefromstring
+--FILE--
+<?PHP
+$img = __DIR__ . '/test.gif';
+
+$i1 = getimagesize($img);
+
+$data = file_get_contents($img);
+
+$i2 = getimagesizefromstring($data);
+
+var_dump($i1);
+var_dump($i2);
+?>
+--EXPECT--
+array(7) {
+ [0]=>
+ int(120)
+ [1]=>
+ int(67)
+ [2]=>
+ int(1)
+ [3]=>
+ string(23) "width="120" height="67""
+ ["bits"]=>
+ int(7)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/gif"
+}
+array(7) {
+ [0]=>
+ int(120)
+ [1]=>
+ int(67)
+ [2]=>
+ int(1)
+ [3]=>
+ string(23) "width="120" height="67""
+ ["bits"]=>
+ int(7)
+ ["channels"]=>
+ int(3)
+ ["mime"]=>
+ string(9) "image/gif"
+}
+
diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt
new file mode 100644
index 0000000..31bcfd6
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_extension.phpt
@@ -0,0 +1,103 @@
+--TEST--
+image_type_to_extension()
+--SKIPIF--
+<?php
+ if (!function_exists('image_type_to_extension')) die('skip image_type_to_extension() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+ $constants = array(
+ "IMAGETYPE_GIF" => IMAGETYPE_GIF,
+ "IMAGETYPE_JPEG" => IMAGETYPE_JPEG,
+ "IMAGETYPE_PNG" => IMAGETYPE_PNG,
+ "IMAGETYPE_SWF" => IMAGETYPE_SWF,
+ "IMAGETYPE_PSD" => IMAGETYPE_PSD,
+ "IMAGETYPE_BMP" => IMAGETYPE_BMP,
+ "IMAGETYPE_TIFF_II" => IMAGETYPE_TIFF_II,
+ "IMAGETYPE_TIFF_MM" => IMAGETYPE_TIFF_MM,
+ "IMAGETYPE_JPC" => IMAGETYPE_JPC,
+ "IMAGETYPE_JP2" => IMAGETYPE_JP2,
+ "IMAGETYPE_JPX" => IMAGETYPE_JPX,
+ "IMAGETYPE_JB2" => IMAGETYPE_JB2,
+ "IMAGETYPE_IFF" => IMAGETYPE_IFF,
+ "IMAGETYPE_WBMP" => IMAGETYPE_WBMP,
+ "IMAGETYPE_JPEG2000" => IMAGETYPE_JPEG2000,
+ "IMAGETYPE_XBM" => IMAGETYPE_XBM
+ );
+ foreach($constants as $name => $constant) {
+ printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false));
+ }
+
+ var_dump(image_type_to_extension(-1, array()));
+ var_dump(image_type_to_extension(new stdclass));
+ var_dump(image_type_to_extension(1000000, NULL));
+ var_dump(image_type_to_extension());
+ var_dump(image_type_to_extension(0));
+ var_dump(image_type_to_extension(0, 0, 0));
+?>
+Done
+--EXPECTF--
+Constant: IMAGETYPE_GIF
+ With dot: .gif
+ Without dot: gif
+Constant: IMAGETYPE_JPEG
+ With dot: .jpeg
+ Without dot: jpeg
+Constant: IMAGETYPE_PNG
+ With dot: .png
+ Without dot: png
+Constant: IMAGETYPE_SWF
+ With dot: .swf
+ Without dot: swf
+Constant: IMAGETYPE_PSD
+ With dot: .psd
+ Without dot: psd
+Constant: IMAGETYPE_BMP
+ With dot: .bmp
+ Without dot: bmp
+Constant: IMAGETYPE_TIFF_II
+ With dot: .tiff
+ Without dot: tiff
+Constant: IMAGETYPE_TIFF_MM
+ With dot: .tiff
+ Without dot: tiff
+Constant: IMAGETYPE_JPC
+ With dot: .jpc
+ Without dot: jpc
+Constant: IMAGETYPE_JP2
+ With dot: .jp2
+ Without dot: jp2
+Constant: IMAGETYPE_JPX
+ With dot: .jpx
+ Without dot: jpx
+Constant: IMAGETYPE_JB2
+ With dot: .jb2
+ Without dot: jb2
+Constant: IMAGETYPE_IFF
+ With dot: .iff
+ Without dot: iff
+Constant: IMAGETYPE_WBMP
+ With dot: .bmp
+ Without dot: bmp
+Constant: IMAGETYPE_JPEG2000
+ With dot: .jpc
+ Without dot: jpc
+Constant: IMAGETYPE_XBM
+ With dot: .xbm
+ Without dot: xbm
+
+Warning: image_type_to_extension() expects parameter 2 to be boolean, array given in %s on line %d
+bool(false)
+
+Warning: image_type_to_extension() expects parameter 1 to be long, object given in %s on line %d
+bool(false)
+bool(false)
+
+Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+bool(false)
+
+Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt
new file mode 100644
index 0000000..d83ab8d
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type.phpt
@@ -0,0 +1,53 @@
+--TEST--
+image_type_to_mime_type()
+--SKIPIF--
+<?php
+ if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+ // Note: SWC requires zlib
+ $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__));
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(dirname(__FILE__)."/$file");
+ $result[$file] = image_type_to_mime_type($result[$file][2]);
+ }
+ var_dump($result);
+?>
+--EXPECT--
+array(12) {
+ ["test1bpix.bmp"]=>
+ string(14) "image/x-ms-bmp"
+ ["test1pix.bmp"]=>
+ string(14) "image/x-ms-bmp"
+ ["test1pix.jp2"]=>
+ string(9) "image/jp2"
+ ["test1pix.jpc"]=>
+ string(24) "application/octet-stream"
+ ["test1pix.jpg"]=>
+ string(10) "image/jpeg"
+ ["test2pix.gif"]=>
+ string(9) "image/gif"
+ ["test4pix.gif"]=>
+ string(9) "image/gif"
+ ["test4pix.iff"]=>
+ string(9) "image/iff"
+ ["test4pix.png"]=>
+ string(9) "image/png"
+ ["test4pix.psd"]=>
+ string(9) "image/psd"
+ ["test4pix.swf"]=>
+ string(29) "application/x-shockwave-flash"
+ ["test4pix.tif"]=>
+ string(10) "image/tiff"
+}
diff --git a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt
new file mode 100644
index 0000000..b81bdbd
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt
@@ -0,0 +1,63 @@
+--TEST--
+image_type_to_mime_type()
+--SKIPIF--
+<?php
+ if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available');
+?>
+--FILE--
+<?php
+
+/* Prototype : string image_type_to_mime_type ( int $imagetype )
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype.
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "Starting image_type_to_mime_type() test\n\n";
+
+$image_types = array (
+ IMAGETYPE_GIF,
+ IMAGETYPE_JPEG,
+ IMAGETYPE_PNG,
+ IMAGETYPE_SWF,
+ IMAGETYPE_PSD,
+ IMAGETYPE_BMP,
+ IMAGETYPE_TIFF_II,
+ IMAGETYPE_TIFF_MM,
+ IMAGETYPE_JPC,
+ IMAGETYPE_JP2,
+ IMAGETYPE_JPX,
+ IMAGETYPE_JB2,
+ IMAGETYPE_IFF,
+ IMAGETYPE_WBMP,
+ IMAGETYPE_JPEG2000,
+ IMAGETYPE_XBM
+);
+
+ foreach($image_types as $image_type) {
+ var_dump(image_type_to_mime_type($image_type));
+ }
+
+echo "\nDone image_type_to_mime_type() test\n";
+?>
+--EXPECT--
+Starting image_type_to_mime_type() test
+
+string(9) "image/gif"
+string(10) "image/jpeg"
+string(9) "image/png"
+string(29) "application/x-shockwave-flash"
+string(9) "image/psd"
+string(14) "image/x-ms-bmp"
+string(10) "image/tiff"
+string(10) "image/tiff"
+string(24) "application/octet-stream"
+string(9) "image/jp2"
+string(24) "application/octet-stream"
+string(24) "application/octet-stream"
+string(9) "image/iff"
+string(18) "image/vnd.wap.wbmp"
+string(24) "application/octet-stream"
+string(9) "image/xbm"
+
+Done image_type_to_mime_type() test
diff --git a/ext/standard/tests/image/image_type_to_mime_type_error.phpt b/ext/standard/tests/image/image_type_to_mime_type_error.phpt
new file mode 100644
index 0000000..88aacbf
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test image_type_to_mime_type() function : error conditions - Pass incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : proto string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+$imagetype = IMAGETYPE_GIF;
+$extra_arg = 10;
+echo "*** Testing image_type_to_mime_type() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing image_type_to_mime_type() function with Zero arguments --\n";
+var_dump( image_type_to_mime_type() );
+
+//Test image_type_to_mime_type with one more than the expected number of arguments
+echo "\n-- Testing image_type_to_mime_type() function with more than expected no. of arguments --\n";
+var_dump( image_type_to_mime_type($imagetype, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing image_type_to_mime_type() : error conditions ***
+
+-- Testing image_type_to_mime_type() function with Zero arguments --
+
+Warning: image_type_to_mime_type() expects exactly 1 parameter, 0 given in %simage_type_to_mime_type_error.php on line 13
+NULL
+
+-- Testing image_type_to_mime_type() function with more than expected no. of arguments --
+
+Warning: image_type_to_mime_type() expects exactly 1 parameter, 2 given in %simage_type_to_mime_type_error.php on line 17
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt
new file mode 100644
index 0000000..0023b71
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt
@@ -0,0 +1,152 @@
+--TEST--
+Test image_type_to_mime_type() function : usage variations - Pass different data types as imagetype
+--FILE--
+<?php
+/* Prototype : string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+class MyClass
+{
+ function __toString() {
+ return "MyClass";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 100.5,
+ -100.5,
+ 100.1234567e10,
+ 100.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through each element of the array for imagetype
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( image_type_to_mime_type($value) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing image_type_to_mime_type() : usage variations ***
+
+-- Iteration 1 --
+string(24) "application/octet-stream"
+
+-- Iteration 2 --
+string(24) "application/octet-stream"
+
+-- Iteration 3 --
+string(24) "application/octet-stream"
+
+-- Iteration 4 --
+string(24) "application/octet-stream"
+
+-- Iteration 5 --
+string(24) "application/octet-stream"
+
+-- Iteration 6 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 8 --
+string(24) "application/octet-stream"
+
+-- Iteration 9 --
+string(24) "application/octet-stream"
+
+-- Iteration 10 --
+string(9) "image/gif"
+
+-- Iteration 11 --
+string(24) "application/octet-stream"
+
+-- Iteration 12 --
+string(9) "image/gif"
+
+-- Iteration 13 --
+string(24) "application/octet-stream"
+
+-- Iteration 14 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: image_type_to_mime_type() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 19 --
+string(24) "application/octet-stream"
+
+-- Iteration 20 --
+string(24) "application/octet-stream"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt
new file mode 100644
index 0000000..141bc57
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test image_type_to_mime_type() function : usage variations - Pass decimal, octal, and hexadecimal values as imagetype
+--FILE--
+<?php
+/* Prototype : string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+$values = array (
+ //Decimal values
+ 0,
+ 1,
+ 12345,
+ -12345,
+
+ //Octal values
+ 02,
+ 010,
+ 030071,
+ -030071,
+
+ //Hexadecimal values
+ 0x0,
+ 0x1,
+ 0xABCD,
+ -0xABCD
+);
+
+// loop through each element of the array for imagetype
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( image_type_to_mime_type($value) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECT--
+*** Testing image_type_to_mime_type() : usage variations ***
+
+-- Iteration 1 --
+string(24) "application/octet-stream"
+
+-- Iteration 2 --
+string(9) "image/gif"
+
+-- Iteration 3 --
+string(24) "application/octet-stream"
+
+-- Iteration 4 --
+string(24) "application/octet-stream"
+
+-- Iteration 5 --
+string(10) "image/jpeg"
+
+-- Iteration 6 --
+string(10) "image/tiff"
+
+-- Iteration 7 --
+string(24) "application/octet-stream"
+
+-- Iteration 8 --
+string(24) "application/octet-stream"
+
+-- Iteration 9 --
+string(24) "application/octet-stream"
+
+-- Iteration 10 --
+string(9) "image/gif"
+
+-- Iteration 11 --
+string(24) "application/octet-stream"
+
+-- Iteration 12 --
+string(24) "application/octet-stream"
+===DONE===
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt
new file mode 100644
index 0000000..192f23d
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt
@@ -0,0 +1,79 @@
+--TEST--
+image_type_to_mime_type() (passinf equivalent integer values)
+--CREDITS--
+Sanjay Mantoor <sanjay.mantoor@gmail.com>
+--FILE--
+<?php
+/* Prototype : string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
+
+for($imagetype = 0; $imagetype <= IMAGETYPE_COUNT; ++$imagetype) {
+ echo "\n-- Iteration $imagetype --\n";
+ var_dump(image_type_to_mime_type($imagetype));
+}
+?>
+===DONE===
+--EXPECTREGEX--
+\*\*\* Testing image_type_to_mime_type\(\) : usage variations \*\*\*
+
+-- Iteration 0 --
+string\(24\) "application\/octet-stream"
+
+-- Iteration 1 --
+string\(9\) "image\/gif"
+
+-- Iteration 2 --
+string\(10\) "image\/jpeg"
+
+-- Iteration 3 --
+string\(9\) "image\/png"
+
+-- Iteration 4 --
+string\(29\) "application\/x-shockwave-flash"
+
+-- Iteration 5 --
+string\(9\) "image\/psd"
+
+-- Iteration 6 --
+string\(14\) "image\/x-ms-bmp"
+
+-- Iteration 7 --
+string\(10\) "image\/tiff"
+
+-- Iteration 8 --
+string\(10\) "image\/tiff"
+
+-- Iteration 9 --
+string\(24\) "application\/octet-stream"
+
+-- Iteration 10 --
+string\(9\) "image\/jp2"
+
+-- Iteration 11 --
+string\(24\) "application\/octet-stream"
+
+-- Iteration 12 --
+string\(24\) "application\/octet-stream"
+
+-- Iteration 13 --
+string\(2[49]\) "application\/(x-shockwave-flash|octet-stream)"
+
+-- Iteration 14 --
+string\(9\) "image\/iff"
+
+-- Iteration 15 --
+string\(18\) "image\/vnd.wap.wbmp"
+
+-- Iteration 16 --
+string\(9\) "image\/xbm"
+
+-- Iteration 17 --
+string\(24\) "image\/vnd.microsoft.icon"
+
+-- Iteration 18 --
+string\(24\) "application\/octet-stream"
+===DONE===
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt
new file mode 100644
index 0000000..a67bb86
--- /dev/null
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test image_type_to_mime_type() function : usage variations - Passing IMAGETYPE_ICO and IMAGETYPE_SWC
+--SKIPIF--
+<?php
+ if (!defined("IMAGETYPE_SWC") || !defined("IMAGETYPE_ICO") || !extension_loaded('zlib')) {
+ die("skip zlib extension is not available or IMAGETYPE_SWC/IMAGETYPE_ICO is not defined ");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : string image_type_to_mime_type(int imagetype)
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
+ * Source code: ext/standard/image.c
+ */
+
+
+echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+var_dump( image_type_to_mime_type(IMAGETYPE_ICO) );
+var_dump( image_type_to_mime_type(IMAGETYPE_SWC) );
+?>
+===DONE===
+--EXPECT--
+*** Testing image_type_to_mime_type() : usage variations ***
+string(24) "image/vnd.microsoft.icon"
+string(29) "application/x-shockwave-flash"
+===DONE===
diff --git a/ext/standard/tests/image/iptcembed_001.phpt b/ext/standard/tests/image/iptcembed_001.phpt
new file mode 100644
index 0000000..feaddde
--- /dev/null
+++ b/ext/standard/tests/image/iptcembed_001.phpt
@@ -0,0 +1,18 @@
+--TEST--
+iptcembed() and wrong file
+--FILE--
+<?php
+
+$file = dirname(__FILE__).'/iptcembed_001.data';
+$fp = fopen($file, "w");
+fwrite($fp, "-1-1");
+fclose($fp);
+
+var_dump(iptcembed(-1, $file, -1));
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+Done
diff --git a/ext/standard/tests/image/skipif_imagetype.inc b/ext/standard/tests/image/skipif_imagetype.inc
new file mode 100644
index 0000000..827f10c
--- /dev/null
+++ b/ext/standard/tests/image/skipif_imagetype.inc
@@ -0,0 +1,15 @@
+<?php
+if (!defined('IMAGETYPE_GIF')) die('skip images of type GIF not supported');
+if (!defined('IMAGETYPE_JPEG')) die('skip images of type JPEG not supported');
+if (!defined('IMAGETYPE_PNG')) die('skip images of type PNG not supported');
+if (!defined('IMAGETYPE_SWF')) die('skip images of type SWF not supported');
+if (!defined('IMAGETYPE_PSD')) die('skip images of type PSD not supported');
+if (!defined('IMAGETYPE_BMP')) die('skip images of type BMP not supported');
+if (!defined('IMAGETYPE_TIFF_II')) die('skip images of type TIFF not supported');
+if (!defined('IMAGETYPE_TIFF_MM')) die('skip images of type TIFF not supported');
+if (!defined('IMAGETYPE_JPC')) die('skip images of type JPC not supported');
+//if (!defined('IMAGETYPE_JP2')) die('skip images of type JP2 not supported');
+//if (!defined('IMAGETYPE_JPX')) die('skip images of type JPX not supported');
+//if (!defined('IMAGETYPE_JB2')) die('skip images of type JB2 not supported');
+if (!defined('IMAGETYPE_IFF')) die('skip images of type IFF not supported');
+?>
diff --git a/ext/standard/tests/image/test.gif b/ext/standard/tests/image/test.gif
new file mode 100644
index 0000000..f352c73
--- /dev/null
+++ b/ext/standard/tests/image/test.gif
Binary files differ
diff --git a/ext/standard/tests/image/test.txt b/ext/standard/tests/image/test.txt
new file mode 100644
index 0000000..81c9dfd
--- /dev/null
+++ b/ext/standard/tests/image/test.txt
@@ -0,0 +1 @@
+Testing getimagesize \ No newline at end of file
diff --git a/ext/standard/tests/image/test13pix.swf b/ext/standard/tests/image/test13pix.swf
new file mode 100755
index 0000000..0d40cb7
--- /dev/null
+++ b/ext/standard/tests/image/test13pix.swf
Binary files differ
diff --git a/ext/standard/tests/image/test1bpix.bmp b/ext/standard/tests/image/test1bpix.bmp
new file mode 100644
index 0000000..5522e50
--- /dev/null
+++ b/ext/standard/tests/image/test1bpix.bmp
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.bmp b/ext/standard/tests/image/test1pix.bmp
new file mode 100644
index 0000000..f3799d2
--- /dev/null
+++ b/ext/standard/tests/image/test1pix.bmp
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.jp2 b/ext/standard/tests/image/test1pix.jp2
new file mode 100644
index 0000000..8a1172e
--- /dev/null
+++ b/ext/standard/tests/image/test1pix.jp2
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.jpc b/ext/standard/tests/image/test1pix.jpc
new file mode 100644
index 0000000..ac11c6b
--- /dev/null
+++ b/ext/standard/tests/image/test1pix.jpc
Binary files differ
diff --git a/ext/standard/tests/image/test1pix.jpg b/ext/standard/tests/image/test1pix.jpg
new file mode 100644
index 0000000..121decb
--- /dev/null
+++ b/ext/standard/tests/image/test1pix.jpg
Binary files differ
diff --git a/ext/standard/tests/image/test2pix.gif b/ext/standard/tests/image/test2pix.gif
new file mode 100644
index 0000000..c4d4483
--- /dev/null
+++ b/ext/standard/tests/image/test2pix.gif
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.gif b/ext/standard/tests/image/test4pix.gif
new file mode 100644
index 0000000..a02ebe9
--- /dev/null
+++ b/ext/standard/tests/image/test4pix.gif
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.iff b/ext/standard/tests/image/test4pix.iff
new file mode 100644
index 0000000..fe9daeb
--- /dev/null
+++ b/ext/standard/tests/image/test4pix.iff
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.png b/ext/standard/tests/image/test4pix.png
new file mode 100644
index 0000000..2b75ac5
--- /dev/null
+++ b/ext/standard/tests/image/test4pix.png
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.psd b/ext/standard/tests/image/test4pix.psd
new file mode 100644
index 0000000..4c37823
--- /dev/null
+++ b/ext/standard/tests/image/test4pix.psd
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.swf b/ext/standard/tests/image/test4pix.swf
new file mode 100755
index 0000000..b1d41c6
--- /dev/null
+++ b/ext/standard/tests/image/test4pix.swf
Binary files differ
diff --git a/ext/standard/tests/image/test4pix.tif b/ext/standard/tests/image/test4pix.tif
new file mode 100644
index 0000000..13367ee
--- /dev/null
+++ b/ext/standard/tests/image/test4pix.tif
Binary files differ
diff --git a/ext/standard/tests/image/testAPP.jpg b/ext/standard/tests/image/testAPP.jpg
new file mode 100644
index 0000000..3936a42
--- /dev/null
+++ b/ext/standard/tests/image/testAPP.jpg
Binary files differ
diff --git a/ext/standard/tests/mail/bug51604.phpt b/ext/standard/tests/mail/bug51604.phpt
new file mode 100644
index 0000000..a657021
--- /dev/null
+++ b/ext/standard/tests/mail/bug51604.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #51604 (newline in end of header is shown in start of message)
+--INI--
+sendmail_path=tee mail_bug51604.out >/dev/null
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$additional_headers = "KHeaders\n\n\n\n\n";
+$outFile = "mail_bug51604.out";
+@unlink($outFile);
+
+// Calling mail() with all additional headers
+var_dump( mail($to, $subject, $message, $additional_headers) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+?>
+===DONE===
+--EXPECT--
+bool(true)
+To: user@company.com
+Subject: Test Subject
+KHeaders
+
+A Message
+===DONE===
diff --git a/ext/standard/tests/mail/ezmlm_hash_basic.phpt b/ext/standard/tests/mail/ezmlm_hash_basic.phpt
new file mode 100644
index 0000000..ce70eac
--- /dev/null
+++ b/ext/standard/tests/mail/ezmlm_hash_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test ezmlm_hash() function : basic functionality
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int ezmlm_hash ( string $addr )
+ * Description: Calculate the hash value needed by EZMLM.
+ * Source code: ext/standard/mail.c
+ */
+
+echo "*** Testing ezmlm_hash() : basic functionality ***\n";
+
+var_dump(ezmlm_hash(b"webmaster@somewhere.com"));
+var_dump(ezmlm_hash(b"foo@somewhere.com"));
+
+?>
+===Done===
+--EXPECT--
+*** Testing ezmlm_hash() : basic functionality ***
+int(1)
+int(7)
+===Done===
diff --git a/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt b/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt
new file mode 100644
index 0000000..03ac67b
--- /dev/null
+++ b/ext/standard/tests/mail/ezmlm_hash_basic_64bit.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test ezmlm_hash() function : basic functionality
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int ezmlm_hash ( string $addr )
+ * Description: Calculate the hash value needed by EZMLM.
+ * Source code: ext/standard/mail.c
+ */
+
+echo "*** Testing ezmlm_hash() : basic functionality ***\n";
+
+var_dump(ezmlm_hash(b"webmaster@somewhere.com"));
+var_dump(ezmlm_hash(b"foo@somewhere.com"));
+
+?>
+===Done===
+--EXPECT--
+*** Testing ezmlm_hash() : basic functionality ***
+int(1)
+int(7)
+===Done===
diff --git a/ext/standard/tests/mail/ezmlm_hash_error.phpt b/ext/standard/tests/mail/ezmlm_hash_error.phpt
new file mode 100644
index 0000000..c5f49dd
--- /dev/null
+++ b/ext/standard/tests/mail/ezmlm_hash_error.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test ezmlm_hash() function : error conditions
+--FILE--
+<?php
+/* Prototype : int ezmlm_hash ( string $addr )
+ * Description: Calculate the hash value needed by EZMLM.
+ * Source code: ext/standard/mail.c
+ */
+
+echo "*** Testing ezmlm_hash() : error conditions ***\n";
+
+echo "\n-- Testing ezmlm_hash() function with fewer than expected no. of arguments --\n";
+var_dump( ezmlm_hash() );
+
+echo "\n-- Testing ezmlm_hash() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( ezmlm_hash("webmaster@example.com", $extra_arg) );
+
+echo "\n-- Testing ezmlm_hash() function with invalid input - ARRAY --\n";
+$array_arg = array(1,2,3,4);
+$extra_arg = 10;
+var_dump( ezmlm_hash($array_arg) );
+
+echo "\n-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --\n";
+class sample {
+}
+
+$obj_arg = new sample();
+var_dump( ezmlm_hash($obj_arg) );
+
+echo "\n-- Testing ezmlm_hash() function with invalid input - RESOURCE --\n";
+$file_handle = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( ezmlm_hash($file_handle) );
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ezmlm_hash() : error conditions ***
+
+-- Testing ezmlm_hash() function with fewer than expected no. of arguments --
+
+Warning: ezmlm_hash() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ezmlm_hash() function with more than expected no. of arguments --
+
+Warning: ezmlm_hash() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing ezmlm_hash() function with invalid input - ARRAY --
+
+Warning: ezmlm_hash() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --
+
+Warning: ezmlm_hash() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+-- Testing ezmlm_hash() function with invalid input - RESOURCE --
+
+Warning: ezmlm_hash() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt
new file mode 100644
index 0000000..aa1e521
--- /dev/null
+++ b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test explode() function : usage variations - test values for $delimiter argument
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $delimeter
+$delimeters = array (
+
+ // integer values
+ 0,
+ 1,
+ 255,
+ 256,
+ PHP_INT_MAX,
+ -PHP_INT_MAX,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $delimeters array to test explode() function
+$count = 1;
+$string = "piece1 piece2 piece3 piece4 piece5 piece6";
+$limit = 5;
+foreach($delimeters as $delimeter) {
+ echo "-- Iteration $count --\n";
+ var_dump( explode($delimeter, $string, $limit) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===Done===
+--EXPECTF--
+*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ string(5) "piece"
+ [1]=>
+ string(35) " piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 10 --
+
+Warning: explode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: explode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: explode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ string(5) "piece"
+ [1]=>
+ string(35) " piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 14 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(5) "piece"
+ [1]=>
+ string(35) " piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 16 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 19 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 20 --
+
+Warning: explode() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+===Done===
diff --git a/ext/standard/tests/mail/mail_basic.phpt b/ext/standard/tests/mail/mail_basic.phpt
new file mode 100644
index 0000000..fecb50f
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test mail() function : basic functionality
+--INI--
+sendmail_path=tee mailBasic.out >/dev/null
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$additional_headers = 'KHeaders';
+$outFile = "mailBasic.out";
+@unlink($outFile);
+
+echo "-- All Mail Content Parameters --\n";
+// Calling mail() with all additional headers
+var_dump( mail($to, $subject, $message, $additional_headers) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+echo "\n-- Mandatory Parameters --\n";
+// Calling mail() with mandatory arguments
+var_dump( mail($to, $subject, $message) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mail() : basic functionality ***
+-- All Mail Content Parameters --
+bool(true)
+To: user@company.com
+Subject: Test Subject
+KHeaders
+
+A Message
+
+-- Mandatory Parameters --
+bool(true)
+To: user@company.com
+Subject: Test Subject
+
+A Message
+===DONE===
diff --git a/ext/standard/tests/mail/mail_basic2.phpt b/ext/standard/tests/mail/mail_basic2.phpt
new file mode 100644
index 0000000..8967d18
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic2.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--INI--
+sendmail_path="cat > /tmp/php_test_mailBasic2.out"
+mail.add_x_header = Off
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$additional_headers = 'KHeaders';
+$additional_parameters = "-n";
+$outFile = "/tmp/php_test_mailBasic2.out";
+@unlink($outFile);
+
+echo "-- extra parameters --\n";
+// Calling mail() with all possible arguments
+var_dump( mail($to, $subject, $message, $additional_headers, $additional_parameters) );
+
+echo file_get_contents($outFile);
+unlink($outFile);
+?>
+===DONE===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+-- extra parameters --
+bool(true)
+%w1%wTo: user@company.com
+%w2%wSubject: Test Subject
+%w3%wKHeaders
+%w4%w
+%w5%wA Message
+===DONE===
diff --git a/ext/standard/tests/mail/mail_basic3.phpt b/ext/standard/tests/mail/mail_basic3.phpt
new file mode 100644
index 0000000..58eae03
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic3.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mail() function : basic functionality
+--INI--
+sendmail_path="exit 1"
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+
+
+echo "-- failure --\n";
+var_dump( mail($to, $subject, $message) );
+?>
+===DONE===
+--EXPECT--
+*** Testing mail() : basic functionality ***
+-- failure --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/mail/mail_basic4.phpt b/ext/standard/tests/mail/mail_basic4.phpt
new file mode 100644
index 0000000..9ecc886
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic4.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test mail() function : basic functionality
+--INI--
+sendmail_path="exit 1"
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+
+
+echo "-- failure --\n";
+
+var_dump( mail($to, $subject, $message) );
+?>
+===DONE===
+--EXPECT--
+*** Testing mail() : basic functionality ***
+-- failure --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/mail/mail_basic5.phpt b/ext/standard/tests/mail/mail_basic5.phpt
new file mode 100644
index 0000000..7e42ccb
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test mail() function : basic functionality
+--INI--
+sendmail_path="exit 1"
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+
+echo "-- failure --\n";
+var_dump( mail($to, $subject, $message) );
+?>
+===DONE===
+--EXPECT--
+*** Testing mail() : basic functionality ***
+-- failure --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt
new file mode 100644
index 0000000..3c4dd88
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+ini_set("SMTP", "localhost");
+ini_set("smtp_port", 25);
+ini_set("sendmail_from", "user@company.com");
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$res = mail($to, $subject, $message);
+
+if ($res !== true) {
+ exit("TEST FAILED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+Msg sent OK
+Id of msg just sent is %d
+.. delete it
+TEST PASSED: Msgs sent and deleted OK
+===Done===
diff --git a/ext/standard/tests/mail/mail_basic_alt2-win32.phpt b/ext/standard/tests/mail/mail_basic_alt2-win32.phpt
new file mode 100644
index 0000000..d7bae62
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic_alt2-win32.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$extra_headers = "from: user@company.com";
+
+$res = mail($to, $subject, $message, $extra_headers);
+
+if ($res !== true) {
+ exit("TEST FAILED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+Msg sent OK
+Id of msg just sent is %d
+.. delete it
+TEST PASSED: Msgs sent and deleted OK
+===Done===
diff --git a/ext/standard/tests/mail/mail_basic_alt3-win32.phpt b/ext/standard/tests/mail/mail_basic_alt3-win32.phpt
new file mode 100644
index 0000000..86b57eb
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic_alt3-win32.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$extra_headers = "FRom: user@company.com";
+
+$res = mail($to, $subject, $message, $extra_headers);
+
+if ($res !== true) {
+ exit("TEST FAILED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+Msg sent OK
+Id of msg just sent is %d
+.. delete it
+TEST PASSED: Msgs sent and deleted OK
+===Done===
diff --git a/ext/standard/tests/mail/mail_basic_alt4-win32.phpt b/ext/standard/tests/mail/mail_basic_alt4-win32.phpt
new file mode 100644
index 0000000..f4a9d46
--- /dev/null
+++ b/ext/standard/tests/mail/mail_basic_alt4-win32.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$extra_headers = "from: user@company.com";
+$extra_parameters = "addons"; // should be ignored
+
+$res = mail($to, $subject, $message, $extra_headers, $extra_parameters);
+
+if ($res !== true) {
+ exit("TEST FAILED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+Msg sent OK
+Id of msg just sent is %d
+.. delete it
+TEST PASSED: Msgs sent and deleted OK
+===Done===
diff --git a/ext/standard/tests/mail/mail_error.phpt b/ext/standard/tests/mail/mail_error.phpt
new file mode 100644
index 0000000..871b6da
--- /dev/null
+++ b/ext/standard/tests/mail/mail_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test mail() function : error conditions
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : error conditions ***\n";
+
+
+//Test mail with one more than the expected number of arguments
+echo "\n-- Testing mail() function with more than expected no. of arguments --\n";
+$to = 'string_val';
+$subject = 'string_val';
+$message = 'string_val';
+$additional_headers = 'string_val';
+$additional_parameters = 'string_val';
+$extra_arg = 10;
+var_dump( mail($to, $subject, $message, $additional_headers, $additional_parameters, $extra_arg) );
+
+// Testing mail with one less than the expected number of arguments
+echo "\n-- Testing mail() function with less than expected no. of arguments --\n";
+$to = 'string_val';
+$subject = 'string_val';
+var_dump( mail($to, $subject) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mail() : error conditions ***
+
+-- Testing mail() function with more than expected no. of arguments --
+
+Warning: mail() expects at most 5 parameters, 6 given in %s on line %d
+NULL
+
+-- Testing mail() function with less than expected no. of arguments --
+
+Warning: mail() expects at least 3 parameters, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/mail/mail_include.inc b/ext/standard/tests/mail/mail_include.inc
new file mode 100644
index 0000000..a0ff5e0
--- /dev/null
+++ b/ext/standard/tests/mail/mail_include.inc
@@ -0,0 +1,150 @@
+<?php
+// Change these to make tests run successfully
+$server = '{localhost}';
+$default_mailbox = $server . "INBOX";
+$domain = "example.com";
+$admin_user = "webmaster"; // a user with admin access
+$username = "$admin_user@$domain";
+$password = 'p4ssw0rd';
+$users = array("webmaster", "info", "admin", "foo"); // tests require 4 valid userids
+$mailbox_prefix = "phpttest"; // name used for test mailbox
+
+/**
+ * Create a test mailbox and populate with msgs
+ *
+ * @para, string mailbox_suffix Suffix used to uniquely identify mailboxes
+ * @param int message_count number of test msgs to be written to new mailbox
+ *
+ * @return IMAP stream to new mailbox on sucesss; FALSE on failure
+ */
+function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
+ global $server, $default_mailbox, $username, $password;
+
+ // open a stream to default mailbox
+ $imap_stream = imap_open($default_mailbox, $username, $password);
+
+ if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+ }
+
+ echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
+ $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
+ if ($new_mailbox === false) {
+ echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
+ return false;
+ }
+
+ echo ".. mailbox '$new_mailbox' created\n";
+
+ // reopen stream to new mailbox
+ if (imap_reopen($imap_stream, $new_mailbox) === false) {
+ echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
+ return false;
+ }
+
+ return $imap_stream;
+}
+
+/**
+ * Create mailbox and fill with generic emails
+ *
+ * @param resource $imap_stream
+ * @param string $mailbox
+ */
+function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
+ global $default_mailbox, $mailbox_prefix;
+ $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
+
+ $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
+
+ // check mailbox does not already exist
+ if ($mailboxes) {
+ foreach($mailboxes as $value) {
+ if ($value->name == $mailbox) {
+ exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
+ }
+ }
+ }
+
+ if (imap_createmailbox($imap_stream, $mailbox) === false) {
+ return false;
+ }
+
+ // Add number of test msgs requested
+ if ($message_count > 0) {
+ populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
+ }
+
+ return $mailbox;
+}
+
+/**
+ * Populate a mailbox with generic emails
+ *
+ * @param resource $imap_stream
+ * @param string $mailbox
+ */
+function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "simple"){
+
+ global $users, $domain;
+
+ for($i = 1; $i <= $message_count; $i++) {
+ if ($msg_type == "simple") {
+ $msg = "From: foo@anywhere.com\r\n"
+ . "To: $users[0]@$domain\r\n"
+ . "Subject: test$i\r\n"
+ . "\r\n"
+ . "$i: this is a test message, please ignore\r\n";
+ } else {
+ $envelope["from"]= "foo@anywhere.com";
+ $envelope["to"] = "$users[0]@$domain";
+ $envelope["subject"] = "Test msg $i";
+
+ $part1["type"] = TYPEMULTIPART;
+ $part1["subtype"] = "mixed";
+
+ $part2["type"] = TYPETEXT;
+ $part2["subtype"] = "plain";
+ $part2["description"] = "imap_mail_compose() function";
+ $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+ $part3["type"] = TYPETEXT;
+ $part3["subtype"] = "plain";
+ $part3["description"] = "Example";
+ $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
+
+ $part4["type"] = TYPETEXT;
+ $part4["subtype"] = "plain";
+ $part4["description"] = "Return Values";
+ $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
+
+ $body[1] = $part1;
+ $body[2] = $part2;
+ $body[3] = $part3;
+ $body[4] = $part4;
+
+ $msg = imap_mail_compose($envelope, $body);
+ }
+
+ imap_append($imap_stream, $mailbox, $msg);
+ }
+}
+
+/**
+ * Get the mailbox name from a mailbox decription, i.e strip off server details.
+ *
+ * @param string mailbox complete mailbox name
+ * @return mailbox name
+ */
+function get_mailbox_name($mailbox){
+
+ if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) {
+ echo "Unrecpognized mailbox name\n";
+ return false;
+ }
+
+ return $match[1];
+}
+
+?>
diff --git a/ext/standard/tests/mail/mail_skipif.inc b/ext/standard/tests/mail/mail_skipif.inc
new file mode 100644
index 0000000..0065940
--- /dev/null
+++ b/ext/standard/tests/mail/mail_skipif.inc
@@ -0,0 +1,26 @@
+<?php
+extension_loaded('imap') or die('skip imap extension not available in this build');
+
+if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) {
+ // be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f,
+ // the code below didn't skip test even though there was no mail server
+ // test then failed (no mail server to test against)
+ $socket = socket_create(AF_INET, SOCK_RAW, 1);
+ socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10));
+ // imap uses tcp port 143
+ socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
+}
+
+// Change these to make tests run successfully
+$mailbox = '{localhost}';
+$username = 'webmaster@example.com';
+$password = 'p4ssw0rd';
+$options = OP_HALFOPEN; // this should be enough to verify server present
+$retries = 0; // dont retry connect on failure
+
+$mbox = imap_open($mailbox, $username, $password, $options, $retries);
+if (!$mbox) {
+ die("skip could not connect to mailbox $mailbox");
+}
+imap_close($mbox);
+?>
diff --git a/ext/standard/tests/mail/mail_variation1.phpt b/ext/standard/tests/mail/mail_variation1.phpt
new file mode 100644
index 0000000..bf37bf4
--- /dev/null
+++ b/ext/standard/tests/mail/mail_variation1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test mail() function : variation invalid program for sendmail
+--INI--
+sendmail_path=rubbish 2>/dev/null
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : variation ***\n";
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+var_dump( mail($to, $subject, $message) );
+?>
+===DONE===
+--EXPECT--
+*** Testing mail() : variation ***
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/mail/mail_variation2.phpt b/ext/standard/tests/mail/mail_variation2.phpt
new file mode 100644
index 0000000..c16c270
--- /dev/null
+++ b/ext/standard/tests/mail/mail_variation2.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test mail() function : variation force extra parameters
+--INI--
+sendmail_path="cat > /tmp/php_test_mailVariation2.out"
+mail.force_extra_parameters="-n"
+mail.add_x_header = Off
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Won't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mail() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$to = 'user@company.com';
+$subject = 'Test Subject';
+$message = 'A Message';
+$outFile = "/tmp/php_test_mailVariation2.out";
+@unlink($outFile);
+
+var_dump( mail($to, $subject, $message) );
+echo file_get_contents($outFile);
+unlink($outFile);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+bool(true)
+%w1%wTo: user@company.com
+%w2%wSubject: Test Subject
+%w3%w
+%w4%wA Message
+===DONE===
diff --git a/ext/standard/tests/mail/mail_variation_alt1-win32.phpt b/ext/standard/tests/mail/mail_variation_alt1-win32.phpt
new file mode 100644
index 0000000..b81f3af
--- /dev/null
+++ b/ext/standard/tests/mail/mail_variation_alt1-win32.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+ini_set("SMTP", "localhost");
+ini_set("smtp_port", 2525);
+ini_set("sendmail_from", "user@company.com");
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$res = mail($to, $subject, $message);
+
+if ($res !== true) {
+ exit("TEST COMPLETED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+
+Warning: mail(): Failed to connect to mailserver at "localhost" port 2525, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in %s on line %d
+TEST COMPLETED : Unable to send test email
diff --git a/ext/standard/tests/mail/mail_variation_alt2-win32.phpt b/ext/standard/tests/mail/mail_variation_alt2-win32.phpt
new file mode 100644
index 0000000..6ae06bb
--- /dev/null
+++ b/ext/standard/tests/mail/mail_variation_alt2-win32.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+ini_set("SMTP", "localplace");
+ini_set("smtp_port", 25);
+ini_set("sendmail_from", "user@company.com");
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$res = mail($to, $subject, $message);
+
+if ($res !== true) {
+ exit("TEST COMPLETED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+
+Warning: mail(): Failed to connect to mailserver at "localplace" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in %s on line %d
+TEST COMPLETED : Unable to send test email
diff --git a/ext/standard/tests/mail/mail_variation_alt3-win32.phpt b/ext/standard/tests/mail/mail_variation_alt3-win32.phpt
new file mode 100644
index 0000000..4062fae
--- /dev/null
+++ b/ext/standard/tests/mail/mail_variation_alt3-win32.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test mail() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Windows only test');
+}
+
+require_once(dirname(__FILE__).'/mail_skipif.inc');
+?>
+--INI--
+max_execution_time = 120
+--FILE--
+<?php
+/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+ * Description: Send an email message
+ * Source code: ext/standard/mail.c
+ * Alias to functions:
+ */
+
+error_reporting(E_ALL & ~E_STRICT);
+ini_set("SMTP", "localhost");
+ini_set("smtp_port", 25);
+
+echo "*** Testing mail() : basic functionality ***\n";
+require_once(dirname(__FILE__).'/mail_include.inc');
+$subject_prefix = "!**PHPT**!";
+
+$to = "$username";
+$subject = "$subject_prefix: Basic PHPT test for mail() function";
+$message = <<<HERE
+Description
+bool mail ( string \$to , string \$subject , string \$message [, string \$additional_headers [, string \$additional_parameters]] )
+Send an email message
+HERE;
+
+$res = mail($to, $subject, $message);
+
+if ($res !== true) {
+ exit("TEST COMPLETED : Unable to send test email\n");
+} else {
+ echo "Msg sent OK\n";
+}
+
+// Search for email message on the mail server using imap.
+$imap_stream = imap_open($default_mailbox, $username, $password);
+if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+}
+
+$found = false;
+$repeat_count = 20; // we will repeat a max of 20 times
+while (!$found && $repeat_count > 0) {
+
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
+
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
+
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
+
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
+
+ $repeat_count -= 1;
+}
+
+if (!$found) {
+ echo "TEST FAILED: email not delivered\n";
+} else {
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
+}
+
+imap_close($imap_stream, CL_EXPUNGE);
+?>
+===Done===
+--EXPECTF--
+*** Testing mail() : basic functionality ***
+
+Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in %s on line %d
+TEST COMPLETED : Unable to send test email
diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt
new file mode 100644
index 0000000..f5c26c3
--- /dev/null
+++ b/ext/standard/tests/math/abs.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Simple math tests
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+ 1 === abs(-1)
+ 1.5 === abs(-1.5)
+ 1 === abs("-1")
+ 1.5 === abs("-1.5")
+-LONG_MIN+1 === abs(LONG_MIN-1)
+-LONG_MIN === abs(LONG_MIN)
+-(LONG_MIN+1) === abs(LONG_MIN+1)
+TESTS;
+
+include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+--EXPECT--
+1,1,0,0
+OK
diff --git a/ext/standard/tests/math/abs_basic.phpt b/ext/standard/tests/math/abs_basic.phpt
new file mode 100644
index 0000000..0f6ecbc
--- /dev/null
+++ b/ext/standard/tests/math/abs_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test abs() function : basic functionality
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype : number abs ( mixed $number )
+ * Description: Returns the absolute value of number.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing abs() : basic functionality ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "-23",
+ "23.45",
+ "2.345e1",
+ "-2.345e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = abs($values[$i]);
+ var_dump($res);
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing abs() : basic functionality ***
+int(23)
+int(23)
+float(23.45)
+float(23.45)
+int(23)
+int(23)
+int(23)
+int(23)
+float(23.45)
+float(23.45)
+float(23.45)
+int(0)
+int(1)
+int(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/abs_basiclong_64bit.phpt b/ext/standard/tests/math/abs_basiclong_64bit.phpt
new file mode 100644
index 0000000..ccb2556
--- /dev/null
+++ b/ext/standard/tests/math/abs_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test abs function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(abs($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+int(9223372036854775807)
+--- testing: -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 2147483647 ---
+int(2147483647)
+--- testing: -2147483648 ---
+int(2147483648)
+--- testing: 9223372034707292160 ---
+int(9223372034707292160)
+--- testing: -9223372034707292160 ---
+int(9223372034707292160)
+--- testing: 2147483648 ---
+int(2147483648)
+--- testing: -2147483649 ---
+int(2147483649)
+--- testing: 4294967294 ---
+int(4294967294)
+--- testing: 4294967295 ---
+int(4294967295)
+--- testing: 4294967293 ---
+int(4294967293)
+--- testing: 9223372036854775806 ---
+int(9223372036854775806)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+int(9223372036854775807)
+--- testing: -9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/abs_error.phpt b/ext/standard/tests/math/abs_error.phpt
new file mode 100644
index 0000000..4d62259
--- /dev/null
+++ b/ext/standard/tests/math/abs_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test abs() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : number abs ( mixed $number )
+ * Description: Returns the absolute value of number.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect number of arguments to abs() to test behaviour
+ */
+
+echo "*** Testing abs() : error conditions ***\n";
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(abs($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(abs());
+
+?>
+===Done===
+--EXPECTF--
+*** Testing abs() : error conditions ***
+
+Too many arguments
+
+Warning: abs() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: abs() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt
new file mode 100644
index 0000000..6df1e6b
--- /dev/null
+++ b/ext/standard/tests/math/abs_variation.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test abs() function : usage variations - different data types as $number arg
+--FILE--
+<?php
+/* Prototype : number abs ( mixed $number )
+ * Description: Returns the absolute value of number.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass different data types as $number argument to abs() to test behaviour
+ */
+
+echo "*** Testing abs() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "abs";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+abs
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $number argument
+$inputs = array(
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abs",
+ 'abs',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of abs()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(abs($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing abs() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(0)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(0)
+
+-- Iteration 5 --
+int(1)
+
+-- Iteration 6 --
+int(0)
+
+-- Iteration 7 --
+int(0)
+
+-- Iteration 8 --
+int(0)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(%d)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/acos_basic.phpt b/ext/standard/tests/math/acos_basic.phpt
new file mode 100644
index 0000000..150eb97
--- /dev/null
+++ b/ext/standard/tests/math/acos_basic.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test return type and value for expected input acos()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+//output is in degrees
+
+echo "acos .5 = ";
+$acosv1 = 360.0 * acos(0.5) / (2.0 * M_PI );
+var_dump($acosv1);
+if (allowed_rounding_error($acosv1 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "acos 0.86602540378444 = ";
+$acosv2 = 360.0 * acos(0.86602540378444) / (2.0 * M_PI );
+var_dump($acosv2);
+if (allowed_rounding_error($acosv2 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "acos 1.0 = ";
+$acosv3 = 360.0 * acos(1.0) / (2.0 * M_PI);
+var_dump($acosv3);
+if (allowed_rounding_error($acosv3 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "acos 0.0 = ";
+$acosv4 = 360.0 * acos(0.0) / (2.0 * M_PI );
+var_dump($acosv4);
+if (allowed_rounding_error($acosv3 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+acos .5 = float(%f)
+Pass
+acos 0.86602540378444 = float(%f)
+Pass
+acos 1.0 = float(%f)
+Pass
+acos 0.0 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/acos_basiclong_64bit.phpt b/ext/standard/tests/math/acos_basiclong_64bit.phpt
new file mode 100644
index 0000000..3d811f5
--- /dev/null
+++ b/ext/standard/tests/math/acos_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test acos function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(acos($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(NAN)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(NAN)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(NAN)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(NAN)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(NAN)
+--- testing: 4294967295 ---
+float(NAN)
+--- testing: 4294967293 ---
+float(NAN)
+--- testing: 9223372036854775806 ---
+float(NAN)
+--- testing: 9.2233720368548E+18 ---
+float(NAN)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/acos_error.phpt b/ext/standard/tests/math/acos_error.phpt
new file mode 100644
index 0000000..6cfdb8f
--- /dev/null
+++ b/ext/standard/tests/math/acos_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for acos()
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(acos($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(acos());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: acos() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: acos() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt
new file mode 100644
index 0000000..006bcec
--- /dev/null
+++ b/ext/standard/tests/math/acos_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of acos()
+--INI--
+precision=10
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test acos with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = acos($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+Warning: acos() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(NAN)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(NAN)
+float(1.570796327)
+float(0)
+float(1.570796327)
diff --git a/ext/standard/tests/math/acosh_basic.phpt b/ext/standard/tests/math/acosh_basic.phpt
new file mode 100644
index 0000000..d94109d
--- /dev/null
+++ b/ext/standard/tests/math/acosh_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input acosh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "acosh 1.1276259652064= ";
+var_dump(acosh(1.1276259652064));
+if (allowed_rounding_error(acosh(1.1276259652064), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "acosh 10.067661995778= ";
+var_dump(acosh(10.067661995778));
+if (allowed_rounding_error(acosh(10.067661995778), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+?>
+--EXPECTF--
+acosh 1.1276259652064= float(%f)
+Pass
+acosh 10.067661995778= float(%f)
+Pass
diff --git a/ext/standard/tests/math/acosh_basiclong_64bit.phpt b/ext/standard/tests/math/acosh_basiclong_64bit.phpt
new file mode 100644
index 0000000..80c33b2
--- /dev/null
+++ b/ext/standard/tests/math/acosh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test acosh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(acosh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(44.361419555836)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(22.180709777453)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(44.361419555604)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(22.180709777918)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(22.873856958013)
+--- testing: 4294967295 ---
+float(22.873856958245)
+--- testing: 4294967293 ---
+float(22.87385695778)
+--- testing: 9223372036854775806 ---
+float(44.361419555836)
+--- testing: 9.2233720368548E+18 ---
+float(44.361419555836)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/acosh_error.phpt b/ext/standard/tests/math/acosh_error.phpt
new file mode 100644
index 0000000..cb85bec
--- /dev/null
+++ b/ext/standard/tests/math/acosh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for acosh()
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(acosh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(acosh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: acosh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: acosh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt
new file mode 100644
index 0000000..fbcb62a
--- /dev/null
+++ b/ext/standard/tests/math/acosh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of acosh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test acosh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = acosh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(3.828168471)
+float(NAN)
+float(3.847562739)
+float(NAN)
+float(3.828168471)
+float(3.828168471)
+float(3.828168471)
+float(3.847562739)
+float(3.847562739)
+
+Warning: acosh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(7.60090221)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(7.60090221)
+float(NAN)
+float(0)
+float(NAN)
diff --git a/ext/standard/tests/math/allowed_rounding_error.inc b/ext/standard/tests/math/allowed_rounding_error.inc
new file mode 100644
index 0000000..71dbf9a
--- /dev/null
+++ b/ext/standard/tests/math/allowed_rounding_error.inc
@@ -0,0 +1,18 @@
+<?php
+function allowed_rounding_error ($number, $expected) {
+
+ //different machines may give slightly different floating point numbers
+ //This assumes that the results will be the same to + or - 1.0E-10.
+
+ $small_number = 1.0e-10;
+ $min = $expected - $small_number;
+ $max = $expected + $small_number;
+
+ if ($number < $max && $number > $min ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+?> \ No newline at end of file
diff --git a/ext/standard/tests/math/asin_basic.phpt b/ext/standard/tests/math/asin_basic.phpt
new file mode 100644
index 0000000..183f744
--- /dev/null
+++ b/ext/standard/tests/math/asin_basic.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test return type and value for expected input asin()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+//output is in degrees
+
+echo "asin .5 = ";
+$asinv1 = 360.0 * asin(0.5) / (2.0 * M_PI );
+var_dump($asinv1);
+if (allowed_rounding_error($asinv1 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asin 0.86602540378444 = ";
+$asinv2 = 360.0 * asin(0.86602540378444) / (2.0 * M_PI );
+var_dump($asinv2);
+if (allowed_rounding_error($asinv2 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asin 1.0 = ";
+$asinv3 = 360.0 * asin(1.0) / (2.0 * M_PI );
+var_dump($asinv3);
+if (allowed_rounding_error($asinv3 ,90 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "asin 0.0 = ";
+$asinv4 = 360.0 * asin(0.0) / (2.0 * M_PI );
+var_dump($asinv4);
+if (allowed_rounding_error($asinv4 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+asin .5 = float(%f)
+Pass
+asin 0.86602540378444 = float(%f)
+Pass
+asin 1.0 = float(%f)
+Pass
+asin 0.0 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/asin_basiclong_64bit.phpt b/ext/standard/tests/math/asin_basiclong_64bit.phpt
new file mode 100644
index 0000000..7e17f2d
--- /dev/null
+++ b/ext/standard/tests/math/asin_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test asin function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(asin($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(NAN)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(NAN)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(NAN)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(NAN)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(NAN)
+--- testing: 4294967295 ---
+float(NAN)
+--- testing: 4294967293 ---
+float(NAN)
+--- testing: 9223372036854775806 ---
+float(NAN)
+--- testing: 9.2233720368548E+18 ---
+float(NAN)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/asin_error.phpt b/ext/standard/tests/math/asin_error.phpt
new file mode 100644
index 0000000..a51a077
--- /dev/null
+++ b/ext/standard/tests/math/asin_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for asin()
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(asin($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(asin());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: asin() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: asin() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt
new file mode 100644
index 0000000..83a33ee
--- /dev/null
+++ b/ext/standard/tests/math/asin_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of asin()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test asin with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = asin($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+Warning: asin() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(NAN)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(NAN)
+float(0)
+float(1.570796327)
+float(0)
diff --git a/ext/standard/tests/math/asinh_basic.phpt b/ext/standard/tests/math/asinh_basic.phpt
new file mode 100644
index 0000000..ff8a2d1
--- /dev/null
+++ b/ext/standard/tests/math/asinh_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test return type and value for expected input asinh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "asinh 0.52109530549375= ";
+var_dump(asinh(0.52109530549375));
+if (allowed_rounding_error(asinh(0.52109530549375), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asinh 10.01787492741= ";
+var_dump(asinh(10.01787492741));
+if (allowed_rounding_error(asinh(10.01787492741), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+asinh 0.52109530549375= float(%f)
+Pass
+asinh 10.01787492741= float(%f)
+Pass
diff --git a/ext/standard/tests/math/asinh_basiclong_64bit.phpt b/ext/standard/tests/math/asinh_basiclong_64bit.phpt
new file mode 100644
index 0000000..a501d75
--- /dev/null
+++ b/ext/standard/tests/math/asinh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test asinh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(asinh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(44.361419555836)
+--- testing: -9223372036854775808 ---
+float(-44.361419555836)
+--- testing: 2147483647 ---
+float(22.180709777453)
+--- testing: -2147483648 ---
+float(-22.180709777918)
+--- testing: 9223372034707292160 ---
+float(44.361419555604)
+--- testing: -9223372034707292160 ---
+float(-44.361419555604)
+--- testing: 2147483648 ---
+float(22.180709777918)
+--- testing: -2147483649 ---
+float(-22.180709778384)
+--- testing: 4294967294 ---
+float(22.873856958013)
+--- testing: 4294967295 ---
+float(22.873856958245)
+--- testing: 4294967293 ---
+float(22.87385695778)
+--- testing: 9223372036854775806 ---
+float(44.361419555836)
+--- testing: 9.2233720368548E+18 ---
+float(44.361419555836)
+--- testing: -9223372036854775807 ---
+float(-44.361419555836)
+--- testing: -9.2233720368548E+18 ---
+float(-44.361419555836)
+===DONE===
diff --git a/ext/standard/tests/math/asinh_error.phpt b/ext/standard/tests/math/asinh_error.phpt
new file mode 100644
index 0000000..8a0d558
--- /dev/null
+++ b/ext/standard/tests/math/asinh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for asinh()
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(asinh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(asinh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: asinh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: asinh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt
new file mode 100644
index 0000000..96fbbcb
--- /dev/null
+++ b/ext/standard/tests/math/asinh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of asinh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test asinh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = asinh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(3.829113652)
+float(-3.829113652)
+float(3.848471992)
+float(-3.848471992)
+float(3.829113652)
+float(3.829113652)
+float(3.829113652)
+float(3.848471992)
+float(3.848471992)
+
+Warning: asinh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(7.60090271)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(7.60090271)
+float(0)
+float(0.881373587)
+float(0)
diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt
new file mode 100644
index 0000000..65a0622
--- /dev/null
+++ b/ext/standard/tests/math/atan2_basic.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test atan2() - basic function test of atan2()
+--INI--
+precision=14
+--FILE--
+<?php
+$valuesy = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+$valuesx = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($valuesy); $i++) {
+ for ($j = 0; $j < count($valuesx); $j++) {
+ $res = atan2($valuesy[$i], $valuesx[$j]);
+ echo "Y:$valuesy[$i] X:$valuesx[$j] ";
+ var_dump($res);
+ }
+}
+?>
+--EXPECTF--
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:-23 float(-2.3561944901923)
+Y:-23 X:23.45 float(-0.77571063007847)
+Y:-23 X:-23.45 float(-2.3658820235113)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23.45 float(-0.77571063007847)
+Y:-23 X:2.345e1 float(-0.77571063007847)
+Y:-23 X: float(-1.5707963267949)
+Y:-23 X:1 float(-1.5273454314034)
+Y:-23 X: float(-1.5707963267949)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:-23 float(2.3465069568734)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:-23.45 float(2.3561944901923)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:2.345e1 float(0.78539816339745)
+Y:23.45 X: float(1.5707963267949)
+Y:23.45 X:1 float(1.5281782247706)
+Y:23.45 X: float(1.5707963267949)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:-23 float(-2.3465069568734)
+Y:-23.45 X:23.45 float(-0.78539816339745)
+Y:-23.45 X:-23.45 float(-2.3561944901923)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23.45 float(-0.78539816339745)
+Y:-23.45 X:2.345e1 float(-0.78539816339745)
+Y:-23.45 X: float(-1.5707963267949)
+Y:-23.45 X:1 float(-1.5281782247706)
+Y:-23.45 X: float(-1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:-23 float(2.3465069568734)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:-23.45 float(2.3561944901923)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:2.345e1 float(0.78539816339745)
+Y:23.45 X: float(1.5707963267949)
+Y:23.45 X:1 float(1.5281782247706)
+Y:23.45 X: float(1.5707963267949)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:-23 float(2.3465069568734)
+Y:2.345e1 X:23.45 float(0.78539816339745)
+Y:2.345e1 X:-23.45 float(2.3561944901923)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23.45 float(0.78539816339745)
+Y:2.345e1 X:2.345e1 float(0.78539816339745)
+Y:2.345e1 X: float(1.5707963267949)
+Y:2.345e1 X:1 float(1.5281782247706)
+Y:2.345e1 X: float(1.5707963267949)
+Y: X:23 float(0)
+Y: X:-23 float(3.1415926535898)
+Y: X:23.45 float(0)
+Y: X:-23.45 float(3.1415926535898)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23.45 float(0)
+Y: X:2.345e1 float(0)
+Y: X: float(0)
+Y: X:1 float(0)
+Y: X: float(0)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:-23 float(3.0981417581983)
+Y:1 X:23.45 float(0.042618102024328)
+Y:1 X:-23.45 float(3.0989745515655)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23.45 float(0.042618102024328)
+Y:1 X:2.345e1 float(0.042618102024328)
+Y:1 X: float(1.5707963267949)
+Y:1 X:1 float(0.78539816339745)
+Y:1 X: float(1.5707963267949)
+Y: X:23 float(0)
+Y: X:-23 float(3.1415926535898)
+Y: X:23.45 float(0)
+Y: X:-23.45 float(3.1415926535898)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23.45 float(0)
+Y: X:2.345e1 float(0)
+Y: X: float(0)
+Y: X:1 float(0)
+Y: X: float(0)
diff --git a/ext/standard/tests/math/atan2_basiclong_64bit.phpt b/ext/standard/tests/math/atan2_basiclong_64bit.phpt
new file mode 100644
index 0000000..e0548a0
--- /dev/null
+++ b/ext/standard/tests/math/atan2_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test atan2 function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(atan2($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, -1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 7 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 9 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 65 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, -44 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9223372036854775807, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(0.78539816339745)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(2.3561944901923)
+--- testing: -9223372036854775808, 0 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, -1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 7 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 9 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 65 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, -44 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9223372036854775808, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(-0.78539816339745)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(-2.3561944901923)
+--- testing: 2147483647, 0 ---
+float(1.5707963267949)
+--- testing: 2147483647, 1 ---
+float(1.5707963263292)
+--- testing: 2147483647, -1 ---
+float(1.5707963272606)
+--- testing: 2147483647, 7 ---
+float(1.5707963235353)
+--- testing: 2147483647, 9 ---
+float(1.5707963226039)
+--- testing: 2147483647, 65 ---
+float(1.5707962965269)
+--- testing: 2147483647, -44 ---
+float(1.570796347284)
+--- testing: 2147483647, 2147483647 ---
+float(0.78539816339745)
+--- testing: 2147483647, -2147483648 ---
+float(2.3561944904252)
+--- testing: 2147483647, 9223372036854775807 ---
+float(2.3283064354545E-10)
+--- testing: 2147483647, -9223372036854775808 ---
+float(3.141592653357)
+--- testing: -2147483648, 0 ---
+float(-1.5707963267949)
+--- testing: -2147483648, 1 ---
+float(-1.5707963263292)
+--- testing: -2147483648, -1 ---
+float(-1.5707963272606)
+--- testing: -2147483648, 7 ---
+float(-1.5707963235353)
+--- testing: -2147483648, 9 ---
+float(-1.5707963226039)
+--- testing: -2147483648, 65 ---
+float(-1.5707962965269)
+--- testing: -2147483648, -44 ---
+float(-1.570796347284)
+--- testing: -2147483648, 2147483647 ---
+float(-0.78539816363028)
+--- testing: -2147483648, -2147483648 ---
+float(-2.3561944901923)
+--- testing: -2147483648, 9223372036854775807 ---
+float(-2.3283064365387E-10)
+--- testing: -2147483648, -9223372036854775808 ---
+float(-3.141592653357)
+--- testing: 9223372034707292160, 0 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 1 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, -1 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 7 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 9 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 65 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, -44 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9223372034707292160, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(0.78539816328103)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(2.3561944903088)
+--- testing: -9223372034707292160, 0 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 1 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, -1 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 7 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 9 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 65 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, -44 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9223372034707292160, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(-0.78539816328103)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(-2.3561944903088)
+--- testing: 2147483648, 0 ---
+float(1.5707963267949)
+--- testing: 2147483648, 1 ---
+float(1.5707963263292)
+--- testing: 2147483648, -1 ---
+float(1.5707963272606)
+--- testing: 2147483648, 7 ---
+float(1.5707963235353)
+--- testing: 2147483648, 9 ---
+float(1.5707963226039)
+--- testing: 2147483648, 65 ---
+float(1.5707962965269)
+--- testing: 2147483648, -44 ---
+float(1.570796347284)
+--- testing: 2147483648, 2147483647 ---
+float(0.78539816363028)
+--- testing: 2147483648, -2147483648 ---
+float(2.3561944901923)
+--- testing: 2147483648, 9223372036854775807 ---
+float(2.3283064365387E-10)
+--- testing: 2147483648, -9223372036854775808 ---
+float(3.141592653357)
+--- testing: -2147483649, 0 ---
+float(-1.5707963267949)
+--- testing: -2147483649, 1 ---
+float(-1.5707963263292)
+--- testing: -2147483649, -1 ---
+float(-1.5707963272606)
+--- testing: -2147483649, 7 ---
+float(-1.5707963235353)
+--- testing: -2147483649, 9 ---
+float(-1.5707963226039)
+--- testing: -2147483649, 65 ---
+float(-1.5707962965269)
+--- testing: -2147483649, -44 ---
+float(-1.570796347284)
+--- testing: -2147483649, 2147483647 ---
+float(-0.78539816386311)
+--- testing: -2147483649, -2147483648 ---
+float(-2.3561944899595)
+--- testing: -2147483649, 9223372036854775807 ---
+float(-2.3283064376229E-10)
+--- testing: -2147483649, -9223372036854775808 ---
+float(-3.141592653357)
+--- testing: 4294967294, 0 ---
+float(1.5707963267949)
+--- testing: 4294967294, 1 ---
+float(1.5707963265621)
+--- testing: 4294967294, -1 ---
+float(1.5707963270277)
+--- testing: 4294967294, 7 ---
+float(1.5707963251651)
+--- testing: 4294967294, 9 ---
+float(1.5707963246994)
+--- testing: 4294967294, 65 ---
+float(1.5707963116609)
+--- testing: 4294967294, -44 ---
+float(1.5707963370394)
+--- testing: 4294967294, 2147483647 ---
+float(1.1071487177941)
+--- testing: 4294967294, -2147483648 ---
+float(2.034443935982)
+--- testing: 4294967294, 9223372036854775807 ---
+float(4.656612870909E-10)
+--- testing: 4294967294, -9223372036854775808 ---
+float(3.1415926531241)
+--- testing: 4294967295, 0 ---
+float(1.5707963267949)
+--- testing: 4294967295, 1 ---
+float(1.5707963265621)
+--- testing: 4294967295, -1 ---
+float(1.5707963270277)
+--- testing: 4294967295, 7 ---
+float(1.5707963251651)
+--- testing: 4294967295, 9 ---
+float(1.5707963246994)
+--- testing: 4294967295, 65 ---
+float(1.5707963116609)
+--- testing: 4294967295, -44 ---
+float(1.5707963370394)
+--- testing: 4294967295, 2147483647 ---
+float(1.1071487178872)
+--- testing: 4294967295, -2147483648 ---
+float(2.0344439358888)
+--- testing: 4294967295, 9223372036854775807 ---
+float(4.6566128719932E-10)
+--- testing: 4294967295, -9223372036854775808 ---
+float(3.1415926531241)
+--- testing: 4294967293, 0 ---
+float(1.5707963267949)
+--- testing: 4294967293, 1 ---
+float(1.5707963265621)
+--- testing: 4294967293, -1 ---
+float(1.5707963270277)
+--- testing: 4294967293, 7 ---
+float(1.5707963251651)
+--- testing: 4294967293, 9 ---
+float(1.5707963246994)
+--- testing: 4294967293, 65 ---
+float(1.5707963116609)
+--- testing: 4294967293, -44 ---
+float(1.5707963370394)
+--- testing: 4294967293, 2147483647 ---
+float(1.107148717701)
+--- testing: 4294967293, -2147483648 ---
+float(2.0344439360751)
+--- testing: 4294967293, 9223372036854775807 ---
+float(4.6566128698248E-10)
+--- testing: 4294967293, -9223372036854775808 ---
+float(3.1415926531241)
+--- testing: 9223372036854775806, 0 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, -1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 7 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 9 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 65 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, -44 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9223372036854775806, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(0.78539816339745)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(2.3561944901923)
+--- testing: 9.2233720368548E+18, 0 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 1 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, -1 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 7 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 9 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 65 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, -44 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(0.78539816339745)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(2.3561944901923)
+--- testing: -9223372036854775807, 0 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, -1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 7 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 9 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 65 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, -44 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9223372036854775807, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(-0.78539816339745)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(-2.3561944901923)
+--- testing: -9.2233720368548E+18, 0 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 1 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, -1 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 7 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 9 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 65 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, -44 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(-0.78539816339745)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(-2.3561944901923)
+===DONE===
diff --git a/ext/standard/tests/math/atan2_error.phpt b/ext/standard/tests/math/atan2_error.phpt
new file mode 100644
index 0000000..ce9687c
--- /dev/null
+++ b/ext/standard/tests/math/atan2_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test atan2() - wrong params atan2()
+--FILE--
+<?php
+atan2();
+atan2(36);
+atan2(36,25,0);
+?>
+--EXPECTF--
+Warning: atan2() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: atan2() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: atan2() expects exactly 2 parameters, 3 given in %s on line %d
diff --git a/ext/standard/tests/math/atan2_variation1.phpt b/ext/standard/tests/math/atan2_variation1.phpt
new file mode 100644
index 0000000..d606060
--- /dev/null
+++ b/ext/standard/tests/math/atan2_variation1.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test atan2() function : usage variations - different data types as $y arg
+--INI--
+precision = 10
+--FILE--
+<?php
+/* Prototype : float atan2 ( float $y , float $x )
+ * Description: Arc tangent of two variables.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing atan2() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of atan2()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(atan2($input, 23));
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing atan2() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0.04345089539)
+
+-- Iteration 3 --
+float(0.4808872802)
+
+-- Iteration 4 --
+float(-0.4808872802)
+
+-- Iteration 5 --
+float(1.570796316)
+
+-- Iteration 6 --
+float(0.4282641529)
+
+-- Iteration 7 --
+float(-0.4282641529)
+
+-- Iteration 8 --
+float(1.386607742)
+
+-- Iteration 9 --
+float(0.0005367682093)
+
+-- Iteration 10 --
+float(0.02173570684)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0.04345089539)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(0.04345089539)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: atan2() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: atan2() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+
+Warning: atan2() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/atan2_variation2.phpt b/ext/standard/tests/math/atan2_variation2.phpt
new file mode 100644
index 0000000..fc0b9e6
--- /dev/null
+++ b/ext/standard/tests/math/atan2_variation2.phpt
@@ -0,0 +1,186 @@
+--TEST--
+Test atan2() function : usage variations - different data types as $x arg
+--INI--
+precision = 10
+--FILE--
+<?php
+/* Prototype : float atan2 ( float $y , float $x )
+ * Description: Arc tangent of two variables.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing atan2() : basic functionality ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of atan2()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(atan2(23, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing atan2() : basic functionality ***
+
+-- Iteration 1 --
+float(1.570796327)
+
+-- Iteration 2 --
+float(1.527345431)
+
+-- Iteration 3 --
+float(1.089909047)
+
+-- Iteration 4 --
+float(2.051683607)
+
+-- Iteration 5 --
+float(1.071020961E-8)
+
+-- Iteration 6 --
+float(1.142532174)
+
+-- Iteration 7 --
+float(1.99906048)
+
+-- Iteration 8 --
+float(0.1841885846)
+
+-- Iteration 9 --
+float(1.570259559)
+
+-- Iteration 10 --
+float(1.54906062)
+
+-- Iteration 11 --
+float(1.570796327)
+
+-- Iteration 12 --
+float(1.570796327)
+
+-- Iteration 13 --
+float(1.527345431)
+
+-- Iteration 14 --
+float(1.570796327)
+
+-- Iteration 15 --
+float(1.527345431)
+
+-- Iteration 16 --
+float(1.570796327)
+
+-- Iteration 17 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: atan2() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: atan2() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(1.570796327)
+
+-- Iteration 25 --
+float(1.570796327)
+
+-- Iteration 26 --
+
+Warning: atan2() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/atan_basic.phpt b/ext/standard/tests/math/atan_basic.phpt
new file mode 100644
index 0000000..f4a2bed
--- /dev/null
+++ b/ext/standard/tests/math/atan_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test return type and value for expected input atan()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "atan 1.7320508075689 = ";
+$atan1 = 360 * atan(1.7320508075689) / (2.0 * M_PI);
+var_dump($atan1);
+if (allowed_rounding_error($atan1 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "atan 0.57735026918963 = ";
+$atan2 = 360 * atan(0.57735026918963) / (2.0 * M_PI);
+var_dump($atan2);
+if (allowed_rounding_error($atan2 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+atan 1.7320508075689 = float(%f)
+Pass
+atan 0.57735026918963 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/atan_basiclong_64bit.phpt b/ext/standard/tests/math/atan_basiclong_64bit.phpt
new file mode 100644
index 0000000..ffdfe24
--- /dev/null
+++ b/ext/standard/tests/math/atan_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test atan function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(atan($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(1.5707963267949)
+--- testing: -9223372036854775808 ---
+float(-1.5707963267949)
+--- testing: 2147483647 ---
+float(1.5707963263292)
+--- testing: -2147483648 ---
+float(-1.5707963263292)
+--- testing: 9223372034707292160 ---
+float(1.5707963267949)
+--- testing: -9223372034707292160 ---
+float(-1.5707963267949)
+--- testing: 2147483648 ---
+float(1.5707963263292)
+--- testing: -2147483649 ---
+float(-1.5707963263292)
+--- testing: 4294967294 ---
+float(1.5707963265621)
+--- testing: 4294967295 ---
+float(1.5707963265621)
+--- testing: 4294967293 ---
+float(1.5707963265621)
+--- testing: 9223372036854775806 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18 ---
+float(1.5707963267949)
+--- testing: -9223372036854775807 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18 ---
+float(-1.5707963267949)
+===DONE===
diff --git a/ext/standard/tests/math/atan_error.phpt b/ext/standard/tests/math/atan_error.phpt
new file mode 100644
index 0000000..61b35b0
--- /dev/null
+++ b/ext/standard/tests/math/atan_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for atan()
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(atan($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(atan());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: atan() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: atan() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt
new file mode 100644
index 0000000..c58514d
--- /dev/null
+++ b/ext/standard/tests/math/atan_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of atan()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test atan with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = atan($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1.527345431)
+float(-1.527345431)
+float(1.528178225)
+float(-1.528178225)
+float(1.527345431)
+float(1.527345431)
+float(1.527345431)
+float(1.528178225)
+float(1.528178225)
+
+Warning: atan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(1.569796327)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(1.569796327)
+float(0)
+float(0.7853981634)
+float(0)
diff --git a/ext/standard/tests/math/atanh_basic.phpt b/ext/standard/tests/math/atanh_basic.phpt
new file mode 100644
index 0000000..7e7144e
--- /dev/null
+++ b/ext/standard/tests/math/atanh_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input atanh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "atanh 0.46211715726001 = ";
+var_dump(atanh(0.46211715726001));
+if (allowed_rounding_error(atanh(0.46211715726001), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "atanh 0.99505475368673 = ";
+var_dump(atanh(0.99505475368673));
+if (allowed_rounding_error(atanh(0.99505475368673), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+?>
+--EXPECTF--
+atanh 0.46211715726001 = float(%f)
+Pass
+atanh 0.99505475368673 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/atanh_basiclong_64bit.phpt b/ext/standard/tests/math/atanh_basiclong_64bit.phpt
new file mode 100644
index 0000000..d7608ca
--- /dev/null
+++ b/ext/standard/tests/math/atanh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test atanh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(atanh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(NAN)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(NAN)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(NAN)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(NAN)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(NAN)
+--- testing: 4294967295 ---
+float(NAN)
+--- testing: 4294967293 ---
+float(NAN)
+--- testing: 9223372036854775806 ---
+float(NAN)
+--- testing: 9.2233720368548E+18 ---
+float(NAN)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/atanh_error.phpt b/ext/standard/tests/math/atanh_error.phpt
new file mode 100644
index 0000000..e442825
--- /dev/null
+++ b/ext/standard/tests/math/atanh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for atanh()
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(atanh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(atanh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: atanh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: atanh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt
new file mode 100644
index 0000000..4ce9646
--- /dev/null
+++ b/ext/standard/tests/math/atanh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of atanh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test atanh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = atanh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+Warning: atanh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(NAN)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(NAN)
+float(0)
+float(INF)
+float(0)
diff --git a/ext/standard/tests/math/base_convert_basic.phpt b/ext/standard/tests/math/base_convert_basic.phpt
new file mode 100644
index 0000000..327f47c
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_basic.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test base_convert() - basic function tests base_convert()
+--FILE--
+<?php
+$frombase = array(2,8,10,16,36);
+$tobase = array(2,8,10,16,36);
+
+$values = array(10,
+ 27,
+ 39,
+ 039,
+ 0x5F,
+ "10",
+ "27",
+ "39",
+ "5F",
+ "3XYZ"
+ );
+
+for ($f= 0; $f < count($frombase); $f++) {
+ echo "\n...from base is ", $frombase[$f], "\n";
+ for ($t= 0; $t < count($tobase); $t++) {
+ echo "......to base is ", $tobase[$t], "\n";
+ for ($i =0; $i < count($values); $i++){
+ $res = base_convert($values[$i],$frombase[$f],$tobase[$t]);
+ echo ".........value= ", $values[$i], " res = ", $res, "\n";
+ }
+ }
+}
+?>
+
+--EXPECTF--
+...from base is 2
+......to base is 2
+.........value= 10 res = 10
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 10
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 8
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 10
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 16
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 36
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+
+...from base is 8
+......to base is 2
+.........value= 10 res = 1000
+.........value= 27 res = 10111
+.........value= 39 res = 11
+.........value= 3 res = 11
+.........value= 95 res = 101
+.........value= 10 res = 1000
+.........value= 27 res = 10111
+.........value= 39 res = 11
+.........value= 5F res = 101
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 8
+.........value= 27 res = 23
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = 23
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = 8
+.........value= 27 res = 17
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = 17
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = 8
+.........value= 27 res = n
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = n
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+
+...from base is 10
+......to base is 2
+.........value= 10 res = 1010
+.........value= 27 res = 11011
+.........value= 39 res = 100111
+.........value= 3 res = 11
+.........value= 95 res = 1011111
+.........value= 10 res = 1010
+.........value= 27 res = 11011
+.........value= 39 res = 100111
+.........value= 5F res = 101
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 12
+.........value= 27 res = 33
+.........value= 39 res = 47
+.........value= 3 res = 3
+.........value= 95 res = 137
+.........value= 10 res = 12
+.........value= 27 res = 33
+.........value= 39 res = 47
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = a
+.........value= 27 res = 1b
+.........value= 39 res = 27
+.........value= 3 res = 3
+.........value= 95 res = 5f
+.........value= 10 res = a
+.........value= 27 res = 1b
+.........value= 39 res = 27
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = a
+.........value= 27 res = r
+.........value= 39 res = 13
+.........value= 3 res = 3
+.........value= 95 res = 2n
+.........value= 10 res = a
+.........value= 27 res = r
+.........value= 39 res = 13
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+
+...from base is 16
+......to base is 2
+.........value= 10 res = 10000
+.........value= 27 res = 100111
+.........value= 39 res = 111001
+.........value= 3 res = 11
+.........value= 95 res = 10010101
+.........value= 10 res = 10000
+.........value= 27 res = 100111
+.........value= 39 res = 111001
+.........value= 5F res = 1011111
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 20
+.........value= 27 res = 47
+.........value= 39 res = 71
+.........value= 3 res = 3
+.........value= 95 res = 225
+.........value= 10 res = 20
+.........value= 27 res = 47
+.........value= 39 res = 71
+.........value= 5F res = 137
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 16
+.........value= 27 res = 39
+.........value= 39 res = 57
+.........value= 3 res = 3
+.........value= 95 res = 149
+.........value= 10 res = 16
+.........value= 27 res = 39
+.........value= 39 res = 57
+.........value= 5F res = 95
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5f
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = g
+.........value= 27 res = 13
+.........value= 39 res = 1l
+.........value= 3 res = 3
+.........value= 95 res = 45
+.........value= 10 res = g
+.........value= 27 res = 13
+.........value= 39 res = 1l
+.........value= 5F res = 2n
+.........value= 3XYZ res = 3
+
+...from base is 36
+......to base is 2
+.........value= 10 res = 100100
+.........value= 27 res = 1001111
+.........value= 39 res = 1110101
+.........value= 3 res = 11
+.........value= 95 res = 101001001
+.........value= 10 res = 100100
+.........value= 27 res = 1001111
+.........value= 39 res = 1110101
+.........value= 5F res = 11000011
+.........value= 3XYZ res = 101100111010111011
+......to base is 8
+.........value= 10 res = 44
+.........value= 27 res = 117
+.........value= 39 res = 165
+.........value= 3 res = 3
+.........value= 95 res = 511
+.........value= 10 res = 44
+.........value= 27 res = 117
+.........value= 39 res = 165
+.........value= 5F res = 303
+.........value= 3XYZ res = 547273
+......to base is 10
+.........value= 10 res = 36
+.........value= 27 res = 79
+.........value= 39 res = 117
+.........value= 3 res = 3
+.........value= 95 res = 329
+.........value= 10 res = 36
+.........value= 27 res = 79
+.........value= 39 res = 117
+.........value= 5F res = 195
+.........value= 3XYZ res = 183995
+......to base is 16
+.........value= 10 res = 24
+.........value= 27 res = 4f
+.........value= 39 res = 75
+.........value= 3 res = 3
+.........value= 95 res = 149
+.........value= 10 res = 24
+.........value= 27 res = 4f
+.........value= 39 res = 75
+.........value= 5F res = c3
+.........value= 3XYZ res = 2cebb
+......to base is 36
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5f
+.........value= 3XYZ res = 3xyz \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
new file mode 100644
index 0000000..4e35a81
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test base_convert() function : error conditions - incorrect input
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "Incorrect number of arguments\n";
+base_convert();
+base_convert(35);
+base_convert(35,2);
+base_convert(1234, 1, 10);
+base_convert(1234, 10, 37);
+
+echo "Incorrect input\n";
+base_convert(new classA(), 8, 10);
+
+?>
+--EXPECTF--
+*** Testing base_convert() : error conditions ***
+Incorrect number of arguments
+
+Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d
+
+Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d
+
+Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+
+Warning: base_convert(): Invalid `to base' (37) in %s on line %s
+Incorrect input
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt
new file mode 100644
index 0000000..afa0c5b
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_variation1.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test base_convert() function : usage variations - different data types as $number argument
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of base_convert()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert($input, 10, 8));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing base_convert() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(2) "14"
+
+-- Iteration 4 --
+string(2) "14"
+
+-- Iteration 5 --
+string(11) "17777777777"
+
+-- Iteration 6 --
+string(3) "151"
+
+-- Iteration 7 --
+string(3) "151"
+
+-- Iteration 8 --
+string(7) "4553207"
+
+-- Iteration 9 --
+string(7) "4553207"
+
+-- Iteration 10 --
+string(1) "5"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "1"
+
+-- Iteration 14 --
+string(1) "0"
+
+-- Iteration 15 --
+string(1) "1"
+
+-- Iteration 16 --
+string(1) "0"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+string(1) "0"
+
+-- Iteration 25 --
+string(%d) "%d"
+===Done===
diff --git a/ext/standard/tests/math/base_convert_variation2.phpt b/ext/standard/tests/math/base_convert_variation2.phpt
new file mode 100644
index 0000000..bc02584
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_variation2.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test base_convert() function : usage variations - different data types as $frombase argument
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ -1,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behaviour of base_convert()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert(25, $input, 8));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing base_convert() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: base_convert(): Invalid `from base' (-1) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: base_convert(): Invalid `from base' (-12) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: base_convert(): Invalid `from base' (2147483647) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+string(2) "31"
+
+-- Iteration 7 --
+
+Warning: base_convert(): Invalid `from base' (-10) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: base_convert(): Invalid `from base' (123) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: base_convert() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_variation3.phpt b/ext/standard/tests/math/base_convert_variation3.phpt
new file mode 100644
index 0000000..039d271
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_variation3.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test base_convert() function : usage variations - different data types as $tobase argument
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ -1,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behaviour of base_convert()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert(25, 10, $input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing base_convert() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: base_convert(): Invalid `to base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: base_convert(): Invalid `to base' (-1) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: base_convert(): Invalid `to base' (-12) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: base_convert(): Invalid `to base' (2147483647) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+string(2) "25"
+
+-- Iteration 7 --
+
+Warning: base_convert(): Invalid `to base' (-10) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: base_convert(): Invalid `to base' (123) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: base_convert(): Invalid `to base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: base_convert(): Invalid `to base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: base_convert() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt
new file mode 100644
index 0000000..9fcca4a
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(111000111,
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = bindec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+float(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt
new file mode 100644
index 0000000..949c19e
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basic_64bit.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(111000111,
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = bindec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+int(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/bindec_basiclong_64bit.phpt b/ext/standard/tests/math/bindec_basiclong_64bit.phpt
new file mode 100644
index 0000000..3cc57d5
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basiclong_64bit.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test bindec function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$binLongStrs = array(
+ '0'.str_repeat('1',63),
+ str_repeat('1',64),
+ '0'.str_repeat('1',31),
+ str_repeat('1',32),
+ '0'.str_repeat('1',64),
+ str_repeat('1',65),
+ '0'.str_repeat('1',32),
+ str_repeat('1',33)
+);
+
+
+foreach ($binLongStrs as $strVal) {
+ echo "--- testing: $strVal ---\n";
+ var_dump(bindec($strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 0111111111111111111111111111111111111111111111111111111111111111 ---
+int(9223372036854775807)
+--- testing: 1111111111111111111111111111111111111111111111111111111111111111 ---
+float(1.844674407371E+19)
+--- testing: 01111111111111111111111111111111 ---
+int(2147483647)
+--- testing: 11111111111111111111111111111111 ---
+int(4294967295)
+--- testing: 01111111111111111111111111111111111111111111111111111111111111111 ---
+float(1.844674407371E+19)
+--- testing: 11111111111111111111111111111111111111111111111111111111111111111 ---
+float(3.6893488147419E+19)
+--- testing: 011111111111111111111111111111111 ---
+int(4294967295)
+--- testing: 111111111111111111111111111111111 ---
+int(8589934591)
+===DONE===
diff --git a/ext/standard/tests/math/bindec_error.phpt b/ext/standard/tests/math/bindec_error.phpt
new file mode 100644
index 0000000..8cf3cf7
--- /dev/null
+++ b/ext/standard/tests/math/bindec_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test bindec() function : error conditions - incorrect input
+--FILE--
+<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect input to bindec() to test behaviour
+ */
+
+echo "*** Testing bindec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "Incorrect number of arguments\n";
+bindec();
+bindec('01010101111',true);
+
+echo "Incorrect input\n";
+bindec(new classA());
+?>
+--EXPECTF--
+*** Testing bindec() : error conditions ***
+Incorrect number of arguments
+
+Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
+Incorrect input
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt
new file mode 100644
index 0000000..1e188ba
--- /dev/null
+++ b/ext/standard/tests/math/bindec_variation1.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test bindec() function : usage variations - different data types as $binary_string arg
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing bindec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of bindec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(bindec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing bindec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(0)
+
+-- Iteration 5 --
+int(2)
+
+-- Iteration 6 --
+int(2)
+
+-- Iteration 7 --
+int(8)
+
+-- Iteration 8 --
+int(1)
+
+-- Iteration 9 --
+int(0)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(%d)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt
new file mode 100644
index 0000000..0a37c4c
--- /dev/null
+++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test bindec() function : usage variations - different data types as $binary_string arg
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing bindec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of bindec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(bindec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing bindec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(0)
+
+-- Iteration 5 --
+int(2)
+
+-- Iteration 6 --
+int(2)
+
+-- Iteration 7 --
+int(8)
+
+-- Iteration 8 --
+int(1)
+
+-- Iteration 9 --
+int(0)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(%d)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/bug21523.phpt b/ext/standard/tests/math/bug21523.phpt
new file mode 100644
index 0000000..9fc441f
--- /dev/null
+++ b/ext/standard/tests/math/bug21523.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #21523 (number_format tries to allocate negative amount of memory)
+--FILE--
+<?php // $Id$ vim600:syn=php
+set_time_limit(5);
+
+var_dump(number_format(-2000, 2768));
+echo "OK";
+?>
+--EXPECT--
+string(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+OK
diff --git a/ext/standard/tests/math/bug24142.phpt b/ext/standard/tests/math/bug24142.phpt
new file mode 100644
index 0000000..2449523
--- /dev/null
+++ b/ext/standard/tests/math/bug24142.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #24142 (round() problems)
+--FILE--
+<?php // $Id$ vim600:syn=php
+$v = 0.005;
+for ($i = 1; $i < 10; $i++) {
+ echo "round({$v}, 2) -> ".round($v, 2)."\n";
+ $v += 0.01;
+}
+?>
+--EXPECT--
+round(0.005, 2) -> 0.01
+round(0.015, 2) -> 0.02
+round(0.025, 2) -> 0.03
+round(0.035, 2) -> 0.04
+round(0.045, 2) -> 0.05
+round(0.055, 2) -> 0.06
+round(0.065, 2) -> 0.07
+round(0.075, 2) -> 0.08
+round(0.085, 2) -> 0.09
diff --git a/ext/standard/tests/math/bug25665.phpt b/ext/standard/tests/math/bug25665.phpt
new file mode 100644
index 0000000..469236c
--- /dev/null
+++ b/ext/standard/tests/math/bug25665.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #25665 (var_dump () hangs on Nan and INF)
+--SKIPIF--
+<?php
+ $OS = strtoupper(PHP_OS);
+ if ($OS == 'SUNOS' || $OS == 'SOLARIS') die("SKIP Solaris acos() returns wrong value");
+?>
+--FILE--
+<?php
+set_time_limit(5);
+var_dump(acos(1.01));
+var_dump(log(0));
+?>
+--EXPECT--
+float(NAN)
+float(-INF)
diff --git a/ext/standard/tests/math/bug25694.phpt b/ext/standard/tests/math/bug25694.phpt
new file mode 100644
index 0000000..d40d2b8
--- /dev/null
+++ b/ext/standard/tests/math/bug25694.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #25694 (round() and number_format() inconsistency)
+--INI--
+precision=14
+--FILE--
+<?php
+echo "round 0.045 = " . round(0.045, 2) . "\n";
+echo "number format 0.045 = " . number_format(0.045, 2) . "\n\n";
+echo "round 0.055 = " . round(0.055, 2) . "\n";
+echo "number format 0.055 = " . number_format(0.055, 2) . "\n\n";
+echo "round 5.045 = " . round(5.045, 2) . "\n";
+echo "number format 5.045 = " . number_format(5.045, 2) . "\n\n";
+echo "round 5.055 = " . round(5.055, 2) . "\n";
+echo "number format 5.055 = " . number_format(5.055, 2) . "\n\n";
+echo "round 3.025 = " . round(3.025, 2) . "\n";
+echo "number format 3.025 = " . number_format(3.025, 2) . "\n\n";
+echo "round 4.025 = " . round(4.025, 2) . "\n";
+echo "number format 4.025 = " . number_format(4.025, 2) . "\n\n";
+?>
+--EXPECT--
+round 0.045 = 0.05
+number format 0.045 = 0.05
+
+round 0.055 = 0.06
+number format 0.055 = 0.06
+
+round 5.045 = 5.05
+number format 5.045 = 5.05
+
+round 5.055 = 5.06
+number format 5.055 = 5.06
+
+round 3.025 = 3.03
+number format 3.025 = 3.03
+
+round 4.025 = 4.03
+number format 4.025 = 4.03
diff --git a/ext/standard/tests/math/bug27646.phpt b/ext/standard/tests/math/bug27646.phpt
new file mode 100644
index 0000000..7b4a923
--- /dev/null
+++ b/ext/standard/tests/math/bug27646.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #27646 (Cannot serialize/unserialize non-finite numeric values)
+--FILE--
+<?php
+set_time_limit(5);
+
+$f=12.3;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=-12.3;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=-INF;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=INF;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=NAN;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+?>
+--EXPECTF--
+float(1%f)
+string(%d) "d:1%s;"
+float(1%f)
+float(-1%f)
+string(%d) "d:-1%s;"
+float(-1%f)
+float(-INF)
+string(7) "d:-INF;"
+float(-INF)
+float(INF)
+string(6) "d:INF;"
+float(INF)
+float(NAN)
+string(6) "d:NAN;"
+float(NAN)
diff --git a/ext/standard/tests/math/bug28228.phpt b/ext/standard/tests/math/bug28228.phpt
new file mode 100644
index 0000000..4223f4b
--- /dev/null
+++ b/ext/standard/tests/math/bug28228.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #28228 (number_format() does not allow empty decimal separator)
+--FILE--
+<?php
+echo number_format(1234.5678, 4, '', '') . "\n";
+echo number_format(1234.5678, 4, NULL, ',') . "\n";
+echo number_format(1234.5678, 4, 0, ',') . "\n";
+echo number_format(1234.5678, 4);
+?>
+--EXPECT--
+12345678
+1,234.5678
+1,23405678
+1,234.5678
diff --git a/ext/standard/tests/math/bug30069.phpt b/ext/standard/tests/math/bug30069.phpt
new file mode 100644
index 0000000..5e3246c
--- /dev/null
+++ b/ext/standard/tests/math/bug30069.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #30069 (floats as strings used in calculations do not work)
+--FILE--
+<?php
+echo ".1" * "2";
+echo "\n";
+echo "-.1" * "2";
+echo "\n";
+?>
+--EXPECT--
+0.2
+-0.2
diff --git a/ext/standard/tests/math/bug30695.phpt b/ext/standard/tests/math/bug30695.phpt
new file mode 100644
index 0000000..c515784
--- /dev/null
+++ b/ext/standard/tests/math/bug30695.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #30695 (32 bit issues)
+--FILE--
+<?php
+ function toUTF8( $char_code )
+ {
+ switch ( $char_code )
+ {
+ case 0:
+ $char = chr( 0 );
+ case !($char_code & 0xffffff80): // 7 bit
+ $char = chr( $char_code );
+ break;
+ case !($char_code & 0xfffff800): // 11 bit
+ $char = ( chr(0xc0 | (($char_code >> 6) & 0x1f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xffff0000): // 16 bit
+ $char = ( chr(0xe0 | (($char_code >> 12) & 0x0f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xffe00000): // 21 bit
+ $char = ( chr(0xf0 | (($char_code >> 18) & 0x07)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xfc000000): // 26 bit
+ $char = ( chr(0xf8 | (($char_code >> 24) & 0x03)) .
+ chr(0x80 | (($char_code >> 18) & 0x3f)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ default: // 31 bit
+ $char = ( chr(0xfc | (($char_code >> 30) & 0x01)) .
+ chr(0x80 | (($char_code >> 24) & 0x3f)) .
+ chr(0x80 | (($char_code >> 18) & 0x3f)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ }
+ return $char;
+ }
+
+
+ echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n";
+?>
+--EXPECT--
+
+A
+é
+Ó€
+乿
diff --git a/ext/standard/tests/math/bug45712.phpt b/ext/standard/tests/math/bug45712.phpt
new file mode 100644
index 0000000..e10d0e7
--- /dev/null
+++ b/ext/standard/tests/math/bug45712.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Bug #45712 (NaN/INF comparison)
+--XFAIL--
+Bug 45712 not fixed yet.
+--FILE--
+<?php
+
+// NaN
+$nan = acos(1.01);
+var_dump($nan);
+var_dump(is_nan($nan));
+//
+var_dump($nan=='');
+var_dump($nan==0.5);
+var_dump($nan==50);
+var_dump($nan=='500');
+var_dump($nan=='abc');
+var_dump($nan==$nan);
+//
+var_dump($nan==='');
+var_dump($nan===0.5);
+var_dump($nan===50);
+var_dump($nan==='500');
+var_dump($nan==='abc');
+var_dump($nan===$nan);
+
+// INF
+$inf = pow(0,-2);
+var_dump($inf);
+var_dump(is_infinite($inf));
+//
+var_dump($inf=='');
+var_dump($inf==0.5);
+var_dump($inf==50);
+var_dump($inf=='500');
+var_dump($inf=='abc');
+var_dump($inf==$inf);
+//
+var_dump($inf==='');
+var_dump($inf===0.5);
+var_dump($inf===50);
+var_dump($inf==='500');
+var_dump($inf==='abc');
+var_dump($inf===$inf);
+
+?>
+--EXPECT--
+float(NAN)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+float(INF)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
diff --git a/ext/standard/tests/math/bug62112.phpt b/ext/standard/tests/math/bug62112.phpt
new file mode 100644
index 0000000..01de35a
--- /dev/null
+++ b/ext/standard/tests/math/bug62112.phpt
Binary files differ
diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt
new file mode 100644
index 0000000..6794605
--- /dev/null
+++ b/ext/standard/tests/math/ceil_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test ceil() - basic function test for ceil()
+--INI--
+precision=14
+--SKIPIF--
+if (strtolower(PHP_OS) == 'darwin') {
+ die('SKIP OSX does weird things with -0 so this test doesn't work there');
+}
+--FILE--
+<?php
+/* Prototype : float ceil ( float $value )
+ * Description: Round fractions up.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing ceil() : basic functionality ***\n";
+$values = array(0,
+ -0,
+ 0.5,
+ -0.5,
+ 1,
+ -1,
+ 1.5,
+ -1.5,
+ 2.6,
+ -2.6,
+ 037,
+ 0x5F,
+ "10.5",
+ "-10.5",
+ "3.95E3",
+ "-3.95E3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = ceil($values[$i]);
+ var_dump($res);
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing ceil() : basic functionality ***
+float(0)
+float(0)
+float(1)
+float(-0)
+float(1)
+float(-1)
+float(2)
+float(-1)
+float(3)
+float(-2)
+float(31)
+float(95)
+float(11)
+float(-10)
+float(3950)
+float(-3950)
+float(39)
+float(95)
+float(1)
+float(0)
+float(0)
+===Done===
diff --git a/ext/standard/tests/math/ceil_basiclong_64bit.phpt b/ext/standard/tests/math/ceil_basiclong_64bit.phpt
new file mode 100644
index 0000000..b4c23d8
--- /dev/null
+++ b/ext/standard/tests/math/ceil_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test ceil function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(ceil($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+float(2147483647)
+--- testing: -2147483648 ---
+float(-2147483648)
+--- testing: 9223372034707292160 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648 ---
+float(2147483648)
+--- testing: -2147483649 ---
+float(-2147483649)
+--- testing: 4294967294 ---
+float(4294967294)
+--- testing: 4294967295 ---
+float(4294967295)
+--- testing: 4294967293 ---
+float(4294967293)
+--- testing: 9223372036854775806 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/ceil_error.phpt b/ext/standard/tests/math/ceil_error.phpt
new file mode 100644
index 0000000..1cf7ce4
--- /dev/null
+++ b/ext/standard/tests/math/ceil_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test ceil() - error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float ceil ( float $value )
+ * Description: Round fractions up.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing ceil() : error conditions ***\n";
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(ceil($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(ceil());
+?>
+===Done===
+--EXPECTF--
+*** Testing ceil() : error conditions ***
+
+Too many arguments
+
+Warning: ceil() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: ceil() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt
new file mode 100644
index 0000000..7c1f859
--- /dev/null
+++ b/ext/standard/tests/math/ceil_variation1.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test ceil() function : usage variations - different data types as $value arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float ceil ( float $value )
+ * Description: Round fractions up.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing ceil() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $value argument
+$inputs = array(
+ // null data
+/* 1*/ NULL,
+ null,
+
+ // boolean data
+/* 3*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 7*/ "",
+ '',
+ array(),
+
+ // string data
+/*10*/ "abcxyz",
+ 'abcxyz}',
+ $heredoc,
+
+ // object data
+/*13*/ new classA(),
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable
+/*16*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of ceil()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(ceil($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing ceil() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(1)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(1)
+
+-- Iteration 6 --
+float(0)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(0)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(%d)
+===Done===
diff --git a/ext/standard/tests/math/constants.phpt b/ext/standard/tests/math/constants.phpt
new file mode 100644
index 0000000..deeb785
--- /dev/null
+++ b/ext/standard/tests/math/constants.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Math constants
+--INI--
+precision=14
+--FILE--
+<?php
+$constants = array(
+ "M_E",
+ "M_LOG2E",
+ "M_LOG10E",
+ "M_LN2",
+ "M_LN10",
+ "M_PI",
+ "M_PI_2",
+ "M_PI_4",
+ "M_1_PI",
+ "M_2_PI",
+ "M_SQRTPI",
+ "M_2_SQRTPI",
+ "M_LNPI",
+ "M_EULER",
+ "M_SQRT2",
+ "M_SQRT1_2",
+ "M_SQRT3"
+);
+foreach($constants as $constant) {
+ printf("%-10s: %s\n", $constant, constant($constant));
+}
+?>
+--EXPECTREGEX--
+M_E : 2.718281[0-9]*
+M_LOG2E : 1.442695[0-9]*
+M_LOG10E : 0.434294[0-9]*
+M_LN2 : 0.693147[0-9]*
+M_LN10 : 2.302585[0-9]*
+M_PI : 3.141592[0-9]*
+M_PI_2 : 1.570796[0-9]*
+M_PI_4 : 0.785398[0-9]*
+M_1_PI : 0.318309[0-9]*
+M_2_PI : 0.636619[0-9]*
+M_SQRTPI : 1.772453[0-9]*
+M_2_SQRTPI: 1.128379[0-9]*
+M_LNPI : 1.144729[0-9]*
+M_EULER : 0.577215[0-9]*
+M_SQRT2 : 1.414213[0-9]*
+M_SQRT1_2 : 0.707106[0-9]*
+M_SQRT3 : 1.732050[0-9]*
+
diff --git a/ext/standard/tests/math/constants_basic.phpt b/ext/standard/tests/math/constants_basic.phpt
new file mode 100644
index 0000000..0220d93
--- /dev/null
+++ b/ext/standard/tests/math/constants_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test for pre-defined math constants
+--INI--
+precision=14
+--FILE--
+<?php
+echo "M_E= ";
+var_dump(M_E);
+echo "M_LOG2E= ";
+var_dump(M_LOG2E);
+echo "M_LOG10E= ";
+var_dump(M_LOG10E);
+echo "M_LN2= ";
+var_dump(M_LN2);
+echo "M_LN10= ";
+var_dump(M_LN10);
+echo "M_PI= ";
+var_dump(M_PI);
+echo "M_PI_2= ";
+var_dump(M_PI_2);
+echo "M_PI_4= ";
+var_dump(M_PI_4);
+echo "M_1_PI= ";
+var_dump(M_1_PI);
+echo "M_2_PI= ";
+var_dump(M_2_PI);
+echo "M_SQRTPI= ";
+var_dump(M_SQRTPI);
+echo "M_2_SQRTPI= ";
+var_dump(M_2_SQRTPI);
+echo "M_LNPI= ";
+var_dump(M_LNPI);
+echo "M_EULER= ";
+var_dump(M_EULER);
+echo "M_SQRT2= ";
+var_dump(M_SQRT2);
+echo "M_SQRT1_2= ";
+var_dump(M_SQRT1_2);
+echo "M_SQRT3= ";
+var_dump(M_SQRT3);
+echo "INF= ";
+var_dump(INF);
+echo "NAN= ";
+var_dump(NAN);
+?>
+--EXPECT--
+M_E= float(2.718281828459)
+M_LOG2E= float(1.442695040889)
+M_LOG10E= float(0.43429448190325)
+M_LN2= float(0.69314718055995)
+M_LN10= float(2.302585092994)
+M_PI= float(3.1415926535898)
+M_PI_2= float(1.5707963267949)
+M_PI_4= float(0.78539816339745)
+M_1_PI= float(0.31830988618379)
+M_2_PI= float(0.63661977236758)
+M_SQRTPI= float(1.7724538509055)
+M_2_SQRTPI= float(1.1283791670955)
+M_LNPI= float(1.1447298858494)
+M_EULER= float(0.57721566490153)
+M_SQRT2= float(1.4142135623731)
+M_SQRT1_2= float(0.70710678118655)
+M_SQRT3= float(1.7320508075689)
+INF= float(INF)
+NAN= float(NAN)
diff --git a/ext/standard/tests/math/cos_basic.phpt b/ext/standard/tests/math/cos_basic.phpt
new file mode 100644
index 0000000..f0cfa66
--- /dev/null
+++ b/ext/standard/tests/math/cos_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test return type and value for expected input cos()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+// Use known values to test
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+$ninety = M_PI /2.0;
+$oneeighty = M_PI;
+$twoseventy = M_PI * 1.5;
+$threesixty = M_PI * 2.0;
+
+
+echo "cos 30 = ";
+var_dump(cos($thirty));
+if (allowed_rounding_error(cos($thirty),0.86602540378444)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 60 = ";
+var_dump(cos($sixty));
+if (allowed_rounding_error(cos($sixty),0.5)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 90 = ";
+var_dump(cos($ninety));
+if (allowed_rounding_error(cos($ninety),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 180 = ";
+var_dump(cos($oneeighty));
+if (allowed_rounding_error(cos($oneeighty),-1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 270 = ";
+var_dump(cos($twoseventy));
+if (allowed_rounding_error(cos($twoseventy),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 360 = ";
+var_dump(cos($threesixty));
+if (allowed_rounding_error(cos($threesixty),1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+cos 30 = float(%f)
+Pass
+cos 60 = float(%f)
+Pass
+cos 90 = float(%f)
+Pass
+cos 180 = float(%f)
+Pass
+cos 270 = float(%f)
+Pass
+cos 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/cos_basiclong_64bit.phpt b/ext/standard/tests/math/cos_basiclong_64bit.phpt
new file mode 100644
index 0000000..c9f0417
--- /dev/null
+++ b/ext/standard/tests/math/cos_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test cos function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(cos($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(0.0118000765128)
+--- testing: -9223372036854775808 ---
+float(0.0118000765128)
+--- testing: 2147483647 ---
+float(-0.68883669187794)
+--- testing: -2147483648 ---
+float(0.2378161945728)
+--- testing: 9223372034707292160 ---
+float(-0.96843630065544)
+--- testing: -9223372034707292160 ---
+float(-0.96843630065544)
+--- testing: 2147483648 ---
+float(0.2378161945728)
+--- testing: -2147483649 ---
+float(0.94582196847889)
+--- testing: 4294967294 ---
+float(-0.051008023845301)
+--- testing: 4294967295 ---
+float(-0.8679353473572)
+--- testing: 4294967293 ---
+float(0.81281584155442)
+--- testing: 9223372036854775806 ---
+float(0.0118000765128)
+--- testing: 9.2233720368548E+18 ---
+float(0.0118000765128)
+--- testing: -9223372036854775807 ---
+float(0.0118000765128)
+--- testing: -9.2233720368548E+18 ---
+float(0.0118000765128)
+===DONE===
diff --git a/ext/standard/tests/math/cos_error.phpt b/ext/standard/tests/math/cos_error.phpt
new file mode 100644
index 0000000..4090199
--- /dev/null
+++ b/ext/standard/tests/math/cos_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for cos()
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(cos($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(cos());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: cos() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: cos() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt
new file mode 100644
index 0000000..cb45f3e
--- /dev/null
+++ b/ext/standard/tests/math/cos_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of cos()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test cos with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = cos($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.1117112391)
+float(-0.1117112391)
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.1117112391)
+float(-0.1117112391)
+
+Warning: cos() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(0.5623790763)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(0.5623790763)
+float(1)
+float(0.5403023059)
+float(1)
diff --git a/ext/standard/tests/math/cosh_basic.phpt b/ext/standard/tests/math/cosh_basic.phpt
new file mode 100644
index 0000000..0a637ca
--- /dev/null
+++ b/ext/standard/tests/math/cosh_basic.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test return type and value for expected input cosh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "cosh .5 = ";
+var_dump(cosh(0.5));
+
+if (allowed_rounding_error(cosh(0.5),1.1276259652064)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh -0.5 = ";
+var_dump(cosh(-0.5));
+if (allowed_rounding_error(cosh(-0.5),1.1276259652064)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh 3 = ";
+var_dump(cosh(3.0));
+if (allowed_rounding_error(cosh(3.0), 10.067661995778)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh -3 = ";
+var_dump(cosh(-3.0));
+if (allowed_rounding_error(cosh(-3.0), 10.067661995778)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+cosh .5 = float(%f)
+Pass
+cosh -0.5 = float(%f)
+Pass
+cosh 3 = float(%f)
+Pass
+cosh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/cosh_basiclong_64bit.phpt b/ext/standard/tests/math/cosh_basiclong_64bit.phpt
new file mode 100644
index 0000000..0916839
--- /dev/null
+++ b/ext/standard/tests/math/cosh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test cosh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(cosh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(INF)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(INF)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(INF)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(INF)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(INF)
+--- testing: -9.2233720368548E+18 ---
+float(INF)
+===DONE===
diff --git a/ext/standard/tests/math/cosh_error.phpt b/ext/standard/tests/math/cosh_error.phpt
new file mode 100644
index 0000000..afed24f
--- /dev/null
+++ b/ext/standard/tests/math/cosh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for cosh()
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(cosh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(cosh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: cosh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: cosh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt
new file mode 100644
index 0000000..c702fa3
--- /dev/null
+++ b/ext/standard/tests/math/cosh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of cosh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test cosh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = cosh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+float(4872401723)
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+
+Warning: cosh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(INF)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(INF)
+float(1)
+float(1.543080635)
+float(1)
diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt
new file mode 100644
index 0000000..e6fc5dc
--- /dev/null
+++ b/ext/standard/tests/math/decbin_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test decbin() - basic function test
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = decbin($values[$i]);
+ var_dump($res);
+}
+?>
+
+--EXPECTF--
+string(4) "1010"
+string(12) "111101101110"
+string(12) "111101101110"
+string(2) "11"
+string(7) "1011111"
+string(4) "1010"
+string(12) "111101101110"
+string(2) "11"
+string(6) "100111"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0" \ No newline at end of file
diff --git a/ext/standard/tests/math/decbin_basiclong_64bit.phpt b/ext/standard/tests/math/decbin_basiclong_64bit.phpt
new file mode 100644
index 0000000..3dc61c4
--- /dev/null
+++ b/ext/standard/tests/math/decbin_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test decbin function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(decbin($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+string(63) "111111111111111111111111111111111111111111111111111111111111111"
+--- testing: -9223372036854775808 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000000"
+--- testing: 2147483647 ---
+string(31) "1111111111111111111111111111111"
+--- testing: -2147483648 ---
+string(64) "1111111111111111111111111111111110000000000000000000000000000000"
+--- testing: 9223372034707292160 ---
+string(63) "111111111111111111111111111111110000000000000000000000000000000"
+--- testing: -9223372034707292160 ---
+string(64) "1000000000000000000000000000000010000000000000000000000000000000"
+--- testing: 2147483648 ---
+string(32) "10000000000000000000000000000000"
+--- testing: -2147483649 ---
+string(64) "1111111111111111111111111111111101111111111111111111111111111111"
+--- testing: 4294967294 ---
+string(32) "11111111111111111111111111111110"
+--- testing: 4294967295 ---
+string(32) "11111111111111111111111111111111"
+--- testing: 4294967293 ---
+string(32) "11111111111111111111111111111101"
+--- testing: 9223372036854775806 ---
+string(63) "111111111111111111111111111111111111111111111111111111111111110"
+--- testing: 9.2233720368548E+18 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000000"
+--- testing: -9223372036854775807 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000001"
+--- testing: -9.2233720368548E+18 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000000"
+===DONE===
diff --git a/ext/standard/tests/math/decbin_error.phpt b/ext/standard/tests/math/decbin_error.phpt
new file mode 100644
index 0000000..fcfd187
--- /dev/null
+++ b/ext/standard/tests/math/decbin_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test expm1() - Error conditions
+--INI--
+precision=14
+--SKIPIF--
+<?php
+ function_exists('expm1') or die('skip expm1() is not supported in this build.');
+?>
+--FILE--
+<?php
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : error conditions ***\n";
+
+echo "\n-- Testing expm1() function with less than expected no. of arguments --\n";
+expm1();
+echo "\n-- Testing expm1() function with more than expected no. of arguments --\n";
+expm1(23,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : error conditions ***
+
+-- Testing expm1() function with less than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing expm1() function with more than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 2 given in %s on line %d
+===Done===
+
diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt
new file mode 100644
index 0000000..b357c27
--- /dev/null
+++ b/ext/standard/tests/math/decbin_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test decbin() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decbin ( int $number )
+ * Description: Decimal to binary.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decbin() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decbin()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decbin($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decbin() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(14) "11000000111001"
+
+-- Iteration 4 --
+string(32) "11111111111111111111011011010111"
+
+-- Iteration 5 --
+string(32) "11111111111111111111111111111111"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(4) "1010"
+
+-- Iteration 8 --
+string(32) "11111111111111111111111111110110"
+
+-- Iteration 9 --
+string(32) "10111110100110010001101000001000"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt
new file mode 100644
index 0000000..e82ee3e
--- /dev/null
+++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test decbin() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decbin ( int $number )
+ * Description: Decimal to binary.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decbin() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 18446744073709551615, // largest decimal
+ 18446744073709551616,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decbin()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decbin($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decbin() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(14) "11000000111001"
+
+-- Iteration 4 --
+string(64) "1111111111111111111111111111111111111111111111111111011011010111"
+
+-- Iteration 5 --
+string(1) "0"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(4) "1010"
+
+-- Iteration 8 --
+string(64) "1111111111111111111111111111111111111111111111111111111111110110"
+
+-- Iteration 9 --
+string(37) "1110010111110100110010001101000001000"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt
new file mode 100644
index 0000000..cba4aa6
--- /dev/null
+++ b/ext/standard/tests/math/dechex_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test dechex() - basic function dechex()
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = dechex($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+string(1) "a"
+string(3) "f6e"
+string(3) "f6e"
+string(1) "3"
+string(2) "5f"
+string(1) "a"
+string(3) "f6e"
+string(1) "3"
+string(2) "27"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0" \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_basiclong_64bit.phpt b/ext/standard/tests/math/dechex_basiclong_64bit.phpt
new file mode 100644
index 0000000..40b0879
--- /dev/null
+++ b/ext/standard/tests/math/dechex_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test dechex function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(dechex($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+string(16) "7fffffffffffffff"
+--- testing: -9223372036854775808 ---
+string(16) "8000000000000000"
+--- testing: 2147483647 ---
+string(8) "7fffffff"
+--- testing: -2147483648 ---
+string(16) "ffffffff80000000"
+--- testing: 9223372034707292160 ---
+string(16) "7fffffff80000000"
+--- testing: -9223372034707292160 ---
+string(16) "8000000080000000"
+--- testing: 2147483648 ---
+string(8) "80000000"
+--- testing: -2147483649 ---
+string(16) "ffffffff7fffffff"
+--- testing: 4294967294 ---
+string(8) "fffffffe"
+--- testing: 4294967295 ---
+string(8) "ffffffff"
+--- testing: 4294967293 ---
+string(8) "fffffffd"
+--- testing: 9223372036854775806 ---
+string(16) "7ffffffffffffffe"
+--- testing: 9.2233720368548E+18 ---
+string(16) "8000000000000000"
+--- testing: -9223372036854775807 ---
+string(16) "8000000000000001"
+--- testing: -9.2233720368548E+18 ---
+string(16) "8000000000000000"
+===DONE===
diff --git a/ext/standard/tests/math/dechex_error.phpt b/ext/standard/tests/math/dechex_error.phpt
new file mode 100644
index 0000000..7ed0c45
--- /dev/null
+++ b/ext/standard/tests/math/dechex_error.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test dechex() - wrong params dechex()
+--FILE--
+<?php
+/* Prototype : string dechex ( int $number )
+ * Description: Returns a string containing a hexadecimal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing dechex() : error conditions ***\n";
+
+echo "\nIncorrect number of arguments\n";
+dechex();
+dechex(23,2,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing dechex() : error conditions ***
+
+Incorrect number of arguments
+
+Warning: dechex() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: dechex() expects exactly 1 parameter, 3 given in %s on line %d
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt
new file mode 100644
index 0000000..5bcd2b5
--- /dev/null
+++ b/ext/standard/tests/math/dechex_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test dechex() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string dechex ( int $number )
+ * Description: Returns a string containing a hexadecimal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing dechex() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of dechex()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(dechex($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing dechex() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(4) "3039"
+
+-- Iteration 4 --
+string(8) "fffff6d7"
+
+-- Iteration 5 --
+string(8) "ffffffff"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(1) "a"
+
+-- Iteration 8 --
+string(8) "fffffff6"
+
+-- Iteration 9 --
+string(8) "be991a08"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%s"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt
new file mode 100644
index 0000000..a513264
--- /dev/null
+++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test dechex() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string dechex ( int $number )
+ * Description: Returns a string containing a hexadecimal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing dechex() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 18446744073709551615, // largest decimal
+ 18446744073709551616,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of dechex()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(dechex($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing dechex() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(4) "3039"
+
+-- Iteration 4 --
+string(16) "fffffffffffff6d7"
+
+-- Iteration 5 --
+string(1) "0"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(1) "a"
+
+-- Iteration 8 --
+string(16) "fffffffffffffff6"
+
+-- Iteration 9 --
+string(10) "1cbe991a08"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%s"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt
new file mode 100644
index 0000000..3021e6b
--- /dev/null
+++ b/ext/standard/tests/math/decoct_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test decoct() - basic function test decoct()
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = decoct($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+string(2) "12"
+string(4) "7556"
+string(4) "7556"
+string(1) "3"
+string(3) "137"
+string(2) "12"
+string(4) "7556"
+string(1) "3"
+string(2) "47"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0"
diff --git a/ext/standard/tests/math/decoct_basiclong_64bit.phpt b/ext/standard/tests/math/decoct_basiclong_64bit.phpt
new file mode 100644
index 0000000..d743417
--- /dev/null
+++ b/ext/standard/tests/math/decoct_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test decoct function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(decoct($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+string(21) "777777777777777777777"
+--- testing: -9223372036854775808 ---
+string(22) "1000000000000000000000"
+--- testing: 2147483647 ---
+string(11) "17777777777"
+--- testing: -2147483648 ---
+string(22) "1777777777760000000000"
+--- testing: 9223372034707292160 ---
+string(21) "777777777760000000000"
+--- testing: -9223372034707292160 ---
+string(22) "1000000000020000000000"
+--- testing: 2147483648 ---
+string(11) "20000000000"
+--- testing: -2147483649 ---
+string(22) "1777777777757777777777"
+--- testing: 4294967294 ---
+string(11) "37777777776"
+--- testing: 4294967295 ---
+string(11) "37777777777"
+--- testing: 4294967293 ---
+string(11) "37777777775"
+--- testing: 9223372036854775806 ---
+string(21) "777777777777777777776"
+--- testing: 9.2233720368548E+18 ---
+string(22) "1000000000000000000000"
+--- testing: -9223372036854775807 ---
+string(22) "1000000000000000000001"
+--- testing: -9.2233720368548E+18 ---
+string(22) "1000000000000000000000"
+===DONE===
diff --git a/ext/standard/tests/math/decoct_error.phpt b/ext/standard/tests/math/decoct_error.phpt
new file mode 100644
index 0000000..d3f6699
--- /dev/null
+++ b/ext/standard/tests/math/decoct_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test decoct() - error conditions
+--FILE--
+<?php
+/* Prototype : string decbin ( int $number )
+ * Description: Decimal to binary.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decoct() : error conditions ***\n";
+
+echo "Incorrect number of arguments\n";
+decoct();
+decoct(23,2,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing decoct() : error conditions ***
+Incorrect number of arguments
+
+Warning: decoct() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: decoct() expects exactly 1 parameter, 3 given in %s on line %d
+===Done===
diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt
new file mode 100644
index 0000000..49ba57f
--- /dev/null
+++ b/ext/standard/tests/math/decoct_variation1.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test decoct() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decoct ( int $number )
+ * Description: Returns a string containing an octal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decoct() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decoct()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decoct($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decoct() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "30071"
+
+-- Iteration 4 --
+string(11) "37777773327"
+
+-- Iteration 5 --
+string(11) "37777777777"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(2) "12"
+
+-- Iteration 8 --
+string(11) "37777777766"
+
+-- Iteration 9 --
+string(11) "27646215010"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done===
diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt
new file mode 100644
index 0000000..40afafa
--- /dev/null
+++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test decoct() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decoct ( int $number )
+ * Description: Returns a string containing an octal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decoct() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 18446744073709551615, // largest decimal
+ 18446744073709551616,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decoct()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decoct($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decoct() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "30071"
+
+-- Iteration 4 --
+string(22) "1777777777777777773327"
+
+-- Iteration 5 --
+string(1) "0"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(2) "12"
+
+-- Iteration 8 --
+string(22) "1777777777777777777766"
+
+-- Iteration 9 --
+string(13) "1627646215010"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/deg2rad_basic.phpt b/ext/standard/tests/math/deg2rad_basic.phpt
new file mode 100644
index 0000000..64771b9
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_basic.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test return type and value for expected input deg2rad()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 0.0;
+$arg_1 = 90.0;
+$arg_2 = 180.0;
+$arg_3 = 360.0;
+
+
+echo "deg2rad $arg_0 = ";
+$r0 = deg2rad($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "deg2rad $arg_1 = ";
+$r1 = deg2rad($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,1.5707963267949 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "deg2rad $arg_2 = ";
+$r2 = deg2rad($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,3.1415926535898 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "deg2rad $arg_3 = ";
+$r3 = deg2rad($arg_3);
+var_dump($r3);
+if (allowed_rounding_error($r3 ,6.2831853071796 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+deg2rad 0 = float(%f)
+Pass
+deg2rad 90 = float(%f)
+Pass
+deg2rad 180 = float(%f)
+Pass
+deg2rad 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt b/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
new file mode 100644
index 0000000..c646276
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test deg2rad function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(deg2rad($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(1.6097821017949E+17)
+--- testing: -9223372036854775808 ---
+float(-1.6097821017949E+17)
+--- testing: 2147483647 ---
+float(37480660.272886)
+--- testing: -2147483648 ---
+float(-37480660.290339)
+--- testing: 9223372034707292160 ---
+float(1.6097821014201E+17)
+--- testing: -9223372034707292160 ---
+float(-1.6097821014201E+17)
+--- testing: 2147483648 ---
+float(37480660.290339)
+--- testing: -2147483649 ---
+float(-37480660.307792)
+--- testing: 4294967294 ---
+float(74961320.545771)
+--- testing: 4294967295 ---
+float(74961320.563225)
+--- testing: 4294967293 ---
+float(74961320.528318)
+--- testing: 9223372036854775806 ---
+float(1.6097821017949E+17)
+--- testing: 9.2233720368548E+18 ---
+float(1.6097821017949E+17)
+--- testing: -9223372036854775807 ---
+float(-1.6097821017949E+17)
+--- testing: -9.2233720368548E+18 ---
+float(-1.6097821017949E+17)
+===DONE===
diff --git a/ext/standard/tests/math/deg2rad_error.phpt b/ext/standard/tests/math/deg2rad_error.phpt
new file mode 100644
index 0000000..517680a
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for deg2rad()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(deg2rad($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(deg2rad());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: deg2rad() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: deg2rad() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt
new file mode 100644
index 0000000..70bb759
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of deg2rad()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test deg2rad with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = deg2rad($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(0.401425728)
+float(-0.401425728)
+float(0.4092797096)
+float(-0.4092797096)
+float(0.401425728)
+float(0.401425728)
+float(0.401425728)
+float(0.4092797096)
+float(0.4092797096)
+
+Warning: deg2rad() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(17.45329252)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(17.45329252)
+float(0)
+float(0.01745329252)
+float(0)
diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt
new file mode 100644
index 0000000..9526c66
--- /dev/null
+++ b/ext/standard/tests/math/exp_basic.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test exp() - basic function test for exp()
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(10,
+ 10.3,
+ 3.9505e3,
+ 037,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(exp($value));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+
+-- Iteration 1 --
+float(22026.465794807)
+
+-- Iteration 2 --
+float(29732.618852891)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(29048849665247)
+
+-- Iteration 5 --
+float(1.811239082889E+41)
+
+-- Iteration 6 --
+float(22026.465794807)
+
+-- Iteration 7 --
+float(INF)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(8.6593400423994E+16)
+
+-- Iteration 10 --
+float(1.811239082889E+41)
+
+-- Iteration 11 --
+float(2.718281828459)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(1)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/exp_basiclong_64bit.phpt b/ext/standard/tests/math/exp_basiclong_64bit.phpt
new file mode 100644
index 0000000..5156d05
--- /dev/null
+++ b/ext/standard/tests/math/exp_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test exp function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(exp($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(0)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(0)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(0)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(0)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(0)
+--- testing: -9.2233720368548E+18 ---
+float(0)
+===DONE===
diff --git a/ext/standard/tests/math/exp_error.phpt b/ext/standard/tests/math/exp_error.phpt
new file mode 100644
index 0000000..21949f4
--- /dev/null
+++ b/ext/standard/tests/math/exp_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test exp() - wrong params for exp()
+--INI--
+precision=14
+--FILE--
+<?php
+exp();
+exp(23,true);
+?>
+--EXPECTF--
+
+Warning: exp() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: exp() expects exactly 1 parameter, 2 given in %s on line %d
diff --git a/ext/standard/tests/math/exp_variation1.phpt b/ext/standard/tests/math/exp_variation1.phpt
new file mode 100644
index 0000000..567f6b2
--- /dev/null
+++ b/ext/standard/tests/math/exp_variation1.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test exp() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float exp ( float $arg )
+ * Description: Returns e raised to the power of arg.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing exp() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of exp()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(exp($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing exp() : usage variations ***
+
+-- Iteration 1 --
+float(1)
+
+-- Iteration 2 --
+float(2.718281828459)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(INF)
+
+-- Iteration 6 --
+float(36315.502674247)
+
+-- Iteration 7 --
+float(2.7536449349747E-5)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(1.0000000012346)
+
+-- Iteration 10 --
+float(1.6487212707001)
+
+-- Iteration 11 --
+float(1)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(2.718281828459)
+
+-- Iteration 14 --
+float(1)
+
+-- Iteration 15 --
+float(2.718281828459)
+
+-- Iteration 16 --
+float(1)
+
+-- Iteration 17 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: exp() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: exp() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(1)
+
+-- Iteration 25 --
+float(1)
+
+-- Iteration 26 --
+
+Warning: exp() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt
new file mode 100644
index 0000000..fa1d571
--- /dev/null
+++ b/ext/standard/tests/math/expm1_basic.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test expm1() - basic function test for expm1()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : basic functionality ***\n";
+$values = array(10,
+ 10.3,
+ 3.9505e3,
+ 037,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+// loop through each element of $values to check the behaviour of expm1()
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(expm1($value));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : basic functionality ***
+
+-- Iteration 1 --
+float(22025.465794807)
+
+-- Iteration 2 --
+float(29731.618852891)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(29048849665246)
+
+-- Iteration 5 --
+float(1.811239082889E+41)
+
+-- Iteration 6 --
+float(22025.465794807)
+
+-- Iteration 7 --
+float(INF)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(8.6593400423994E+16)
+
+-- Iteration 10 --
+float(1.811239082889E+41)
+
+-- Iteration 11 --
+float(1.718281828459)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/expm1_basiclong_64bit.phpt b/ext/standard/tests/math/expm1_basiclong_64bit.phpt
new file mode 100644
index 0000000..6963976
--- /dev/null
+++ b/ext/standard/tests/math/expm1_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test expm1 function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(expm1($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(-1)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(-1)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(-1)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(-1)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(-1)
+--- testing: -9.2233720368548E+18 ---
+float(-1)
+===DONE===
diff --git a/ext/standard/tests/math/expm1_error.phpt b/ext/standard/tests/math/expm1_error.phpt
new file mode 100644
index 0000000..380633b
--- /dev/null
+++ b/ext/standard/tests/math/expm1_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test expm1() - Error conditions
+--FILE--
+<?php
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : error conditions ***\n";
+
+echo "\n-- Testing expm1() function with less than expected no. of arguments --\n";
+expm1();
+echo "\n-- Testing expm1() function with more than expected no. of arguments --\n";
+expm1(23,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : error conditions ***
+
+-- Testing expm1() function with less than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing expm1() function with more than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 2 given in %s on line %d
+===Done===
diff --git a/ext/standard/tests/math/expm1_variation1.phpt b/ext/standard/tests/math/expm1_variation1.phpt
new file mode 100644
index 0000000..e976b5a
--- /dev/null
+++ b/ext/standard/tests/math/expm1_variation1.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test expm1() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789E4,
+ 12.3456789E-4,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // array data
+ array(),
+ array(1,2,4),
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of expm1()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(expm1($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1.718281828459)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(-1)
+
+-- Iteration 5 --
+float(36314.502674247)
+
+-- Iteration 6 --
+float(-0.99997246355065)
+
+-- Iteration 7 --
+float(INF)
+
+-- Iteration 8 --
+float(0.0012353302826471)
+
+-- Iteration 9 --
+float(0.64872127070013)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(1.718281828459)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(1.718281828459)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: expm1() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: expm1() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: expm1() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: expm1() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(0)
+
+-- Iteration 27 --
+
+Warning: expm1() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt
new file mode 100644
index 0000000..bbb8a2a
--- /dev/null
+++ b/ext/standard/tests/math/floor_basic.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test floor() - basic function test for floor()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float floor ( float $value )
+ * Description: Round fractions down.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing floor() : basic functionality ***\n";
+$values = array(0,
+ -0,
+ 0.5,
+ -0.5,
+ 1,
+ -1,
+ 1.5,
+ -1.5,
+ 2.6,
+ -2.6,
+ 037,
+ 0x5F,
+ "10.5",
+ "-10.5",
+ "3.95E3",
+ "-3.95E3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+foreach($values as $value) {
+ echo "\n-- floor $value --\n";
+ var_dump(floor($value));
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing floor() : basic functionality ***
+
+-- floor 0 --
+float(0)
+
+-- floor 0 --
+float(0)
+
+-- floor 0.5 --
+float(0)
+
+-- floor -0.5 --
+float(-1)
+
+-- floor 1 --
+float(1)
+
+-- floor -1 --
+float(-1)
+
+-- floor 1.5 --
+float(1)
+
+-- floor -1.5 --
+float(-2)
+
+-- floor 2.6 --
+float(2)
+
+-- floor -2.6 --
+float(-3)
+
+-- floor 31 --
+float(31)
+
+-- floor 95 --
+float(95)
+
+-- floor 10.5 --
+float(10)
+
+-- floor -10.5 --
+float(-11)
+
+-- floor 3.95E3 --
+float(3950)
+
+-- floor -3.95E3 --
+float(-3950)
+
+-- floor 039 --
+float(39)
+
+-- floor 0x5F --
+float(95)
+
+-- floor 1 --
+float(1)
+
+-- floor --
+float(0)
+
+-- floor --
+float(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/floor_basiclong_64bit.phpt b/ext/standard/tests/math/floor_basiclong_64bit.phpt
new file mode 100644
index 0000000..65a50fc
--- /dev/null
+++ b/ext/standard/tests/math/floor_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test floor function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(floor($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+float(2147483647)
+--- testing: -2147483648 ---
+float(-2147483648)
+--- testing: 9223372034707292160 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648 ---
+float(2147483648)
+--- testing: -2147483649 ---
+float(-2147483649)
+--- testing: 4294967294 ---
+float(4294967294)
+--- testing: 4294967295 ---
+float(4294967295)
+--- testing: 4294967293 ---
+float(4294967293)
+--- testing: 9223372036854775806 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/floor_error.phpt b/ext/standard/tests/math/floor_error.phpt
new file mode 100644
index 0000000..f33902e
--- /dev/null
+++ b/ext/standard/tests/math/floor_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test floor() - error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float floor ( float $value )
+ * Description: Round fractions down.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing floor() : error conditions ***\n";
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\n-- Too many arguments --\n";
+var_dump(floor($arg_0, $extra_arg));
+
+echo "\n-- Too few arguments --\n";
+var_dump(floor());
+?>
+===Done===
+--EXPECTF--
+*** Testing floor() : error conditions ***
+
+-- Too many arguments --
+
+Warning: floor() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Too few arguments --
+
+Warning: floor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt
new file mode 100644
index 0000000..baba53a
--- /dev/null
+++ b/ext/standard/tests/math/floor_variation1.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test floor() function : usage variations - different data types as $value arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float floor ( float $value )
+ * Description: Round fractions down.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing floor() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $value argument
+$inputs = array(
+ // null data
+/* 1*/ NULL,
+ null,
+
+ // boolean data
+/* 3*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 7*/ "",
+ '',
+ array(),
+
+ // string data
+/*10*/ "abcxyz",
+ 'abcxyz}',
+ $heredoc,
+
+ // object data
+/*13*/ new classA(),
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable
+/*16*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of floor()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(floor($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing floor() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(1)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(1)
+
+-- Iteration 6 --
+float(0)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(0)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(%f)
+===Done===
diff --git a/ext/standard/tests/math/floorceil.phpt b/ext/standard/tests/math/floorceil.phpt
new file mode 100644
index 0000000..2f7d82c
--- /dev/null
+++ b/ext/standard/tests/math/floorceil.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Tests for floor en ceil
+--FILE--
+<?php
+ $a = ceil (-0); $b = ceil (-1); $c = ceil (-1.5);
+ $d = ceil (-1.8); $e = ceil (-2.7);
+ var_dump ($a, $b, $c, $d, $e);
+
+ $a = ceil (0); $b = ceil (0.5); $c = ceil (1);
+ $d = ceil (1.5); $e = ceil (1.8); $f = ceil (2.7);
+ var_dump ($a, $b, $c, $d, $e, $f);
+
+ $a = floor (-0); $b = floor (-0.5); $c = floor (-1);
+ $d = floor (-1.5); $e = floor (-1.8); $f = floor (-2.7);
+ var_dump ($a, $b, $c, $d, $e, $f);
+
+ $a = floor (0); $b = floor (0.5); $c = floor (1);
+ $d = floor (1.5); $e = floor (1.8); $f = floor (2.7);
+ var_dump ($a, $b, $c, $d, $e, $f);
+?>
+--EXPECT--
+float(0)
+float(-1)
+float(-1)
+float(-1)
+float(-2)
+float(0)
+float(1)
+float(1)
+float(2)
+float(2)
+float(3)
+float(0)
+float(-1)
+float(-1)
+float(-2)
+float(-2)
+float(-3)
+float(0)
+float(0)
+float(1)
+float(1)
+float(1)
+float(2)
diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt
new file mode 100644
index 0000000..c29abca
--- /dev/null
+++ b/ext/standard/tests/math/fmod_basic.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Test fmod() - basic function test fmod()
+--INI--
+precision=14
+--FILE--
+<?php
+$values1 = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false);
+
+$values2 = array(2,
+ -2,
+ 2.3e1,
+ -2.3e1,
+ 0x2,
+ 02,
+ "2",
+ "2.3",
+ "2.3e1",
+ null,
+ true,
+ false);
+for ($i = 0; $i < count($values1); $i++) {
+ echo "\niteration ", $i, "\n";
+
+ for ($j = 0; $j < count($values2); $j++) {
+ $res = fmod($values1[$i], $values2[$j]);
+ var_dump($res);
+ }
+}
+?>
+--EXPECTF--
+
+iteration 0
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 1
+float(-0)
+float(-0)
+float(-4)
+float(-4)
+float(-0)
+float(-0)
+float(-0)
+float(-1.7)
+float(-4)
+float(NAN)
+float(-0)
+float(NAN)
+
+iteration 2
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 3
+float(-0.5)
+float(-0.5)
+float(-4.5)
+float(-4.5)
+float(-0.5)
+float(-0.5)
+float(-0.5)
+float(-2.2)
+float(-4.5)
+float(NAN)
+float(-0.5)
+float(NAN)
+
+iteration 4
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 5
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 6
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 7
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 8
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 9
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 10
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 11
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(NAN)
+float(0)
+float(NAN)
diff --git a/ext/standard/tests/math/fmod_basiclong_64bit.phpt b/ext/standard/tests/math/fmod_basiclong_64bit.phpt
new file mode 100644
index 0000000..1502b65
--- /dev/null
+++ b/ext/standard/tests/math/fmod_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test fmod function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(fmod($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+float(NAN)
+--- testing: 9223372036854775807, 1 ---
+float(0)
+--- testing: 9223372036854775807, -1 ---
+float(0)
+--- testing: 9223372036854775807, 7 ---
+float(1)
+--- testing: 9223372036854775807, 9 ---
+float(8)
+--- testing: 9223372036854775807, 65 ---
+float(8)
+--- testing: 9223372036854775807, -44 ---
+float(8)
+--- testing: 9223372036854775807, 2147483647 ---
+float(2)
+--- testing: 9223372036854775807, -2147483648 ---
+float(0)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(0)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775808, 0 ---
+float(NAN)
+--- testing: -9223372036854775808, 1 ---
+float(-0)
+--- testing: -9223372036854775808, -1 ---
+float(-0)
+--- testing: -9223372036854775808, 7 ---
+float(-1)
+--- testing: -9223372036854775808, 9 ---
+float(-8)
+--- testing: -9223372036854775808, 65 ---
+float(-8)
+--- testing: -9223372036854775808, -44 ---
+float(-8)
+--- testing: -9223372036854775808, 2147483647 ---
+float(-2)
+--- testing: -9223372036854775808, -2147483648 ---
+float(-0)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(-0)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(-0)
+--- testing: 2147483647, 0 ---
+float(NAN)
+--- testing: 2147483647, 1 ---
+float(0)
+--- testing: 2147483647, -1 ---
+float(0)
+--- testing: 2147483647, 7 ---
+float(1)
+--- testing: 2147483647, 9 ---
+float(1)
+--- testing: 2147483647, 65 ---
+float(62)
+--- testing: 2147483647, -44 ---
+float(23)
+--- testing: 2147483647, 2147483647 ---
+float(0)
+--- testing: 2147483647, -2147483648 ---
+float(2147483647)
+--- testing: 2147483647, 9223372036854775807 ---
+float(2147483647)
+--- testing: 2147483647, -9223372036854775808 ---
+float(2147483647)
+--- testing: -2147483648, 0 ---
+float(NAN)
+--- testing: -2147483648, 1 ---
+float(-0)
+--- testing: -2147483648, -1 ---
+float(-0)
+--- testing: -2147483648, 7 ---
+float(-2)
+--- testing: -2147483648, 9 ---
+float(-2)
+--- testing: -2147483648, 65 ---
+float(-63)
+--- testing: -2147483648, -44 ---
+float(-24)
+--- testing: -2147483648, 2147483647 ---
+float(-1)
+--- testing: -2147483648, -2147483648 ---
+float(-0)
+--- testing: -2147483648, 9223372036854775807 ---
+float(-2147483648)
+--- testing: -2147483648, -9223372036854775808 ---
+float(-2147483648)
+--- testing: 9223372034707292160, 0 ---
+float(NAN)
+--- testing: 9223372034707292160, 1 ---
+float(0)
+--- testing: 9223372034707292160, -1 ---
+float(0)
+--- testing: 9223372034707292160, 7 ---
+float(6)
+--- testing: 9223372034707292160, 9 ---
+float(6)
+--- testing: 9223372034707292160, 65 ---
+float(10)
+--- testing: 9223372034707292160, -44 ---
+float(28)
+--- testing: 9223372034707292160, 2147483647 ---
+float(1)
+--- testing: 9223372034707292160, -2147483648 ---
+float(0)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 0 ---
+float(NAN)
+--- testing: -9223372034707292160, 1 ---
+float(-0)
+--- testing: -9223372034707292160, -1 ---
+float(-0)
+--- testing: -9223372034707292160, 7 ---
+float(-6)
+--- testing: -9223372034707292160, 9 ---
+float(-6)
+--- testing: -9223372034707292160, 65 ---
+float(-10)
+--- testing: -9223372034707292160, -44 ---
+float(-28)
+--- testing: -9223372034707292160, 2147483647 ---
+float(-1)
+--- testing: -9223372034707292160, -2147483648 ---
+float(-0)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(-9.2233720347073E+18)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648, 0 ---
+float(NAN)
+--- testing: 2147483648, 1 ---
+float(0)
+--- testing: 2147483648, -1 ---
+float(0)
+--- testing: 2147483648, 7 ---
+float(2)
+--- testing: 2147483648, 9 ---
+float(2)
+--- testing: 2147483648, 65 ---
+float(63)
+--- testing: 2147483648, -44 ---
+float(24)
+--- testing: 2147483648, 2147483647 ---
+float(1)
+--- testing: 2147483648, -2147483648 ---
+float(0)
+--- testing: 2147483648, 9223372036854775807 ---
+float(2147483648)
+--- testing: 2147483648, -9223372036854775808 ---
+float(2147483648)
+--- testing: -2147483649, 0 ---
+float(NAN)
+--- testing: -2147483649, 1 ---
+float(-0)
+--- testing: -2147483649, -1 ---
+float(-0)
+--- testing: -2147483649, 7 ---
+float(-3)
+--- testing: -2147483649, 9 ---
+float(-3)
+--- testing: -2147483649, 65 ---
+float(-64)
+--- testing: -2147483649, -44 ---
+float(-25)
+--- testing: -2147483649, 2147483647 ---
+float(-2)
+--- testing: -2147483649, -2147483648 ---
+float(-1)
+--- testing: -2147483649, 9223372036854775807 ---
+float(-2147483649)
+--- testing: -2147483649, -9223372036854775808 ---
+float(-2147483649)
+--- testing: 4294967294, 0 ---
+float(NAN)
+--- testing: 4294967294, 1 ---
+float(0)
+--- testing: 4294967294, -1 ---
+float(0)
+--- testing: 4294967294, 7 ---
+float(2)
+--- testing: 4294967294, 9 ---
+float(2)
+--- testing: 4294967294, 65 ---
+float(59)
+--- testing: 4294967294, -44 ---
+float(2)
+--- testing: 4294967294, 2147483647 ---
+float(0)
+--- testing: 4294967294, -2147483648 ---
+float(2147483646)
+--- testing: 4294967294, 9223372036854775807 ---
+float(4294967294)
+--- testing: 4294967294, -9223372036854775808 ---
+float(4294967294)
+--- testing: 4294967295, 0 ---
+float(NAN)
+--- testing: 4294967295, 1 ---
+float(0)
+--- testing: 4294967295, -1 ---
+float(0)
+--- testing: 4294967295, 7 ---
+float(3)
+--- testing: 4294967295, 9 ---
+float(3)
+--- testing: 4294967295, 65 ---
+float(60)
+--- testing: 4294967295, -44 ---
+float(3)
+--- testing: 4294967295, 2147483647 ---
+float(1)
+--- testing: 4294967295, -2147483648 ---
+float(2147483647)
+--- testing: 4294967295, 9223372036854775807 ---
+float(4294967295)
+--- testing: 4294967295, -9223372036854775808 ---
+float(4294967295)
+--- testing: 4294967293, 0 ---
+float(NAN)
+--- testing: 4294967293, 1 ---
+float(0)
+--- testing: 4294967293, -1 ---
+float(0)
+--- testing: 4294967293, 7 ---
+float(1)
+--- testing: 4294967293, 9 ---
+float(1)
+--- testing: 4294967293, 65 ---
+float(58)
+--- testing: 4294967293, -44 ---
+float(1)
+--- testing: 4294967293, 2147483647 ---
+float(2147483646)
+--- testing: 4294967293, -2147483648 ---
+float(2147483645)
+--- testing: 4294967293, 9223372036854775807 ---
+float(4294967293)
+--- testing: 4294967293, -9223372036854775808 ---
+float(4294967293)
+--- testing: 9223372036854775806, 0 ---
+float(NAN)
+--- testing: 9223372036854775806, 1 ---
+float(0)
+--- testing: 9223372036854775806, -1 ---
+float(0)
+--- testing: 9223372036854775806, 7 ---
+float(1)
+--- testing: 9223372036854775806, 9 ---
+float(8)
+--- testing: 9223372036854775806, 65 ---
+float(8)
+--- testing: 9223372036854775806, -44 ---
+float(8)
+--- testing: 9223372036854775806, 2147483647 ---
+float(2)
+--- testing: 9223372036854775806, -2147483648 ---
+float(0)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(0)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(0)
+--- testing: 9.2233720368548E+18, 0 ---
+float(NAN)
+--- testing: 9.2233720368548E+18, 1 ---
+float(0)
+--- testing: 9.2233720368548E+18, -1 ---
+float(0)
+--- testing: 9.2233720368548E+18, 7 ---
+float(1)
+--- testing: 9.2233720368548E+18, 9 ---
+float(8)
+--- testing: 9.2233720368548E+18, 65 ---
+float(8)
+--- testing: 9.2233720368548E+18, -44 ---
+float(8)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(2)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(0)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(0)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775807, 0 ---
+float(NAN)
+--- testing: -9223372036854775807, 1 ---
+float(-0)
+--- testing: -9223372036854775807, -1 ---
+float(-0)
+--- testing: -9223372036854775807, 7 ---
+float(-1)
+--- testing: -9223372036854775807, 9 ---
+float(-8)
+--- testing: -9223372036854775807, 65 ---
+float(-8)
+--- testing: -9223372036854775807, -44 ---
+float(-8)
+--- testing: -9223372036854775807, 2147483647 ---
+float(-2)
+--- testing: -9223372036854775807, -2147483648 ---
+float(-0)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(-0)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(-0)
+--- testing: -9.2233720368548E+18, 0 ---
+float(NAN)
+--- testing: -9.2233720368548E+18, 1 ---
+float(-0)
+--- testing: -9.2233720368548E+18, -1 ---
+float(-0)
+--- testing: -9.2233720368548E+18, 7 ---
+float(-1)
+--- testing: -9.2233720368548E+18, 9 ---
+float(-8)
+--- testing: -9.2233720368548E+18, 65 ---
+float(-8)
+--- testing: -9.2233720368548E+18, -44 ---
+float(-8)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(-2)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(-0)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(-0)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(-0)
+===DONE===
diff --git a/ext/standard/tests/math/fmod_error.phpt b/ext/standard/tests/math/fmod_error.phpt
new file mode 100644
index 0000000..42a6ad1
--- /dev/null
+++ b/ext/standard/tests/math/fmod_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test fmod() - wrong params test fmod()
+--INI--
+precision=14
+--FILE--
+<?php
+fmod();
+fmod(23);
+fmod(23,2,true);
+?>
+--EXPECTF--
+
+Warning: fmod() expects exactly 2 parameters, 0 given in %s on line 2
+
+Warning: fmod() expects exactly 2 parameters, 1 given in %s on line 3
+
+Warning: fmod() expects exactly 2 parameters, 3 given in %s on line 4
diff --git a/ext/standard/tests/math/fmod_variation1.phpt b/ext/standard/tests/math/fmod_variation1.phpt
new file mode 100644
index 0000000..9c6ab13
--- /dev/null
+++ b/ext/standard/tests/math/fmod_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test fmod() function : usage variations - different data types as $x argument
+--FILE--
+<?php
+/* Prototype : float fmod ( float $x , float $y )
+ * Description: Returns the floating point remainder (modulo) of the division of the arguments.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing fmod() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of fmod()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(fmod($input, 2));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing fmod() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1)
+
+-- Iteration 3 --
+float(1)
+
+-- Iteration 4 --
+float(-1)
+
+-- Iteration 5 --
+float(1)
+
+-- Iteration 6 --
+float(0.5)
+
+-- Iteration 7 --
+float(-0.5)
+
+-- Iteration 8 --
+float(0)
+
+-- Iteration 9 --
+float(1.23456789E-9)
+
+-- Iteration 10 --
+float(0.5)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(1)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: fmod() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: fmod() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+
+Warning: fmod() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/fmod_variation2.phpt b/ext/standard/tests/math/fmod_variation2.phpt
new file mode 100644
index 0000000..bbeddb6
--- /dev/null
+++ b/ext/standard/tests/math/fmod_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test fmod() function : usage variations - different data types as $y argument
+--FILE--
+<?php
+/* Prototype : float fmod ( float $x , float $y )
+ * Description: Returns the floating point remainder (modulo) of the division of the arguments.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing fmod() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of fmod()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(fmod(123456, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing fmod() : usage variations ***
+
+-- Iteration 1 --
+float(NAN)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(6)
+
+-- Iteration 4 --
+float(1516)
+
+-- Iteration 5 --
+float(123456)
+
+-- Iteration 6 --
+float(7.5)
+
+-- Iteration 7 --
+float(7.5)
+
+-- Iteration 8 --
+float(123456)
+
+-- Iteration 9 --
+float(2.3605615109341E-10)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(NAN)
+
+-- Iteration 12 --
+float(NAN)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(NAN)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(NAN)
+
+-- Iteration 17 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: fmod() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: fmod() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(NAN)
+
+-- Iteration 25 --
+float(NAN)
+
+-- Iteration 26 --
+
+Warning: fmod() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/getrandmax_basic.phpt b/ext/standard/tests/math/getrandmax_basic.phpt
new file mode 100644
index 0000000..4e52c19
--- /dev/null
+++ b/ext/standard/tests/math/getrandmax_basic.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test getrandmax() - basic function test getrandmax()
+--FILE--
+<?php
+$biggest_int = getrandmax();
+var_dump($biggest_int);
+?>
+--EXPECTF--
+int(%d) \ No newline at end of file
diff --git a/ext/standard/tests/math/getrandmax_error.phpt b/ext/standard/tests/math/getrandmax_error.phpt
new file mode 100644
index 0000000..6cc87ff
--- /dev/null
+++ b/ext/standard/tests/math/getrandmax_error.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test getrandmax() - wrong params test getrandmax()
+--FILE--
+<?php
+var_dump($biggest_int = getrandmax(true));
+?>
+--EXPECTF--
+Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line 2
+NULL
diff --git a/ext/standard/tests/math/hexdec.phpt b/ext/standard/tests/math/hexdec.phpt
new file mode 100644
index 0000000..d9e644a
--- /dev/null
+++ b/ext/standard/tests/math/hexdec.phpt
@@ -0,0 +1,24 @@
+--TEST--
+overflow check for _php_math_basetozval
+--INI--
+precision=14
+--FILE--
+<?php
+
+var_dump(hexdec("012345"));
+var_dump(hexdec("12345"));
+var_dump(hexdec("q12345"));
+var_dump(hexdec("12345+?!"));
+var_dump(hexdec("12345q"));
+var_dump((float)hexdec("1234500001"));
+var_dump((float)hexdec("17fffffff"));
+
+?>
+--EXPECT--
+int(74565)
+int(74565)
+int(74565)
+int(74565)
+int(74565)
+float(78187069441)
+float(6442450943)
diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt
new file mode 100644
index 0000000..1c42ae7
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test hexdec() - basic function test hexdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(0x123abc,
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
+for ($i = 0; $i < count($values); $i++) {
+ $res = hexdec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(18433668)
+int(126895953)
+float(142929835591)
+float(142929835592)
+int(1194684)
+int(7904751)
+int(2147483647)
+float(2147483648)
+int(1194684)
+int(3215381)
+int(3215381)
+int(3215379)
+int(51446064)
+int(18279)
+int(70199)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt
new file mode 100644
index 0000000..f1a2028
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test hexdec() - basic function test hexdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+echo "*** Testing hexdec() : basic functionality ***\n";
+
+$values = array(0x123abc,
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
+
+foreach($values as $value) {
+ echo "\n-- hexdec $value --\n";
+ var_dump(hexdec($value));
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing hexdec() : basic functionality ***
+
+-- hexdec 1194684 --
+int(18433668)
+
+-- hexdec 7904751 --
+int(126895953)
+
+-- hexdec 2147483647 --
+int(142929835591)
+
+-- hexdec 2147483648 --
+int(142929835592)
+
+-- hexdec 0x123abc --
+int(1194684)
+
+-- hexdec 0x789DEF --
+int(7904751)
+
+-- hexdec 0x7FFFFFFF --
+int(2147483647)
+
+-- hexdec 0x80000000 --
+int(2147483648)
+
+-- hexdec 0x123XYZABC --
+int(1194684)
+
+-- hexdec 311015 --
+int(3215381)
+
+-- hexdec 311015 --
+int(3215381)
+
+-- hexdec 31101.3 --
+int(3215379)
+
+-- hexdec 3110130 --
+int(51446064)
+
+-- hexdec 4767 --
+int(18279)
+
+-- hexdec 011237 --
+int(70199)
+
+-- hexdec 1 --
+int(1)
+
+-- hexdec --
+int(0)
+
+-- hexdec --
+int(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hexdec_basiclong_64bit.phpt b/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
new file mode 100644
index 0000000..29c684a
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test hexdec function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$hexLongStrs = array(
+ '7'.str_repeat('f',15),
+ str_repeat('f',16),
+ '7'.str_repeat('f',7),
+ str_repeat('f',8),
+ '7'.str_repeat('f',16),
+ str_repeat('f',18),
+ '7'.str_repeat('f',8),
+ str_repeat('f',9)
+);
+
+
+foreach ($hexLongStrs as $strVal) {
+ echo "--- testing: $strVal ---\n";
+ var_dump(hexdec($strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 7fffffffffffffff ---
+int(9223372036854775807)
+--- testing: ffffffffffffffff ---
+float(1.844674407371E+19)
+--- testing: 7fffffff ---
+int(2147483647)
+--- testing: ffffffff ---
+int(4294967295)
+--- testing: 7ffffffffffffffff ---
+float(1.4757395258968E+20)
+--- testing: ffffffffffffffffff ---
+float(4.7223664828696E+21)
+--- testing: 7ffffffff ---
+int(34359738367)
+--- testing: fffffffff ---
+int(68719476735)
+===DONE===
diff --git a/ext/standard/tests/math/hexdec_error.phpt b/ext/standard/tests/math/hexdec_error.phpt
new file mode 100644
index 0000000..e9ab9e5
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test hexdec() - wrong params test hexdec()
+--FILE--
+<?php
+/* Prototype : number hexdec ( string $hex_string )
+ * Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hexdec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "\n-- Incorrect number of arguments --\n";
+hexdec();
+hexdec('0x123abc',true);
+
+echo "\n-- Incorrect input --\n";
+hexdec(new classA());
+
+?>
+--EXPECTF--
+*** Testing hexdec() : error conditions ***
+
+-- Incorrect number of arguments --
+
+Warning: hexdec() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: hexdec() expects exactly 1 parameter, 2 given in %s on line %d
+
+-- Incorrect input --
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt
new file mode 100644
index 0000000..2b3f1b6
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_variation1.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test hexdec() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number hexdec ( string $hex_string )
+ * Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hexdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hexdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hexdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hexdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(74565)
+
+-- Iteration 4 --
+int(9029)
+
+-- Iteration 5 --
+float(285960729237)
+
+-- Iteration 6 --
+float(285960729238)
+
+-- Iteration 7 --
+int(261)
+
+-- Iteration 8 --
+int(261)
+
+-- Iteration 9 --
+float(20015998341120)
+
+-- Iteration 10 --
+float(1250999896553)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+int(170)
+
+-- Iteration 21 --
+int(2748)
+
+-- Iteration 22 --
+int(2748)
+
+-- Iteration 23 --
+int(2748)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
new file mode 100644
index 0000000..65beb2d
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test hexdec() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number hexdec ( string $hex_string )
+ * Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hexdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hexdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hexdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hexdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(74565)
+
+-- Iteration 4 --
+int(9029)
+
+-- Iteration 5 --
+int(285960729237)
+
+-- Iteration 6 --
+int(285960729238)
+
+-- Iteration 7 --
+int(261)
+
+-- Iteration 8 --
+int(261)
+
+-- Iteration 9 --
+int(20015998341120)
+
+-- Iteration 10 --
+int(1250999896553)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+int(170)
+
+-- Iteration 21 --
+int(2748)
+
+-- Iteration 22 --
+int(2748)
+
+-- Iteration 23 --
+int(2748)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_basic.phpt b/ext/standard/tests/math/hypot_basic.phpt
new file mode 100644
index 0000000..c280a23
--- /dev/null
+++ b/ext/standard/tests/math/hypot_basic.phpt
@@ -0,0 +1,444 @@
+--TEST--
+Test hypot() - basic function test hypot()
+--INI--
+precision=14
+--FILE--
+<?php
+
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : basic functionality ***\n";
+
+$valuesy = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "23abc",
+ null,
+ true,
+ false);
+
+$valuesx = array(33,
+ -33,
+ 3.345e1,
+ -3.345e1,
+ 0x27,
+ 037,
+ "33",
+ "43.45",
+ "1.345e1",
+ "33abc",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($valuesy); $i++) {
+ for ($j = 0; $j < count($valuesx); $j++) {
+ echo "\nY:$valuesy[$i] X:$valuesx[$j] ";
+ $res = hypot($valuesy[$i], $valuesx[$j]);
+ var_dump($res);
+ }
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : basic functionality ***
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:-23 X:33 float(40.224370722238)
+
+Y:-23 X:-33 float(40.224370722238)
+
+Y:-23 X:33.45 float(40.594365372549)
+
+Y:-23 X:-33.45 float(40.594365372549)
+
+Y:-23 X:39 float(45.276925690687)
+
+Y:-23 X:31 float(38.600518131238)
+
+Y:-23 X:33 float(40.224370722238)
+
+Y:-23 X:43.45 float(49.162002603637)
+
+Y:-23 X:1.345e1 float(26.643995571235)
+
+Y:-23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:-23 X: float(23)
+
+Y:-23 X:1 float(23.021728866443)
+
+Y:-23 X: float(23)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:-33 float(40.483360779461)
+
+Y:23.45 X:33.45 float(40.851009779441)
+
+Y:23.45 X:-33.45 float(40.851009779441)
+
+Y:23.45 X:39 float(45.507169764774)
+
+Y:23.45 X:31 float(38.870329301409)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:43.45 float(49.374132903779)
+
+Y:23.45 X:1.345e1 float(27.033405260899)
+
+Y:23.45 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:23.45 X: float(23.45)
+
+Y:23.45 X:1 float(23.471312276905)
+
+Y:23.45 X: float(23.45)
+
+Y:-23.45 X:33 float(40.483360779461)
+
+Y:-23.45 X:-33 float(40.483360779461)
+
+Y:-23.45 X:33.45 float(40.851009779441)
+
+Y:-23.45 X:-33.45 float(40.851009779441)
+
+Y:-23.45 X:39 float(45.507169764774)
+
+Y:-23.45 X:31 float(38.870329301409)
+
+Y:-23.45 X:33 float(40.483360779461)
+
+Y:-23.45 X:43.45 float(49.374132903779)
+
+Y:-23.45 X:1.345e1 float(27.033405260899)
+
+Y:-23.45 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:-23.45 X: float(23.45)
+
+Y:-23.45 X:1 float(23.471312276905)
+
+Y:-23.45 X: float(23.45)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:-33 float(40.483360779461)
+
+Y:23.45 X:33.45 float(40.851009779441)
+
+Y:23.45 X:-33.45 float(40.851009779441)
+
+Y:23.45 X:39 float(45.507169764774)
+
+Y:23.45 X:31 float(38.870329301409)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:43.45 float(49.374132903779)
+
+Y:23.45 X:1.345e1 float(27.033405260899)
+
+Y:23.45 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:23.45 X: float(23.45)
+
+Y:23.45 X:1 float(23.471312276905)
+
+Y:23.45 X: float(23.45)
+
+Y:2.345e1 X:33 float(40.483360779461)
+
+Y:2.345e1 X:-33 float(40.483360779461)
+
+Y:2.345e1 X:33.45 float(40.851009779441)
+
+Y:2.345e1 X:-33.45 float(40.851009779441)
+
+Y:2.345e1 X:39 float(45.507169764774)
+
+Y:2.345e1 X:31 float(38.870329301409)
+
+Y:2.345e1 X:33 float(40.483360779461)
+
+Y:2.345e1 X:43.45 float(49.374132903779)
+
+Y:2.345e1 X:1.345e1 float(27.033405260899)
+
+Y:2.345e1 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:2.345e1 X: float(23.45)
+
+Y:2.345e1 X:1 float(23.471312276905)
+
+Y:2.345e1 X: float(23.45)
+
+Y:23abc X:33
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:-33
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:33.45
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.594365372549)
+
+Y:23abc X:-33.45
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.594365372549)
+
+Y:23abc X:39
+Notice: A non well formed numeric value encountered in %s on line %d
+float(45.276925690687)
+
+Y:23abc X:31
+Notice: A non well formed numeric value encountered in %s on line %d
+float(38.600518131238)
+
+Y:23abc X:33
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:43.45
+Notice: A non well formed numeric value encountered in %s on line %d
+float(49.162002603637)
+
+Y:23abc X:1.345e1
+Notice: A non well formed numeric value encountered in %s on line %d
+float(26.643995571235)
+
+Y:23abc X:33abc
+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
+float(40.224370722238)
+
+Y:23abc X:
+Notice: A non well formed numeric value encountered in %s on line %d
+float(23)
+
+Y:23abc X:1
+Notice: A non well formed numeric value encountered in %s on line %d
+float(23.021728866443)
+
+Y:23abc X:
+Notice: A non well formed numeric value encountered in %s on line %d
+float(23)
+
+Y: X:33 float(33)
+
+Y: X:-33 float(33)
+
+Y: X:33.45 float(33.45)
+
+Y: X:-33.45 float(33.45)
+
+Y: X:39 float(39)
+
+Y: X:31 float(31)
+
+Y: X:33 float(33)
+
+Y: X:43.45 float(43.45)
+
+Y: X:1.345e1 float(13.45)
+
+Y: X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(33)
+
+Y: X: float(0)
+
+Y: X:1 float(1)
+
+Y: X: float(0)
+
+Y:1 X:33 float(33.015148038438)
+
+Y:1 X:-33 float(33.015148038438)
+
+Y:1 X:33.45 float(33.464944344792)
+
+Y:1 X:-33.45 float(33.464944344792)
+
+Y:1 X:39 float(39.012818406262)
+
+Y:1 X:31 float(31.016124838542)
+
+Y:1 X:33 float(33.015148038438)
+
+Y:1 X:43.45 float(43.461505956421)
+
+Y:1 X:1.345e1 float(13.487123488721)
+
+Y:1 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(33.015148038438)
+
+Y:1 X: float(1)
+
+Y:1 X:1 float(1.4142135623731)
+
+Y:1 X: float(1)
+
+Y: X:33 float(33)
+
+Y: X:-33 float(33)
+
+Y: X:33.45 float(33.45)
+
+Y: X:-33.45 float(33.45)
+
+Y: X:39 float(39)
+
+Y: X:31 float(31)
+
+Y: X:33 float(33)
+
+Y: X:43.45 float(43.45)
+
+Y: X:1.345e1 float(13.45)
+
+Y: X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(33)
+
+Y: X: float(0)
+
+Y: X:1 float(1)
+
+Y: X: float(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_basiclong_64bit.phpt b/ext/standard/tests/math/hypot_basiclong_64bit.phpt
new file mode 100644
index 0000000..241fa9c
--- /dev/null
+++ b/ext/standard/tests/math/hypot_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test hypot function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(hypot($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, -1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 7 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 9 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 65 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, -44 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775808, 0 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, -1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 7 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 9 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 65 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, -44 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: 2147483647, 0 ---
+float(2147483647)
+--- testing: 2147483647, 1 ---
+float(2147483647)
+--- testing: 2147483647, -1 ---
+float(2147483647)
+--- testing: 2147483647, 7 ---
+float(2147483647)
+--- testing: 2147483647, 9 ---
+float(2147483647)
+--- testing: 2147483647, 65 ---
+float(2147483647)
+--- testing: 2147483647, -44 ---
+float(2147483647)
+--- testing: 2147483647, 2147483647 ---
+float(3037000498.5618)
+--- testing: 2147483647, -2147483648 ---
+float(3037000499.2689)
+--- testing: 2147483647, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 2147483647, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: -2147483648, 0 ---
+float(2147483648)
+--- testing: -2147483648, 1 ---
+float(2147483648)
+--- testing: -2147483648, -1 ---
+float(2147483648)
+--- testing: -2147483648, 7 ---
+float(2147483648)
+--- testing: -2147483648, 9 ---
+float(2147483648)
+--- testing: -2147483648, 65 ---
+float(2147483648)
+--- testing: -2147483648, -44 ---
+float(2147483648)
+--- testing: -2147483648, 2147483647 ---
+float(3037000499.2689)
+--- testing: -2147483648, -2147483648 ---
+float(3037000499.976)
+--- testing: -2147483648, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -2147483648, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 9223372034707292160, 0 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 1 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -1 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 7 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 9 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 65 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -44 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 2147483647 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -2147483648 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(1.3043817823814E+19)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(1.3043817823814E+19)
+--- testing: -9223372034707292160, 0 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 1 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, -1 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 7 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 9 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 65 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, -44 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 2147483647 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, -2147483648 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(1.3043817823814E+19)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(1.3043817823814E+19)
+--- testing: 2147483648, 0 ---
+float(2147483648)
+--- testing: 2147483648, 1 ---
+float(2147483648)
+--- testing: 2147483648, -1 ---
+float(2147483648)
+--- testing: 2147483648, 7 ---
+float(2147483648)
+--- testing: 2147483648, 9 ---
+float(2147483648)
+--- testing: 2147483648, 65 ---
+float(2147483648)
+--- testing: 2147483648, -44 ---
+float(2147483648)
+--- testing: 2147483648, 2147483647 ---
+float(3037000499.2689)
+--- testing: 2147483648, -2147483648 ---
+float(3037000499.976)
+--- testing: 2147483648, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 2147483648, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: -2147483649, 0 ---
+float(2147483649)
+--- testing: -2147483649, 1 ---
+float(2147483649)
+--- testing: -2147483649, -1 ---
+float(2147483649)
+--- testing: -2147483649, 7 ---
+float(2147483649)
+--- testing: -2147483649, 9 ---
+float(2147483649)
+--- testing: -2147483649, 65 ---
+float(2147483649)
+--- testing: -2147483649, -44 ---
+float(2147483649)
+--- testing: -2147483649, 2147483647 ---
+float(3037000499.976)
+--- testing: -2147483649, -2147483648 ---
+float(3037000500.6832)
+--- testing: -2147483649, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -2147483649, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 4294967294, 0 ---
+float(4294967294)
+--- testing: 4294967294, 1 ---
+float(4294967294)
+--- testing: 4294967294, -1 ---
+float(4294967294)
+--- testing: 4294967294, 7 ---
+float(4294967294)
+--- testing: 4294967294, 9 ---
+float(4294967294)
+--- testing: 4294967294, 65 ---
+float(4294967294)
+--- testing: 4294967294, -44 ---
+float(4294967294)
+--- testing: 4294967294, 2147483647 ---
+float(4801919415.2612)
+--- testing: 4294967294, -2147483648 ---
+float(4801919415.7084)
+--- testing: 4294967294, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 4294967294, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 4294967295, 0 ---
+float(4294967295)
+--- testing: 4294967295, 1 ---
+float(4294967295)
+--- testing: 4294967295, -1 ---
+float(4294967295)
+--- testing: 4294967295, 7 ---
+float(4294967295)
+--- testing: 4294967295, 9 ---
+float(4294967295)
+--- testing: 4294967295, 65 ---
+float(4294967295)
+--- testing: 4294967295, -44 ---
+float(4294967295)
+--- testing: 4294967295, 2147483647 ---
+float(4801919416.1556)
+--- testing: 4294967295, -2147483648 ---
+float(4801919416.6028)
+--- testing: 4294967295, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 4294967295, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 4294967293, 0 ---
+float(4294967293)
+--- testing: 4294967293, 1 ---
+float(4294967293)
+--- testing: 4294967293, -1 ---
+float(4294967293)
+--- testing: 4294967293, 7 ---
+float(4294967293)
+--- testing: 4294967293, 9 ---
+float(4294967293)
+--- testing: 4294967293, 65 ---
+float(4294967293)
+--- testing: 4294967293, -44 ---
+float(4294967293)
+--- testing: 4294967293, 2147483647 ---
+float(4801919414.3667)
+--- testing: 4294967293, -2147483648 ---
+float(4801919414.8139)
+--- testing: 4294967293, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 4294967293, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 0 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, -1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 7 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 9 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 65 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, -44 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: 9.2233720368548E+18, 0 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -1 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 7 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 9 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 65 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -44 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775807, 0 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, -1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 7 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 9 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 65 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, -44 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: -9.2233720368548E+18, 0 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 1 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -1 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 7 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 9 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 65 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -44 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(1.3043817825333E+19)
+===DONE===
diff --git a/ext/standard/tests/math/hypot_error.phpt b/ext/standard/tests/math/hypot_error.phpt
new file mode 100644
index 0000000..b357a3a
--- /dev/null
+++ b/ext/standard/tests/math/hypot_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test hypot() - wrong params test hypot()
+--FILE--
+<?php
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : error conditions ***\n";
+
+echo "\n-- Testing hypot() function with less than expected no. of arguments --\n";
+hypot();
+hypot(36);
+
+echo "\n-- Testing hypot() function with more than expected no. of arguments --\n";
+hypot(36,25,0);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : error conditions ***
+
+-- Testing hypot() function with less than expected no. of arguments --
+
+Warning: hypot() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: hypot() expects exactly 2 parameters, 1 given in %s on line %d
+
+-- Testing hypot() function with more than expected no. of arguments --
+
+Warning: hypot() expects exactly 2 parameters, 3 given in %s on line %d
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_variation1.phpt b/ext/standard/tests/math/hypot_variation1.phpt
new file mode 100644
index 0000000..5ea8b3f
--- /dev/null
+++ b/ext/standard/tests/math/hypot_variation1.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test hypot() function : usage variations - different data types as $x argument
+--FILE--
+<?php
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hypot()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hypot($input, 5));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : usage variations ***
+
+-- Iteration 1 --
+float(5)
+
+-- Iteration 2 --
+float(5.0990195135928)
+
+-- Iteration 3 --
+float(12345.001012556)
+
+-- Iteration 4 --
+float(2345.0053304843)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(11.629703349613)
+
+-- Iteration 7 --
+float(11.629703349613)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(5)
+
+-- Iteration 10 --
+float(5.0249378105604)
+
+-- Iteration 11 --
+float(5)
+
+-- Iteration 12 --
+float(5)
+
+-- Iteration 13 --
+float(5.0990195135928)
+
+-- Iteration 14 --
+float(5)
+
+-- Iteration 15 --
+float(5.0990195135928)
+
+-- Iteration 16 --
+float(5)
+
+-- Iteration 17 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: hypot() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: hypot() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(5)
+
+-- Iteration 25 --
+float(5)
+
+-- Iteration 26 --
+
+Warning: hypot() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_variation2.phpt b/ext/standard/tests/math/hypot_variation2.phpt
new file mode 100644
index 0000000..a629474
--- /dev/null
+++ b/ext/standard/tests/math/hypot_variation2.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test hypot() function : usage variations - different data types as $y argument
+--FILE--
+<?php
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hypot()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hypot(3, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : usage variations ***
+
+-- Iteration 1 --
+float(3)
+
+-- Iteration 2 --
+float(3.1622776601684)
+
+-- Iteration 3 --
+float(12345.00036452)
+
+-- Iteration 4 --
+float(2345.0019189758)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(10.920164833921)
+
+-- Iteration 7 --
+float(10.920164833921)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(3)
+
+-- Iteration 10 --
+float(3.0413812651491)
+
+-- Iteration 11 --
+float(3)
+
+-- Iteration 12 --
+float(3)
+
+-- Iteration 13 --
+float(3.1622776601684)
+
+-- Iteration 14 --
+float(3)
+
+-- Iteration 15 --
+float(3.1622776601684)
+
+-- Iteration 16 --
+float(3)
+
+-- Iteration 17 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: hypot() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: hypot() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(3)
+
+-- Iteration 25 --
+float(3)
+
+-- Iteration 26 --
+
+Warning: hypot() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt
new file mode 100644
index 0000000..85d2685
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test is_finite() - basic function test is_finite()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+;
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_finite($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+
diff --git a/ext/standard/tests/math/is_finite_basiclong_64bit.phpt b/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
new file mode 100644
index 0000000..bbc43f7
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_finite function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(is_finite($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+bool(true)
+--- testing: -9223372036854775808 ---
+bool(true)
+--- testing: 2147483647 ---
+bool(true)
+--- testing: -2147483648 ---
+bool(true)
+--- testing: 9223372034707292160 ---
+bool(true)
+--- testing: -9223372034707292160 ---
+bool(true)
+--- testing: 2147483648 ---
+bool(true)
+--- testing: -2147483649 ---
+bool(true)
+--- testing: 4294967294 ---
+bool(true)
+--- testing: 4294967295 ---
+bool(true)
+--- testing: 4294967293 ---
+bool(true)
+--- testing: 9223372036854775806 ---
+bool(true)
+--- testing: 9.2233720368548E+18 ---
+bool(true)
+--- testing: -9223372036854775807 ---
+bool(true)
+--- testing: -9.2233720368548E+18 ---
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/math/is_finite_error.phpt b/ext/standard/tests/math/is_finite_error.phpt
new file mode 100644
index 0000000..e265630
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test is_finite() - wrong params test is_finite()
+--FILE--
+<?php
+is_finite();
+is_finite(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_finite() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_finite() expects exactly 1 parameter, 3 given in %s on line 3
+
diff --git a/ext/standard/tests/math/is_finite_variation1.phpt b/ext/standard/tests/math/is_finite_variation1.phpt
new file mode 100644
index 0000000..83786ad
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test is_finite() function : usage variations - different data types as $val argument
+--FILE--
+<?php
+/* Prototype : bool is_finite ( float $val )
+ * Description: Finds whether a value is a legal finite number.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing is_finite() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of is_finite()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(is_finite($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing is_finite() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: is_finite() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: is_finite() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+bool(true)
+
+-- Iteration 25 --
+bool(true)
+
+-- Iteration 26 --
+
+Warning: is_finite() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt
new file mode 100644
index 0000000..ca79922
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test is_infinite() - basic function test is_infinite()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+;
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_infinite($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+
+
+
diff --git a/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt b/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
new file mode 100644
index 0000000..ab15ec7
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_infinite function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(is_infinite($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+bool(false)
+--- testing: -9223372036854775808 ---
+bool(false)
+--- testing: 2147483647 ---
+bool(false)
+--- testing: -2147483648 ---
+bool(false)
+--- testing: 9223372034707292160 ---
+bool(false)
+--- testing: -9223372034707292160 ---
+bool(false)
+--- testing: 2147483648 ---
+bool(false)
+--- testing: -2147483649 ---
+bool(false)
+--- testing: 4294967294 ---
+bool(false)
+--- testing: 4294967295 ---
+bool(false)
+--- testing: 4294967293 ---
+bool(false)
+--- testing: 9223372036854775806 ---
+bool(false)
+--- testing: 9.2233720368548E+18 ---
+bool(false)
+--- testing: -9223372036854775807 ---
+bool(false)
+--- testing: -9.2233720368548E+18 ---
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/math/is_infinite_error.phpt b/ext/standard/tests/math/is_infinite_error.phpt
new file mode 100644
index 0000000..5d6ad9d
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test is_infinite() - wrong params test is_infinite()
+--FILE--
+<?php
+is_infinite();
+is_infinite(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_infinite() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_infinite() expects exactly 1 parameter, 3 given in %s on line 3
diff --git a/ext/standard/tests/math/is_infinite_variation1.phpt b/ext/standard/tests/math/is_infinite_variation1.phpt
new file mode 100644
index 0000000..0d8573d
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test is_infinite() function : usage variations - different data types as $val argument
+--FILE--
+<?php
+/* Prototype : bool is_finite ( float $val )
+ * Description: Finds whether a value is infinite.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing is_infinite() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of is_infinite()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(is_infinite($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing is_infinite() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: is_infinite() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: is_infinite() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+
+Warning: is_infinite() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt
new file mode 100644
index 0000000..fb10737
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test is_nan() - basic function test is_nan()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_nan($values[$i]);
+ var_dump($res);
+}
+
+?>
+
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+
+
diff --git a/ext/standard/tests/math/is_nan_basiclong_64bit.phpt b/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
new file mode 100644
index 0000000..6f66d6b
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_nan function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(is_nan($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+bool(false)
+--- testing: -9223372036854775808 ---
+bool(false)
+--- testing: 2147483647 ---
+bool(false)
+--- testing: -2147483648 ---
+bool(false)
+--- testing: 9223372034707292160 ---
+bool(false)
+--- testing: -9223372034707292160 ---
+bool(false)
+--- testing: 2147483648 ---
+bool(false)
+--- testing: -2147483649 ---
+bool(false)
+--- testing: 4294967294 ---
+bool(false)
+--- testing: 4294967295 ---
+bool(false)
+--- testing: 4294967293 ---
+bool(false)
+--- testing: 9223372036854775806 ---
+bool(false)
+--- testing: 9.2233720368548E+18 ---
+bool(false)
+--- testing: -9223372036854775807 ---
+bool(false)
+--- testing: -9.2233720368548E+18 ---
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/math/is_nan_error.phpt b/ext/standard/tests/math/is_nan_error.phpt
new file mode 100644
index 0000000..7749e4e
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test is_nan() - wrong params test is_nan()
+--FILE--
+<?php
+is_nan();
+is_nan(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_nan() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_nan() expects exactly 1 parameter, 3 given in %s on line 3
+
+
+
+
diff --git a/ext/standard/tests/math/is_nan_variation1.phpt b/ext/standard/tests/math/is_nan_variation1.phpt
new file mode 100644
index 0000000..3eb6429
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test is_nan() function : usage variations - different data types as $val argument
+--FILE--
+<?php
+/* Prototype : bool is_nan ( float $val )
+ * Description: Finds whether a value is not a number.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing is_nan() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of is_nan()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(is_nan($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing is_nan() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: is_nan() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: is_nan() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+
+Warning: is_nan() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt
new file mode 100644
index 0000000..6d624d8
--- /dev/null
+++ b/ext/standard/tests/math/lcg_value_basic.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Maths test for xapic versions of lcg_value()
+--FILE--
+<?php
+
+echo "MATHS test script started\n";
+
+
+echo "\n lcg_value tests...\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = lcg_value();
+
+ if (!is_float($res) || $res < 0 || $res > 1) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+echo "\n lcg_value error cases..spurious args get ignored\n";
+$res = lcg_value(23);
+
+if (!is_float($res) || $res < 0 || $res > 1) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+$res = lcg_value(10,false);
+if (!is_float($res) || $res < 0 || $res > 1) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+echo "MATHS test script completed\n";
+
+?>
+
+--EXPECT--
+MATHS test script started
+
+ lcg_value tests...
+PASSED
+
+ lcg_value error cases..spurious args get ignored
+PASSED
+PASSED
+MATHS test script completed
+
+
+
diff --git a/ext/standard/tests/math/log.phpt b/ext/standard/tests/math/log.phpt
new file mode 100644
index 0000000..4f8b47a
--- /dev/null
+++ b/ext/standard/tests/math/log.phpt
@@ -0,0 +1,42 @@
+--TEST--
+log() tests
+--FILE--
+<?php // $Id$
+echo "On failure, please mail result to php-dev@lists.php.net\n";
+for ($x = 0, $count= 0; $x < 200; $x++) {
+ $x2 = (int) exp(log($x));
+ // e ^ log(x) should be close in range to x
+ if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
+ $count++;
+ } else {
+ print "$x : $x2\n";
+ }
+}
+print $count . "\n";
+
+// Now test the base form of log
+for ($base = 2; $base < 11; $base++) {
+ for ($x = 0, $count= 0; $x < 50; $x++) {
+ $x2 = (int) pow($base, log($x, $base));
+ // base ^ log(x) should be close in range to x
+ if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
+ $count++;
+ } else {
+ print "base $base: $x : $x2\n";
+ }
+ }
+ print $count . "\n";
+}
+?>
+--EXPECT--
+On failure, please mail result to php-dev@lists.php.net
+200
+50
+50
+50
+50
+50
+50
+50
+50
+50
diff --git a/ext/standard/tests/math/log10_basic.phpt b/ext/standard/tests/math/log10_basic.phpt
new file mode 100644
index 0000000..0877df2
--- /dev/null
+++ b/ext/standard/tests/math/log10_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test return type and value for expected input log10()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 1.0;
+$arg_1 = 10.0;
+$arg_2 = 100.0;
+
+echo "log10 $arg_0 = ";
+$r0 = log10($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "log10 $arg_1 = ";
+$r1 = log10($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,1.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "log10 $arg_2 = ";
+$r2 = log10($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,2.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+log10 1 = float(%f)
+Pass
+log10 10 = float(%f)
+Pass
+log10 100 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/log10_basiclong_64bit.phpt b/ext/standard/tests/math/log10_basiclong_64bit.phpt
new file mode 100644
index 0000000..be1b7ef
--- /dev/null
+++ b/ext/standard/tests/math/log10_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log10 function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(log10($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(18.964889726831)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(9.3319298653812)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(18.96488972673)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(9.3319298655834)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(9.6329598610452)
+--- testing: 4294967295 ---
+float(9.6329598611463)
+--- testing: 4294967293 ---
+float(9.632959860944)
+--- testing: 9223372036854775806 ---
+float(18.964889726831)
+--- testing: 9.2233720368548E+18 ---
+float(18.964889726831)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/log10_error.phpt b/ext/standard/tests/math/log10_error.phpt
new file mode 100644
index 0000000..e3bc604
--- /dev/null
+++ b/ext/standard/tests/math/log10_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for log10()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(log10($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(log10());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: log10() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: log10() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt
new file mode 100644
index 0000000..2325705
--- /dev/null
+++ b/ext/standard/tests/math/log10_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of log10()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test log10 with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = log10($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1.361727836)
+float(NAN)
+float(1.370142847)
+float(NAN)
+float(1.361727836)
+float(1.361727836)
+float(1.361727836)
+float(1.370142847)
+float(1.370142847)
+
+Warning: log10() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(3)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(3)
+float(-INF)
+float(0)
+float(-INF)
diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt
new file mode 100644
index 0000000..b289418
--- /dev/null
+++ b/ext/standard/tests/math/log1p_basic.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test log1p() - basic function test log1p()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : basic functionality ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+echo "\n LOG1p tests\n";
+
+foreach($values as $value) {
+ echo "\n-- log1p $value --\n";
+ var_dump(log1p($value));
+};
+
+
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : basic functionality ***
+
+ LOG1p tests
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p -23 --
+float(NAN)
+
+-- log1p 23.45 --
+float(3.1966302159209)
+
+-- log1p -23.45 --
+float(NAN)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23.45 --
+float(3.1966302159209)
+
+-- log1p 2.345e1 --
+float(3.1966302159209)
+
+-- log1p --
+float(0)
+
+-- log1p 1 --
+float(0.69314718055995)
+
+-- log1p --
+float(0)
+===Done===
diff --git a/ext/standard/tests/math/log1p_basiclong_64bit.phpt b/ext/standard/tests/math/log1p_basiclong_64bit.phpt
new file mode 100644
index 0000000..a0b32bd
--- /dev/null
+++ b/ext/standard/tests/math/log1p_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log1p function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(log1p($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(43.668272375277)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(21.487562597358)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(43.668272375044)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(21.487562597824)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(22.180709777685)
+--- testing: 4294967295 ---
+float(22.180709777918)
+--- testing: 4294967293 ---
+float(22.180709777453)
+--- testing: 9223372036854775806 ---
+float(43.668272375277)
+--- testing: 9.2233720368548E+18 ---
+float(43.668272375277)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/log1p_error.phpt b/ext/standard/tests/math/log1p_error.phpt
new file mode 100644
index 0000000..e0b01a1
--- /dev/null
+++ b/ext/standard/tests/math/log1p_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test log1p() - Error conditions
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : error conditions ***\n";
+
+echo "\n-- Testing log1p() function with less than expected no. of arguments --\n";
+log1p();
+echo "\n-- Testing log1p() function with more than expected no. of arguments --\n";
+log1p(36, true);
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : error conditions ***
+
+-- Testing log1p() function with less than expected no. of arguments --
+
+Warning: log1p() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing log1p() function with more than expected no. of arguments --
+
+Warning: log1p() expects exactly 1 parameter, 2 given in %s on line %d
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/log1p_variation1.phpt b/ext/standard/tests/math/log1p_variation1.phpt
new file mode 100644
index 0000000..d36b878
--- /dev/null
+++ b/ext/standard/tests/math/log1p_variation1.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test log1p() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+ -2147483648,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789E4,
+ 12.3456789E-4,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log1p()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log1p($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0.69314718055995)
+
+-- Iteration 3 --
+float(9.4210874029538)
+
+-- Iteration 4 --
+float(NAN)
+
+-- Iteration 5 --
+float(21.487562597358)
+
+-- Iteration 6 --
+float(NAN)
+
+-- Iteration 7 --
+float(2.4423470353692)
+
+-- Iteration 8 --
+float(NAN)
+
+-- Iteration 9 --
+float(11.723654587153)
+
+-- Iteration 10 --
+float(0.0012338064377078)
+
+-- Iteration 11 --
+float(0.40546510810816)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(0.69314718055995)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(0.69314718055995)
+
+-- Iteration 17 --
+float(0)
+
+-- Iteration 18 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log1p() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: log1p() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(0)
+
+-- Iteration 27 --
+
+Warning: log1p() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt
new file mode 100644
index 0000000..e2f9c9f
--- /dev/null
+++ b/ext/standard/tests/math/log_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log() - basic function test log()
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+echo "\n LOG tests...no base\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = log($values[$i]);
+ var_dump($res);
+}
+
+echo "\n LOG tests...base\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = log($values[$i], 4);
+ var_dump($res);
+}
+?>
+
+--EXPECTF--
+ LOG tests...no base
+float(3.1354942159291)
+float(NAN)
+float(3.1548704948923)
+float(NAN)
+float(3.1354942159291)
+float(3.1354942159291)
+float(3.1354942159291)
+float(3.1548704948923)
+float(3.1548704948923)
+float(-INF)
+float(0)
+float(-INF)
+
+ LOG tests...base
+float(2.2617809780285)
+float(NAN)
+float(2.275758008814)
+float(NAN)
+float(2.2617809780285)
+float(2.2617809780285)
+float(2.2617809780285)
+float(2.275758008814)
+float(2.275758008814)
+float(-INF)
+float(0)
+float(-INF)
diff --git a/ext/standard/tests/math/log_basiclong_64bit.phpt b/ext/standard/tests/math/log_basiclong_64bit.phpt
new file mode 100644
index 0000000..9a8f8a6
--- /dev/null
+++ b/ext/standard/tests/math/log_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(log($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(43.668272375277)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(21.487562596893)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(43.668272375044)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(21.487562597358)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(22.180709777453)
+--- testing: 4294967295 ---
+float(22.180709777685)
+--- testing: 4294967293 ---
+float(22.18070977722)
+--- testing: 9223372036854775806 ---
+float(43.668272375277)
+--- testing: 9.2233720368548E+18 ---
+float(43.668272375277)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt
new file mode 100644
index 0000000..48a23df
--- /dev/null
+++ b/ext/standard/tests/math/log_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test log() - wrong params test log()
+--INI--
+precision=14
+--FILE--
+<?php
+log();
+log(36,4,true);
+log(36, -4);
+?>
+--EXPECTF--
+Warning: log() expects at least 1 parameter, 0 given in %s on line %d
+
+Warning: log() expects at most 2 parameters, 3 given in %s on line %d
+
+Warning: log(): base must be greater than 0 in %s on line %d
diff --git a/ext/standard/tests/math/log_variation1.phpt b/ext/standard/tests/math/log_variation1.phpt
new file mode 100644
index 0000000..8925047
--- /dev/null
+++ b/ext/standard/tests/math/log_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test log() function : usage variations - different data types as $arg argument
+--FILE--
+<?php
+/* Prototype : float log ( float $arg [, float $base ] )
+ * Description: Natural logarithm.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log($input, 10));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log() : usage variations ***
+
+-- Iteration 1 --
+float(-INF)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(4.091491094268)
+
+-- Iteration 4 --
+float(NAN)
+
+-- Iteration 5 --
+float(9.3319298653812)
+
+-- Iteration 6 --
+float(1.0211892990699)
+
+-- Iteration 7 --
+float(NAN)
+
+-- Iteration 8 --
+float(11.091514977169)
+
+-- Iteration 9 --
+float(-8.9084850228307)
+
+-- Iteration 10 --
+float(-0.30102999566398)
+
+-- Iteration 11 --
+float(-INF)
+
+-- Iteration 12 --
+float(-INF)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(-INF)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(-INF)
+
+-- Iteration 17 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(-INF)
+
+-- Iteration 25 --
+float(-INF)
+
+-- Iteration 26 --
+
+Warning: log() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/log_variation2.phpt b/ext/standard/tests/math/log_variation2.phpt
new file mode 100644
index 0000000..327e7c5
--- /dev/null
+++ b/ext/standard/tests/math/log_variation2.phpt
@@ -0,0 +1,202 @@
+--TEST--
+Test log() function : usage variations - different data types as $base argument
+--FILE--
+<?php
+/* Prototype : float log ( float $arg [, float $base ] )
+ * Description: Natural logarithm.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log(3.14, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+float(NAN)
+
+-- Iteration 3 --
+float(0.12145441273706)
+
+-- Iteration 4 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+float(0.053250469650086)
+
+-- Iteration 6 --
+float(0.48661854224853)
+
+-- Iteration 7 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+float(0.044802684673473)
+
+-- Iteration 9 --
+float(-0.055781611216686)
+
+-- Iteration 10 --
+float(-1.6507645591169)
+
+-- Iteration 11 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+float(NAN)
+
+-- Iteration 14 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+float(NAN)
+
+-- Iteration 16 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 26 --
+
+Warning: log() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_getrandmax_basic.phpt b/ext/standard/tests/math/mt_getrandmax_basic.phpt
new file mode 100644
index 0000000..29a30d0
--- /dev/null
+++ b/ext/standard/tests/math/mt_getrandmax_basic.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Test mt_getrandmax() - basic function test mt_getrandmax()
+--FILE--
+<?php
+var_dump(mt_getrandmax());
+?>
+--EXPECTF--
+int(%d) \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_getrandmax_error.phpt b/ext/standard/tests/math/mt_getrandmax_error.phpt
new file mode 100644
index 0000000..fc6adb8
--- /dev/null
+++ b/ext/standard/tests/math/mt_getrandmax_error.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test mt_getrandmax() - wrong paramas mt_getrandmax()
+--FILE--
+<?php
+var_dump(mt_getrandmax(true));
+?>
+--EXPECTF--
+Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line 2
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt
new file mode 100644
index 0000000..8b6b3cb
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_basic.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test mt_rand() - basic function test mt_rand()
+--FILE--
+<?php
+$default_max = mt_getrandmax();
+
+echo "\nmt_rand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand();
+
+// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+} else {
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
+}
+
+echo "\nmt_rand() tests with defined min and max value\n";
+
+$min = array(10,
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
+
+$max = array(100,
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
+
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], $max[$x]);
+
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
+}
+
+echo "\nNon-numeric cases\n";
+$min = array(true,
+ false,
+ null,
+ "10",
+ "0x10",
+ "10.5");
+
+// Eexepcted numerical equivalent of above non-numerics
+$minval = array(1,
+ 0,
+ 0,
+ 10,
+ 0,
+ 10);
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], 100);
+
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
+}
+?>
+--EXPECTF--
+mt_rand() tests with default min and max value (i.e 0 thru 2147483647)
+PASSED: range min = 0 max = 2147483647
+
+mt_rand() tests with defined min and max value
+PASSED: range min = 10 max = 100
+PASSED: range min = 100 max = 1000
+PASSED: range min = 10 max = 19
+PASSED: range min = 10500 max = 1050000
+PASSED: range min = 16 max = 65536
+PASSED: range min = 256 max = 448
+
+Non-numeric cases
+PASSED range min = 1 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
diff --git a/ext/standard/tests/math/mt_rand_error.phpt b/ext/standard/tests/math/mt_rand_error.phpt
new file mode 100644
index 0000000..e0a8058
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test mt_rand() - wrong params test mt_rand()
+--FILE--
+<?php
+mt_rand(25);
+mt_rand(10,100,false);
+mt_rand("one", 100);
+mt_rand(1, "hundered");
+?>
+
+--EXPECTF--
+
+Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line 2
+
+Warning: mt_rand() expects exactly 2 parameters, 3 given in %s on line 3
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line 4
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line 5
diff --git a/ext/standard/tests/math/mt_rand_variation1.phpt b/ext/standard/tests/math/mt_rand_variation1.phpt
new file mode 100644
index 0000000..aa43716
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test rand() function : usage variations - different data types as $min argument
+--FILE--
+<?php
+/* Prototype : int mt_rand ([ int $min , int $max ] )
+ * Description: Generate a better random value.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_rand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000E8,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_rand($input, mt_getrandmax()));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_rand() : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_rand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_rand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: mt_rand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/mt_rand_variation2.phpt b/ext/standard/tests/math/mt_rand_variation2.phpt
new file mode 100644
index 0000000..2174a34
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test mt_rand() function : usage variations - different data types as $max argument
+--FILE--
+<?php
+/* Prototype : int mt_rand ([ int $min , int $max ] )
+ * Description: Generate a better random value.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_rand) : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_rand(-1 * mt_getrandmax(), $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_rand) : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_rand() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_rand() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: mt_rand() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/mt_srand_basic.phpt b/ext/standard/tests/math/mt_srand_basic.phpt
new file mode 100644
index 0000000..e28b1b9
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test mt_srand() - basic function (return values) mt_srand()
+--FILE--
+<?php
+// Should return NULL if given anything that it can convert to long
+// This doesn't actually test what it does with the input :-\
+var_dump(mt_srand());
+var_dump(mt_srand(500));
+var_dump(mt_srand(500.1));
+var_dump(mt_srand("500"));
+var_dump(mt_srand("500E3"));
+var_dump(mt_srand(true));
+var_dump(mt_srand(false));
+var_dump(mt_srand(NULL));
+?>
+--EXPECTF--
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_srand_error.phpt b/ext/standard/tests/math/mt_srand_error.phpt
new file mode 100644
index 0000000..5543d78
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_error.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test mt_srand() - wrong params test mt_srand()
+--FILE--
+<?php
+var_dump(mt_srand(500, true));
+var_dump(mt_srand("fivehundred"));
+var_dump(mt_srand("500ABC"));
+?>
+--EXPECTF--
+Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line 2
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line 3
+NULL
+
+Notice: A non well formed numeric value encountered in %s on line 4
+NULL
+
+
+
diff --git a/ext/standard/tests/math/mt_srand_variation1.phpt b/ext/standard/tests/math/mt_srand_variation1.phpt
new file mode 100644
index 0000000..feb0b37
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test mt_srand() function : usage variations - different data types as $seed argument
+--FILE--
+<?php
+/* Prototype : void mt_srand ([ int $seed ] )
+ * Description: Seed the better random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_srand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_srand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_srand($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_srand() : usage variations ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_srand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+NULL
+
+-- Iteration 25 --
+NULL
+
+-- Iteration 26 --
+
+Warning: mt_srand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt
new file mode 100644
index 0000000..7f5f4be
--- /dev/null
+++ b/ext/standard/tests/math/number_format_basic.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test number_format() - basic function test number_format()
+--FILE--
+<?php
+$values = array(1234.5678,
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
+
+echo "\n number_format tests.....default\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i]);
+ var_dump($res);
+}
+
+echo "\n number_format tests.....with two dp\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2);
+ var_dump($res);
+}
+
+echo "\n number_format tests.....English format\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '.', ' ');
+ var_dump($res);
+}
+
+echo "\n number_format tests.....French format\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, ',' , ' ');
+ var_dump($res);
+}
+?>
+--EXPECTF--
+ number_format tests.....default
+string(5) "1,235"
+string(6) "-1,235"
+string(10) "12,346,578"
+string(11) "-12,345,679"
+string(11) "305,450,479"
+string(11) "402,653,183"
+string(11) "123,456,789"
+string(3) "123"
+string(3) "123"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+
+ number_format tests.....with two dp
+string(8) "1,234.57"
+string(9) "-1,234.57"
+string(13) "12,346,578.00"
+string(14) "-12,345,678.90"
+string(14) "305,450,479.00"
+string(14) "402,653,183.00"
+string(14) "123,456,789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+ number_format tests.....English format
+string(8) "1 234.57"
+string(9) "-1 234.57"
+string(13) "12 346 578.00"
+string(14) "-12 345 678.90"
+string(14) "305 450 479.00"
+string(14) "402 653 183.00"
+string(14) "123 456 789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+ number_format tests.....French format
+string(8) "1 234,57"
+string(9) "-1 234,57"
+string(13) "12 346 578,00"
+string(14) "-12 345 678,90"
+string(14) "305 450 479,00"
+string(14) "402 653 183,00"
+string(14) "123 456 789,00"
+string(6) "123,46"
+string(6) "123,46"
+string(4) "0,00"
+string(4) "1,00"
+string(4) "0,00"
diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt
new file mode 100644
index 0000000..ae36d12
--- /dev/null
+++ b/ext/standard/tests/math/number_format_multichar.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test number_format() - multiple character separator support
+--FILE--
+<?php
+$values = array(1234.5678,
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
+
+echo " number_format tests.....multiple character decimal point\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '&#183;', ' ');
+ var_dump($res);
+}
+
+echo "\n number_format tests.....multiple character thousand separator\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '.' , '&thinsp;');
+ var_dump($res);
+}
+
+echo "\n number_format tests.....multiple character decimal and thousep\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '&#183;' , '&thinsp;');
+ var_dump($res);
+}
+?>
+--EXPECTF--
+ number_format tests.....multiple character decimal point
+string(13) "1 234&#183;57"
+string(14) "-1 234&#183;57"
+string(18) "12 346 578&#183;00"
+string(19) "-12 345 678&#183;90"
+string(19) "305 450 479&#183;00"
+string(19) "402 653 183&#183;00"
+string(19) "123 456 789&#183;00"
+string(11) "123&#183;46"
+string(11) "123&#183;46"
+string(9) "0&#183;00"
+string(9) "1&#183;00"
+string(9) "0&#183;00"
+
+ number_format tests.....multiple character thousand separator
+string(15) "1&thinsp;234.57"
+string(16) "-1&thinsp;234.57"
+string(27) "12&thinsp;346&thinsp;578.00"
+string(28) "-12&thinsp;345&thinsp;678.90"
+string(28) "305&thinsp;450&thinsp;479.00"
+string(28) "402&thinsp;653&thinsp;183.00"
+string(28) "123&thinsp;456&thinsp;789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+ number_format tests.....multiple character decimal and thousep
+string(20) "1&thinsp;234&#183;57"
+string(21) "-1&thinsp;234&#183;57"
+string(32) "12&thinsp;346&thinsp;578&#183;00"
+string(33) "-12&thinsp;345&thinsp;678&#183;90"
+string(33) "305&thinsp;450&thinsp;479&#183;00"
+string(33) "402&thinsp;653&thinsp;183&#183;00"
+string(33) "123&thinsp;456&thinsp;789&#183;00"
+string(11) "123&#183;46"
+string(11) "123&#183;46"
+string(9) "0&#183;00"
+string(9) "1&#183;00"
+string(9) "0&#183;00"
diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt
new file mode 100644
index 0000000..8fd57ec
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test octdec() - basic function test octdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(01234567,
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = octdec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(14489)
+int(253)
+int(36947879)
+int(4618484)
+int(4104)
+int(5349)
+int(342391)
+int(375)
+int(2147483647)
+float(2147483648)
+int(668)
+int(5349)
+int(102923)
+int(823384)
+int(1)
+int(0)
+int(0) \ No newline at end of file
diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt
new file mode 100644
index 0000000..98996dc
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basic_64bit.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test octdec() - basic function test octdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "*** Testing octdec() : basic functionality ***\n";
+
+$values = array(01234567,
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = octdec($values[$i]);
+ var_dump($res);
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing octdec() : basic functionality ***
+int(14489)
+int(253)
+int(36947879)
+int(4618484)
+int(4104)
+int(5349)
+int(342391)
+int(375)
+int(2147483647)
+int(2147483648)
+int(668)
+int(5349)
+int(102923)
+int(823384)
+int(1)
+int(0)
+int(0)
+===Done===
diff --git a/ext/standard/tests/math/octdec_basiclong_64bit.phpt b/ext/standard/tests/math/octdec_basiclong_64bit.phpt
new file mode 100644
index 0000000..651b09d
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basiclong_64bit.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test octdec function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$octLongStrs = array(
+ '777777777777777777777',
+ '1777777777777777777777',
+ '17777777777',
+ '37777777777',
+ '377777777777777777777777',
+ '17777777777777777777777777',
+ '377777777777',
+ '777777777777',
+);
+
+
+foreach ($octLongStrs as $strVal) {
+ echo "--- testing: $strVal ---\n";
+ var_dump(octdec($strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 777777777777777777777 ---
+int(9223372036854775807)
+--- testing: 1777777777777777777777 ---
+float(1.844674407371E+19)
+--- testing: 17777777777 ---
+int(2147483647)
+--- testing: 37777777777 ---
+int(4294967295)
+--- testing: 377777777777777777777777 ---
+float(2.3611832414348E+21)
+--- testing: 17777777777777777777777777 ---
+float(7.5557863725914E+22)
+--- testing: 377777777777 ---
+int(34359738367)
+--- testing: 777777777777 ---
+int(68719476735)
+===DONE===
diff --git a/ext/standard/tests/math/octdec_error.phpt b/ext/standard/tests/math/octdec_error.phpt
new file mode 100644
index 0000000..5d21383
--- /dev/null
+++ b/ext/standard/tests/math/octdec_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test octdec() - wrong params test octdec()
+--FILE--
+<?php
+/* Prototype : number octdec ( string $octal_string )
+ * Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing octdec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "\n-- Incorrect number of arguments --\n";
+octdec();
+octdec('0123567',true);
+
+echo "\n-- Incorrect input --\n";
+octdec(new classA());
+
+
+?>
+--EXPECTF--
+*** Testing octdec() : error conditions ***
+
+-- Incorrect number of arguments --
+
+Warning: octdec() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: octdec() expects exactly 1 parameter, 2 given in %s on line %d
+
+-- Incorrect input --
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt
new file mode 100644
index 0000000..1171196
--- /dev/null
+++ b/ext/standard/tests/math/octdec_variation1.phpt
@@ -0,0 +1,164 @@
+--TEST--
+Test octdec() function : usage variations - different data types as $octal_string arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : number octdec ( string $octal_string )
+ * Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing octdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of octdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(octdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+---Done---
+--EXPECTF--
+*** Testing octdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(5349)
+
+-- Iteration 4 --
+int(1253)
+
+-- Iteration 5 --
+int(1134037)
+
+-- Iteration 6 --
+int(1134038)
+
+-- Iteration 7 --
+int(69)
+
+-- Iteration 8 --
+int(69)
+
+-- Iteration 9 --
+int(175304192)
+
+-- Iteration 10 --
+int(342391)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+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(%d)
+---Done---
diff --git a/ext/standard/tests/math/pi_basic.phpt b/ext/standard/tests/math/pi_basic.phpt
new file mode 100644
index 0000000..fec5691
--- /dev/null
+++ b/ext/standard/tests/math/pi_basic.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test pi() - basic function test pi()
+--INI--
+precision=14
+--FILE--
+<?php
+echo pi(), "\n";
+echo M_PI, "\n";
+// N.B pi() ignores all specified arguments no error
+// messages are produced if arguments are spcified.
+?>
+--EXPECTF--
+3.1415926535898
+3.1415926535898
diff --git a/ext/standard/tests/math/pow.phpt b/ext/standard/tests/math/pow.phpt
new file mode 100644
index 0000000..a1e8944
--- /dev/null
+++ b/ext/standard/tests/math/pow.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Various pow() tests
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+ 0.25 === pow(-2,-2)
+-0.5 === pow(-2,-1)
+ 1 === pow(-2, 0)
+-2 === pow(-2, 1)
+ 4 === pow(-2, 2)
+ 1.0 === pow(-1,-2)
+-1.0 === pow(-1,-1)
+ 1 === pow(-1, 0)
+-1 === pow(-1, 1)
+ 1 === pow(-1, 2)
+ TRUE === is_infinite(pow(0,-2))
+ TRUE === is_infinite(pow(0,-1))
+ 1 === pow( 0, 0)
+ 0 === pow( 0, 1)
+ 0 === pow( 0, 2)
+ 1.0 === pow( 1,-2)
+ 1.0 === pow( 1,-1)
+ 1 === pow( 1, 0)
+ 1 === pow( 1, 1)
+ 1 === pow( 1, 2)
+ 0.25 === pow( 2,-2)
+ 0.5 === pow( 2,-1)
+ 1 === pow( 2, 0)
+ 2 === pow( 2, 1)
+ 4 === pow( 2, 2)
+ 0.25 === pow(-2,-2.0)
+-0.5 === pow(-2,-1.0)
+ 1.0 === pow(-2, 0.0)
+-2.0 === pow(-2, 1.0)
+ 4.0 === pow(-2, 2.0)
+ 1.0 === pow(-1,-2.0)
+-1.0 === pow(-1,-1.0)
+ 1.0 === pow(-1, 0.0)
+-1.0 === pow(-1, 1.0)
+ 1.0 === pow(-1, 2.0)
+ TRUE === is_infinite(pow(0,-2.0))
+ TRUE === is_infinite(pow(0,-1.0))
+ 1.0 === pow( 0, 0.0)
+ 0.0 === pow( 0, 1.0)
+ 0.0 === pow( 0, 2.0)
+ 1.0 === pow( 1,-2.0)
+ 1.0 === pow( 1,-1.0)
+ 1.0 === pow( 1, 0.0)
+ 1.0 === pow( 1, 1.0)
+ 1.0 === pow( 1, 2.0)
+ 0.25 === pow( 2,-2.0)
+ 0.5 === pow( 2,-1.0)
+ 1.0 === pow( 2, 0.0)
+ 2.0 === pow( 2, 1.0)
+ 4.0 === pow( 2, 2.0)
+ 2147483648 === pow(2,31)
+-2147483648 ~== pow(-2,31)
+ 1000000000 === pow(10,9)
+ 100000000 === pow(-10,8)
+ 1 === pow(-1,1443279822)
+-1 === pow(-1,1443279821)
+sqrt(2) ~== pow(2,1/2)
+ 0.25 === pow(-2.0,-2.0)
+-0.5 === pow(-2.0,-1.0)
+ 1.0 === pow(-2.0, 0.0)
+-2.0 === pow(-2.0, 1.0)
+ 4.0 === pow(-2.0, 2.0)
+ 1.0 === pow(-1.0,-2.0)
+-1.0 === pow(-1.0,-1.0)
+ 1.0 === pow(-1.0, 0.0)
+-1.0 === pow(-1.0, 1.0)
+ 1.0 === pow(-1.0, 2.0)
+ TRUE === is_infinite(pow(0.0,-2.0))
+ TRUE === is_infinite(pow(0.0,-1.0))
+ 1.0 === pow( 0.0, 0.0)
+ 0.0 === pow( 0.0, 1.0)
+ 0.0 === pow( 0.0, 2.0)
+ 1.0 === pow( 1.0,-2.0)
+ 1.0 === pow( 1.0,-1.0)
+ 1.0 === pow( 1.0, 0.0)
+ 1.0 === pow( 1.0, 1.0)
+ 1.0 === pow( 1.0, 2.0)
+ 0.25 === pow( 2.0,-2.0)
+ 0.5 === pow( 2.0,-1.0)
+ 1.0 === pow( 2.0, 0.0)
+ 2.0 === pow( 2.0, 1.0)
+ 4.0 === pow( 2.0, 2.0)
+ 0.25 === pow(-2.0,-2)
+-0.5 === pow(-2.0,-1)
+ 1.0 === pow(-2.0, 0)
+-2.0 === pow(-2.0, 1)
+ 4.0 === pow(-2.0, 2)
+ 1.0 === pow(-1.0,-2)
+-1.0 === pow(-1.0,-1)
+ 1.0 === pow(-1.0, 0)
+-1.0 === pow(-1.0, 1)
+ 1.0 === pow(-1.0, 2)
+ TRUE === is_infinite(pow( 0.0,-2))
+ TRUE === is_infinite(pow( 0.0,-1))
+ 1.0 === pow( 0.0, 0)
+ 0.0 === pow( 0.0, 1)
+ 0.0 === pow( 0.0, 2)
+ 1.0 === pow( 1.0,-2)
+ 1.0 === pow( 1.0,-1)
+ 1.0 === pow( 1.0, 0)
+ 1.0 === pow( 1.0, 1)
+ 1.0 === pow( 1.0, 2)
+ 0.25 === pow( 2.0,-2)
+ 0.5 === pow( 2.0,-1)
+ 1.0 === pow( 2.0, 0)
+ 2.0 === pow( 2.0, 1)
+ 4.0 === pow( 2.0, 2)
+ 2.0 === pow( 4, 0.5)
+ 2.0 === pow( 4.0, 0.5)
+ 3.0 === pow( 27, 1/3)
+ 3.0 === pow(27.0, 1/3)
+ 0.5 === pow( 4, -0.5)
+ 0.5 === pow( 4.0, -0.5)
+LONG_MAX-1 === pow(LONG_MAX-1,1)
+LONG_MIN+1 === pow(LONG_MIN+1,1)
+(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2)
+(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2)
+(float)(LONG_MAX-1) === pow(LONG_MAX-1,1.0)
+(float)(LONG_MIN+1) === pow(LONG_MIN+1,1.0)
+(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2.0)
+(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2.0)
+LONG_MAX === pow(LONG_MAX,1)
+LONG_MIN === pow(LONG_MIN,1)
+LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2)
+LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2)
+(float)LONG_MAX === pow(LONG_MAX,1.0)
+(float)LONG_MIN === pow(LONG_MIN,1.0)
+LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2.0)
+LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2.0)
+TESTS;
+
+ echo "On failure, please mail result to php-dev@lists.php.net\n";
+ include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+
+--EXPECT--
+1,1,0,0
+On failure, please mail result to php-dev@lists.php.net
+OK
diff --git a/ext/standard/tests/math/pow_basic.phpt b/ext/standard/tests/math/pow_basic.phpt
new file mode 100644
index 0000000..b7d96ca
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test pow() - basic function test pow()
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$bases = array(23,
+ -23,
+ 23.1,
+ -23.1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
+
+$exponents = array(0,
+ 1,
+ -1,
+ 2,
+ -2,
+ 3,
+ -3,
+ 2.5,
+ -2.5,
+ 500,
+ -500,
+ 2147483647,
+ -2147483648);
+
+foreach($bases as $base) {
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
+}
+?>
+===Done===
+--EXPECT--
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.1
+..... Exponent = -1 Result = 0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = 12326.391
+..... Exponent = -3 Result = 8.1126746668997E-5
+..... Exponent = 2.5 Result = 2564.6608940579
+..... Exponent = -2.5 Result = 0.00038991509650141
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.1
+..... Exponent = -1 Result = -0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = -12326.391
+..... Exponent = -3 Result = -8.1126746668997E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.45
+..... Exponent = -1 Result = -0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = -12895.213625
+..... Exponent = -3 Result = -7.7548153065204E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2.345e1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2147483647
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 2147483647
+..... Exponent = -1 Result = 4.6566128752458E-10
+..... Exponent = 2 Result = 4.6116860141324E+18
+..... Exponent = -2 Result = 2.1684043469905E-19
+..... Exponent = 3 Result = 9.903520300448E+27
+..... Exponent = -3 Result = 1.0097419600935E-28
+..... Exponent = 2.5 Result = 2.1370991100146E+23
+..... Exponent = -2.5 Result = 4.6792401686657E-24
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -2147483648
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -2147483648
+..... Exponent = -1 Result = -4.6566128730774E-10
+..... Exponent = 2 Result = 4.6116860184274E+18
+..... Exponent = -2 Result = 2.168404344971E-19
+..... Exponent = 3 Result = -9.903520314283E+27
+..... Exponent = -3 Result = -1.0097419586829E-28
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_basic2.phpt b/ext/standard/tests/math/pow_basic2.phpt
new file mode 100644
index 0000000..fc55cac
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test pow() - basic function test pow() - with large exponents
+--INI--
+precision=14
+--FILE--
+<?php
+
+$large_exp = 20000;
+
+echo "\n-- The following all result in INF --\n";
+var_dump(pow(24, $large_exp));
+var_dump(pow(0.24, -$large_exp));
+var_dump(pow(-0.24, -$large_exp));
+
+echo "\n\n-- The following all result in 0 --\n";
+var_dump(pow(0.24, $large_exp));
+var_dump(pow(-0.24, $large_exp));
+var_dump(pow(24, -$large_exp));
+var_dump(pow(-24, -$large_exp));
+
+echo "\n\n-- The following all result in -0 --\n";
+var_dump(pow(-0.24, $large_exp+1));
+
+echo "\n\n-- The following all result in -INF --\n";
+var_dump(pow(-24, $large_exp+1));
+var_dump(pow(-0.24, -$large_exp+1));
+
+?>
+===Done===
+--EXPECTF--
+
+-- The following all result in INF --
+float(INF)
+float(INF)
+float(INF)
+
+
+-- The following all result in 0 --
+float(0)
+float(0)
+float(0)
+float(0)
+
+
+-- The following all result in -0 --
+float(%s)
+
+
+-- The following all result in -INF --
+float(-INF)
+float(-INF)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_basic_64bit.phpt b/ext/standard/tests/math/pow_basic_64bit.phpt
new file mode 100644
index 0000000..898f6ef
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic_64bit.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test pow() - basic function test pow()
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+$bases = array(23,
+ -23,
+ 23.1,
+ -23.1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
+
+$exponents = array(0,
+ 1,
+ -1,
+ 2,
+ -2,
+ 3,
+ -3,
+ 2.5,
+ -2.5,
+ 500,
+ -500,
+ 2147483647,
+ -2147483648);
+
+foreach($bases as $base) {
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
+}
+?>
+===Done===
+--EXPECTF--
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.1
+..... Exponent = -1 Result = 0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = 12326.391
+..... Exponent = -3 Result = 8.1126746668997E-5
+..... Exponent = 2.5 Result = 2564.6608940579
+..... Exponent = -2.5 Result = 0.00038991509650141
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.1
+..... Exponent = -1 Result = -0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = -12326.391
+..... Exponent = -3 Result = -8.1126746668997E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.45
+..... Exponent = -1 Result = -0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = -12895.213625
+..... Exponent = -3 Result = -7.7548153065204E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2.345e1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 9223372036854775807
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 9223372036854775807
+..... Exponent = -1 Result = 1.0842021724855E-19
+..... Exponent = 2 Result = 8.5070591730235E+37
+..... Exponent = -2 Result = 1.1754943508223E-38
+..... Exponent = 3 Result = 7.8463771692334E+56
+..... Exponent = -3 Result = 1.274473528906E-57
+..... Exponent = 2.5 Result = 2.5835942961798E+47
+..... Exponent = -2.5 Result = 3.8705767444936E-48
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -9223372036854775808
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -9223372036854775808
+..... Exponent = -1 Result = -1.0842021724855E-19
+..... Exponent = 2 Result = 8.5070591730235E+37
+..... Exponent = -2 Result = 1.1754943508223E-38
+..... Exponent = 3 Result = -7.8463771692334E+56
+..... Exponent = -3 Result = -1.274473528906E-57
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+===Done===
diff --git a/ext/standard/tests/math/pow_basiclong_64bit.phpt b/ext/standard/tests/math/pow_basiclong_64bit.phpt
new file mode 100644
index 0000000..dfff0f6
--- /dev/null
+++ b/ext/standard/tests/math/pow_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test pow function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(pow($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+int(1)
+--- testing: 9223372036854775807, 1 ---
+int(9223372036854775807)
+--- testing: 9223372036854775807, -1 ---
+float(1.0842021724855E-19)
+--- testing: 9223372036854775807, 7 ---
+float(5.6784275335594E+132)
+--- testing: 9223372036854775807, 9 ---
+float(4.8306719037716E+170)
+--- testing: 9223372036854775807, 65 ---
+float(INF)
+--- testing: 9223372036854775807, -44 ---
+float(0)
+--- testing: 9223372036854775807, 2147483647 ---
+float(INF)
+--- testing: 9223372036854775807, -2147483648 ---
+float(0)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(INF)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775808, 0 ---
+int(1)
+--- testing: -9223372036854775808, 1 ---
+int(-9223372036854775808)
+--- testing: -9223372036854775808, -1 ---
+float(-1.0842021724855E-19)
+--- testing: -9223372036854775808, 7 ---
+float(-5.6784275335594E+132)
+--- testing: -9223372036854775808, 9 ---
+float(-4.8306719037716E+170)
+--- testing: -9223372036854775808, 65 ---
+float(-INF)
+--- testing: -9223372036854775808, -44 ---
+float(0)
+--- testing: -9223372036854775808, 2147483647 ---
+float(-INF)
+--- testing: -9223372036854775808, -2147483648 ---
+float(0)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(-INF)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(0)
+--- testing: 2147483647, 0 ---
+int(1)
+--- testing: 2147483647, 1 ---
+int(2147483647)
+--- testing: 2147483647, -1 ---
+float(4.6566128752458E-10)
+--- testing: 2147483647, 7 ---
+float(2.1062458265056E+65)
+--- testing: 2147483647, 9 ---
+float(9.7133444204205E+83)
+--- testing: 2147483647, 65 ---
+float(INF)
+--- testing: 2147483647, -44 ---
+float(0)
+--- testing: 2147483647, 2147483647 ---
+float(INF)
+--- testing: 2147483647, -2147483648 ---
+float(0)
+--- testing: 2147483647, 9223372036854775807 ---
+float(INF)
+--- testing: 2147483647, -9223372036854775808 ---
+float(0)
+--- testing: -2147483648, 0 ---
+int(1)
+--- testing: -2147483648, 1 ---
+int(-2147483648)
+--- testing: -2147483648, -1 ---
+float(-4.6566128730774E-10)
+--- testing: -2147483648, 7 ---
+float(-2.1062458333711E+65)
+--- testing: -2147483648, 9 ---
+float(-9.7133444611286E+83)
+--- testing: -2147483648, 65 ---
+float(-INF)
+--- testing: -2147483648, -44 ---
+float(0)
+--- testing: -2147483648, 2147483647 ---
+float(-INF)
+--- testing: -2147483648, -2147483648 ---
+float(0)
+--- testing: -2147483648, 9223372036854775807 ---
+float(-INF)
+--- testing: -2147483648, -9223372036854775808 ---
+float(0)
+--- testing: 9223372034707292160, 0 ---
+int(1)
+--- testing: 9223372034707292160, 1 ---
+int(9223372034707292160)
+--- testing: 9223372034707292160, -1 ---
+float(1.0842021727379E-19)
+--- testing: 9223372034707292160, 7 ---
+float(5.6784275243046E+132)
+--- testing: 9223372034707292160, 9 ---
+float(4.830671893649E+170)
+--- testing: 9223372034707292160, 65 ---
+float(INF)
+--- testing: 9223372034707292160, -44 ---
+float(0)
+--- testing: 9223372034707292160, 2147483647 ---
+float(INF)
+--- testing: 9223372034707292160, -2147483648 ---
+float(0)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(INF)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(0)
+--- testing: -9223372034707292160, 0 ---
+int(1)
+--- testing: -9223372034707292160, 1 ---
+int(-9223372034707292160)
+--- testing: -9223372034707292160, -1 ---
+float(-1.0842021727379E-19)
+--- testing: -9223372034707292160, 7 ---
+float(-5.6784275243046E+132)
+--- testing: -9223372034707292160, 9 ---
+float(-4.830671893649E+170)
+--- testing: -9223372034707292160, 65 ---
+float(-INF)
+--- testing: -9223372034707292160, -44 ---
+float(0)
+--- testing: -9223372034707292160, 2147483647 ---
+float(-INF)
+--- testing: -9223372034707292160, -2147483648 ---
+float(0)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(-INF)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(0)
+--- testing: 2147483648, 0 ---
+int(1)
+--- testing: 2147483648, 1 ---
+int(2147483648)
+--- testing: 2147483648, -1 ---
+float(4.6566128730774E-10)
+--- testing: 2147483648, 7 ---
+float(2.1062458333711E+65)
+--- testing: 2147483648, 9 ---
+float(9.7133444611286E+83)
+--- testing: 2147483648, 65 ---
+float(INF)
+--- testing: 2147483648, -44 ---
+float(0)
+--- testing: 2147483648, 2147483647 ---
+float(INF)
+--- testing: 2147483648, -2147483648 ---
+float(0)
+--- testing: 2147483648, 9223372036854775807 ---
+float(INF)
+--- testing: 2147483648, -9223372036854775808 ---
+float(0)
+--- testing: -2147483649, 0 ---
+int(1)
+--- testing: -2147483649, 1 ---
+int(-2147483649)
+--- testing: -2147483649, -1 ---
+float(-4.656612870909E-10)
+--- testing: -2147483649, 7 ---
+float(-2.1062458402367E+65)
+--- testing: -2147483649, 9 ---
+float(-9.7133445018368E+83)
+--- testing: -2147483649, 65 ---
+float(-INF)
+--- testing: -2147483649, -44 ---
+float(0)
+--- testing: -2147483649, 2147483647 ---
+float(-INF)
+--- testing: -2147483649, -2147483648 ---
+float(0)
+--- testing: -2147483649, 9223372036854775807 ---
+float(-INF)
+--- testing: -2147483649, -9223372036854775808 ---
+float(0)
+--- testing: 4294967294, 0 ---
+int(1)
+--- testing: 4294967294, 1 ---
+int(4294967294)
+--- testing: 4294967294, -1 ---
+float(2.3283064376229E-10)
+--- testing: 4294967294, 7 ---
+float(2.6959946579271E+67)
+--- testing: 4294967294, 9 ---
+float(4.9732323432553E+86)
+--- testing: 4294967294, 65 ---
+float(INF)
+--- testing: 4294967294, -44 ---
+float(0)
+--- testing: 4294967294, 2147483647 ---
+float(INF)
+--- testing: 4294967294, -2147483648 ---
+float(0)
+--- testing: 4294967294, 9223372036854775807 ---
+float(INF)
+--- testing: 4294967294, -9223372036854775808 ---
+float(0)
+--- testing: 4294967295, 0 ---
+int(1)
+--- testing: 4294967295, 1 ---
+int(4294967295)
+--- testing: 4294967295, -1 ---
+float(2.3283064370808E-10)
+--- testing: 4294967295, 7 ---
+float(2.6959946623211E+67)
+--- testing: 4294967295, 9 ---
+float(4.9732323536766E+86)
+--- testing: 4294967295, 65 ---
+float(INF)
+--- testing: 4294967295, -44 ---
+float(0)
+--- testing: 4294967295, 2147483647 ---
+float(INF)
+--- testing: 4294967295, -2147483648 ---
+float(0)
+--- testing: 4294967295, 9223372036854775807 ---
+float(INF)
+--- testing: 4294967295, -9223372036854775808 ---
+float(0)
+--- testing: 4294967293, 0 ---
+int(1)
+--- testing: 4294967293, 1 ---
+int(4294967293)
+--- testing: 4294967293, -1 ---
+float(2.328306438165E-10)
+--- testing: 4294967293, 7 ---
+float(2.6959946535332E+67)
+--- testing: 4294967293, 9 ---
+float(4.973232332834E+86)
+--- testing: 4294967293, 65 ---
+float(INF)
+--- testing: 4294967293, -44 ---
+float(0)
+--- testing: 4294967293, 2147483647 ---
+float(INF)
+--- testing: 4294967293, -2147483648 ---
+float(0)
+--- testing: 4294967293, 9223372036854775807 ---
+float(INF)
+--- testing: 4294967293, -9223372036854775808 ---
+float(0)
+--- testing: 9223372036854775806, 0 ---
+int(1)
+--- testing: 9223372036854775806, 1 ---
+int(9223372036854775806)
+--- testing: 9223372036854775806, -1 ---
+float(1.0842021724855E-19)
+--- testing: 9223372036854775806, 7 ---
+float(5.6784275335594E+132)
+--- testing: 9223372036854775806, 9 ---
+float(4.8306719037716E+170)
+--- testing: 9223372036854775806, 65 ---
+float(INF)
+--- testing: 9223372036854775806, -44 ---
+float(0)
+--- testing: 9223372036854775806, 2147483647 ---
+float(INF)
+--- testing: 9223372036854775806, -2147483648 ---
+float(0)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(INF)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(0)
+--- testing: 9.2233720368548E+18, 0 ---
+float(1)
+--- testing: 9.2233720368548E+18, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -1 ---
+float(1.0842021724855E-19)
+--- testing: 9.2233720368548E+18, 7 ---
+float(5.6784275335594E+132)
+--- testing: 9.2233720368548E+18, 9 ---
+float(4.8306719037716E+170)
+--- testing: 9.2233720368548E+18, 65 ---
+float(INF)
+--- testing: 9.2233720368548E+18, -44 ---
+float(0)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(INF)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(0)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(INF)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775807, 0 ---
+int(1)
+--- testing: -9223372036854775807, 1 ---
+int(-9223372036854775807)
+--- testing: -9223372036854775807, -1 ---
+float(-1.0842021724855E-19)
+--- testing: -9223372036854775807, 7 ---
+float(-5.6784275335594E+132)
+--- testing: -9223372036854775807, 9 ---
+float(-4.8306719037716E+170)
+--- testing: -9223372036854775807, 65 ---
+float(-INF)
+--- testing: -9223372036854775807, -44 ---
+float(0)
+--- testing: -9223372036854775807, 2147483647 ---
+float(-INF)
+--- testing: -9223372036854775807, -2147483648 ---
+float(0)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(-INF)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(0)
+--- testing: -9.2233720368548E+18, 0 ---
+float(1)
+--- testing: -9.2233720368548E+18, 1 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -1 ---
+float(-1.0842021724855E-19)
+--- testing: -9.2233720368548E+18, 7 ---
+float(-5.6784275335594E+132)
+--- testing: -9.2233720368548E+18, 9 ---
+float(-4.8306719037716E+170)
+--- testing: -9.2233720368548E+18, 65 ---
+float(-INF)
+--- testing: -9.2233720368548E+18, -44 ---
+float(0)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(-INF)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(0)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(INF)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(0)
+===DONE===
diff --git a/ext/standard/tests/math/pow_error.phpt b/ext/standard/tests/math/pow_error.phpt
new file mode 100644
index 0000000..d00173e
--- /dev/null
+++ b/ext/standard/tests/math/pow_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test pow() - wrong params test pow()
+--INI--
+precision=14
+--FILE--
+<?php
+pow();
+pow(36);
+pow(36,4,true);
+?>
+--EXPECTF--
+
+Warning: pow() expects exactly 2 parameters, 0 given in %s line 2
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s line 3
+
+Warning: pow() expects exactly 2 parameters, 3 given in %s line 4
+
+
diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt
new file mode 100644
index 0000000..df51190
--- /dev/null
+++ b/ext/standard/tests/math/pow_variation1.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test pow() function : usage variations - different data types as $base argument
+--INI--
+precision = 14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ PHP_INT_MAX,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow($input, 3));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+float(1881365963625)
+
+-- Iteration 4 --
+float(-12895213625)
+
+-- Iteration 5 --
+float(9.903520300448E+27)
+
+-- Iteration 6 --
+float(1157.625)
+
+-- Iteration 7 --
+float(-1157.625)
+
+-- Iteration 8 --
+float(1.881676371789%dE+33)
+
+-- Iteration 9 --
+float(1.881676371789%dE-27)
+
+-- Iteration 10 --
+float(0.125)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+float(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done===
diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt
new file mode 100644
index 0000000..24b4826
--- /dev/null
+++ b/ext/standard/tests/math/pow_variation1_64bit.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test pow() function : usage variations - different data types as $base argument
+--INI--
+precision = 14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ PHP_INT_MAX,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow($input, 3));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1881365963625)
+
+-- Iteration 4 --
+int(-12895213625)
+
+-- Iteration 5 --
+float(7.8463771692334E+56)
+
+-- Iteration 6 --
+float(1157.625)
+
+-- Iteration 7 --
+float(-1157.625)
+
+-- Iteration 8 --
+float(1.8816763717892E+33)
+
+-- Iteration 9 --
+float(1.8816763717892E-27)
+
+-- Iteration 10 --
+float(0.125)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+float(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt
new file mode 100644
index 0000000..b1800bb
--- /dev/null
+++ b/ext/standard/tests/math/pow_variation2.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test pow() function : usage variations - different data types as $exp argument
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 2.5,
+ -2.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow(20.3, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+float(1)
+
+-- Iteration 2 --
+float(20.3)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(INF)
+
+-- Iteration 6 --
+float(1856.6929774279)
+
+-- Iteration 7 --
+float(0.00053859200856424)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(1.0000000037168)
+
+-- Iteration 10 --
+float(4.5055521304275)
+
+-- Iteration 11 --
+float(1)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(20.3)
+
+-- Iteration 14 --
+float(1)
+
+-- Iteration 15 --
+float(20.3)
+
+-- Iteration 16 --
+float(1)
+
+-- Iteration 17 --
+float(1)
+
+-- Iteration 18 --
+float(1)
+
+-- Iteration 19 --
+float(1)
+
+-- Iteration 20 --
+float(1)
+
+-- Iteration 21 --
+float(1)
+
+-- Iteration 22 --
+float(1)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(20.3)
+
+-- Iteration 24 --
+float(1)
+
+-- Iteration 25 --
+float(1)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/rad2deg_basic.phpt b/ext/standard/tests/math/rad2deg_basic.phpt
new file mode 100644
index 0000000..0256ffb
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test return type and value for expected input rad2deg()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 0.0;
+$arg_1 = 1.570796327;
+$arg_2 = 3.141592654;
+$arg_3 = 6.283185307;
+
+echo "rad2deg $arg_0= ";
+$r0 = rad2deg($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_1 = ";
+$r1 = rad2deg($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,90.000000011752)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_2 = ";
+$r2 = rad2deg($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,180.0000000235 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_3 = ";
+$r3 = rad2deg($arg_3);
+var_dump($r3);
+if (allowed_rounding_error($r3 ,359.99999998971 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+rad2deg 0= float(%f)
+Pass
+rad2deg 1.570796327 = float(%f)
+Pass
+rad2deg 3.141592654 = float(%f)
+Pass
+rad2deg 6.283185307 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt b/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
new file mode 100644
index 0000000..4f43ef1
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test rad2deg function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(rad2deg($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(5.2846029059076E+20)
+--- testing: -9223372036854775808 ---
+float(-5.2846029059076E+20)
+--- testing: 2147483647 ---
+float(123041749546.46)
+--- testing: -2147483648 ---
+float(-123041749603.76)
+--- testing: 9223372034707292160 ---
+float(5.2846029046772E+20)
+--- testing: -9223372034707292160 ---
+float(-5.2846029046772E+20)
+--- testing: 2147483648 ---
+float(123041749603.76)
+--- testing: -2147483649 ---
+float(-123041749661.05)
+--- testing: 4294967294 ---
+float(246083499092.92)
+--- testing: 4294967295 ---
+float(246083499150.22)
+--- testing: 4294967293 ---
+float(246083499035.63)
+--- testing: 9223372036854775806 ---
+float(5.2846029059076E+20)
+--- testing: 9.2233720368548E+18 ---
+float(5.2846029059076E+20)
+--- testing: -9223372036854775807 ---
+float(-5.2846029059076E+20)
+--- testing: -9.2233720368548E+18 ---
+float(-5.2846029059076E+20)
+===DONE===
diff --git a/ext/standard/tests/math/rad2deg_error.phpt b/ext/standard/tests/math/rad2deg_error.phpt
new file mode 100644
index 0000000..32b2f4d
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for rad2deg()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(rad2deg($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(rad2deg());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: rad2deg() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: rad2deg() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt
new file mode 100644
index 0000000..173cbc4
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of rad2deg()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test rad2deg with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = rad2deg($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1317.802929)
+float(-1317.802929)
+float(1343.58603)
+float(-1343.58603)
+float(1317.802929)
+float(1317.802929)
+float(1317.802929)
+float(1343.58603)
+float(1343.58603)
+
+Warning: rad2deg() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(57295.77951)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(57295.77951)
+float(0)
+float(57.29577951)
+float(0)
diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt
new file mode 100644
index 0000000..5259560
--- /dev/null
+++ b/ext/standard/tests/math/rand_basic.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test rand() - basic function test rand()
+--FILE--
+<?php
+$default_max = getrandmax();
+
+echo "\nrand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = rand();
+
+// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+} else {
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
+}
+
+echo "\nrand() tests with defined min and max value\n";
+
+$min = array(10,
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
+
+$max = array(100,
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
+
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], $max[$x]);
+
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
+}
+
+echo "\nNon-numeric cases\n";
+$min = array(true,
+ false,
+ null,
+ "10",
+ "0x10",
+ "10.5");
+
+// Eexepcted numerical equivalent of above non-numerics
+$minval = array(1,
+ 0,
+ 0,
+ 10,
+ 0,
+ 10);
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], 100);
+
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
+}
+?>
+--EXPECTF--
+
+rand() tests with default min and max value (i.e 0 thru %i)
+PASSED: range min = 0 max = %i
+
+rand() tests with defined min and max value
+PASSED: range min = 10 max = 100
+PASSED: range min = 100 max = 1000
+PASSED: range min = 10 max = 19
+PASSED: range min = 10500 max = 1050000
+PASSED: range min = 16 max = 65536
+PASSED: range min = 256 max = 448
+
+Non-numeric cases
+PASSED range min = 1 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
diff --git a/ext/standard/tests/math/rand_error.phpt b/ext/standard/tests/math/rand_error.phpt
new file mode 100644
index 0000000..79aa011
--- /dev/null
+++ b/ext/standard/tests/math/rand_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test rand() - wrong params test rand()
+--FILE--
+<?php
+rand(25);
+rand(10,100,false);
+rand("one", 100);
+rand(1, "hundered");
+?>
+--EXPECTF--
+
+Warning: rand() expects exactly 2 parameters, 1 given in %s on line 2
+
+Warning: rand() expects exactly 2 parameters, 3 given in %s on line 3
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line 4
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line 5
diff --git a/ext/standard/tests/math/rand_variation1.phpt b/ext/standard/tests/math/rand_variation1.phpt
new file mode 100644
index 0000000..02e552b
--- /dev/null
+++ b/ext/standard/tests/math/rand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test rand() function : usage variations - different data types as $min argument
+--FILE--
+<?php
+/* Prototype : int rand ([ int $min , int $max ] )
+ * Description: Generate a random integer.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing rand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(rand($input, 100));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing rand() : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: rand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: rand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: rand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/rand_variation2.phpt b/ext/standard/tests/math/rand_variation2.phpt
new file mode 100644
index 0000000..c0e1fc6
--- /dev/null
+++ b/ext/standard/tests/math/rand_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test rand() function : usage variations - different data types as $max argument
+--FILE--
+<?php
+/* Prototype : int rand ([ int $min , int $max ] )
+ * Description: Generate a random integer.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing rand) : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(rand(100, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing rand) : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: rand() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: rand() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: rand() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt
new file mode 100644
index 0000000..47f57da
--- /dev/null
+++ b/ext/standard/tests/math/round.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Simple math tests
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+-1 ~== ceil(-1.5)
+ 2 ~== ceil( 1.5)
+-2 ~== floor(-1.5)
+ 1 ~== floor(1.5)
+ LONG_MIN ~== ceil(LONG_MIN - 0.5)
+ LONG_MIN+1 ~== ceil(LONG_MIN + 0.5)
+ LONG_MIN-1 ~== round(LONG_MIN - 0.6)
+ LONG_MIN ~== round(LONG_MIN - 0.4)
+ LONG_MIN ~== round(LONG_MIN + 0.4)
+ LONG_MIN+1 ~== round(LONG_MIN + 0.6)
+ LONG_MIN-1 ~== floor(LONG_MIN - 0.5)
+ LONG_MIN ~== floor(LONG_MIN + 0.5)
+ LONG_MAX ~== ceil(LONG_MAX - 0.5)
+ LONG_MAX+1 ~== ceil(LONG_MAX + 0.5)
+ LONG_MAX-1 ~== round(LONG_MAX - 0.6)
+ LONG_MAX ~== round(LONG_MAX - 0.4)
+ LONG_MAX ~== round(LONG_MAX + 0.4)
+ LONG_MAX+1 ~== round(LONG_MAX + 0.6)
+ LONG_MAX-1 ~== floor(LONG_MAX - 0.5)
+ LONG_MAX ~== floor(LONG_MAX + 0.5)
+TESTS;
+
+include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+--EXPECT--
+1,1,0,0
+OK
diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt
new file mode 100644
index 0000000..dd4725f
--- /dev/null
+++ b/ext/standard/tests/math/round_basic.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test round() - basic function test for round()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : basic functionality ***\n";
+
+$values = array(123456789,
+ 123.456789,
+ -4.5679123,
+ 1.23E4,
+ -4.567E3,
+ 0x234567,
+ 067777777,
+ "1.234567",
+ "2.3456789e8",
+ "0x1234CDEF");
+
+$precision = array(2,
+ 8,
+ 0x3,
+ 04,
+ 3.6,
+ "2",
+ "0x03",
+ "04",
+ "3.6",
+ "2.1e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ echo "round: $values[$i]\n";
+ for ($j = 0; $j < count($precision); $j++) {
+ $res = round($values[$i], $precision[$j]);
+ echo "...with precision $precision[$j]-> ";
+ var_dump($res);
+ }
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : basic functionality ***
+round: 123456789
+...with precision 2-> float(123456789)
+...with precision 8-> float(123456789)
+...with precision 3-> float(123456789)
+...with precision 4-> float(123456789)
+...with precision 3.6-> float(123456789)
+...with precision 2-> float(123456789)
+...with precision 0x03-> float(123456789)
+...with precision 04-> float(123456789)
+...with precision 3.6-> float(123456789)
+...with precision 2.1e1-> float(123456789)
+...with precision -> float(123456789)
+...with precision 1-> float(123456789)
+...with precision -> float(123456789)
+round: 123.456789
+...with precision 2-> float(123.46)
+...with precision 8-> float(123.456789)
+...with precision 3-> float(123.457)
+...with precision 4-> float(123.4568)
+...with precision 3.6-> float(123.457)
+...with precision 2-> float(123.46)
+...with precision 0x03-> float(123.457)
+...with precision 04-> float(123.4568)
+...with precision 3.6-> float(123.457)
+...with precision 2.1e1-> float(123.456789)
+...with precision -> float(123)
+...with precision 1-> float(123.5)
+...with precision -> float(123)
+round: -4.5679123
+...with precision 2-> float(-4.57)
+...with precision 8-> float(-4.5679123)
+...with precision 3-> float(-4.568)
+...with precision 4-> float(-4.5679)
+...with precision 3.6-> float(-4.568)
+...with precision 2-> float(-4.57)
+...with precision 0x03-> float(-4.568)
+...with precision 04-> float(-4.5679)
+...with precision 3.6-> float(-4.568)
+...with precision 2.1e1-> float(-4.5679123)
+...with precision -> float(-5)
+...with precision 1-> float(-4.6)
+...with precision -> float(-5)
+round: 12300
+...with precision 2-> float(12300)
+...with precision 8-> float(12300)
+...with precision 3-> float(12300)
+...with precision 4-> float(12300)
+...with precision 3.6-> float(12300)
+...with precision 2-> float(12300)
+...with precision 0x03-> float(12300)
+...with precision 04-> float(12300)
+...with precision 3.6-> float(12300)
+...with precision 2.1e1-> float(12300)
+...with precision -> float(12300)
+...with precision 1-> float(12300)
+...with precision -> float(12300)
+round: -4567
+...with precision 2-> float(-4567)
+...with precision 8-> float(-4567)
+...with precision 3-> float(-4567)
+...with precision 4-> float(-4567)
+...with precision 3.6-> float(-4567)
+...with precision 2-> float(-4567)
+...with precision 0x03-> float(-4567)
+...with precision 04-> float(-4567)
+...with precision 3.6-> float(-4567)
+...with precision 2.1e1-> float(-4567)
+...with precision -> float(-4567)
+...with precision 1-> float(-4567)
+...with precision -> float(-4567)
+round: 2311527
+...with precision 2-> float(2311527)
+...with precision 8-> float(2311527)
+...with precision 3-> float(2311527)
+...with precision 4-> float(2311527)
+...with precision 3.6-> float(2311527)
+...with precision 2-> float(2311527)
+...with precision 0x03-> float(2311527)
+...with precision 04-> float(2311527)
+...with precision 3.6-> float(2311527)
+...with precision 2.1e1-> float(2311527)
+...with precision -> float(2311527)
+...with precision 1-> float(2311527)
+...with precision -> float(2311527)
+round: 14680063
+...with precision 2-> float(14680063)
+...with precision 8-> float(14680063)
+...with precision 3-> float(14680063)
+...with precision 4-> float(14680063)
+...with precision 3.6-> float(14680063)
+...with precision 2-> float(14680063)
+...with precision 0x03-> float(14680063)
+...with precision 04-> float(14680063)
+...with precision 3.6-> float(14680063)
+...with precision 2.1e1-> float(14680063)
+...with precision -> float(14680063)
+...with precision 1-> float(14680063)
+...with precision -> float(14680063)
+round: 1.234567
+...with precision 2-> float(1.23)
+...with precision 8-> float(1.234567)
+...with precision 3-> float(1.235)
+...with precision 4-> float(1.2346)
+...with precision 3.6-> float(1.235)
+...with precision 2-> float(1.23)
+...with precision 0x03-> float(1.235)
+...with precision 04-> float(1.2346)
+...with precision 3.6-> float(1.235)
+...with precision 2.1e1-> float(1.234567)
+...with precision -> float(1)
+...with precision 1-> float(1.2)
+...with precision -> float(1)
+round: 2.3456789e8
+...with precision 2-> float(234567890)
+...with precision 8-> float(234567890)
+...with precision 3-> float(234567890)
+...with precision 4-> float(234567890)
+...with precision 3.6-> float(234567890)
+...with precision 2-> float(234567890)
+...with precision 0x03-> float(234567890)
+...with precision 04-> float(234567890)
+...with precision 3.6-> float(234567890)
+...with precision 2.1e1-> float(234567890)
+...with precision -> float(234567890)
+...with precision 1-> float(234567890)
+...with precision -> float(234567890)
+round: 0x1234CDEF
+...with precision 2-> float(305450479)
+...with precision 8-> float(305450479)
+...with precision 3-> float(305450479)
+...with precision 4-> float(305450479)
+...with precision 3.6-> float(305450479)
+...with precision 2-> float(305450479)
+...with precision 0x03-> float(305450479)
+...with precision 04-> float(305450479)
+...with precision 3.6-> float(305450479)
+...with precision 2.1e1-> float(305450479)
+...with precision -> float(305450479)
+...with precision 1-> float(305450479)
+...with precision -> float(305450479)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/round_basiclong_64bit.phpt b/ext/standard/tests/math/round_basiclong_64bit.phpt
new file mode 100644
index 0000000..19db12e
--- /dev/null
+++ b/ext/standard/tests/math/round_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test round function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(round($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+float(2147483647)
+--- testing: -2147483648 ---
+float(-2147483648)
+--- testing: 9223372034707292160 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648 ---
+float(2147483648)
+--- testing: -2147483649 ---
+float(-2147483649)
+--- testing: 4294967294 ---
+float(4294967294)
+--- testing: 4294967295 ---
+float(4294967295)
+--- testing: 4294967293 ---
+float(4294967293)
+--- testing: 9223372036854775806 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/round_error.phpt b/ext/standard/tests/math/round_error.phpt
new file mode 100644
index 0000000..28a6d5c
--- /dev/null
+++ b/ext/standard/tests/math/round_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test round() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect number of arguments to round() to test behaviour
+ */
+
+echo "*** Testing round() : error conditions ***\n";
+
+echo "\n-- Wrong nmumber of arguments --\n";
+var_dump(round());
+var_dump(round(500, 10, true));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : error conditions ***
+
+-- Wrong nmumber of arguments --
+
+Warning: round() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+float(500)
+===Done===
diff --git a/ext/standard/tests/math/round_large_exp.phpt b/ext/standard/tests/math/round_large_exp.phpt
new file mode 100644
index 0000000..36db605
--- /dev/null
+++ b/ext/standard/tests/math/round_large_exp.phpt
@@ -0,0 +1,30 @@
+--TEST--
+round() works correctly for large exponents
+--FILE--
+<?php
+var_dump (2e-22 == round (2e-22, 22, PHP_ROUND_HALF_UP));
+var_dump (1e-22 == round (1e-22, 22, PHP_ROUND_HALF_UP));
+var_dump (2e-23 == round (2e-23, 23, PHP_ROUND_HALF_UP));
+var_dump (1e-23 == round (1e-23, 23, PHP_ROUND_HALF_UP));
+var_dump (2e-24 == round (2e-24, 24, PHP_ROUND_HALF_UP));
+var_dump (1e-24 == round (1e-24, 24, PHP_ROUND_HALF_UP));
+var_dump (2e22 == round (2e22, -22, PHP_ROUND_HALF_UP));
+var_dump (1e22 == round (1e22, -22, PHP_ROUND_HALF_UP));
+var_dump (2e23 == round (2e23, -23, PHP_ROUND_HALF_UP));
+var_dump (1e23 == round (1e23, -23, PHP_ROUND_HALF_UP));
+var_dump (2e24 == round (2e24, -24, PHP_ROUND_HALF_UP));
+var_dump (1e24 == round (1e24, -24, PHP_ROUND_HALF_UP));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/math/round_modes.phpt b/ext/standard/tests/math/round_modes.phpt
new file mode 100644
index 0000000..03479c4
--- /dev/null
+++ b/ext/standard/tests/math/round_modes.phpt
@@ -0,0 +1,38 @@
+--TEST--
+round() with different rounding modes
+--FILE--
+<?php
+var_dump (round (2.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (2.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (2.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (2.5, 0, PHP_ROUND_HALF_ODD));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_ODD));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_ODD));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_ODD));
+?>
+--EXPECT--
+float(3)
+float(2)
+float(2)
+float(3)
+float(-3)
+float(-2)
+float(-2)
+float(-3)
+float(4)
+float(3)
+float(4)
+float(3)
+float(-4)
+float(-3)
+float(-4)
+float(-3)
diff --git a/ext/standard/tests/math/round_prerounding.phpt b/ext/standard/tests/math/round_prerounding.phpt
new file mode 100644
index 0000000..0419d6c
--- /dev/null
+++ b/ext/standard/tests/math/round_prerounding.phpt
@@ -0,0 +1,10 @@
+--TEST--
+round() prerounds results to precision
+--INI--
+precision=14
+--FILE--
+<?php
+var_dump (round (0.285, 2, PHP_ROUND_HALF_UP));
+?>
+--EXPECT--
+float(0.29)
diff --git a/ext/standard/tests/math/round_variation1.phpt b/ext/standard/tests/math/round_variation1.phpt
new file mode 100644
index 0000000..c89dd68
--- /dev/null
+++ b/ext/standard/tests/math/round_variation1.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test round() function : usage variations - different data types as $val argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of round()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(round($input, 14));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1)
+
+-- Iteration 3 --
+float(12345)
+
+-- Iteration 4 --
+float(-2345)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(10.5)
+
+-- Iteration 7 --
+float(-10.5)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(1.23457E-9)
+
+-- Iteration 10 --
+float(0.5)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(1)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+float(0)
+
+-- Iteration 18 --
+float(0)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+float(0)
+
+-- Iteration 21 --
+float(0)
+
+-- Iteration 22 --
+float(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(%f)
+===Done===
diff --git a/ext/standard/tests/math/round_variation2.phpt b/ext/standard/tests/math/round_variation2.phpt
new file mode 100644
index 0000000..2fd9061
--- /dev/null
+++ b/ext/standard/tests/math/round_variation2.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test round() function : usage variations - different data types as $precision argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e5,
+ 12.3456789000E-5,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of round()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(round(123.4456789, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : usage variations ***
+
+-- Iteration 1 --
+float(123)
+
+-- Iteration 2 --
+float(123.4)
+
+-- Iteration 3 --
+float(123.4456789)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(123.4456789)
+
+-- Iteration 6 --
+float(123.4456789)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(123.4456789)
+
+-- Iteration 9 --
+float(123)
+
+-- Iteration 10 --
+float(123)
+
+-- Iteration 11 --
+float(123)
+
+-- Iteration 12 --
+float(123)
+
+-- Iteration 13 --
+float(123.4)
+
+-- Iteration 14 --
+float(123)
+
+-- Iteration 15 --
+float(123.4)
+
+-- Iteration 16 --
+float(123)
+
+-- Iteration 17 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: round() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: round() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(123)
+
+-- Iteration 25 --
+float(123)
+
+-- Iteration 26 --
+
+Warning: round() 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/math/sin_basic.phpt b/ext/standard/tests/math/sin_basic.phpt
new file mode 100644
index 0000000..2b55ad7
--- /dev/null
+++ b/ext/standard/tests/math/sin_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test return type and value for expected input sin()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+// Use known values to test
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+$ninety = M_PI /2.0;
+$oneeighty = M_PI;
+$twoseventy = M_PI * 1.5;
+$threesixty = M_PI * 2.0;
+
+
+echo "sin 30 = ";
+var_dump(sin($thirty));
+if (allowed_rounding_error(sin($thirty),0.5)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 60 = ";
+var_dump(sin($sixty));
+if (allowed_rounding_error(sin($sixty),0.86602540378444)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 90 = ";
+var_dump(sin($ninety));
+if (allowed_rounding_error(sin($ninety),1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 180 = ";
+var_dump(sin($oneeighty));
+if (allowed_rounding_error(sin($oneeighty),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 270 = ";
+var_dump(sin($twoseventy));
+if (allowed_rounding_error(sin($twoseventy),-1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 360 = ";
+var_dump(sin($threesixty));
+if (allowed_rounding_error(sin($threesixty),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+sin 30 = float(%f)
+Pass
+sin 60 = float(%f)
+Pass
+sin 90 = float(%f)
+Pass
+sin 180 = float(%f)
+Pass
+sin 270 = float(%f)
+Pass
+sin 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/sin_basiclong_64bit.phpt b/ext/standard/tests/math/sin_basiclong_64bit.phpt
new file mode 100644
index 0000000..55b859a
--- /dev/null
+++ b/ext/standard/tests/math/sin_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sin function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(sin($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(0.99993037667344)
+--- testing: -9223372036854775808 ---
+float(-0.99993037667344)
+--- testing: 2147483647 ---
+float(-0.72491655514456)
+--- testing: -2147483648 ---
+float(0.97131017579294)
+--- testing: 9223372034707292160 ---
+float(0.24926117141025)
+--- testing: -9223372034707292160 ---
+float(-0.24926117141025)
+--- testing: 2147483648 ---
+float(-0.97131017579294)
+--- testing: -2147483649 ---
+float(0.32468570024367)
+--- testing: 4294967294 ---
+float(0.99869824346666)
+--- testing: 4294967295 ---
+float(0.49667719175329)
+--- testing: 4294967293 ---
+float(0.58252073586971)
+--- testing: 9223372036854775806 ---
+float(0.99993037667344)
+--- testing: 9.2233720368548E+18 ---
+float(0.99993037667344)
+--- testing: -9223372036854775807 ---
+float(-0.99993037667344)
+--- testing: -9.2233720368548E+18 ---
+float(-0.99993037667344)
+===DONE===
diff --git a/ext/standard/tests/math/sin_error.phpt b/ext/standard/tests/math/sin_error.phpt
new file mode 100644
index 0000000..41a4b2e
--- /dev/null
+++ b/ext/standard/tests/math/sin_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for sin()
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sin($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sin());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: sin() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: sin() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt
new file mode 100644
index 0000000..ff95e99
--- /dev/null
+++ b/ext/standard/tests/math/sin_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of sin()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sin with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sin($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(-0.8462204042)
+float(0.8462204042)
+float(-0.9937407102)
+float(0.9937407102)
+float(-0.8462204042)
+float(-0.8462204042)
+float(-0.8462204042)
+float(-0.9937407102)
+float(-0.9937407102)
+
+Warning: sin() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(0.8268795405)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(0.8268795405)
+float(0)
+float(0.8414709848)
+float(0)
diff --git a/ext/standard/tests/math/sinh_basic.phpt b/ext/standard/tests/math/sinh_basic.phpt
new file mode 100644
index 0000000..79bef63
--- /dev/null
+++ b/ext/standard/tests/math/sinh_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test return type and value for expected input sinh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "sinh .5 = ";
+var_dump(sinh(0.5));
+if (allowed_rounding_error(sinh(0.5),0.52109530549375)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh -0.5 = ";
+var_dump(sinh(-0.5));
+if (allowed_rounding_error(sinh(-0.5), -0.52109530549375)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh 3 = ";
+var_dump(sinh(3.0));
+if (allowed_rounding_error(sinh(3.0), 10.01787492741)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh -3 = ";
+var_dump(sinh(-3.0));
+if (allowed_rounding_error(sinh(-3.0), -10.01787492741)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+sinh .5 = float(%f)
+Pass
+sinh -0.5 = float(%f)
+Pass
+sinh 3 = float(%f)
+Pass
+sinh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/sinh_basiclong_64bit.phpt b/ext/standard/tests/math/sinh_basiclong_64bit.phpt
new file mode 100644
index 0000000..5206814
--- /dev/null
+++ b/ext/standard/tests/math/sinh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sinh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(sinh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(-INF)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(-INF)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(-INF)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(-INF)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(-INF)
+--- testing: -9.2233720368548E+18 ---
+float(-INF)
+===DONE===
diff --git a/ext/standard/tests/math/sinh_error.phpt b/ext/standard/tests/math/sinh_error.phpt
new file mode 100644
index 0000000..70decf2
--- /dev/null
+++ b/ext/standard/tests/math/sinh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for sinh()
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sinh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sinh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: sinh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: sinh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt
new file mode 100644
index 0000000..3704e0f
--- /dev/null
+++ b/ext/standard/tests/math/sinh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of sinh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sinh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sinh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(4872401723)
+float(-4872401723)
+float(7641446995)
+float(-7641446995)
+float(4872401723)
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+
+Warning: sinh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(INF)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(INF)
+float(0)
+float(1.175201194)
+float(0)
diff --git a/ext/standard/tests/math/sqrt_basic.phpt b/ext/standard/tests/math/sqrt_basic.phpt
new file mode 100644
index 0000000..076a113
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test return type and value for expected input sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 9.0;
+
+var_dump(sqrt($arg_0));
+
+?>
+--EXPECT--
+float(3)
diff --git a/ext/standard/tests/math/sqrt_basiclong_64bit.phpt b/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
new file mode 100644
index 0000000..99091e2
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sqrt function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(sqrt($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(3037000499.976)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(46340.950001052)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(3037000499.6225)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(46340.950011842)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(65535.999984741)
+--- testing: 4294967295 ---
+float(65535.999992371)
+--- testing: 4294967293 ---
+float(65535.999977112)
+--- testing: 9223372036854775806 ---
+float(3037000499.976)
+--- testing: 9.2233720368548E+18 ---
+float(3037000499.976)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/sqrt_error.phpt b/ext/standard/tests/math/sqrt_error.phpt
new file mode 100644
index 0000000..66d6d27
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sqrt($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sqrt());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: sqrt() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: sqrt() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt
new file mode 100644
index 0000000..bb1806b
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_variation.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test variations in usage of sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sqrt with a different input values
+echo "*** Testing sqrt() : usage variations ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sqrt($values[$i]);
+ var_dump($res);
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing sqrt() : usage variations ***
+float(4.7958315233127)
+float(NAN)
+float(4.8425200051213)
+float(NAN)
+float(4.7958315233127)
+float(4.7958315233127)
+float(4.7958315233127)
+float(4.8425200051213)
+float(4.8425200051213)
+
+Warning: sqrt() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(31.622776601684)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(31.622776601684)
+float(0)
+float(1)
+float(0)
+===Done===
diff --git a/ext/standard/tests/math/srand_basic.phpt b/ext/standard/tests/math/srand_basic.phpt
new file mode 100644
index 0000000..b56ad10
--- /dev/null
+++ b/ext/standard/tests/math/srand_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test srand() - basic function test for srand()
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing srand() : basic functionality ***\n";
+
+// Should return NULL if given anything that it can convert to long
+// This doesn't actually test what it does with the input :-\
+var_dump(srand());
+var_dump(srand(500));
+var_dump(srand(500.1));
+var_dump(srand("500"));
+var_dump(srand("500E3"));
+var_dump(srand(true));
+var_dump(srand(false));
+var_dump(srand(NULL));
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : basic functionality ***
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+===Done===
diff --git a/ext/standard/tests/math/srand_error.phpt b/ext/standard/tests/math/srand_error.phpt
new file mode 100644
index 0000000..4c21e55
--- /dev/null
+++ b/ext/standard/tests/math/srand_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test srand() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+/*
+ * Pass incorrect number of arguments to srand() to test behaviour
+ */
+
+echo "*** Testing srand() : error conditions ***\n";
+
+var_dump(srand(500, true));
+var_dump(srand("fivehundred"));
+var_dump(srand("500ABC"));
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : error conditions ***
+
+Warning: srand() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Notice: A non well formed numeric value encountered in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/srand_variation1.phpt b/ext/standard/tests/math/srand_variation1.phpt
new file mode 100644
index 0000000..16da80f
--- /dev/null
+++ b/ext/standard/tests/math/srand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test srand() function : usage variations - different data types as $seed argument
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing srand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of srand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(srand($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : usage variations ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: srand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+NULL
+
+-- Iteration 25 --
+NULL
+
+-- Iteration 26 --
+
+Warning: srand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/tan_basic.phpt b/ext/standard/tests/math/tan_basic.phpt
new file mode 100644
index 0000000..e2934fb
--- /dev/null
+++ b/ext/standard/tests/math/tan_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input tan()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+
+echo "tan 60 = ";
+var_dump(tan($sixty));
+if (allowed_rounding_error(tan($sixty),1.7320508075689)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tan 30 = ";
+var_dump(tan($thirty));
+if (allowed_rounding_error(tan($thirty),0.57735026918963)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+tan 60 = float(%f)
+Pass
+tan 30 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/tan_basiclong_64bit.phpt b/ext/standard/tests/math/tan_basiclong_64bit.phpt
new file mode 100644
index 0000000..8ab083d
--- /dev/null
+++ b/ext/standard/tests/math/tan_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test tan function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(tan($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(84.739312968756)
+--- testing: -9223372036854775808 ---
+float(-84.739312968756)
+--- testing: 2147483647 ---
+float(1.0523779637351)
+--- testing: -2147483648 ---
+float(4.0842894552986)
+--- testing: 9223372034707292160 ---
+float(-0.25738520049439)
+--- testing: -9223372034707292160 ---
+float(0.25738520049439)
+--- testing: 2147483648 ---
+float(-4.0842894552986)
+--- testing: -2147483649 ---
+float(0.34328416030117)
+--- testing: 4294967294 ---
+float(-19.579238091943)
+--- testing: 4294967295 ---
+float(-0.57225137018055)
+--- testing: 4294967293 ---
+float(0.71667000824652)
+--- testing: 9223372036854775806 ---
+float(84.739312968756)
+--- testing: 9.2233720368548E+18 ---
+float(84.739312968756)
+--- testing: -9223372036854775807 ---
+float(-84.739312968756)
+--- testing: -9.2233720368548E+18 ---
+float(-84.739312968756)
+===DONE===
diff --git a/ext/standard/tests/math/tan_error.phpt b/ext/standard/tests/math/tan_error.phpt
new file mode 100644
index 0000000..b3d4cf8
--- /dev/null
+++ b/ext/standard/tests/math/tan_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for tan()
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(tan($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(tan());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: tan() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: tan() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt
new file mode 100644
index 0000000..59aa5be
--- /dev/null
+++ b/ext/standard/tests/math/tan_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of tan()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test tan with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = tan($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1.588153083)
+float(-1.588153083)
+float(8.895619796)
+float(-8.895619796)
+float(1.588153083)
+float(1.588153083)
+float(1.588153083)
+float(8.895619796)
+float(8.895619796)
+
+Warning: tan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(1.470324156)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(1.470324156)
+float(0)
+float(1.557407725)
+float(0)
diff --git a/ext/standard/tests/math/tanh_basic.phpt b/ext/standard/tests/math/tanh_basic.phpt
new file mode 100644
index 0000000..6b6a9df
--- /dev/null
+++ b/ext/standard/tests/math/tanh_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test return type and value for expected input tanh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+echo "tanh .5 = ";
+var_dump(tanh(0.5));
+if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh -0.5 = ";
+var_dump(tanh(-0.5));
+if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh 3 = ";
+var_dump(tanh(3.0));
+if (allowed_rounding_error(tanh(3.0),0.99505475368673 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh -3 = ";
+var_dump(tanh(-3.0));
+if (allowed_rounding_error(tanh(-3.0),-0.99505475368673 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+tanh .5 = float(%f)
+Pass
+tanh -0.5 = float(%f)
+Pass
+tanh 3 = float(%f)
+Pass
+tanh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/tanh_basiclong_64bit.phpt b/ext/standard/tests/math/tanh_basiclong_64bit.phpt
new file mode 100644
index 0000000..02e6c10
--- /dev/null
+++ b/ext/standard/tests/math/tanh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test tanh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(tanh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(1)
+--- testing: -9223372036854775808 ---
+float(-1)
+--- testing: 2147483647 ---
+float(1)
+--- testing: -2147483648 ---
+float(-1)
+--- testing: 9223372034707292160 ---
+float(1)
+--- testing: -9223372034707292160 ---
+float(-1)
+--- testing: 2147483648 ---
+float(1)
+--- testing: -2147483649 ---
+float(-1)
+--- testing: 4294967294 ---
+float(1)
+--- testing: 4294967295 ---
+float(1)
+--- testing: 4294967293 ---
+float(1)
+--- testing: 9223372036854775806 ---
+float(1)
+--- testing: 9.2233720368548E+18 ---
+float(1)
+--- testing: -9223372036854775807 ---
+float(-1)
+--- testing: -9.2233720368548E+18 ---
+float(-1)
+===DONE===
diff --git a/ext/standard/tests/math/tanh_error.phpt b/ext/standard/tests/math/tanh_error.phpt
new file mode 100644
index 0000000..cc92cb4
--- /dev/null
+++ b/ext/standard/tests/math/tanh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for tanh()
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(tanh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(tanh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: tanh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: tanh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt
new file mode 100644
index 0000000..e5e65a3
--- /dev/null
+++ b/ext/standard/tests/math/tanh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of tanh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test tanh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = tanh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1)
+float(-1)
+float(1)
+float(-1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+
+Warning: tanh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(1)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(1)
+float(0)
+float(0.761594156)
+float(0)
diff --git a/ext/standard/tests/misc/browscap.ini b/ext/standard/tests/misc/browscap.ini
new file mode 100644
index 0000000..f9f4b1d
--- /dev/null
+++ b/ext/standard/tests/misc/browscap.ini
@@ -0,0 +1,16927 @@
+;;; Provided courtesy of http://browsers.garykeith.com
+;;; Created on August 27, 2008 at 6:08:26 AM GMT
+
+[GJK_Browscap_Version]
+Version=4091
+Released=Wed, 27 Aug 2008 06:08:26 -0000
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DefaultProperties
+
+[DefaultProperties]
+Browser="DefaultProperties"
+Version=0
+MajorVer=0
+MinorVer=0
+Platform=unknown
+Alpha=false
+Beta=false
+Win16=false
+Win32=false
+Win64=false
+Frames=false
+IFrames=false
+Tables=false
+Cookies=false
+BackgroundSounds=false
+AuthenticodeUpdate=
+CDF=false
+VBScript=false
+JavaApplets=false
+JavaScript=false
+ActiveXControls=false
+Stripper=false
+isBanned=false
+WAP=false
+isMobileDevice=false
+isSyndicationReader=false
+Crawler=false
+CSS=0
+CssVersion=0
+supportsCSS=false
+AOL=false
+aolVersion=0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ask
+
+[Ask]
+Parent=DefaultProperties
+Browser="Ask"
+Frames=true
+Tables=true
+Crawler=true
+
+[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]
+Parent=Ask
+Browser="Teoma"
+
+[Mozilla/2.0 (compatible; Ask Jeeves)]
+Parent=Ask
+Browser="AskJeeves"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Baidu
+
+[Baidu]
+Parent=DefaultProperties
+Browser="Baidu"
+Frames=true
+Tables=true
+Crawler=true
+
+[BaiduImageSpider*]
+Parent=Baidu
+Browser="BaiduImageSpider"
+
+[Baiduspider*]
+Parent=Baidu
+Browser="BaiDu"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Google
+
+[Google]
+Parent=DefaultProperties
+Browser="Google"
+Frames=true
+IFrames=true
+Tables=true
+JavaScript=true
+Crawler=true
+
+[AdsBot-Google (*http://www.google.com/adsbot.html)]
+Parent=Google
+Browser="AdsBot-Google"
+
+[Feedfetcher-Google;*]
+Parent=Google
+Browser="Feedfetcher-Google"
+isSyndicationReader=true
+
+[Google-Sitemaps/*]
+Parent=Google
+Browser="Google-Sitemaps"
+
+[Googlebot-Image/*]
+Parent=Google
+Browser="Googlebot-Image"
+CDF=true
+
+[googlebot-urlconsole]
+Parent=Google
+Browser="googlebot-urlconsole"
+
+[Googlebot/2.1 (*http://www.google.com/bot.html)]
+Parent=Google
+Browser="Googlebot"
+
+[Googlebot/2.1 (*http://www.googlebot.com/bot.html)]
+Parent=Google
+Browser="Googlebot"
+
+[Googlebot/Test*]
+Parent=Google
+Browser="Googlebot/Test"
+
+[gsa-crawler*]
+Parent=Google
+Browser="Google Search Appliance"
+Stripper=true
+isBanned=true
+
+[Mediapartners-Google*]
+Parent=Google
+Browser="Mediapartners-Google"
+
+[Mozilla/4.0 (compatible; Google Desktop)]
+Parent=Google
+Browser="Google Desktop"
+
+[Mozilla/4.0 (compatible; GoogleToolbar*)]
+Parent=Google
+Browser="Google Toolbar"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; Googlebot/2.1; *http://www.google.com/bot.html)]
+Parent=Google
+Browser="Googlebot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Inktomi
+
+[Inktomi]
+Parent=DefaultProperties
+Browser="Inktomi"
+Frames=true
+Tables=true
+Crawler=true
+
+[Mozilla/4.0]
+Parent=Inktomi
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)]
+Parent=Inktomi
+Win32=true
+
+[Mozilla/4.0 (compatible; Yahoo Japan; for robot study; kasugiya)]
+Parent=Inktomi
+Browser="Yahoo! RobotStudy"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; Yahoo! DE Slurp; http://help.yahoo.com/help/us/ysearch/slurp)]
+Parent=Inktomi
+Browser="Yahoo! Directory Engine"
+
+[Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html)]
+Parent=Inktomi
+Browser="Yahoo! Slurp China"
+
+[Mozilla/5.0 (compatible; Yahoo! Slurp/3.0; http://help.yahoo.com/help/us/ysearch/slurp)]
+Parent=Inktomi
+Browser="Yahoo! Slurp"
+Version=3.0
+MajorVer=3
+MinorVer=0
+
+[Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)]
+Parent=Inktomi
+Browser="Yahoo! Slurp"
+
+[Mozilla/5.0 (Slurp/cat; slurp@inktomi.com; http://www.inktomi.com/slurp.html)]
+Parent=Inktomi
+Browser="Slurp/cat"
+
+[Mozilla/5.0 (Slurp/si; slurp@inktomi.com; http://www.inktomi.com/slurp.html)]
+Parent=Inktomi
+
+[Mozilla/5.0 (Yahoo-MMCrawler/4.0; mailto:vertical-crawl-support@yahoo-inc.com)]
+Parent=Inktomi
+Browser="Yahoo-MMCrawler"
+Version=4.0
+MajorVer=4
+MinorVer=0
+
+[Scooter/*]
+Parent=Inktomi
+Browser="Scooter"
+
+[Scooter/3.3Y!CrawlX]
+Parent=Inktomi
+Browser="Scooter/3.3Y!CrawlX"
+Version=3.3
+MajorVer=3
+MinorVer=3
+
+[slurp]
+Parent=Inktomi
+Browser="slurp"
+
+[Y!J-BSC/1.0*]
+Parent=Inktomi
+Browser="Y!J-BSC"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Stripper=true
+isBanned=true
+
+[Y!J-SRD/1.0]
+Parent=Inktomi
+Browser="Y!J-SRD"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Yahoo Mindset]
+Parent=Inktomi
+Browser="Yahoo Mindset"
+
+[Yahoo Pipes*]
+Parent=Inktomi
+Browser="Yahoo Pipes"
+
+[Yahoo! Mindset]
+Parent=Inktomi
+Browser="Yahoo! Mindset"
+
+[Yahoo! Slurp/Site Explorer]
+Parent=Inktomi
+Browser="Yahoo! Site Explorer"
+
+[Yahoo-Blogs/*]
+Parent=Inktomi
+Browser="Yahoo-Blogs"
+
+[Yahoo-MMAudVid*]
+Parent=Inktomi
+Browser="Yahoo-MMAudVid"
+
+[Yahoo-MMCrawler*]
+Parent=Inktomi
+Browser="Yahoo-MMCrawler"
+Stripper=true
+isBanned=true
+
+[YahooFeedSeeker*]
+Parent=Inktomi
+Browser="YahooFeedSeeker"
+isSyndicationReader=true
+Crawler=false
+
+[YahooSeeker/*]
+Parent=Inktomi
+Browser="YahooSeeker"
+WAP=true
+isMobileDevice=true
+
+[YahooSeeker/CafeKelsa (compatible; Konqueror/3.2; FreeBSD*) (KHTML, like Gecko)]
+Parent=Inktomi
+Browser="YahooSeeker/CafeKelsa"
+
+[YahooSeeker/CafeKelsa-dev (compatible; Konqueror/3.2; FreeBSD*) (KHTML, like Gecko)]
+Parent=Inktomi
+
+[YahooVideoSearch*]
+Parent=Inktomi
+Browser="YahooVideoSearch"
+
+[YahooYSMcm*]
+Parent=Inktomi
+Browser="YahooYSMcm"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MSN
+
+[MSN]
+Parent=DefaultProperties
+Browser="MSN"
+Frames=true
+Tables=true
+Crawler=true
+
+[MSNBot-Academic/1.0*]
+Parent=MSN
+Browser="MSNBot-Academic"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[msnbot-media/1.0*]
+Parent=MSN
+Browser="msnbot-media"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[msnbot-media/1.1*]
+Parent=MSN
+Browser="msnbot-media"
+Version=1.1
+MajorVer=1
+MinorVer=1
+
+[MSNBot-News/1.0*]
+Parent=MSN
+Browser="MSNBot-News"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[MSNBot-NewsBlogs/1.0*]
+Parent=MSN
+Browser="MSNBot-NewsBlogs"
+Version=1
+MajorVer=1
+MinorVer=0
+
+[msnbot-products]
+Parent=MSN
+Browser="msnbot-products"
+
+[msnbot/1.0*]
+Parent=MSN
+Browser="msnbot"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[msnbot/1.1*]
+Parent=MSN
+Browser="msnbot"
+Version=1.1
+MajorVer=1
+MinorVer=1
+
+[MSR-ISRCCrawler]
+Parent=MSN
+Browser="MSR-ISRCCrawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Yahoo
+
+[Yahoo]
+Parent=DefaultProperties
+Browser="Yahoo"
+Frames=true
+Tables=true
+Crawler=true
+
+[Mozilla/4.0 (compatible; Y!J; for robot study*)]
+Parent=Yahoo
+Browser="Y!J"
+
+[Mozilla/5.0 (Yahoo-Test/4.0*)]
+Parent=Yahoo
+Browser="Yahoo-Test"
+Version=4.0
+MajorVer=4
+MinorVer=0
+
+[mp3Spider cn-search-devel at yahoo-inc dot com]
+Parent=Yahoo
+Browser="Yahoo! Media"
+Stripper=true
+isBanned=true
+
+[My Browser]
+Parent=Yahoo
+Browser="Yahoo! My Browser"
+
+[Y!OASIS/*]
+Parent=Yahoo
+Browser="Y!OASIS"
+Stripper=true
+isBanned=true
+
+[YahooYSMcm/2.0.0]
+Parent=Yahoo
+Browser="YahooYSMcm"
+Version=2.0
+MajorVer=2
+MinorVer=0
+Stripper=true
+isBanned=true
+
+[YRL_ODP_CRAWLER]
+Parent=Yahoo
+Browser="YRL_ODP_CRAWLER"
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Yandex
+
+[Yandex]
+Parent=DefaultProperties
+Browser="Yandex"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+Crawler=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; YANDEX)]
+Parent=Yandex
+
+[Yandex/*]
+Parent=Yandex
+
+[YandexBlog/*]
+Parent=Yandex
+Browser="YandexBlog"
+isSyndicationReader=true
+
+[YandexSomething/*]
+Parent=Yandex
+Browser="YandexSomething"
+isSyndicationReader=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Accoona
+
+[Accoona]
+Parent=DefaultProperties
+Browser="Accoona"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[accoona*]
+Parent=Accoona
+Browser="Accoona"
+
+[Accoona-AI-Agent/* (crawler at accoona dot com)]
+Parent=Accoona
+Browser="Accoona-AI-Agent"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Best of the Web
+
+[Best of the Web]
+Parent=DefaultProperties
+Browser="Best of the Web"
+Frames=true
+Tables=true
+
+[Mozilla/4.0 (compatible; BOTW Feed Grabber; *http://botw.org)]
+Parent=Best of the Web
+Browser="BOTW Feed Grabber"
+isSyndicationReader=true
+Crawler=false
+
+[Mozilla/4.0 (compatible; BOTW Spider; *http://botw.org)]
+Parent=Best of the Web
+Browser="BOTW Spider"
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Boitho
+
+[Boitho]
+Parent=DefaultProperties
+Browser="Boitho"
+Frames=true
+Tables=true
+Crawler=true
+
+[boitho.com-dc/*]
+Parent=Boitho
+Browser="boitho.com-dc"
+
+[boitho.com-robot/*]
+Parent=Boitho
+Browser="boitho.com-robot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Convera
+
+[Convera]
+Parent=DefaultProperties
+Browser="Convera"
+Frames=true
+Tables=true
+Crawler=true
+
+[ConveraCrawler/*]
+Parent=Convera
+Browser="ConveraCrawler"
+
+[ConveraMultiMediaCrawler/0.1*]
+Parent=Convera
+Browser="ConveraMultiMediaCrawler"
+Version=0.1
+MajorVer=0
+MinorVer=1
+
+[CrawlConvera*]
+Parent=Convera
+Browser="CrawlConvera"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Entireweb
+
+[Entireweb]
+Parent=DefaultProperties
+Browser="Entireweb"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Mozilla/4.0 (compatible; SpeedySpider; www.entireweb.com)]
+Parent=Entireweb
+
+[Speedy Spider (*Beta/*)]
+Parent=Entireweb
+
+[Speedy?Spider?(http://www.entireweb.com*)]
+Parent=Entireweb
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Envolk
+
+[Envolk]
+Parent=DefaultProperties
+Browser="Envolk"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[envolk/* (?http://www.envolk.com/envolk*)]
+Parent=Envolk
+
+[envolk?ITS?spider/* (?http://www.envolk.com/envolk*)]
+Parent=Envolk
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exalead
+
+[Exalead]
+Parent=DefaultProperties
+Browser="Exalead"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Exabot-Images/1.0]
+Parent=Exalead
+Browser="Exabot-Images"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Exabot-Test/*]
+Parent=Exalead
+Browser="Exabot-Test"
+
+[Exabot/2.0]
+Parent=Exalead
+Browser="Exabot"
+
+[Exabot/3.0]
+Parent=Exalead
+Browser="Exabot"
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=Liberate
+
+[Exalead NG/*]
+Parent=Exalead
+Browser="Exalead NG"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; Exabot-Images/3.0;*)]
+Parent=Exalead
+Browser="Exabot-Images"
+
+[Mozilla/5.0 (compatible; Exabot/3.0;*)]
+Parent=Exalead
+Browser="Exabot"
+Stripper=false
+isBanned=false
+
+[Mozilla/5.0 (compatible; NGBot/*)]
+Parent=Exalead
+
+[ng/*]
+Parent=Exalead
+Browser="Exalead Previewer"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Excite
+
+[Excite]
+Parent=DefaultProperties
+Browser="Excite"
+Frames=true
+Tables=true
+Crawler=true
+
+[Mozilla/4.0 (compatible; * sureseeker.com*)]
+Parent=Excite
+Browser="Excite sureseeker.com"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Fast/AllTheWeb
+
+[Fast/AllTheWeb]
+Parent=DefaultProperties
+Browser="Fast/AllTheWeb"
+Alpha=true
+Beta=true
+Win16=true
+Win32=true
+Win64=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+Stripper=true
+isBanned=true
+WAP=true
+isMobileDevice=true
+isSyndicationReader=true
+Crawler=true
+
+[*FAST Enterprise Crawler*]
+Parent=Fast/AllTheWeb
+Browser="FAST Enterprise Crawler"
+
+[FAST Data Search Document Retriever/4.0*]
+Parent=Fast/AllTheWeb
+Browser="FAST Data Search Document Retriever"
+
+[FAST MetaWeb Crawler (helpdesk at fastsearch dot com)]
+Parent=Fast/AllTheWeb
+Browser="FAST MetaWeb Crawler"
+
+[Fast PartnerSite Crawler*]
+Parent=Fast/AllTheWeb
+Browser="FAST PartnerSite"
+
+[FAST-WebCrawler/*]
+Parent=Fast/AllTheWeb
+Browser="FAST-WebCrawler"
+
+[FAST-WebCrawler/*/FirstPage*]
+Parent=Fast/AllTheWeb
+Browser="FAST-WebCrawler/FirstPage"
+
+[FAST-WebCrawler/*/Fresh*]
+Parent=Fast/AllTheWeb
+Browser="FAST-WebCrawler/Fresh"
+
+[FAST-WebCrawler/*/PartnerSite*]
+Parent=Fast/AllTheWeb
+Browser="FAST PartnerSite"
+
+[FAST-WebCrawler/*?Multimedia*]
+Parent=Fast/AllTheWeb
+Browser="FAST-WebCrawler/Multimedia"
+
+[FastSearch Web Crawler for*]
+Parent=Fast/AllTheWeb
+Browser="FastSearch Web Crawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Galaxy
+
+[Galaxy]
+Parent=DefaultProperties
+Browser="Galaxy"
+Frames=true
+Tables=true
+Crawler=true
+
+[GalaxyBot/*0 (http://www.galaxy.com/galaxybot.html)]
+Parent=Galaxy
+Browser="GalaxyBot"
+
+[Mozilla/* (compatible; MSIE *; www.galaxy.com;*)]
+Parent=Galaxy
+Browser="GalaxyBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ilse
+
+[Ilse]
+Parent=DefaultProperties
+Browser="Ilse"
+Frames=true
+Tables=true
+Crawler=true
+
+[IlseBot/*]
+Parent=Ilse
+
+[INGRID/?.0*]
+Parent=Ilse
+Browser="Ilse"
+
+[Mozilla/3.0 (INGRID/*]
+Parent=Ilse
+Browser="Ilse"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iVia Project
+
+[iVia Project]
+Parent=DefaultProperties
+Browser="iVia Project"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[DataFountains/DMOZ Downloader*]
+Parent=iVia Project
+Browser="DataFountains/DMOZ Downloader"
+Stripper=true
+isBanned=true
+
+[DataFountains/DMOZ Feature Vector Corpus Creator*]
+Parent=iVia Project
+Browser="DataFountains/DMOZ Feature Vector Corpus"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Jayde Online
+
+[Jayde Online]
+Parent=DefaultProperties
+Browser="Jayde Online"
+Frames=true
+Tables=true
+Crawler=true
+
+[ExactSeek Crawler/*]
+Parent=Jayde Online
+Browser="ExactSeek Crawler"
+
+[exactseek-pagereaper-* (crawler@exactseek.com)]
+Parent=Jayde Online
+Browser="exactseek-pagereaper"
+Stripper=true
+isBanned=true
+
+[exactseek.com]
+Parent=Jayde Online
+Browser="exactseek.com"
+
+[Jayde Crawler*]
+Parent=Jayde Online
+Browser="Jayde Crawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lycos
+
+[Lycos]
+Parent=DefaultProperties
+Browser="Lycos"
+Frames=true
+Tables=true
+Crawler=true
+
+[Lycos*]
+Parent=Lycos
+Browser="Lycos"
+
+[Lycos-Proxy]
+Parent=Lycos
+Browser="Lycos-Proxy"
+
+[Lycos-Spider_(modspider)]
+Parent=Lycos
+Browser="Lycos-Spider_(modspider)"
+
+[Lycos-Spider_(T-Rex)]
+Parent=Lycos
+Browser="Lycos-Spider_(T-Rex)"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Naver
+
+[Naver]
+Parent=DefaultProperties
+Browser="Naver"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Cowbot-* (NHN Corp*naver.com)]
+Parent=Naver
+Browser="Naver Cowbot"
+
+[Mozilla/4.0 (compatible; NaverBot/*; *)]
+Parent=Naver
+
+[Mozilla/4.0 (compatible; NaverBot/*; nhnbot@naver.com)]
+Parent=Naver
+Browser="Naver NaverBot"
+
+[NaverBot-* (NHN Corp*naver.com)]
+Parent=Naver
+Browser="Naver NHN Corp"
+
+[Yeti/*]
+Parent=Naver
+Browser="Yeti"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Onet.pl Szukaj
+
+[Onet.pl Szukaj]
+Parent=DefaultProperties
+Browser="Onet.pl Szukaj"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[Mozilla/5.0 (compatible; OnetSzukaj/5.0*]
+Parent=Onet.pl Szukaj
+Browser="OnetSzukaj"
+
+[Onet.pl SA, http://szukaj.onet.pl]
+Parent=Onet.pl Szukaj
+Browser="Onet.pl"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Openfind
+
+[Openfind]
+Parent=DefaultProperties
+Browser="Openfind"
+Frames=true
+Tables=true
+Crawler=true
+
+[Gaisbot/*]
+Parent=Openfind
+
+[Openbot/*]
+Parent=Openfind
+
+[Openfind data gatherer*]
+Parent=Openfind
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Orbiter
+
+[Orbiter]
+Parent=DefaultProperties
+Browser="Orbiter"
+Frames=true
+Tables=true
+Crawler=true
+
+[Orbiter (?http://www.dailyorbit.com/bot.htm)]
+Parent=Orbiter
+
+[Orbiter (?http://www.thatsearchengine.com/bot.htm)]
+Parent=Orbiter
+Browser="Orbiter"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PeerFactory
+
+[PeerFactory]
+Parent=DefaultProperties
+Browser="PeerFactory"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[PeerFactor 404 crawler]
+Parent=PeerFactory
+Browser="PeerFactor 404 crawler"
+
+[PeerFactor Crawler]
+Parent=PeerFactory
+Browser="PeerFactor Crawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Pogodak!
+
+[Pogodak]
+Parent=DefaultProperties
+Browser="Pogodak!"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Mozilla/5.0 (compatible; Pogodak*)]
+Parent=Pogodak
+
+[Mozilla/5.0 (compatible; TridentSpider/*)]
+Parent=Pogodak
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Relevare
+
+[Relevare]
+Parent=DefaultProperties
+Browser="Relevare"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[bumblebee/*]
+Parent=Relevare
+Browser="Relevare"
+
+[Bumblebee@relevare.com]
+Parent=Relevare
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Sensis
+
+[Sensis]
+Parent=DefaultProperties
+Browser="Sensis"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[Sensis Web Crawler (search_comments\at\sensis\dot\com\dot\au)]
+Parent=Sensis
+Browser="Sensis Web Crawler"
+
+[Sensis.com.au Web Crawler (search_comments\at\sensis\dot\com\dot\au)]
+Parent=Sensis
+Browser="Sensis.com.au Web Crawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Shunix
+
+[Shunix]
+Parent=DefaultProperties
+Browser="Shunix"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[Mozilla/5.0 (compatible; ShunixBot/*)]
+Parent=Shunix
+Browser="ShunixBot"
+
+[XunBot/*]
+Parent=Shunix
+Browser="Shunix XunBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Singing Fish
+
+[Singing Fish]
+Parent=DefaultProperties
+Browser="Singing Fish"
+Frames=true
+Tables=true
+Crawler=true
+
+[asterias/*]
+Parent=Singing Fish
+
+[Mozilla/* (compatible; *Asterias Crawler v*)*]
+Parent=Singing Fish
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Snap
+
+[Snap]
+Parent=DefaultProperties
+Browser="Snap"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Mozilla/5.0 (*) Gecko/* Firefox/* SnapPreviewBot]
+Parent=Snap
+
+[Mozilla/5.0 (SnapPreviewBot) Gecko/* Firefox/*]
+Parent=Snap
+
+[Snapbot/*]
+Parent=Snap
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Sogou
+
+[Sogou]
+Parent=DefaultProperties
+Browser="Sogou"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[shaboyi spider]
+Parent=Sogou
+Browser="Sogou/Shaboyi Spider"
+
+[sogou js robot(*)]
+Parent=Sogou
+
+[Sogou Orion spider/*]
+Parent=Sogou
+Browser="Sogou Orion spider"
+
+[Sogou Pic Agent]
+Parent=Sogou
+Browser="Sogou/Image Crawler"
+
+[Sogou Pic Spider]
+Parent=Sogou
+Browser="Sogou Pic Spider"
+
+[Sogou Push Spider/*]
+Parent=Sogou
+Browser="Sogou Push Spider"
+
+[sogou spider]
+Parent=Sogou
+Browser="Sogou/Spider"
+
+[sogou test spider]
+Parent=Sogou
+Browser="sogou test spider"
+
+[sogou web spider*]
+Parent=Sogou
+Browser="sogou web spider"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Thunderstone
+
+[Thunderstone]
+Parent=DefaultProperties
+Browser="Thunderstone"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*Webinator*]
+Parent=Thunderstone
+Browser="Webinator"
+
+[Mozilla/* (compatible; T-H-U-N-D-E-R-S-T-O-N-E)]
+Parent=Thunderstone
+Browser="Texis"
+
+[T-H-U-N-D-E-R-S-T-O-N-E]
+Parent=Thunderstone
+Browser="Texis"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Vagabondo
+
+[Vagabondo]
+Parent=DefaultProperties
+Browser="Vagabondo"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[Mozilla/4.0 (compatible; Vagabondo/*)]
+Parent=Vagabondo
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Yoono
+
+[Yoono]
+Parent=DefaultProperties
+Browser="Yoono"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Mozilla/5.0 (compatible; Yoono; http://www.yoono.com/)]
+Parent=Yoono
+
+[yoono/* web-crawler/*]
+Parent=Yoono
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ZoomInfo
+
+[ZoomInfo]
+Parent=DefaultProperties
+Browser="ZoomInfo"
+Frames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[NextGenSearchBot 1 (for information visit http://about.zoominfo.com/PublicSite/NextGenSearchBot.asp)]
+Parent=ZoomInfo
+Browser="ZoomInfo"
+
+[NextGenSearchBot 1 (for information visit http://www.eliyon.com/NextGenSearchBot)]
+Parent=ZoomInfo
+Browser="Eliyon"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Zymboo
+
+[Zymboo]
+Parent=DefaultProperties
+Browser="Zymboo"
+Frames=true
+Tables=true
+Crawler=true
+
+[zymbot (renato@zymboo.com)]
+Parent=Zymboo
+Browser="zymbot"
+
+[zymbot renato@zymboo.com]
+Parent=Zymboo
+Browser="zymbot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Directories
+
+[Directories]
+Parent=DefaultProperties
+Browser="Directories"
+Frames=true
+Tables=true
+Crawler=true
+
+[acontbot]
+Parent=Directories
+Browser="acontbot"
+
+[aipbot/*]
+Parent=Directories
+Browser="aipbot"
+
+[Findexa Crawler (http://www.findexa.no/gulesider/article26548.ece)]
+Parent=Directories
+Browser="Findexa Crawler"
+
+[FirstGov.gov Search - POC:firstgov.webmasters@gsa.gov]
+Parent=Directories
+Browser="FirstGov.gov Search"
+
+[http://www.istarthere.com (spider@istarthere.com)]
+Parent=Directories
+Browser="Istartere.com"
+Stripper=true
+isBanned=true
+
+[Mackster (*)]
+Parent=Directories
+Browser="Mackster"
+
+[Misterbot]
+Parent=Directories
+Browser="Misterbot"
+
+[Mozilla/4.0 (compatible; MSIE 5.0; www.galaxy.com;*)]
+Parent=Directories
+Browser="Galaxy/LOGIKA Search Engine"
+
+[Mozilla/5.0 (?http://www.toile.com/) ToileBot/*]
+Parent=Directories
+Browser="Toile"
+
+[Mozilla/5.0 (Votay bot/*)]
+Parent=Directories
+Browser="Votay"
+Stripper=true
+isBanned=true
+
+[Mozilla/6.0 (compatible; arameda.com Spider)]
+Parent=Directories
+Browser="Arameda"
+
+[NationalDirectory-*Spider/*]
+Parent=Directories
+Browser="National Directory"
+Stripper=true
+isBanned=true
+
+[Octopus/*]
+Parent=Directories
+Browser="Octopus"
+
+[OpenIntelligenceData/1.* (?http://www.worldwideweb-x.com/openData.html)]
+Parent=Directories
+Browser="World Wide Web Directory Project"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Stripper=true
+isBanned=true
+
+[Poirot]
+Parent=Directories
+Browser="Poirot"
+
+[silk/1.*]
+Parent=Directories
+Browser="Slider"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[WebFindBot(http://www.web-find.com)]
+Parent=Directories
+Browser="WebFindBot"
+
+[Best Whois (http://www.bestwhois.net/)]
+Parent=DNS Tools
+Browser="Best Whois"
+
+[DNSGroup/*]
+Parent=DNS Tools
+Browser="DNS Group Crawler"
+
+[NG-Search/*]
+Parent=Exalead
+Browser="NG-SearchBot"
+
+[TouchStone]
+Parent=Feeds Syndicators
+Browser="TouchStone"
+isSyndicationReader=true
+
+[flatlandbot/*]
+Parent=Flatland Industries
+Browser="flatlandbot"
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; General Crawlers
+
+[General Crawlers]
+Parent=DefaultProperties
+Browser="General Crawlers"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[*autokrawl*]
+Parent=General Crawlers
+Browser="autokrawl"
+Stripper=true
+isBanned=true
+
+[*Networking4all*]
+Parent=General Crawlers
+Browser="Networking4all Bot"
+
+[Aport]
+Parent=General Crawlers
+Browser="Aport"
+
+[ArachnetAgent*]
+Parent=General Crawlers
+
+[Art-Online.com*]
+Parent=General Crawlers
+Browser="Art-Online.com"
+
+[BabalooSpider/1.*]
+Parent=General Crawlers
+Browser="BabalooSpider"
+
+[BeijingCrawler]
+Parent=General Crawlers
+Browser="BeijingCrawler"
+Stripper=true
+isBanned=true
+
+[BilgiBot/*]
+Parent=General Crawlers
+Browser="BilgiBot"
+Stripper=true
+isBanned=true
+
+[bot/* (bot; *bot@bot.bot)]
+Parent=General Crawlers
+Browser="bot"
+Stripper=true
+isBanned=true
+
+[botlist]
+Parent=General Crawlers
+Browser="botlist"
+Stripper=true
+isBanned=true
+
+[Botswana*]
+Parent=General Crawlers
+Browser="Botswana"
+
+[BravoBrian BStop*]
+Parent=General Crawlers
+Browser="BravoBrian BStop"
+
+[BruinBot*]
+Parent=General Crawlers
+Browser="BruinBot"
+
+[CacheabilityEngine/*]
+Parent=General Crawlers
+Browser="CacheabilityEngine"
+
+[ccubee/*]
+Parent=General Crawlers
+Browser="ccubee"
+
+[CFM-SearchBot(http://www.cfm-search.com)]
+Parent=General Crawlers
+Browser="CFM-SearchBot"
+
+[CJNetworkQuality; http://www.cj.com/networkquality]
+Parent=General Crawlers
+Browser="CJNetworkQuality"
+Frames=true
+Tables=true
+Cookies=true
+
+[Clushbot/*]
+Parent=General Crawlers
+Browser="Clushbot"
+Stripper=true
+isBanned=true
+
+[Comodo HTTP(S) Crawler*]
+Parent=General Crawlers
+Browser="Comodo HTTP Crawler"
+
+[Crawler Mozilla/4.0]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[CrawlWave/*]
+Parent=General Crawlers
+Browser="CrawlWave"
+
+[CSHttpClient/*]
+Parent=General Crawlers
+Browser="CSHttpClient"
+
+[CydralSpider/1.9*]
+Parent=General Crawlers
+Browser="Cydral Web Image Search"
+Version=1.9
+MajorVer=1
+MinorVer=9
+Stripper=true
+isBanned=true
+
+[Cynthia 1.0]
+Parent=General Crawlers
+Browser="Cynthia"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[DiamondBot/*]
+Parent=General Crawlers
+Browser="DiamondBot"
+Stripper=true
+isBanned=true
+
+[Diff-Engine*]
+Parent=General Crawlers
+
+[DomainsBotBot/1.*]
+Parent=General Crawlers
+Browser="DomainsBotBot"
+Stripper=true
+isBanned=true
+
+[DomainsDB.net MetaCrawler*]
+Parent=General Crawlers
+Browser="DomainsDB"
+
+[dragonfly(ebingbong#playstarmusic.com)]
+Parent=General Crawlers
+Browser="eBingBong"
+Stripper=true
+isBanned=true
+
+[Drupal (*)]
+Parent=General Crawlers
+Browser="Drupal"
+
+[DTAAgent]
+Parent=General Crawlers
+Browser="DTAAgent"
+
+[Dumbot (version *)]
+Parent=General Crawlers
+Browser="Dumbfind"
+
+[EARTHCOM.info/*]
+Parent=General Crawlers
+Browser="EarthCom"
+
+[EDI/* (Edacious & Intelligent*)]
+Parent=General Crawlers
+Browser="Edacious & Intelligent Web Crawler"
+Stripper=true
+isBanned=true
+
+[EmeraldShield.com*]
+Parent=General Crawlers
+Browser="EmeraldShield"
+Stripper=true
+isBanned=true
+
+[EuripBot/*]
+Parent=General Crawlers
+Browser="Europe Internet Portal"
+
+[eventax/*]
+Parent=General Crawlers
+Browser="eventax"
+
+[FANGCrawl/*]
+Parent=General Crawlers
+Browser="FANGCrawl"
+Stripper=true
+isBanned=true
+
+[favorstarbot/*]
+Parent=General Crawlers
+Browser="favorstarbot"
+Stripper=true
+isBanned=true
+
+[FRSEEKBOT]
+Parent=General Crawlers
+Browser="FRSEEKBOT"
+
+[Gaisbot*]
+Parent=General Crawlers
+Browser="Gaisbot"
+
+[GeoBot/*]
+Parent=General Crawlers
+Browser="GeoBot"
+
+[grub crawler]
+Parent=General Crawlers
+Browser="grub crawler"
+
+[HiddenMarket-*]
+Parent=General Crawlers
+Browser="HiddenMarket"
+Stripper=true
+isBanned=true
+
+[htdig/*]
+Parent=General Crawlers
+Browser="ht://Dig"
+
+[HTTP-Test-Program]
+Parent=General Crawlers
+Browser="WebBug"
+MajorVer=5
+
+[HTTP/1.0]
+Parent=General Crawlers
+Browser="HTTP/1.0"
+
+[http://www.almaden.ibm.com/cs/crawler*]
+Parent=General Crawlers
+Browser="IBM's WebFountain"
+
+[ichiro/*]
+Parent=General Crawlers
+Browser="ichiro"
+
+[InnerpriseBot/*]
+Parent=General Crawlers
+Browser="InnerpriseBot"
+
+[InternetLinkAgent/*]
+Parent=General Crawlers
+Browser="InternetLinkAgent"
+
+[iVia Page Fetcher*]
+Parent=General Crawlers
+Browser="iVia Software"
+Stripper=true
+isBanned=true
+
+[JetBrains*]
+Parent=General Crawlers
+Browser="Omea Pro"
+
+[JoBot/0.* (John's Robot; jj.boers@gmail.com)]
+Parent=General Crawlers
+Browser="John's Robot"
+Stripper=true
+isBanned=true
+
+[KakleBot - www.kakle.com/0.1]
+Parent=General Crawlers
+Browser="KakleBot"
+
+[KBeeBot/0.*]
+Parent=General Crawlers
+Browser="KBeeBot"
+Stripper=true
+isBanned=true
+
+[Keyword Density/*]
+Parent=General Crawlers
+Browser="Keyword Density"
+
+[LetsCrawl.com/1.0*]
+Parent=General Crawlers
+Browser="LetsCrawl.com"
+Stripper=true
+isBanned=true
+
+[Lincoln State Web Browser]
+Parent=General Crawlers
+Browser="Lincoln State Web Browser"
+Stripper=true
+isBanned=true
+
+[Links4US-Crawler,*]
+Parent=General Crawlers
+Browser="Links4US-Crawler"
+Stripper=true
+isBanned=true
+
+[Lorkyll *.* -- lorkyll@444.net]
+Parent=General Crawlers
+Browser="Lorkyll"
+Stripper=true
+isBanned=true
+
+[Lsearch/sondeur]
+Parent=General Crawlers
+Browser="Lsearch/sondeur"
+Stripper=true
+isBanned=true
+
+[MapoftheInternet.com?(?http://MapoftheInternet.com)]
+Parent=General Crawlers
+Browser="MapoftheInternet"
+Stripper=true
+isBanned=true
+
+[Marvin v0.3]
+Parent=General Crawlers
+Browser="MedHunt"
+Version=0.3
+MajorVer=0
+MinorVer=3
+
+[masidani_bot_v0.6*]
+Parent=General Crawlers
+Browser="masidani_bot"
+
+[Metaspinner/0.01 (Metaspinner; http://www.meta-spinner.de/; support@meta-spinner.de/)]
+Parent=General Crawlers
+Browser="Metaspinner/0.01"
+Version=0.01
+MajorVer=0
+MinorVer=01
+
+[metatagsdir/*]
+Parent=General Crawlers
+Browser="metatagsdir"
+Stripper=true
+isBanned=true
+
+[Miva (AlgoFeedback@miva.com)]
+Parent=General Crawlers
+Browser="Miva"
+
+[moget/*]
+Parent=General Crawlers
+Browser="Goo"
+
+[Mozdex/0.7.2*]
+Parent=General Crawlers
+Browser="Mozdex"
+
+[Mozilla Compatible (MS IE 3.01 WinNT)]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[Mozilla/* (compatible; WebCapture*)]
+Parent=General Crawlers
+Browser="WebCapture"
+
+[Mozilla/4.0 (compatible; DepSpid/*)]
+Parent=General Crawlers
+Browser="DepSpid"
+
+[Mozilla/4.0 (compatible; MSIE 4.01; Vonna.com b o t)]
+Parent=General Crawlers
+Browser="Vonna.com"
+Stripper=true
+isBanned=true
+
+[Mozilla/4.0 (compatible; MSIE 4.01; Windows95)]
+Parent=General Crawlers
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 4.5; Windows 98; )]
+Parent=General Crawlers
+Win32=true
+
+[Mozilla/4.0 (compatible; MyFamilyBot/*)]
+Parent=General Crawlers
+Browser="MyFamilyBot"
+
+[Mozilla/4.0 (compatible; N-Stealth)]
+Parent=General Crawlers
+Browser="N-Stealth"
+
+[Mozilla/4.0 (compatible; Scumbot/*; Linux/*)]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[Mozilla/4.0 (compatible; Spider; Linux)]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[Mozilla/4.1]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[Mozilla/4.5]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; AboutUsBot/*)]
+Parent=General Crawlers
+Browser="AboutUsBot"
+
+[Mozilla/5.0 (compatible; BuzzRankingBot/*)]
+Parent=General Crawlers
+Browser="BuzzRankingBot"
+Stripper=true
+isBanned=true
+
+[mozilla/5.0 (compatible; genevabot http://www.healthdash.com)]
+Parent=General Crawlers
+Browser="Healthdash"
+
+[Mozilla/5.0 (compatible; Kyluka crawl; http://www.kyluka.com/crawl.html; crawl@kyluka.com)]
+Parent=General Crawlers
+Browser="Kyluka"
+
+[Mozilla/5.0 (compatible; Twingly Recon; http://www.twingly.com/)]
+Parent=General Crawlers
+Browser="Twingly Recon"
+
+[Mozilla/5.0 (compatible; unwrapbot/2.*; http://www.unwrap.jp*)]
+Parent=General Crawlers
+Browser="UnWrap"
+
+[Mozilla/5.0 (compatible; Vermut*)]
+Parent=General Crawlers
+Browser="Vermut"
+
+[Mozilla/5.0 (compatible; Webbot/*)]
+Parent=General Crawlers
+Browser="Webbot.ru"
+Stripper=true
+isBanned=true
+
+[n4p_bot*]
+Parent=General Crawlers
+Browser="n4p_bot"
+
+[nabot*]
+Parent=General Crawlers
+Browser="Nabot"
+
+[NetCarta_WebMapper/*]
+Parent=General Crawlers
+Browser="NetCarta_WebMapper"
+Stripper=true
+isBanned=true
+
+[neTVision AG andreas.heidoetting@thomson-webcast.net]
+Parent=General Crawlers
+Browser="neTVision"
+
+[NextopiaBOT*]
+Parent=General Crawlers
+Browser="NextopiaBOT"
+
+[nicebot]
+Parent=General Crawlers
+Browser="nicebot"
+Stripper=true
+isBanned=true
+
+[niXXieBot?Foster*]
+Parent=General Crawlers
+Browser="niXXiebot-Foster"
+
+[Nozilla/P.N (Just for IDS woring)]
+Parent=General Crawlers
+Browser="Nozilla/P.N"
+Stripper=true
+isBanned=true
+
+[Nudelsalat/*]
+Parent=General Crawlers
+Browser="Nudelsalat"
+Stripper=true
+isBanned=true
+
+[Ocelli/*]
+Parent=General Crawlers
+Browser="Ocelli"
+
+[OpenTaggerBot (http://www.opentagger.com/opentaggerbot.htm)]
+Parent=General Crawlers
+Browser="OpenTaggerBot"
+
+[Oracle Enterprise Search]
+Parent=General Crawlers
+Browser="Oracle Enterprise Search"
+Stripper=true
+isBanned=true
+
+[Oracle Ultra Search]
+Parent=General Crawlers
+Browser="Oracle Ultra Search"
+
+[Pajaczek/*]
+Parent=General Crawlers
+Browser="Pajaczek"
+Stripper=true
+isBanned=true
+
+[panscient.com]
+Parent=General Crawlers
+Browser="panscient.com"
+Stripper=true
+isBanned=true
+
+[Patwebbot (http://www.herz-power.de/technik.html)]
+Parent=General Crawlers
+Browser="Patwebbot"
+
+[PDFBot (crawler@pdfind.com)]
+Parent=General Crawlers
+Browser="PDFBot"
+
+[Pete-Spider/1.*]
+Parent=General Crawlers
+Browser="Pete-Spider"
+Stripper=true
+isBanned=true
+
+[PhpDig/*]
+Parent=General Crawlers
+Browser="PhpDig"
+
+[PlantyNet_WebRobot*]
+Parent=General Crawlers
+Browser="PlantyNet"
+Stripper=true
+isBanned=true
+
+[PMAFind]
+Parent=General Crawlers
+Browser="PMAFind"
+Stripper=true
+isBanned=true
+
+[Poodle_predictor_1.0]
+Parent=General Crawlers
+Browser="Poodle Predictor"
+
+[QuickFinder Crawler]
+Parent=General Crawlers
+Browser="QuickFinder"
+Stripper=true
+isBanned=true
+
+[Radiation Retriever*]
+Parent=General Crawlers
+Browser="Radiation Retriever"
+Stripper=true
+isBanned=true
+
+[RedCarpet/*]
+Parent=General Crawlers
+Browser="RedCarpet"
+Stripper=true
+isBanned=true
+
+[RixBot (http://babelserver.org/rix)]
+Parent=General Crawlers
+Browser="RixBot"
+
+[SBIder/*]
+Parent=General Crawlers
+Browser="SiteSell"
+
+[ScollSpider/2.*]
+Parent=General Crawlers
+Browser="ScollSpider"
+Stripper=true
+isBanned=true
+
+[Search Fst]
+Parent=General Crawlers
+Browser="Search Fst"
+
+[searchbot admin@google.com]
+Parent=General Crawlers
+Browser="searchbot"
+Stripper=true
+isBanned=true
+
+[Seeker.lookseek.com]
+Parent=General Crawlers
+Browser="LookSeek"
+Stripper=true
+isBanned=true
+
+[semanticdiscovery/*]
+Parent=General Crawlers
+Browser="Semantic Discovery"
+
+[SeznamBot/*]
+Parent=General Crawlers
+Browser="SeznamBot"
+Stripper=true
+isBanned=true
+
+[shelob v1.*]
+Parent=General Crawlers
+Browser="shelob"
+Stripper=true
+isBanned=true
+
+[ShopWiki/1.0*]
+Parent=General Crawlers
+Browser="ShopWiki"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[ShowXML/1.0 libwww/5.4.0]
+Parent=General Crawlers
+Browser="ShowXML"
+Stripper=true
+isBanned=true
+
+[sitecheck.internetseer.com*]
+Parent=General Crawlers
+Browser="Internetseer"
+
+[SMBot/*]
+Parent=General Crawlers
+Browser="SMBot"
+
+[sohu*]
+Parent=General Crawlers
+Browser="sohu-search"
+Stripper=true
+isBanned=true
+
+[SpankBot*]
+Parent=General Crawlers
+Browser="SpankBot"
+Stripper=true
+isBanned=true
+
+[spider (tspyyp@tom.com)]
+Parent=General Crawlers
+Browser="spider (tspyyp@tom.com)"
+Stripper=true
+isBanned=true
+
+[Sunrise/0.*]
+Parent=General Crawlers
+Browser="Sunrise"
+Stripper=true
+isBanned=true
+
+[SurveyBot/*]
+Parent=General Crawlers
+Browser="SurveyBot"
+Stripper=true
+isBanned=true
+
+[SynapticSearch/AI Crawler 1.?]
+Parent=General Crawlers
+Browser="SynapticSearch"
+Stripper=true
+isBanned=true
+
+[SyncMgr]
+Parent=General Crawlers
+Browser="SyncMgr"
+
+[Tagyu Agent/1.0]
+Parent=General Crawlers
+Browser="Tagyu"
+
+[Talkro Web-Shot/*]
+Parent=General Crawlers
+Browser="Talkro Web-Shot"
+Stripper=true
+isBanned=true
+
+[Tecomi Bot (http://www.tecomi.com/bot.htm)]
+Parent=General Crawlers
+Browser="Tecomi"
+
+[TheInformant*]
+Parent=General Crawlers
+Browser="TheInformant"
+Stripper=true
+isBanned=true
+
+[Tutorial Crawler*]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[UbiCrawler/*]
+Parent=General Crawlers
+Browser="UbiCrawler"
+
+[UCmore]
+Parent=General Crawlers
+Browser="UCmore"
+
+[User*Agent:*]
+Parent=General Crawlers
+Stripper=true
+isBanned=true
+
+[VadixBot]
+Parent=General Crawlers
+Browser="VadixBot"
+
+[VengaBot/*]
+Parent=General Crawlers
+Browser="VengaBot"
+Stripper=true
+isBanned=true
+
+[Visicom Toolbar]
+Parent=General Crawlers
+Browser="Visicom Toolbar"
+
+[W3C-WebCon/*]
+Parent=General Crawlers
+Browser="W3C-WebCon"
+
+[Webclipping.com]
+Parent=General Crawlers
+Browser="Webclipping.com"
+Stripper=true
+isBanned=true
+
+[WebCrawler_1.*]
+Parent=General Crawlers
+Browser="WebCrawler"
+
+[WebFilter Robot*]
+Parent=General Crawlers
+Browser="WebFilter Robot"
+
+[WeBoX/*]
+Parent=General Crawlers
+Browser="WeBoX"
+
+[WebTrends/*]
+Parent=General Crawlers
+Browser="WebTrends"
+
+[West Wind Internet Protocols*]
+Parent=General Crawlers
+Browser="Versatel"
+Stripper=true
+isBanned=true
+
+[WhizBang]
+Parent=General Crawlers
+Browser="WhizBang"
+
+[Willow Internet Crawler by Twotrees V*]
+Parent=General Crawlers
+Browser="Willow Internet Crawler"
+
+[WIRE/* (Linux; i686; Bot,Robot,Spider,Crawler)]
+Parent=General Crawlers
+Browser="WIRE"
+Stripper=true
+isBanned=true
+
+[www.fi crawler, contact crawler@www.fi]
+Parent=General Crawlers
+Browser="www.fi crawler"
+
+[Xerka WebBot v1.*]
+Parent=General Crawlers
+Browser="Xerka"
+Stripper=true
+isBanned=true
+
+[XML Sitemaps Generator*]
+Parent=General Crawlers
+Browser="XML Sitemaps Generator"
+
+[XSpider*]
+Parent=General Crawlers
+Browser="XSpider"
+Stripper=true
+isBanned=true
+
+[YooW!/* (?http://www.yoow.eu)]
+Parent=General Crawlers
+Browser="YooW!"
+Stripper=true
+isBanned=true
+
+[FOTOCHECKER]
+Parent=Image Crawlers
+Browser="FOTOCHECKER"
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Search Engines
+
+[Search Engines]
+Parent=DefaultProperties
+Browser="Search Engines"
+Frames=true
+Tables=true
+Crawler=true
+
+[*FDSE robot*]
+Parent=Search Engines
+Browser="FDSE Robot"
+
+[*Fluffy the spider*]
+Parent=Search Engines
+Browser="SearchHippo"
+
+[Abacho*]
+Parent=Search Engines
+Browser="Abacho"
+
+[ah-ha.com crawler (crawler@ah-ha.com)]
+Parent=Search Engines
+Browser="Ah-Ha"
+
+[AIBOT/*]
+Parent=Search Engines
+Browser="21Seek.Com"
+
+[ALeadSoftbot/*]
+Parent=Search Engines
+Browser="ALeadSoftbot"
+
+[Amfibibot/*]
+Parent=Search Engines
+Browser="Amfibi"
+
+[AnswerBus (http://www.answerbus.com/)]
+Parent=Search Engines
+
+[antibot-V*]
+Parent=Search Engines
+Browser="antibot"
+
+[appie*(www.walhello.com)]
+Parent=Search Engines
+Browser="Walhello"
+
+[ASPSeek/*]
+Parent=Search Engines
+Browser="ASPSeek"
+
+[BigCliqueBOT/*]
+Parent=Search Engines
+Browser="BigClique.com/BigClic.com"
+
+[Blaiz-Bee/*]
+Parent=Search Engines
+Browser="RawGrunt"
+
+[btbot/*]
+Parent=Search Engines
+Browser="Bit Torrent Search Engine"
+
+[CatchBot/1.0; http://www.catchbot.com]
+Parent=Search Engines
+Browser="CatchBot"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[CipinetBot (http://www.cipinet.com/bot.html)]
+Parent=Search Engines
+Browser="CipinetBot"
+
+[cosmos*]
+Parent=Search Engines
+Browser="Xyleme"
+
+[Deepindex]
+Parent=Search Engines
+Browser="Deepindex"
+
+[DiamondBot]
+Parent=Search Engines
+Browser="DiamondBot"
+
+[Dumbot(version 0.2 beta - http://www.searchles.com/ Searchles Inc.)]
+Parent=Search Engines
+Browser="Dumbot"
+Version=0.2
+MajorVer=0
+MinorVer=2
+Beta=true
+
+[Eule?Robot*]
+Parent=Search Engines
+Browser="Eule-Robot"
+
+[Faxobot/*]
+Parent=Search Engines
+Browser="Faxo"
+
+[Filangy/*]
+Parent=Search Engines
+Browser="Filangy"
+
+[Fooky.com/ScorpionBot/ScoutOut;*]
+Parent=Search Engines
+Browser="ScorpionBot"
+Stripper=true
+isBanned=true
+
+[FyberSpider*]
+Parent=Search Engines
+Browser="FyberSpider"
+Stripper=true
+isBanned=true
+
+[gazz/*(gazz@nttr.co.jp)]
+Parent=Search Engines
+Browser="gazz"
+
+[geniebot*]
+Parent=Search Engines
+Browser="GenieKnows"
+
+[GOFORITBOT (?http://www.goforit.com/about/?)]
+Parent=Search Engines
+Browser="GoForIt"
+
+[GoGuidesBot/*]
+Parent=Search Engines
+Browser="GoGuidesBot"
+
+[GroschoBot/*]
+Parent=Search Engines
+Browser="GroschoBot"
+
+[GurujiBot/1.*]
+Parent=Search Engines
+Browser="GurujiBot"
+Stripper=true
+isBanned=true
+
+[HenryTheMiragoRobot*]
+Parent=Search Engines
+Browser="Mirago"
+
+[HolmesBot (http://holmes.ge)]
+Parent=Search Engines
+Browser="HolmesBot"
+
+[Hotzonu/*]
+Parent=Search Engines
+Browser="Hotzonu"
+
+[HyperEstraier/*]
+Parent=Search Engines
+Browser="HyperEstraier"
+Stripper=true
+isBanned=true
+
+[i1searchbot/*]
+Parent=Search Engines
+Browser="i1searchbot"
+
+[IIITBOT/1.*]
+Parent=Search Engines
+Browser="Indian Language Web Search Engine"
+
+[Iltrovatore-?etaccio/*]
+Parent=Search Engines
+Browser="Iltrovatore-Setaccio"
+
+[InfociousBot (?http://corp.infocious.com/tech_crawler.php)]
+Parent=Search Engines
+Browser="InfociousBot"
+Stripper=true
+isBanned=true
+
+[Infoseek SideWinder/*]
+Parent=Search Engines
+Browser="Infoseek"
+
+[iSEEKbot/*]
+Parent=Search Engines
+Browser="iSEEKbot"
+
+[Kolinka Forum Search (www.kolinka.com)]
+Parent=Search Engines
+Browser="Kolinka Forum Search"
+Stripper=true
+isBanned=true
+
+[KRetrieve/]
+Parent=Search Engines
+Browser="KRetrieve"
+Stripper=true
+isBanned=true
+
+[LapozzBot/*]
+Parent=Search Engines
+Browser="LapozzBot"
+
+[Linknzbot*]
+Parent=Search Engines
+Browser="Linknzbot"
+
+[LocalcomBot/*]
+Parent=Search Engines
+Browser="LocalcomBot"
+
+[Mail.Ru/1.0]
+Parent=Search Engines
+Browser="Mail.Ru"
+
+[MaSagool/*]
+Parent=Search Engines
+Browser="Sagoo"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[miniRank/*]
+Parent=Search Engines
+Browser="miniRank"
+
+[MJ12bot/*]
+Parent=Search Engines
+Browser="Majestic-12"
+
+[Mnogosearch*]
+Parent=Search Engines
+Browser="Mnogosearch"
+
+[Mozilla/0.9* no dos :) (Linux)]
+Parent=Search Engines
+Browser="goliat"
+Stripper=true
+isBanned=true
+
+[Mozilla/4.0 (compatible; Arachmo)]
+Parent=Search Engines
+Browser="Arachmo"
+
+[Mozilla/4.0 (compatible; MSIE *; Windows NT; Girafabot; girafabot at girafa dot com; http://www.girafa.com)]
+Parent=Search Engines
+Browser="Girafabot"
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.00; Windows 98]
+Parent=Search Engines
+Browser="directNIC"
+Win32=true
+Stripper=true
+isBanned=true
+
+[Mozilla/4.0(?compatible; MSIE 6.0; Qihoo *)]
+Parent=Search Engines
+Browser="Qihoo"
+
+[Mozilla/4.7 (compatible; WhizBang; http://www.whizbang.com/crawler)]
+Parent=Search Engines
+Browser="Inxight Software"
+
+[Mozilla/5.0 (*) VoilaBot BETA 1.*]
+Parent=Search Engines
+Browser="VoilaBot"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; ActiveTouristBot*; http://www.activetourist.com)]
+Parent=Search Engines
+Browser="ActiveTouristBot"
+
+[Mozilla/5.0 (compatible; Charlotte/1.1; *)]
+Parent=Search Engines
+Browser="Charlotte"
+Version=1.1
+MajorVer=1
+MinorVer=1
+Beta=true
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; CXL-FatAssANT (El Robeiro); http://www.conexcol.com/FatAssANT/; ANTid:alfa; v. 0.5.1)]
+Parent=Search Engines
+Browser="Conexcol.com"
+
+[Mozilla/5.0 (compatible; EARTHCOM.info/*)]
+Parent=Search Engines
+Browser="EARTHCOM"
+
+[Mozilla/5.0 (compatible; MojeekBot/2.0; http://www.mojeek.com/bot.html)]
+Parent=Search Engines
+Browser="MojeekBot"
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/5.0 (compatible; NLCrawler/*]
+Parent=Search Engines
+Browser="Northern Light Web Search"
+
+[Mozilla/5.0 (compatible; OsO;*]
+Parent=Search Engines
+Browser="Octopodus"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; Quantcastbot/1.*)]
+Parent=Search Engines
+Browser="Quantcastbot"
+
+[Mozilla/5.0 (compatible; ScoutJet; http://www.scoutjet.com/)]
+Parent=Search Engines
+Browser="ScoutJet"
+
+[Mozilla/5.0 (compatible; Scrubby/*; http://www.scrubtheweb.com/abs/meta-check.html)]
+Parent=Search Engines
+Browser="Scrubby"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 CostaCider Search*]
+Parent=Search Engines
+Browser="CostaCider Search"
+
+[NavissoBot]
+Parent=Search Engines
+Browser="NavissoBot"
+
+[Norbert the Spider(Burf.com)]
+Parent=Search Engines
+Browser="Norbert the Spider"
+
+[NuSearch Spider*]
+Parent=Search Engines
+Browser="nuSearch"
+
+[ObjectsSearch/*]
+Parent=Search Engines
+Browser="ObjectsSearch"
+
+[OpenISearch/1.*]
+Parent=Search Engines
+Browser="OpenISearch (Amazon)"
+
+[Pagebull http://www.pagebull.com/]
+Parent=Search Engines
+Browser="Pagebull"
+
+[PEERbot*]
+Parent=Search Engines
+Browser="PEERbot"
+
+[Pompos/*]
+Parent=Search Engines
+Browser="Pompos"
+
+[Popdexter/*]
+Parent=Search Engines
+Browser="Popdex"
+
+[Qweery*]
+Parent=Search Engines
+Browser="QweeryBot"
+
+[RedCell/* (*)]
+Parent=Search Engines
+Browser="RedCell"
+
+[Scrubby/*]
+Parent=Search Engines
+Browser="Scrub The Web"
+
+[Search-10/*]
+Parent=Search Engines
+Browser="Search-10"
+
+[search.ch*]
+Parent=Search Engines
+Browser="Swiss Search Engine"
+
+[Searchmee! Spider*]
+Parent=Search Engines
+Browser="Searchmee!"
+
+[Seekbot/*]
+Parent=Search Engines
+Browser="Seekbot"
+
+[SiteSpider (http://www.SiteSpider.com/)]
+Parent=Search Engines
+Browser="SiteSpider"
+
+[Spinne/*]
+Parent=Search Engines
+Browser="Spinne"
+
+[sproose/*]
+Parent=Search Engines
+Browser="Sproose"
+
+[Sqeobot/0.*]
+Parent=Search Engines
+Browser="Branzel"
+Stripper=true
+isBanned=true
+
+[SquigglebotBot/*]
+Parent=Search Engines
+Browser="SquigglebotBot"
+Stripper=true
+isBanned=true
+
+[StackRambler/*]
+Parent=Search Engines
+Browser="StackRambler"
+
+[SygolBot*]
+Parent=Search Engines
+Browser="SygolBot"
+
+[SynoBot]
+Parent=Search Engines
+Browser="SynoBot"
+
+[Szukacz/*]
+Parent=Search Engines
+Browser="Szukacz"
+
+[Tarantula/*]
+Parent=Search Engines
+Browser="Tarantula"
+Stripper=true
+isBanned=true
+
+[TerrawizBot/*]
+Parent=Search Engines
+Browser="TerrawizBot"
+Stripper=true
+isBanned=true
+
+[Tkensaku/*]
+Parent=Search Engines
+Browser="Tkensaku"
+
+[TMCrawler]
+Parent=Search Engines
+Browser="TMCrawler"
+Stripper=true
+isBanned=true
+
+[updated/*]
+Parent=Search Engines
+Browser="Updated!"
+
+[URL Spider Pro/*]
+Parent=Search Engines
+Browser="URL Spider Pro"
+
+[URL Spider SQL*]
+Parent=Search Engines
+Browser="Innerprise Enterprise Search"
+
+[VMBot/*]
+Parent=Search Engines
+Browser="VMBot"
+
+[wadaino.jp-crawler*]
+Parent=Search Engines
+Browser="wadaino.jp"
+Stripper=true
+isBanned=true
+
+[WebAlta Crawler/*]
+Parent=Search Engines
+Browser="WebAlta Crawler"
+Stripper=true
+isBanned=true
+
+[WebCorp/*]
+Parent=Search Engines
+Browser="WebCorp"
+Stripper=true
+isBanned=true
+
+[webcrawl.net]
+Parent=Search Engines
+Browser="webcrawl.net"
+
+[WISEbot/*]
+Parent=Search Engines
+Browser="WISEbot"
+Stripper=true
+isBanned=true
+
+[Wotbox/*]
+Parent=Search Engines
+Browser="Wotbox"
+
+[www.zatka.com]
+Parent=Search Engines
+Browser="Zatka"
+
+[WWWeasel Robot v*]
+Parent=Search Engines
+Browser="World Wide Weasel"
+
+[YadowsCrawler*]
+Parent=Search Engines
+Browser="YadowsCrawler"
+
+[YodaoBot/*]
+Parent=Search Engines
+Browser="YodaoBot"
+Stripper=true
+isBanned=true
+
+[ZeBot_www.ze.bz*]
+Parent=Search Engines
+Browser="ZE.bz"
+
+[zibber-v*]
+Parent=Search Engines
+Browser="Zibb"
+
+[ZipppBot/*]
+Parent=Search Engines
+Browser="ZipppBot"
+
+[ATA-Translation-Service]
+Parent=Translators
+Browser="ATA-Translation-Service"
+
+[GJK_Browser_Check]
+Parent=Version Checkers
+Browser="GJK_Browser_Check"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Amazon.com
+
+[Amazon.com]
+Parent=DefaultProperties
+Browser="Amazon.com"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Intelix/*]
+Parent=Amazon.com
+Browser="Intelix"
+
+[Spock Crawler (http://www.spock.com/crawler)]
+Parent=Amazon.com
+Browser="Spock Crawler"
+
+[YebolBot*]
+Parent=Amazon.com
+Browser="YebolBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DYNAMIC
+
+[DYNAMIC]
+Parent=DefaultProperties
+Browser="DYNAMIC"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[DYNAMIC (*; http://www.dynamicplus.it; admin@dynamicplus.it)]
+Parent=DYNAMIC
+Browser="DYNAMIC+"
+
+[Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; DYNAMIC*)]
+Parent=DYNAMIC
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Flatland Industries
+
+[Flatland Industries]
+Parent=DefaultProperties
+Browser="Flatland Industries"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[great-plains-web-spider/flatlandbot*]
+Parent=Flatland Industries
+Browser="flatlandbot"
+
+[great-plains-web-spider/gpws]
+Parent=Flatland Industries
+Browser="flatlandbot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Hatena
+
+[Hatena]
+Parent=DefaultProperties
+Browser="Hatena"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Feed::Find/0.*]
+Parent=Hatena
+Browser="Feed::Find"
+isSyndicationReader=true
+
+[Hatena Antenna/*]
+Parent=Hatena
+Browser="Hatena Antenna"
+
+[Hatena Bookmark/*]
+Parent=Hatena
+Browser="Hatena Bookmark"
+
+[Hatena RSS/*]
+Parent=Hatena
+Browser="Hatena RSS"
+isSyndicationReader=true
+
+[HatenaScreenshot*]
+Parent=Hatena
+Browser="HatenaScreenshot"
+
+[URI::Fetch/0.*]
+Parent=Hatena
+Browser="URI::Fetch"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Hurricane Electric
+
+[Hurricane Electric]
+Parent=DefaultProperties
+Browser="Hurricane Electric"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Gigabot*]
+Parent=Hurricane Electric
+
+[GigabotSiteSearch/*]
+Parent=Hurricane Electric
+Browser="GigabotSiteSearch"
+
+[Jetbot/*]
+Parent=Hurricane Electric
+
+[Mozilla/4.04 (compatible; Dulance bot;*)]
+Parent=Hurricane Electric
+Browser="Dulance"
+
+[Mozilla/5.0 (Twiceler-*]
+Parent=Hurricane Electric
+Browser="Twiceler"
+
+[OmniExplorer_Bot/*]
+Parent=Hurricane Electric
+Browser="OmniExplorer"
+
+[plinki/0.1*]
+Parent=Hurricane Electric
+Browser="plinki"
+
+[Twiceler*]
+Parent=Hurricane Electric
+Browser="Twiceler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iaskspider
+
+[iaskspider]
+Parent=DefaultProperties
+Browser="iaskspider"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[iaskspider*]
+Parent=iaskspider
+Browser="iaskspider"
+Stripper=true
+isBanned=true
+
+[Mozilla/5.0 (compatible; iaskspider/*; MSIE 6.0)]
+Parent=iaskspider
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Internet Archive
+
+[Internet Archive]
+Parent=DefaultProperties
+Browser="Internet Archive"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*heritrix*]
+Parent=Internet Archive
+Browser="Heritrix"
+Stripper=true
+isBanned=true
+
+[ia_archiver*]
+Parent=Internet Archive
+Browser="Internet Archive"
+
+[InternetArchive/*]
+Parent=Internet Archive
+Browser="InternetArchive"
+
+[Mozilla/5.0 (compatible; archive.org_bot/1.*)]
+Parent=Internet Archive
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Marty Anstey
+
+[Marty Anstey]
+Parent=DefaultProperties
+Browser="Marty Anstey"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Helix/1.2 (?http://www.sitesearch.ca/helix/)]
+Parent=Marty Anstey
+
+[Mozilla/2.0 (compatible; DC9FE0029G; FreeBSD 5.4-RELEASE; i386; en_US)]
+Parent=Marty Anstey
+
+[Reaper/* (?http://www.sitesearch.ca/reaper)]
+Parent=Marty Anstey
+Browser="Reaper"
+
+[Vortex/2.2*]
+Parent=Marty Anstey
+Browser="Vortex"
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Microsoft_Internet_Explorer
+
+[Microsoft_Internet_Explorer]
+Parent=DefaultProperties
+Browser="Microsoft_Internet_Explorer"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Microsoft_Internet_Explorer_5.00.*]
+Parent=Microsoft_Internet_Explorer
+Stripper=true
+isBanned=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Nutch
+
+[Nutch]
+Parent=DefaultProperties
+Browser="Nutch"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*Nutch*]
+Parent=Nutch
+Stripper=true
+isBanned=true
+
+[CazoodleBot/*]
+Parent=Nutch
+Browser="CazoodleBot"
+
+[LOOQ/0.1*]
+Parent=Nutch
+Browser="LOOQ"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Webaroo
+
+[Webaroo]
+Parent=DefaultProperties
+Browser="Webaroo"
+
+[PiyushBot (Piyush Web Miner;*)]
+Parent=Webaroo
+Browser="PiyushBot"
+
+[PsBot (PsBot;*)]
+Parent=Webaroo
+Browser="PsBot"
+
+[pulseBot (pulse Web Miner)]
+Parent=Webaroo
+Browser="pulseBot"
+
+[RufusBot (Rufus Web Miner;*)]
+Parent=Webaroo
+Browser="RufusBot"
+
+[SumeetBot (Sumeet Bot; *)]
+Parent=Webaroo
+Browser="SumeetBot"
+
+[WebarooBot (Webaroo Bot;*)]
+Parent=Webaroo
+Browser="WebarooBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WebCollage
+
+[WebCollage]
+Parent=DefaultProperties
+Browser="WebCollage"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[mywebcollage/*]
+Parent=WebCollage
+
+[webcollage*/*]
+Parent=WebCollage
+Browser="WebCollage"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ad Brokers
+
+[Ad Brokers]
+Parent=DefaultProperties
+Browser="Ad Brokers"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[MicroAd/1.* (http://www.microad.jp/)]
+Parent=Ad Brokers
+Browser="MicroAd"
+
+[BlueCoat ProxySG]
+Parent=Blue Coat Systems
+Browser="BlueCoat ProxySG"
+
+[CerberianDrtrs/*]
+Parent=Blue Coat Systems
+Browser="Cerberian"
+
+[Inne: Mozilla/4.0 (compatible; Cerberian Drtrs*)]
+Parent=Blue Coat Systems
+Browser="Cerberian"
+
+[Mozilla/4.0 (compatible; Cerberian Drtrs*)]
+Parent=Blue Coat Systems
+Browser="Cerberian"
+
+[Mozilla/4.0 (compatible; MSIE 6.0; Bluecoat DRTR)]
+Parent=Blue Coat Systems
+Browser="Bluecoat"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Copyright/Plagiarism
+
+[Copyright/Plagiarism]
+Parent=DefaultProperties
+Browser="Copyright/Plagiarism"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[BDFetch]
+Parent=Copyright/Plagiarism
+Browser="BDFetch"
+
+[CopyRightCheck*]
+Parent=Copyright/Plagiarism
+Browser="CopyRightCheck"
+
+[FairAd Client*]
+Parent=Copyright/Plagiarism
+Browser="FairAd Client"
+
+[IPiumBot laurion(dot)com]
+Parent=Copyright/Plagiarism
+Browser="IPiumBot"
+
+[IWAgent/*]
+Parent=Copyright/Plagiarism
+Browser="Brand Protect"
+
+[oBot]
+Parent=Copyright/Plagiarism
+Browser="oBot"
+
+[SlySearch/*]
+Parent=Copyright/Plagiarism
+Browser="SlySearch"
+
+[TurnitinBot/*]
+Parent=Copyright/Plagiarism
+Browser="TurnitinBot"
+
+[TutorGigBot/*]
+Parent=Copyright/Plagiarism
+Browser="TutorGig"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DNS Tools
+
+[DNS Tools]
+Parent=DefaultProperties
+Browser="DNS Tools"
+Crawler=true
+
+[Domain Dossier utility*]
+Parent=DNS Tools
+Browser="Domain Dossier"
+
+[Mozilla/5.0 (compatible; DNS-Digger/*)]
+Parent=DNS Tools
+Browser="DNS-Digger"
+
+[Mozilla/5.0 (compatible; DNS-Digger/*)]
+Parent=DNS Tools
+Browser="DNS-Digger"
+
+[OpenDNS Domain Crawler noc@opendns.com]
+Parent=DNS Tools
+Browser="OpenDNS Domain Crawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Download Managers
+
+[Download Managers]
+Parent=DefaultProperties
+Browser="Download Managers"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[AutoMate5]
+Parent=Download Managers
+Browser="AutoMate5"
+
+[Beamer*]
+Parent=Download Managers
+Browser="Beamer"
+
+[BitBeamer/*]
+Parent=Download Managers
+Browser="BitBeamer"
+
+[BitTorrent/*]
+Parent=Download Managers
+Browser="BitTorrent"
+
+[DA *]
+Parent=Download Managers
+Browser="Download Accelerator"
+
+[Download Demon*]
+Parent=Download Managers
+Browser="Download Demon"
+
+[Download Express*]
+Parent=Download Managers
+Browser="Download Express"
+
+[Download Master*]
+Parent=Download Managers
+Browser="Download Master"
+
+[Download Ninja*]
+Parent=Download Managers
+Browser="Download Ninja"
+
+[Download Wonder*]
+Parent=Download Managers
+Browser="Download Wonder"
+
+[DownloadSession*]
+Parent=Download Managers
+Browser="DownloadSession"
+
+[EasyDL/*]
+Parent=Download Managers
+Browser="EasyDL"
+
+[FDM 1.x]
+Parent=Download Managers
+Browser="Free Download Manager"
+
+[FlashGet]
+Parent=Download Managers
+Browser="FlashGet"
+
+[FreshDownload/*]
+Parent=Download Managers
+Browser="FreshDownload"
+
+[GetRight/*]
+Parent=Download Managers
+Browser="GetRight"
+
+[GetRightPro/*]
+Parent=Download Managers
+Browser="GetRightPro"
+
+[GetSmart/*]
+Parent=Download Managers
+Browser="GetSmart"
+
+[Go!Zilla*]
+Parent=Download Managers
+Browser="GoZilla"
+
+[Gozilla/*]
+Parent=Download Managers
+Browser="Gozilla"
+
+[Internet Ninja*]
+Parent=Download Managers
+Browser="Internet Ninja"
+
+[Kontiki Client*]
+Parent=Download Managers
+Browser="Kontiki Client"
+
+[lftp/3.2.1]
+Parent=Download Managers
+Browser="lftp"
+
+[LightningDownload/*]
+Parent=Download Managers
+Browser="LightningDownload"
+
+[LMQueueBot/*]
+Parent=Download Managers
+Browser="LMQueueBot"
+
+[MetaProducts Download Express/*]
+Parent=Download Managers
+Browser="Download Express"
+
+[Mozilla/4.0 (compatible; Getleft*)]
+Parent=Download Managers
+Browser="Getleft"
+
+[Myzilla]
+Parent=Download Managers
+Browser="Myzilla"
+
+[Net Vampire/*]
+Parent=Download Managers
+Browser="Net Vampire"
+
+[Net_Vampire*]
+Parent=Download Managers
+Browser="Net_Vampire"
+
+[NetAnts*]
+Parent=Download Managers
+Browser="NetAnts"
+
+[NetPumper*]
+Parent=Download Managers
+Browser="NetPumper"
+
+[NetSucker*]
+Parent=Download Managers
+Browser="NetSucker"
+
+[NetZip Downloader*]
+Parent=Download Managers
+Browser="NetZip Downloader"
+
+[NexTools WebAgent*]
+Parent=Download Managers
+Browser="NexTools WebAgent"
+
+[Offline Downloader*]
+Parent=Download Managers
+Browser="Offline Downloader"
+
+[P3P Client]
+Parent=Download Managers
+Browser="P3P Client"
+
+[PageDown*]
+Parent=Download Managers
+Browser="PageDown"
+
+[PicaLoader*]
+Parent=Download Managers
+Browser="PicaLoader"
+
+[Prozilla*]
+Parent=Download Managers
+Browser="Prozilla"
+
+[RealDownload/*]
+Parent=Download Managers
+Browser="RealDownload"
+
+[sEasyDL/*]
+Parent=Download Managers
+Browser="EasyDL"
+
+[shareaza*]
+Parent=Download Managers
+Browser="shareaza"
+
+[SmartDownload/*]
+Parent=Download Managers
+Browser="SmartDownload"
+
+[SpeedDownload/*]
+Parent=Download Managers
+Browser="Speed Download"
+
+[Star*Downloader/*]
+Parent=Download Managers
+Browser="StarDownloader"
+
+[STEROID Download]
+Parent=Download Managers
+Browser="STEROID Download"
+
+[SuperBot/*]
+Parent=Download Managers
+Browser="SuperBot"
+
+[Vegas95/*]
+Parent=Download Managers
+Browser="Vegas95"
+
+[WebZIP*]
+Parent=Download Managers
+Browser="WebZIP"
+
+[Wget*]
+Parent=Download Managers
+Browser="Wget"
+
+[WinTools]
+Parent=Download Managers
+Browser="WinTools"
+
+[Xaldon WebSpider*]
+Parent=Download Managers
+Browser="Xaldon WebSpider"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; E-Mail Harvesters
+
+[E-Mail Harvesters]
+Parent=DefaultProperties
+Browser="E-Mail Harvesters"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*E-Mail Address Extractor*]
+Parent=E-Mail Harvesters
+Browser="E-Mail Address Extractor"
+
+[*Larbin*]
+Parent=E-Mail Harvesters
+Browser="Larbin"
+
+[*www4mail/*]
+Parent=E-Mail Harvesters
+Browser="www4mail"
+
+[8484 Boston Project*]
+Parent=E-Mail Harvesters
+Browser="8484 Boston Project"
+
+[CherryPicker*/*]
+Parent=E-Mail Harvesters
+Browser="CherryPickerElite"
+
+[Chilkat/*]
+Parent=E-Mail Harvesters
+Browser="Chilkat"
+
+[ContactBot/*]
+Parent=E-Mail Harvesters
+Browser="ContactBot"
+
+[eCatch*]
+Parent=E-Mail Harvesters
+Browser="eCatch"
+
+[EmailCollector*]
+Parent=E-Mail Harvesters
+Browser="E-Mail Collector"
+
+[EMAILsearcher]
+Parent=E-Mail Harvesters
+Browser="EMAILsearcher"
+
+[EmailSiphon*]
+Parent=E-Mail Harvesters
+Browser="E-Mail Siphon"
+
+[EmailWolf*]
+Parent=E-Mail Harvesters
+Browser="EMailWolf"
+
+[Epsilon SoftWorks' MailMunky]
+Parent=E-Mail Harvesters
+Browser="MailMunky"
+
+[EVE-minibrowser/*]
+Parent=E-Mail Harvesters
+Browser="EVE-minibrowser"
+
+[ExtractorPro*]
+Parent=E-Mail Harvesters
+Browser="ExtractorPro"
+
+[Franklin Locator*]
+Parent=E-Mail Harvesters
+Browser="Franklin Locator"
+
+[Missigua Locator*]
+Parent=E-Mail Harvesters
+Browser="Missigua Locator"
+
+[Mozilla/4.0 (compatible; Advanced Email Extractor*)]
+Parent=E-Mail Harvesters
+Browser="Advanced Email Extractor"
+
+[Netprospector*]
+Parent=E-Mail Harvesters
+Browser="Netprospector"
+
+[ProWebWalker*]
+Parent=E-Mail Harvesters
+Browser="ProWebWalker"
+
+[sna-0.0.*]
+Parent=E-Mail Harvesters
+Browser="Mike Elliott's E-Mail Harvester"
+
+[WebEnhancer*]
+Parent=E-Mail Harvesters
+Browser="WebEnhancer"
+
+[WebMiner*]
+Parent=E-Mail Harvesters
+Browser="WebMiner"
+
+[ZIBB Crawler (email address / WWW address)]
+Parent=E-Mail Harvesters
+Browser="ZIBB Crawler"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Feeds Blogs
+
+[Feeds Blogs]
+Parent=DefaultProperties
+Browser="Feeds Blogs"
+isSyndicationReader=true
+Crawler=true
+
+[Bloglines Title Fetch/*]
+Parent=Feeds Blogs
+Browser="Bloglines Title Fetch"
+
+[Bloglines/* (http://www.bloglines.com*)]
+Parent=Feeds Blogs
+Browser="BlogLines Web"
+
+[BlogPulseLive (support@blogpulse.com)]
+Parent=Feeds Blogs
+Browser="BlogPulseLive"
+
+[blogsearchbot-pumpkin-2]
+Parent=Feeds Blogs
+Browser="blogsearchbot-pumpkin"
+isSyndicationReader=false
+
+[Irish Blogs Aggregator/*1.0*]
+Parent=Feeds Blogs
+Browser="Irish Blogs Aggregator"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[kinjabot (http://www.kinja.com; *)]
+Parent=Feeds Blogs
+Browser="kinjabot"
+
+[Net::Trackback/*]
+Parent=Feeds Blogs
+Browser="Net::Trackback"
+
+[Reblog*]
+Parent=Feeds Blogs
+Browser="Reblog"
+
+[WordPress/*]
+Parent=Feeds Blogs
+Browser="WordPress"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Feeds Syndicators
+
+[Feeds Syndicators]
+Parent=DefaultProperties
+Browser="Feeds Syndicators"
+isSyndicationReader=true
+
+[*LinkLint*]
+Parent=Feeds Syndicators
+Browser="LinkLint"
+
+[*NetNewsWire/*]
+Parent=Feeds Syndicators
+
+[*NetVisualize*]
+Parent=Feeds Syndicators
+Browser="NetVisualize"
+
+[Akregator/*]
+Parent=Feeds Syndicators
+Browser="Akregator"
+
+[AppleSyndication/*]
+Parent=Feeds Syndicators
+Browser="Safari RSS"
+Platform=MacOSX
+
+[Cocoal.icio.us/* (*)*]
+Parent=Feeds Syndicators
+Browser="Cocoal.icio.us"
+Stripper=true
+isBanned=true
+
+[Feed43 Proxy/* (*)]
+Parent=Feeds Syndicators
+Browser="Feed For Free"
+
+[FeedBurner/*]
+Parent=Feeds Syndicators
+Browser="FeedBurner"
+
+[FeedDemon/* (*)]
+Parent=Feeds Syndicators
+Browser="FeedDemon"
+Platform=Win32
+
+[FeedDigest/* (*)]
+Parent=Feeds Syndicators
+Browser="FeedDigest"
+
+[FeedOnFeeds/0.1.* ( http://minutillo.com/steve/feedonfeeds/)]
+Parent=Feeds Syndicators
+Browser="FeedOnFeeds"
+Version=0.1
+MajorVer=0
+MinorVer=1
+
+[Feedreader * (Powered by Newsbrain)]
+Parent=Feeds Syndicators
+Browser="Newsbrain"
+
+[Feedshow/* (*)]
+Parent=Feeds Syndicators
+Browser="Feedshow"
+
+[Feedster Crawler/?.0; Feedster, Inc.]
+Parent=Feeds Syndicators
+Browser="Feedster"
+
+[GreatNews/1.0]
+Parent=Feeds Syndicators
+Browser="GreatNews"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Gregarius/*]
+Parent=Feeds Syndicators
+Browser="Gregarius"
+
+[intraVnews/*]
+Parent=Feeds Syndicators
+Browser="intraVnews"
+
+[JetBrains Omea Reader*]
+Parent=Feeds Syndicators
+Browser="Omea Reader"
+Stripper=true
+isBanned=true
+
+[livedoor FeedFetcher/0.0* (http://reader.livedoor.com/;*)]
+Parent=Feeds Syndicators
+Browser="FeedFetcher"
+Version=0.0
+MajorVer=0
+MinorVer=0
+
+[MagpieRSS/* (*)]
+Parent=Feeds Syndicators
+Browser="MagpieRSS"
+
+[Mobitype * (compatible; Mozilla/*; MSIE *.*; Windows *)]
+Parent=Feeds Syndicators
+Browser="Mobitype"
+Platform=Win32
+
+[Mozilla/5.0 (*; Rojo *; http://www.rojo.com/corporate/help/agg; *)*]
+Parent=Feeds Syndicators
+Browser="Rojo"
+
+[Mozilla/5.0 (*aggregator:TailRank; http://tailrank.com/robot)*]
+Parent=Feeds Syndicators
+Browser="TailRank"
+
+[Mozilla/5.0 (compatible; MSIE 6.0; Podtech Network; crawler_admin@podtech.net)]
+Parent=Feeds Syndicators
+Browser="Podtech Network"
+
+[Mozilla/5.0 (compatible; Newz Crawler *; http://www.newzcrawler.com/?)]
+Parent=Feeds Syndicators
+Browser="Newz Crawler"
+
+[Mozilla/5.0 (compatible;*newstin.com;*)]
+Parent=Feeds Syndicators
+Browser="NewsTin"
+
+[Mozilla/5.0 (RSS Reader Panel)]
+Parent=Feeds Syndicators
+Browser="RSS Reader Panel"
+
+[Mozilla/5.0 (X11; U; Linux*; *; rv:1.*; aggregator:FeedParser; *) Gecko/*]
+Parent=Feeds Syndicators
+Browser="FeedParser"
+
+[Mozilla/5.0 (X11; U; Linux*; *; rv:1.*; aggregator:NewsMonster; *) Gecko/*]
+Parent=Feeds Syndicators
+Browser="NewsMonster"
+
+[Mozilla/5.0 (X11; U; Linux*; *; rv:1.*; aggregator:Rojo; *) Gecko/*]
+Parent=Feeds Syndicators
+Browser="Rojo"
+
+[Mozilla/6.0 (MSIE 6.0; *RSSMicro.com RSS/Atom Feed Robot)]
+Parent=Feeds Syndicators
+Browser="RSS Micro"
+
+[Netvibes (*)]
+Parent=Feeds Syndicators
+Browser="Netvibes"
+
+[NewsAlloy/* (*)]
+Parent=Feeds Syndicators
+Browser="NewsAlloy"
+
+[Omnipelagos*]
+Parent=Feeds Syndicators
+Browser="Omnipelagos"
+
+[Particls]
+Parent=Feeds Syndicators
+Browser="Particls"
+
+[Protopage/* (*)]
+Parent=Feeds Syndicators
+Browser="Protopage"
+
+[PubSub-RSS-Reader/* (*)]
+Parent=Feeds Syndicators
+Browser="PubSub-RSS-Reader"
+
+[RSS Menu/*]
+Parent=Feeds Syndicators
+Browser="RSS Menu"
+
+[RssBandit/*]
+Parent=Feeds Syndicators
+Browser="RssBandit"
+
+[RssBar/1.2*]
+Parent=Feeds Syndicators
+Browser="RssBar"
+Version=1.2
+MajorVer=1
+MinorVer=2
+
+[SharpReader/*]
+Parent=Feeds Syndicators
+Browser="SharpReader"
+
+[SimplePie/*]
+Parent=Feeds Syndicators
+Browser="SimplePie"
+
+[Strategic Board Bot (?http://www.strategicboard.com)]
+Parent=Feeds Syndicators
+Browser="Strategic Board Bot"
+Stripper=true
+isBanned=true
+
+[TargetYourNews.com bot]
+Parent=Feeds Syndicators
+Browser="TargetYourNews"
+
+[Technoratibot/*]
+Parent=Feeds Syndicators
+Browser="Technoratibot"
+
+[Windows-RSS-Platform/1.0*]
+Parent=Feeds Syndicators
+Browser="Windows-RSS-Platform"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Win32=true
+
+[Wizz RSS News Reader]
+Parent=Feeds Syndicators
+Browser="Wizz"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; General RSS
+
+[General RSS]
+Parent=DefaultProperties
+Browser="General RSS"
+isSyndicationReader=true
+
+[AideRSS/1.0 (aiderss.com); * subscribers]
+Parent=General RSS
+Browser="AideRSS"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[CC Metadata Scaper http://wiki.creativecommons.org/Metadata_Scraper]
+Parent=General RSS
+Browser="CC Metadata Scaper"
+
+[Mozilla/5.0 (compatible) GM RSS Panel]
+Parent=General RSS
+Browser="RSS Panel"
+
+[Mozilla/5.0 http://www.inclue.com; graeme@inclue.com]
+Parent=General RSS
+Browser="Inclue"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Validation Checkers
+
+[HTML Validators]
+Parent=DefaultProperties
+Browser="HTML Validators"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[(HTML Validator http://www.searchengineworld.com/validator/)]
+Parent=HTML Validators
+Browser="Search Engine World HTML Validator"
+
+[FeedValidator/1.3]
+Parent=HTML Validators
+Browser="FeedValidator"
+Version=1.3
+MajorVer=1
+MinorVer=3
+
+[Jigsaw/* W3C_CSS_Validator_JFouffa/*]
+Parent=HTML Validators
+Browser="Jigsaw CSS Validator"
+
+[Search Engine World Robots.txt Validator*]
+Parent=HTML Validators
+Browser="Search Engine World Robots.txt Validator"
+
+[W3C_Validator/*]
+Parent=HTML Validators
+Browser="W3C Validator"
+
+[W3CLineMode/*]
+Parent=HTML Validators
+Browser="W3C Line Mode"
+
+[Weblide/2.0 beta8*]
+Parent=HTML Validators
+Browser="Weblide"
+Version=2.0
+MajorVer=2
+MinorVer=0
+Beta=true
+
+[WebmasterWorld StickyMail Server Header Checker*]
+Parent=HTML Validators
+Browser="WebmasterWorld Server Header Checker"
+
+[WWWC/*]
+Parent=HTML Validators
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Image Crawlers
+
+[Image Crawlers]
+Parent=DefaultProperties
+Browser="Image Crawlers"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*PhotoStickies/*]
+Parent=Image Crawlers
+Browser="PhotoStickies"
+
+[Camcrawler*]
+Parent=Image Crawlers
+Browser="Camcrawler"
+
+[Der gro\xdfe BilderSauger*]
+Parent=Image Crawlers
+Browser="Gallery Grabber"
+
+[Extreme Picture Finder]
+Parent=Image Crawlers
+Browser="Extreme Picture Finder"
+
+[FLATARTS_FAVICO]
+Parent=Image Crawlers
+Browser="FlatArts Favorites Icon Tool"
+
+[HTML2JPG Blackbox, http://www.html2jpg.com]
+Parent=Image Crawlers
+Browser="HTML2JPG"
+
+[IconSurf/2.*]
+Parent=Image Crawlers
+Browser="IconSurf"
+
+[Mister PIX*]
+Parent=Image Crawlers
+Browser="Mister PIX"
+
+[Mozilla/5.0 (Macintosh; U; *Mac OS X; *) AppleWebKit/* (*) Pandora/2.*]
+Parent=Image Crawlers
+Browser="Pandora"
+
+[naoFavicon4IE*]
+Parent=Image Crawlers
+Browser="naoFavicon4IE"
+
+[pixfinder/*]
+Parent=Image Crawlers
+Browser="pixfinder"
+
+[rssImagesBot/0.1 (*http://herbert.groot.jebbink.nl/?app=rssImages)]
+Parent=Image Crawlers
+Browser="rssImagesBot"
+
+[Web Image Collector*]
+Parent=Image Crawlers
+Browser="Web Image Collector"
+
+[WebImages * (?http://herbert.groot.jebbink.nl/?app=WebImages?)]
+Parent=Image Crawlers
+Browser="WebImages"
+
+[WebPix*]
+Parent=Image Crawlers
+Browser="Custo"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Link Checkers
+
+[Link Checkers]
+Parent=DefaultProperties
+Browser="Link Checkers"
+Frames=true
+IFrames=true
+Tables=true
+Crawler=true
+
+[!Susie (http://www.sync2it.com/susie)]
+Parent=Link Checkers
+Browser="!Susie"
+
+[*AgentName/*]
+Parent=Link Checkers
+Browser="AgentName"
+
+[*Linkman*]
+Parent=Link Checkers
+Browser="Linkman"
+
+[*LinksManager.com*]
+Parent=Link Checkers
+Browser="LinksManager"
+
+[*Powermarks/*]
+Parent=Link Checkers
+Browser="Powermarks"
+
+[*W3C-checklink/*]
+Parent=Link Checkers
+Browser="W3C Link Checker"
+
+[*Web Link Validator*]
+Parent=Link Checkers
+Browser="Web Link Validator"
+
+[*Zeus*]
+Parent=Link Checkers
+Browser="Zeus"
+Stripper=true
+isBanned=true
+
+[ActiveBookmark *]
+Parent=Link Checkers
+Browser="ActiveBookmark"
+
+[Bookdog/*]
+Parent=Link Checkers
+Browser="Bookdog"
+
+[Bookmark Buddy*]
+Parent=Link Checkers
+Browser="Bookmark Buddy"
+
+[Bookmark Renewal Check Agent*]
+Parent=Link Checkers
+Browser="Bookmark Renewal Check Agent"
+
+[Bookmark search tool*]
+Parent=Link Checkers
+Browser="Bookmark search tool"
+
+[Bookmark-Manager]
+Parent=Link Checkers
+Browser="Bookmark-Manager"
+
+[Checkbot*]
+Parent=Link Checkers
+Browser="Checkbot"
+
+[CheckLinks/*]
+Parent=Link Checkers
+Browser="CheckLinks"
+
+[CyberSpyder Link Test/*]
+Parent=Link Checkers
+Browser="CyberSpyder Link Test"
+
+[DLC/*]
+Parent=Link Checkers
+Browser="DLC"
+
+[DocWeb Link Crawler (http://doc.php.net)]
+Parent=Link Checkers
+Browser="DocWeb Link Crawler"
+
+[FavOrg]
+Parent=Link Checkers
+Browser="FavOrg"
+
+[Favorites Sweeper v.3.*]
+Parent=Link Checkers
+Browser="Favorites Sweeper"
+
+[FindLinks/*]
+Parent=Link Checkers
+Browser="FindLinks"
+
+[Funnel Web Profiler*]
+Parent=Link Checkers
+Browser="Funnel Web Profiler"
+
+[Html Link Validator (www.lithopssoft.com)]
+Parent=Link Checkers
+Browser="HTML Link Validator"
+
+[IECheck]
+Parent=Link Checkers
+Browser="IECheck"
+
+[JCheckLinks/*]
+Parent=Link Checkers
+Browser="JCheckLinks"
+
+[JRTwine Software Check Favorites Utility]
+Parent=Link Checkers
+Browser="JRTwine"
+
+[Link Valet Online*]
+Parent=Link Checkers
+Browser="Link Valet"
+Stripper=true
+isBanned=true
+
+[LinkAlarm/*]
+Parent=Link Checkers
+Browser="LinkAlarm"
+
+[Linkbot*]
+Parent=Link Checkers
+Browser="Linkbot"
+
+[LinkChecker/*]
+Parent=Link Checkers
+Browser="LinkChecker"
+
+[LinkextractorPro*]
+Parent=Link Checkers
+Browser="LinkextractorPro"
+Stripper=true
+isBanned=true
+
+[LinkLint-checkonly/*]
+Parent=Link Checkers
+Browser="LinkLint"
+
+[LinkScan/*]
+Parent=Link Checkers
+Browser="LinkScan"
+
+[LinkSweeper/*]
+Parent=Link Checkers
+Browser="LinkSweeper"
+
+[LinkWalker*]
+Parent=Link Checkers
+Browser="LinkWalker"
+
+[MetaGer-LinkChecker]
+Parent=Link Checkers
+Browser="MetaGer-LinkChecker"
+
+[Mozilla/* (compatible; linktiger/*; *http://www.linktiger.com*)]
+Parent=Link Checkers
+Browser="LinkTiger"
+Stripper=true
+isBanned=true
+
+[Mozilla/4.0 (Compatible); URLBase*]
+Parent=Link Checkers
+Browser="URLBase"
+
+[Mozilla/4.0 (compatible; Link Utility; http://net-promoter.com)]
+Parent=Link Checkers
+Browser="NetPromoter Link Utility"
+
+[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Web Link Validator*]
+Parent=Link Checkers
+Browser="Web Link Validator"
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 7.0; Win32) Link Commander 3.0]
+Parent=Link Checkers
+Browser="Link Commander"
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=Win32
+
+[Mozilla/4.0 (compatible; smartBot/1.*; checking links; *)]
+Parent=Link Checkers
+Browser="smartBot"
+
+[Mozilla/4.0 (compatible; SuperCleaner*;*)]
+Parent=Link Checkers
+Browser="SuperCleaner"
+
+[Mozilla/5.0 gURLChecker/*]
+Parent=Link Checkers
+Browser="gURLChecker"
+Stripper=true
+isBanned=true
+
+[Newsgroupreporter LinkCheck]
+Parent=Link Checkers
+Browser="Newsgroupreporter LinkCheck"
+
+[onCHECK Linkchecker von www.scientec.de fuer www.onsinn.de]
+Parent=Link Checkers
+Browser="onCHECK Linkchecker"
+
+[online link validator (http://www.dead-links.com/)]
+Parent=Link Checkers
+Browser="Dead-Links.com"
+Stripper=true
+isBanned=true
+
+[REL Link Checker*]
+Parent=Link Checkers
+Browser="REL Link Checker"
+
+[RLinkCheker*]
+Parent=Link Checkers
+Browser="RLinkCheker"
+
+[Robozilla/*]
+Parent=Link Checkers
+Browser="Robozilla"
+
+[RPT-HTTPClient/*]
+Parent=Link Checkers
+Browser="RPT-HTTPClient"
+Stripper=true
+isBanned=true
+
+[SafariBookmarkChecker*(?http://www.coriolis.ch/)]
+Parent=Link Checkers
+Browser="SafariBookmarkChecker"
+Platform=MacOSX
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Simpy/* (Simpy; http://www.simpy.com/?ref=bot; feedback at simpy dot com)]
+Parent=Link Checkers
+Browser="Simpy"
+
+[SiteBar/*]
+Parent=Link Checkers
+Browser="SiteBar"
+
+[Susie (http://www.sync2it.com/bms/susie.php]
+Parent=Link Checkers
+Browser="Susie"
+
+[URLBase/6.*]
+Parent=Link Checkers
+
+[VSE/*]
+Parent=Link Checkers
+Browser="VSE Link Tester"
+
+[WebTrends Link Analyzer]
+Parent=Link Checkers
+Browser="WebTrends Link Analyzer"
+
+[WorQmada/*]
+Parent=Link Checkers
+Browser="WorQmada"
+
+[Xenu* Link Sleuth*]
+Parent=Link Checkers
+Browser="Xenu's Link Sleuth"
+Stripper=true
+isBanned=true
+
+[Z-Add Link Checker*]
+Parent=Link Checkers
+Browser="Z-Add Link Checker"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Microsoft
+
+[Microsoft]
+Parent=DefaultProperties
+Browser="Microsoft"
+Stripper=true
+isBanned=true
+
+[Live (http://www.live.com/)]
+Parent=Microsoft
+Browser="Microsoft Live"
+Stripper=false
+isBanned=false
+isSyndicationReader=true
+
+[MFC Foundation Class Library*]
+Parent=Microsoft
+Browser="MFC Foundation Class Library"
+
+[MFHttpScan]
+Parent=Microsoft
+Browser="MFHttpScan"
+
+[Microsoft BITS/*]
+Parent=Microsoft
+Browser="BITS"
+
+[Microsoft Data Access Internet Publishing Provider Cache Manager]
+Parent=Microsoft
+Browser="MS IPP"
+
+[Microsoft Data Access Internet Publishing Provider DAV*]
+Parent=Microsoft
+Browser="MS IPP DAV"
+
+[Microsoft Data Access Internet Publishing Provider Protocol Discovery]
+Parent=Microsoft
+Browser="MS IPPPD"
+
+[Microsoft Internet Explorer]
+Parent=Microsoft
+Browser="Fake IE"
+
+[Microsoft Office Existence Discovery]
+Parent=Microsoft
+Browser="Microsoft Office Existence Discovery"
+
+[Microsoft Office Protocol Discovery]
+Parent=Microsoft
+Browser="MS OPD"
+
+[Microsoft Office/* (*Picture Manager*)]
+Parent=Microsoft
+Browser="Microsoft Office Picture Manager"
+
+[Microsoft URL Control*]
+Parent=Microsoft
+Browser="Microsoft URL Control"
+
+[Microsoft Visio MSIE]
+Parent=Microsoft
+Browser="Microsoft Visio"
+
+[Microsoft-WebDAV-MiniRedir/*]
+Parent=Microsoft
+Browser="Microsoft-WebDAV"
+
+[MSN Feed Manager]
+Parent=Microsoft
+Browser="MSN Feed Manager"
+Stripper=false
+isBanned=false
+isSyndicationReader=true
+
+[MSProxy/*]
+Parent=Microsoft
+Browser="MS Proxy"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Miscellaneous Browsers
+
+[Miscellaneous Browsers]
+Parent=DefaultProperties
+Browser="Miscellaneous Browsers"
+Frames=true
+Tables=true
+Cookies=true
+
+[*Amiga*]
+Parent=Miscellaneous Browsers
+Browser="Amiga"
+Platform=Amiga
+
+[*avantbrowser*]
+Parent=Miscellaneous Browsers
+Browser="Avant Browser"
+
+[Ace Explorer]
+Parent=Miscellaneous Browsers
+Browser="Ace Explorer"
+
+[Enigma Browser*]
+Parent=Miscellaneous Browsers
+Browser="Enigma Browser"
+
+[Godzilla/* (Basic*; *; Commodore C=64; *; rv:1.*)*]
+Parent=Miscellaneous Browsers
+Browser="Godzilla"
+
+[GreenBrowser]
+Parent=Miscellaneous Browsers
+Browser="GreenBrowser"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Kopiczek/* (WyderOS*; *)]
+Parent=Miscellaneous Browsers
+Browser="Kopiczek"
+Platform=WyderOS
+IFrames=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (*) - BrowseX (*)]
+Parent=Miscellaneous Browsers
+Browser="BrowseX"
+
+[Mozilla/* (Win32;*Escape?*; ?)]
+Parent=Miscellaneous Browsers
+Browser="Escape"
+Platform=Win32
+
+[Mozilla/4.0 (compatible; ibisBrowser)]
+Parent=Miscellaneous Browsers
+Browser="ibisBrowser"
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) AppleWebKit/* (*) HistoryHound/*]
+Parent=Miscellaneous Browsers
+Browser="HistoryHound"
+
+[Mozilla/5.0 (X11; ?; Linux; *E) AppleWebKit/* (KHTML, like Gecko, Safari/*) Arora/0.4]
+Parent=Miscellaneous Browsers
+Browser="Arora"
+Version=0.4
+MajorVer=0
+MinorVer=4
+Platform=Linux
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[NetRecorder*]
+Parent=Miscellaneous Browsers
+Browser="NetRecorder"
+
+[NetSurfer*]
+Parent=Miscellaneous Browsers
+Browser="NetSurfer"
+
+[ogeb browser , Version 1.1.0]
+Parent=Miscellaneous Browsers
+Browser="ogeb browser"
+Version=1.1
+MajorVer=1
+MinorVer=1
+
+[SCEJ PSP BROWSER 0102pspNavigator]
+Parent=Miscellaneous Browsers
+Browser="Wipeout Pure"
+
+[Sleipnir*]
+Parent=Miscellaneous Browsers
+Browser="Sleipnir"
+
+[SlimBrowser]
+Parent=Miscellaneous Browsers
+Browser="SlimBrowser"
+
+[WWW_Browser/*]
+Parent=Miscellaneous Browsers
+Browser="WWW Browser"
+Version=1.69
+MajorVer=1
+MinorVer=69
+Platform=Win16
+CSS=3
+CssVersion=3
+supportsCSS=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Offline Browsers
+
+[Offline Browsers]
+Parent=DefaultProperties
+Browser="Offline Browsers"
+Frames=true
+Tables=true
+Cookies=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*Check&Get*]
+Parent=Offline Browsers
+Browser="Check&Get"
+
+[*HTTrack*]
+Parent=Offline Browsers
+Browser="HTTrack"
+
+[*MSIECrawler*]
+Parent=Offline Browsers
+Browser="IE Offline Browser"
+
+[*TweakMASTER*]
+Parent=Offline Browsers
+Browser="TweakMASTER"
+
+[BackStreet Browser *]
+Parent=Offline Browsers
+Browser="BackStreet Browser"
+
+[Go-Ahead-Got-It*]
+Parent=Offline Browsers
+Browser="Go Ahead Got-It"
+
+[iGetter/*]
+Parent=Offline Browsers
+Browser="iGetter"
+
+[Teleport*]
+Parent=Offline Browsers
+Browser="Teleport"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Online Scanners
+
+[Online Scanners]
+Parent=DefaultProperties
+Browser="Online Scanners"
+Stripper=true
+isBanned=true
+
+[Morfeus Fucking Scanner]
+Parent=Online Scanners
+Browser="Morfeus Fucking Scanner"
+
+[Mozilla/4.0 (compatible; Trend Micro tmdr 1.*]
+Parent=Online Scanners
+Browser="Trend Micro"
+
+[Titanium 2005 (4.02.01)]
+Parent=Online Scanners
+Browser="Panda Antivirus Titanium"
+
+[virus_detector*]
+Parent=Online Scanners
+Browser="Secure Computing Corporation"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Proxy Servers
+
+[Proxy Servers]
+Parent=DefaultProperties
+Browser="Proxy Servers"
+Stripper=true
+isBanned=true
+
+[*squid*]
+Parent=Proxy Servers
+Browser="Squid"
+
+[Anonymisiert*]
+Parent=Proxy Servers
+Browser="Anonymizied"
+
+[Anonymizer/*]
+Parent=Proxy Servers
+Browser="Anonymizer"
+
+[Anonymizied*]
+Parent=Proxy Servers
+Browser="Anonymizied"
+
+[Anonymous*]
+Parent=Proxy Servers
+Browser="Anonymous"
+
+[Anonymous/*]
+Parent=Proxy Servers
+Browser="Anonymous"
+
+[CE-Preload]
+Parent=Proxy Servers
+Browser="CE-Preload"
+
+[http://Anonymouse.org/*]
+Parent=Proxy Servers
+Browser="Anonymouse"
+
+[IE/6.01 (CP/M; 8-bit*)]
+Parent=Proxy Servers
+Browser="Squid"
+
+[Mozilla/* (TuringOS; Turing Machine; 0.0)]
+Parent=Proxy Servers
+Browser="Anonymizer"
+
+[Mozilla/4.0 (compatible; MSIE ?.0; SaferSurf*)]
+Parent=Proxy Servers
+Browser="SaferSurf"
+
+[Mozilla/5.0 (compatible; del.icio.us-thumbnails/*; *) KHTML/* (like Gecko)]
+Parent=Proxy Servers
+Browser="Yahoo!"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Nutscrape]
+Parent=Proxy Servers
+Browser="Squid"
+
+[Nutscrape/* (CP/M; 8-bit*)]
+Parent=Proxy Servers
+Browser="Squid"
+
+[Privoxy/*]
+Parent=Proxy Servers
+Browser="Privoxy"
+
+[ProxyTester*]
+Parent=Proxy Servers
+Browser="ProxyTester"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[SilentSurf*]
+Parent=Proxy Servers
+Browser="SilentSurf"
+
+[Space*Bison/*]
+Parent=Proxy Servers
+Browser="Proxomitron"
+
+[Sqworm/*]
+Parent=Proxy Servers
+Browser="Websense"
+
+[SurfControl]
+Parent=Proxy Servers
+Browser="SurfControl"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Research Projects
+
+[Research Projects]
+Parent=DefaultProperties
+Browser="Research Projects"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*research*]
+Parent=Research Projects
+
+[AcadiaUniversityWebCensusClient]
+Parent=Research Projects
+Browser="AcadiaUniversityWebCensusClient"
+
+[Amico Alpha * (*) Gecko/* AmicoAlpha/*]
+Parent=Research Projects
+Browser="Amico Alpha"
+
+[annotate_google; http://ponderer.org/*]
+Parent=Research Projects
+Browser="Annotate Google"
+
+[CMS crawler (?http://buytaert.net/crawler/)]
+Parent=Research Projects
+
+[e-SocietyRobot(http://www.yama.info.waseda.ac.jp/~yamana/es/)]
+Parent=Research Projects
+Browser="e-SocietyRobot"
+
+[Forschungsportal/*]
+Parent=Research Projects
+Browser="Forschungsportal"
+
+[Gulper Web *]
+Parent=Research Projects
+Browser="Gulper Web Bot"
+
+[HooWWWer/*]
+Parent=Research Projects
+Browser="HooWWWer"
+
+[http://buytaert.net/crawler]
+Parent=Research Projects
+
+[inetbot/* (?http://www.inetbot.com/bot.html)]
+Parent=Research Projects
+Browser="inetbot"
+
+[IRLbot/*]
+Parent=Research Projects
+Browser="IRLbot"
+
+[Lachesis]
+Parent=Research Projects
+Browser="Lachesis"
+
+[Mozilla/5.0 (compatible; nextthing.org/*)]
+Parent=Research Projects
+Browser="nextthing.org"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Mozilla/5.0 (compatible; Theophrastus/*)]
+Parent=Research Projects
+Browser="Theophrastus"
+
+[Mozilla/5.0 (compatible; Webscan v0.*; http://otc.dyndns.org/webscan/)]
+Parent=Research Projects
+Browser="Webscan"
+
+[MQbot*]
+Parent=Research Projects
+Browser="MQbot"
+
+[OutfoxBot/*]
+Parent=Research Projects
+Browser="OutfoxBot"
+
+[polybot?*]
+Parent=Research Projects
+Browser="Polybot"
+
+[Shim?Crawler*]
+Parent=Research Projects
+Browser="Shim Crawler"
+
+[Steeler/*]
+Parent=Research Projects
+Browser="Steeler"
+
+[Taiga web spider]
+Parent=Research Projects
+Browser="Taiga"
+
+[Theme Spider*]
+Parent=Research Projects
+Browser="Theme Spider"
+
+[UofTDB_experiment* (leehyun@cs.toronto.edu)]
+Parent=Research Projects
+Browser="UofTDB Experiment"
+
+[USyd-NLP-Spider*]
+Parent=Research Projects
+Browser="USyd-NLP-Spider"
+
+[woriobot*]
+Parent=Research Projects
+Browser="woriobot"
+
+[wwwster/* (Beta, mailto:gue@cis.uni-muenchen.de)]
+Parent=Research Projects
+Browser="wwwster"
+Beta=true
+
+[Zao-Crawler]
+Parent=Research Projects
+Browser="Zao-Crawler"
+
+[Zao/*]
+Parent=Research Projects
+Browser="Zao"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Rippers
+
+[Rippers]
+Parent=DefaultProperties
+Browser="Rippers"
+Frames=true
+IFrames=true
+Tables=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*grub-client*]
+Parent=Rippers
+Browser="grub-client"
+
+[*ickHTTP*]
+Parent=Rippers
+Browser="IP*Works"
+
+[*java*]
+Parent=Rippers
+
+[*libwww-perl*]
+Parent=Rippers
+Browser="libwww-perl"
+
+[*WebGrabber*]
+Parent=Rippers
+
+[*WinHttpRequest*]
+Parent=Rippers
+Browser="WinHttp"
+
+[3D-FTP/*]
+Parent=Rippers
+Browser="3D-FTP"
+
+[3wGet/*]
+Parent=Rippers
+Browser="3wGet"
+
+[ActiveRefresh*]
+Parent=Rippers
+Browser="ActiveRefresh"
+
+[Artera (Version *)]
+Parent=Rippers
+Browser="Artera"
+
+[AutoHotkey]
+Parent=Rippers
+Browser="AutoHotkey"
+
+[b2w/*]
+Parent=Rippers
+Browser="b2w"
+
+[BasicHTTP/*]
+Parent=Rippers
+Browser="BasicHTTP"
+
+[BlockNote.Net]
+Parent=Rippers
+Browser="BlockNote.Net"
+
+[CAST]
+Parent=Rippers
+Browser="CAST"
+
+[CFNetwork/*]
+Parent=Rippers
+Browser="CFNetwork"
+
+[CFSCHEDULE*]
+Parent=Rippers
+Browser="ColdFusion Task Scheduler"
+
+[CobWeb/*]
+Parent=Rippers
+Browser="CobWeb"
+
+[ColdFusion*]
+Parent=Rippers
+Browser="ColdFusion"
+
+[Crawl_Application]
+Parent=Rippers
+Browser="Crawl_Application"
+
+[curl/*]
+Parent=Rippers
+Browser="cURL"
+
+[Custo*]
+Parent=Rippers
+Browser="Custo"
+
+[DataCha0s/*]
+Parent=Rippers
+Browser="DataCha0s"
+
+[DeepIndexer*]
+Parent=Rippers
+Browser="DeepIndexer"
+
+[DISCo Pump *]
+Parent=Rippers
+Browser="DISCo Pump"
+
+[eStyleSearch * (compatible; MSIE 6.0; Windows NT 5.0)]
+Parent=Rippers
+Browser="eStyleSearch"
+Win32=true
+
+[ezic.com http agent *]
+Parent=Rippers
+Browser="Ezic.com"
+
+[fetch libfetch/*]
+Parent=Rippers
+
+[FGet*]
+Parent=Rippers
+Browser="FGet"
+
+[Flaming AttackBot*]
+Parent=Rippers
+Browser="Flaming AttackBot"
+
+[Foobot*]
+Parent=Rippers
+Browser="Foobot"
+
+[GameSpyHTTP/*]
+Parent=Rippers
+Browser="GameSpyHTTP"
+
+[gnome-vfs/*]
+Parent=Rippers
+Browser="gnome-vfs"
+
+[Harvest/*]
+Parent=Rippers
+Browser="Harvest"
+
+[hcat/*]
+Parent=Rippers
+Browser="hcat"
+
+[HLoader]
+Parent=Rippers
+Browser="HLoader"
+
+[Holmes/*]
+Parent=Rippers
+Browser="Holmes"
+
+[HTMLParser/*]
+Parent=Rippers
+Browser="HTMLParser"
+
+[http generic]
+Parent=Rippers
+Browser="http generic"
+
+[httpclient*]
+Parent=Rippers
+
+[httperf/*]
+Parent=Rippers
+Browser="httperf"
+
+[HttpSession]
+Parent=Rippers
+Browser="HttpSession"
+
+[httpunit/*]
+Parent=Rippers
+Browser="HttpUnit"
+
+[ICE_GetFile]
+Parent=Rippers
+Browser="ICE_GetFile"
+
+[iexplore.exe]
+Parent=Rippers
+
+[Inet - Eureka App]
+Parent=Rippers
+Browser="Inet - Eureka App"
+
+[INetURL/*]
+Parent=Rippers
+Browser="INetURL"
+
+[InetURL:/*]
+Parent=Rippers
+Browser="InetURL"
+
+[Internet Exploiter/*]
+Parent=Rippers
+
+[Internet Explore *]
+Parent=Rippers
+Browser="Fake IE"
+
+[Internet Explorer *]
+Parent=Rippers
+Browser="Fake IE"
+
+[IP*Works!*/*]
+Parent=Rippers
+Browser="IP*Works!"
+
+[IrssiUrlLog/*]
+Parent=Rippers
+Browser="IrssiUrlLog"
+
+[JPluck/*]
+Parent=Rippers
+Browser="JPluck"
+
+[Kapere (http://www.kapere.com)]
+Parent=Rippers
+Browser="Kapere"
+
+[LeechFTP]
+Parent=Rippers
+Browser="LeechFTP"
+
+[LeechGet*]
+Parent=Rippers
+Browser="LeechGet"
+
+[libcurl-agent/*]
+Parent=Rippers
+Browser="libcurl"
+
+[libWeb/clsHTTP*]
+Parent=Rippers
+Browser="libWeb/clsHTTP"
+
+[lwp*]
+Parent=Rippers
+
+[MFC_Tear_Sample]
+Parent=Rippers
+Browser="MFC_Tear_Sample"
+
+[Moozilla]
+Parent=Rippers
+Browser="Moozilla"
+
+[MovableType/*]
+Parent=Rippers
+Browser="MovableType Web Log"
+
+[Mozilla/2.0 (compatible; NEWT ActiveX; Win32)]
+Parent=Rippers
+Browser="NEWT ActiveX"
+Platform=Win32
+
+[Mozilla/3.0 (compatible)]
+Parent=Rippers
+
+[Mozilla/3.0 (compatible; Indy Library)]
+Parent=Rippers
+Cookies=true
+
+[Mozilla/3.01 (compatible;)]
+Parent=Rippers
+
+[Mozilla/4.0 (compatible; BorderManager*)]
+Parent=Rippers
+Browser="Novell BorderManager"
+
+[Mozilla/4.0 (compatible;)]
+Parent=Rippers
+
+[Mozilla/5.0 (compatible; IPCheck Server Monitor*)]
+Parent=Rippers
+Browser="IPCheck Server Monitor"
+
+[OCN-SOC/*]
+Parent=Rippers
+Browser="OCN-SOC"
+
+[Offline Explorer*]
+Parent=Rippers
+Browser="Offline Explorer"
+
+[Open Web Analytics Bot*]
+Parent=Rippers
+Browser="Open Web Analytics Bot"
+
+[OSSProxy*]
+Parent=Rippers
+Browser="OSSProxy"
+
+[Pageload*]
+Parent=Rippers
+Browser="PageLoad"
+
+[pavuk/*]
+Parent=Rippers
+Browser="Pavuk"
+
+[PEAR HTTP_Request*]
+Parent=Rippers
+Browser="PEAR-PHP"
+
+[PHP*]
+Parent=Rippers
+Browser="PHP"
+
+[PigBlock (Windows NT 5.1; U)*]
+Parent=Rippers
+Browser="PigBlock"
+Win32=true
+
+[Pockey*]
+Parent=Rippers
+Browser="Pockey-GetHTML"
+
+[POE-Component-Client-HTTP/*]
+Parent=Rippers
+Browser="POE-Component-Client-HTTP"
+
+[PycURL/*]
+Parent=Rippers
+Browser="PycURL"
+
+[Python*]
+Parent=Rippers
+Browser="Python"
+
+[RepoMonkey*]
+Parent=Rippers
+Browser="RepoMonkey"
+
+[SBL-BOT*]
+Parent=Rippers
+Browser="BlackWidow"
+
+[ScoutAbout*]
+Parent=Rippers
+Browser="ScoutAbout"
+
+[sherlock/*]
+Parent=Rippers
+Browser="Sherlock"
+
+[SiteParser/*]
+Parent=Rippers
+Browser="SiteParser"
+
+[SiteSnagger*]
+Parent=Rippers
+Browser="SiteSnagger"
+
+[SiteSucker/*]
+Parent=Rippers
+Browser="SiteSucker"
+
+[SiteWinder*]
+Parent=Rippers
+Browser="SiteWinder"
+
+[Snoopy*]
+Parent=Rippers
+Browser="Snoopy"
+
+[SOFTWING_TEAR_AGENT*]
+Parent=Rippers
+Browser="AspTear"
+
+[SuperHTTP/*]
+Parent=Rippers
+Browser="SuperHTTP"
+
+[Tcl http client package*]
+Parent=Rippers
+Browser="Tcl http client package"
+
+[Twisted PageGetter]
+Parent=Rippers
+Browser="Twisted PageGetter"
+
+[URL2File/*]
+Parent=Rippers
+Browser="URL2File"
+
+[UtilMind HTTPGet]
+Parent=Rippers
+Browser="UtilMind HTTPGet"
+
+[VCI WebViewer*]
+Parent=Rippers
+Browser="VCI WebViewer"
+
+[W3CRobot/*]
+Parent=Rippers
+Browser="W3CRobot"
+
+[Web Downloader*]
+Parent=Rippers
+Browser="Web Downloader"
+
+[Web Downloader/*]
+Parent=Rippers
+Browser="Web Downloader"
+
+[Web Magnet*]
+Parent=Rippers
+Browser="Web Magnet"
+
+[WebAuto/*]
+Parent=Rippers
+
+[webbandit/*]
+Parent=Rippers
+Browser="webbandit"
+
+[WebCopier*]
+Parent=Rippers
+Browser="WebCopier"
+
+[WebDownloader*]
+Parent=Rippers
+Browser="WebDownloader"
+
+[WebFetch]
+Parent=Rippers
+Browser="WebFetch"
+
+[webfetch/*]
+Parent=Rippers
+Browser="WebFetch"
+
+[WebGatherer*]
+Parent=Rippers
+Browser="WebGatherer"
+
+[WebGet]
+Parent=Rippers
+Browser="WebGet"
+
+[WebReaper*]
+Parent=Rippers
+Browser="WebReaper"
+
+[WebRipper]
+Parent=Rippers
+Browser="WebRipper"
+
+[WebSauger*]
+Parent=Rippers
+Browser="WebSauger"
+
+[Website Downloader*]
+Parent=Rippers
+Browser="Website Downloader"
+
+[Website eXtractor*]
+Parent=Rippers
+Browser="Website eXtractor"
+
+[Website Quester]
+Parent=Rippers
+Browser="Website Quester"
+
+[WebsiteExtractor*]
+Parent=Rippers
+Browser="Website eXtractor"
+
+[WebSnatcher*]
+Parent=Rippers
+Browser="WebSnatcher"
+
+[Webster Pro*]
+Parent=Rippers
+Browser="Webster Pro"
+
+[WebStripper*]
+Parent=Rippers
+Browser="WebStripper"
+
+[WebWhacker*]
+Parent=Rippers
+Browser="WebWhacker"
+
+[WinScripter iNet Tools]
+Parent=Rippers
+Browser="WinScripter iNet Tools"
+
+[WWW-Mechanize/*]
+Parent=Rippers
+Browser="WWW-Mechanize"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Site Monitors
+
+[Site Monitors]
+Parent=DefaultProperties
+Browser="Site Monitors"
+Cookies=true
+Stripper=true
+isBanned=true
+Crawler=true
+
+[*EasyRider*]
+Parent=Site Monitors
+Browser="EasyRider"
+
+[*maxamine.com--robot*]
+Parent=Site Monitors
+Browser="maxamine.com--robot"
+Stripper=true
+isBanned=true
+
+[*Netcraft Web Server Survey*]
+Parent=Site Monitors
+Browser="Netcraft"
+Stripper=true
+isBanned=true
+
+[*Netcraft Webserver Survey*]
+Parent=Site Monitors
+Browser="Netcraft Webserver Survey"
+Stripper=true
+isBanned=true
+
+[*WebMon ?.*]
+Parent=Site Monitors
+Browser="WebMon"
+
+[Kenjin Spider*]
+Parent=Site Monitors
+Browser="Kenjin Spider"
+
+[Kevin http://*]
+Parent=Site Monitors
+Browser="Kevin"
+Stripper=true
+isBanned=true
+
+[Mozilla/4.0 (compatible; ChangeDetection/*]
+Parent=Site Monitors
+Browser="ChangeDetection"
+
+[Myst Monitor Service v*]
+Parent=Site Monitors
+Browser="Myst Monitor Service"
+
+[Net Probe]
+Parent=Site Monitors
+Browser="Net Probe"
+
+[NetMechanic*]
+Parent=Site Monitors
+Browser="NetMechanic"
+
+[NetReality*]
+Parent=Site Monitors
+Browser="NetReality"
+
+[Pingdom GIGRIB*]
+Parent=Site Monitors
+Browser="Pingdom"
+
+[Site Valet Online*]
+Parent=Site Monitors
+Browser="Site Valet"
+Stripper=true
+isBanned=true
+
+[SITECHECKER]
+Parent=Site Monitors
+Browser="SITECHECKER"
+
+[sitemonitor@dnsvr.com/*]
+Parent=Site Monitors
+Browser="ZoneEdit Failover Monitor"
+Stripper=false
+isBanned=false
+
+[UpTime Checker*]
+Parent=Site Monitors
+Browser="UpTime Checker"
+
+[URL Control*]
+Parent=Site Monitors
+Browser="URL Control"
+
+[URL_Access/*]
+Parent=Site Monitors
+
+[URLCHECK]
+Parent=Site Monitors
+Browser="URLCHECK"
+
+[URLy Warning*]
+Parent=Site Monitors
+Browser="URLy Warning"
+
+[Webcheck *]
+Parent=Site Monitors
+Browser="Webcheck"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[WebPatrol/*]
+Parent=Site Monitors
+Browser="WebPatrol"
+
+[websitepulse checker/*]
+Parent=Site Monitors
+Browser="websitepulse checker"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Social Bookmarkers
+
+[Social Bookmarkers]
+Parent=DefaultProperties
+Browser="Social Bookmarkers"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+
+[Cocoal.icio.us/1.0 (v43) (Mac OS X; http://www.scifihifi.com/cocoalicious)]
+Parent=Social Bookmarkers
+Browser="Cocoalicious"
+
+[WinkBot/*]
+Parent=Social Bookmarkers
+Browser="WinkBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Translators
+
+[Translators]
+Parent=DefaultProperties
+Browser="Translators"
+Frames=true
+Tables=true
+Cookies=true
+
+[Seram Server]
+Parent=Translators
+Browser="Seram Server"
+
+[TeragramWebcrawler/*]
+Parent=Translators
+Browser="TeragramWebcrawler"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[WebIndexer/* (Web Indexer; *)]
+Parent=Translators
+Browser="WorldLingo"
+
+[WebTrans]
+Parent=Translators
+Browser="WebTrans"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Version Checkers
+
+[Version Checkers]
+Parent=DefaultProperties
+Browser="Version Checkers"
+Crawler=true
+
+[Automated Browscap.ini Updater. To report issues contact us at http://www.skycomp.ca]
+Parent=Version Checkers
+Browser="Automated Browscap.ini Updater"
+
+[BMC Link Validator (http://www.briansmodelcars.com/links/)]
+Parent=Version Checkers
+Browser="BMC Link Validator"
+MajorVer=1
+MinorVer=0
+Platform=Win2000
+
+[Browscap updater]
+Parent=Version Checkers
+Browser="Browscap updater"
+
+[BrowscapUpdater1.0]
+Parent=Version Checkers
+
+[Browser Capabilities Project (http://browsers.garykeith.com; http://browsers.garykeith.com/sitemail/contact-me.asp)]
+Parent=Version Checkers
+Browser="Gary Keith's Version Checker"
+
+[Browser Capabilities Project AutoDownloader; created by Tom Kelleher Consulting, Inc. (tkelleher.com); used with special permission from Gary Joel Keith; uses Microsoft's WinHTTP component]
+Parent=Version Checkers
+Browser="TKC AutoDownloader"
+
+[browsers.garykeith.com browscap.ini bot BETA]
+Parent=Version Checkers
+
+[Code Sample Web Client]
+Parent=Version Checkers
+Browser="Code Sample Web Client"
+
+[Mono Browser Capabilities Updater*]
+Parent=Version Checkers
+Browser="Mono Browser Capabilities Updater"
+Stripper=true
+isBanned=true
+
+[Subtext Version 1.9* - http://subtextproject.com/ (Microsoft Windows NT 5.2.*)]
+Parent=Version Checkers
+Browser="Subtext"
+
+[TherapeuticResearch]
+Parent=Version Checkers
+Browser="TherapeuticResearch"
+
+[UpdateBrowscap*]
+Parent=Version Checkers
+Browser="UpdateBrowscap"
+
+[www.garykeith.com browscap.ini bot*]
+Parent=Version Checkers
+Browser="clarkson.edu "
+
+[www.substancia.com AutoHTTPAgent (ver *)]
+Parent=Version Checkers
+Browser="Substância"
+
+[psbot/*]
+Parent=Webaroo
+Browser="PSBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Become
+
+[Become]
+Parent=DefaultProperties
+Browser="Become"
+Frames=true
+Tables=true
+isSyndicationReader=true
+Crawler=true
+
+[*BecomeBot/*]
+Parent=Become
+Browser="BecomeBot"
+
+[*BecomeBot@exava.com*]
+Parent=Become
+Browser="BecomeBot"
+
+[*Exabot@exava.com*]
+Parent=Become
+Browser="Exabot"
+
+[MonkeyCrawl/*]
+Parent=Become
+Browser="MonkeyCrawl"
+
+[Mozilla/5.0 (compatible; BecomeJPBot/2.3; *)]
+Parent=Become
+Browser="BecomeJPBot"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Blue Coat Systems
+
+[Blue Coat Systems]
+Parent=DefaultProperties
+Browser="Blue Coat Systems"
+Stripper=true
+isBanned=true
+Crawler=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FeedHub
+
+[FeedHub]
+Parent=DefaultProperties
+Browser="FeedHub"
+isSyndicationReader=true
+
+[FeedHub FeedDiscovery/1.0 (http://www.feedhub.com)]
+Parent=FeedHub
+Browser="FeedHub FeedDiscovery"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[FeedHub FeedFetcher/1.0 (http://www.feedhub.com)]
+Parent=FeedHub
+Browser="FeedHub FeedFetcher"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[FeedHub MetaDataFetcher/1.0 (http://www.feedhub.com)]
+Parent=FeedHub
+Browser="FeedHub MetaDataFetcher"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NameProtect
+
+[NameProtect]
+Parent=DefaultProperties
+Browser="NameProtect"
+Stripper=true
+isBanned=true
+Crawler=true
+
+[abot/*]
+Parent=NameProtect
+Browser="NameProtect"
+
+[NP/*]
+Parent=NameProtect
+Browser="NameProtect"
+
+[NPBot*]
+Parent=NameProtect
+Browser="NameProtect"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NewsGator
+
+[NewsGator]
+Parent=DefaultProperties
+Browser="NewsGator"
+isSyndicationReader=true
+
+[MarsEdit*]
+Parent=NewsGator
+Browser="MarsEdit"
+
+[NetNewsWire*/*]
+Parent=NewsGator
+Browser="NetNewsWire"
+Platform=MacOSX
+
+[NewsFire/*]
+Parent=NewsGator
+Browser="NewsFire"
+
+[NewsGator FetchLinks extension/*]
+Parent=NewsGator
+Browser="NewsGator FetchLinks"
+
+[NewsGator/*]
+Parent=NewsGator
+Browser="NewsGator"
+Stripper=true
+isBanned=true
+
+[NewsGatorOnline/*]
+Parent=NewsGator
+Browser="NewsGatorOnline"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; The Planet's Vulnerability Scanning
+
+[The Planet]
+Parent=DefaultProperties
+Browser="The Planet's Vulnerability Scanning"
+
+[*; system(id);*]
+Parent=The Planet
+
+[Fastream NETFile Server]
+Parent=The Planet
+
+[mercuryboard_user_agent_sql_injection.nasl*]
+Parent=The Planet
+
+[Mozilla/4.0 (compatible; gallery_203.nasl; Googlebot)]
+Parent=The Planet
+
+[Mozilla/4.75 * (X11, U]
+Parent=The Planet
+
+[Mozilla/7 * (X11; U; Linux 2.6.1 ia64)]
+Parent=The Planet
+
+[NESSUS::SOAP]
+Parent=The Planet
+Browser="NESSUS::SOAP"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Jakarta Project
+
+[Jakarta Project]
+Parent=DefaultProperties
+Browser="Jakarta Project"
+Platform=JAVA
+Stripper=true
+isBanned=true
+Crawler=true
+
+[Jakarta Commons-HttpClient/*]
+Parent=Jakarta Project
+Browser="Jakarta Commons-HttpClient"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iPod
+
+[iPod]
+Parent=DefaultProperties
+Browser="iPod"
+Cookies=true
+
+[Mozilla/5.0 (iPod; U; *Mac OS X; en) AppleWebKit/* (*) Version/3.0 Mobile/* Safari/*]
+Parent=iPod
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Media Players
+
+[Media Players]
+Parent=DefaultProperties
+Browser="Media Players"
+Cookies=true
+
+[iTunes/* (Windows; ?)]
+Parent=Media Players
+Browser="iTunes"
+Platform=Win32
+Win32=true
+
+[Microsoft NetShow(TM) Player with RealVideo(R)]
+Parent=Media Players
+Browser="Microsoft NetShow"
+
+[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; *) AppleWebKit/* RealPlayer]
+Parent=Media Players
+Browser="RealPlayer"
+Platform=MacOSX
+
+[MPlayer 0.9*]
+Parent=Media Players
+Browser="MPlayer"
+Version=0.9
+MajorVer=0
+MinorVer=9
+
+[MPlayer 1.*]
+Parent=Media Players
+Browser="MPlayer"
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[MPlayer HEAD CVS]
+Parent=Media Players
+Browser="MPlayer"
+
+[RealPlayer*]
+Parent=Media Players
+Browser="RealPlayer"
+
+[RMA/*]
+Parent=Media Players
+Browser="RMA"
+
+[vobsub]
+Parent=Media Players
+Browser="vobsub"
+Stripper=true
+isBanned=true
+
+[WinampMPEG/*]
+Parent=Media Players
+Browser="WinAmp"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Windows Media Player
+
+[Windows Media Player]
+Parent=DefaultProperties
+Browser="Windows Media Player"
+Cookies=true
+
+[NSPlayer/10.*]
+Parent=Windows Media Player
+Version=10.0
+MajorVer=10
+MinorVer=0
+
+[NSPlayer/11.* WMFSDK/11.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=11.0
+MajorVer=11
+MinorVer=0
+
+[NSPlayer/4.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=4.0
+MajorVer=4
+MinorVer=0
+
+[NSPlayer/7.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=7.0
+MajorVer=7
+MinorVer=0
+
+[NSPlayer/8.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=8.0
+MajorVer=8
+MinorVer=0
+
+[NSPlayer/9.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=9.0
+MajorVer=9
+MinorVer=0
+
+[Windows-Media-Player/10.*]
+Parent=Windows Media Player
+Browser="Windows-Media-Player"
+Version=10.0
+MajorVer=10
+MinorVer=0
+Win32=true
+
+[Windows-Media-Player/11.*]
+Parent=Windows Media Player
+Version=11.0
+MajorVer=11
+MinorVer=0
+Win32=true
+
+[Windows-Media-Player/7.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=7.0
+MajorVer=7
+MinorVer=0
+Win32=true
+
+[Windows-Media-Player/8.*]
+Parent=Windows Media Player
+Browser="Windows Media Player"
+Version=8.0
+MajorVer=8
+MinorVer=0
+Win32=true
+
+[Windows-Media-Player/9.*]
+Parent=Windows Media Player
+Version=9.0
+MajorVer=9
+MinorVer=0
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 6.5
+
+[QuickTime 6.5]
+Parent=DefaultProperties
+Browser="QuickTime 6.5"
+Version=6.5
+MajorVer=6
+MinorVer=5
+Cookies=true
+
+[QuickTime (qtver=6.5*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 6.5
+Platform=MacOSX
+
+[QuickTime (qtver=6.5*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 6.5
+Platform=MacPPC
+
+[QuickTime (qtver=6.5*;os=Windows 95*)]
+Parent=QuickTime 6.5
+Platform=Win95
+Win32=true
+
+[QuickTime (qtver=6.5*;os=Windows 98*)]
+Parent=QuickTime 6.5
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=6.5*;os=Windows Me*)]
+Parent=QuickTime 6.5
+Platform=WinME
+Win32=true
+
+[QuickTime (qtver=6.5*;os=Windows NT 4.0*)]
+Parent=QuickTime 6.5
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=6.5*;os=Windows NT 5.0*)]
+Parent=QuickTime 6.5
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=6.5*;os=Windows NT 5.1*)]
+Parent=QuickTime 6.5
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=6.5*;os=Windows NT 5.2*)]
+Parent=QuickTime 6.5
+Platform=Win2003
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 6.6
+
+[QuickTime 6.6]
+Parent=DefaultProperties
+Browser="QuickTime 6.6"
+Version=6.6
+MajorVer=6
+MinorVer=6
+Cookies=true
+
+[QuickTime (qtver=6.6*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 6.6
+Platform=MacOSX
+
+[QuickTime (qtver=6.6*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 6.6
+Platform=MacPPC
+
+[QuickTime (qtver=6.6*;os=Windows 95*)]
+Parent=QuickTime 6.6
+Platform=Win95
+Win32=true
+
+[QuickTime (qtver=6.6*;os=Windows 98*)]
+Parent=QuickTime 6.6
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=6.6*;os=Windows Me*)]
+Parent=QuickTime 6.6
+Platform=WinME
+Win32=true
+
+[QuickTime (qtver=6.6*;os=Windows NT 4.0*)]
+Parent=QuickTime 6.6
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=6.6*;os=Windows NT 5.0*)]
+Parent=QuickTime 6.6
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=6.6*;os=Windows NT 5.1*)]
+Parent=QuickTime 6.6
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=6.6*;os=Windows NT 5.2*)]
+Parent=QuickTime 6.6
+Platform=Win2003
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 6.7
+
+[QuickTime 6.7]
+Parent=DefaultProperties
+Browser="QuickTime 6.7"
+Version=6.7
+MajorVer=6
+MinorVer=7
+Cookies=true
+
+[QuickTime (qtver=6.7*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 6.7
+Platform=MacOSX
+
+[QuickTime (qtver=6.7*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 6.7
+Platform=MacPPC
+
+[QuickTime (qtver=6.7*;os=Windows 95*)]
+Parent=QuickTime 6.7
+Platform=Win95
+Win32=true
+
+[QuickTime (qtver=6.7*;os=Windows 98*)]
+Parent=QuickTime 6.7
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=6.7*;os=Windows Me*)]
+Parent=QuickTime 6.7
+Platform=WinME
+Win32=true
+
+[QuickTime (qtver=6.7*;os=Windows NT 4.0*)]
+Parent=QuickTime 6.7
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=6.7*;os=Windows NT 5.0*)]
+Parent=QuickTime 6.7
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=6.7*;os=Windows NT 5.1*)]
+Parent=QuickTime 6.7
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=6.7*;os=Windows NT 5.2*)]
+Parent=QuickTime 6.7
+Platform=Win2003
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 6.8
+
+[QuickTime 6.8]
+Parent=DefaultProperties
+Browser="QuickTime 6.8"
+Version=6.8
+MajorVer=6
+MinorVer=8
+Cookies=true
+
+[QuickTime (qtver=6.8*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 6.8
+Platform=MacOSX
+
+[QuickTime (qtver=6.8*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 6.8
+Platform=MacPPC
+
+[QuickTime (qtver=6.8*;os=Windows 95*)]
+Parent=QuickTime 6.8
+Platform=Win95
+Win32=true
+
+[QuickTime (qtver=6.8*;os=Windows 98*)]
+Parent=QuickTime 6.8
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=6.8*;os=Windows Me*)]
+Parent=QuickTime 6.8
+Platform=WinME
+Win32=true
+
+[QuickTime (qtver=6.8*;os=Windows NT 4.0*)]
+Parent=QuickTime 6.8
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=6.8*;os=Windows NT 5.0*)]
+Parent=QuickTime 6.8
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=6.8*;os=Windows NT 5.1*)]
+Parent=QuickTime 6.8
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=6.8*;os=Windows NT 5.2*)]
+Parent=QuickTime 6.8
+Platform=Win2003
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 6.9
+
+[QuickTime 6.9]
+Parent=DefaultProperties
+Browser="QuickTime 6.9"
+Version=6.9
+MajorVer=6
+MinorVer=9
+Cookies=true
+
+[QuickTime (qtver=6.9*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 6.9
+Platform=MacOSX
+
+[QuickTime (qtver=6.9*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 6.9
+Platform=MacPPC
+
+[QuickTime (qtver=6.9*;os=Windows 95*)]
+Parent=QuickTime 6.9
+Platform=Win95
+Win32=true
+
+[QuickTime (qtver=6.9*;os=Windows 98*)]
+Parent=QuickTime 6.9
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=6.9*;os=Windows Me*)]
+Parent=QuickTime 6.9
+Platform=WinME
+Win32=true
+
+[QuickTime (qtver=6.9*;os=Windows NT 4.0*)]
+Parent=QuickTime 6.9
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=6.9*;os=Windows NT 5.0*)]
+Parent=QuickTime 6.9
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=6.9*;os=Windows NT 5.1*)]
+Parent=QuickTime 6.9
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=6.9*;os=Windows NT 5.2*)]
+Parent=QuickTime 6.9
+Platform=Win2003
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.0
+
+[QuickTime 7.0]
+Parent=DefaultProperties
+Browser="QuickTime 7.0"
+Version=7.0
+MajorVer=7
+Cookies=true
+
+[QuickTime (qtver=7.0*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 7.0
+Platform=MacOSX
+
+[QuickTime (qtver=7.0*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 7.0
+Platform=MacPPC
+
+[QuickTime (qtver=7.0*;os=Windows 95*)]
+Parent=QuickTime 7.0
+Platform=Win95
+Win32=true
+
+[QuickTime (qtver=7.0*;os=Windows 98*)]
+Parent=QuickTime 7.0
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=7.0*;os=Windows Me*)]
+Parent=QuickTime 7.0
+Platform=WinME
+Win32=true
+
+[QuickTime (qtver=7.0*;os=Windows NT 4.0*)]
+Parent=QuickTime 7.0
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=7.0*;os=Windows NT 5.0*)]
+Parent=QuickTime 7.0
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=7.0*;os=Windows NT 5.1*)]
+Parent=QuickTime 7.0
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=7.0*;os=Windows NT 5.2*)]
+Parent=QuickTime 7.0
+Platform=Win2003
+Win32=true
+
+[QuickTime/7.0.* (qtver=7.0.*;*;os=Mac 10.*)*]
+Parent=QuickTime 7.0
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.1
+
+[QuickTime 7.1]
+Parent=DefaultProperties
+Browser="QuickTime 7.1"
+Version=7.1
+MajorVer=7
+MinorVer=1
+Cookies=true
+
+[QuickTime (qtver=7.1*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 7.1
+Platform=MacOSX
+
+[QuickTime (qtver=7.1*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 7.1
+Platform=MacPPC
+
+[QuickTime (qtver=7.1*;os=Windows 98*)]
+Parent=QuickTime 7.1
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=7.1*;os=Windows NT 4.0*)]
+Parent=QuickTime 7.1
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=7.1*;os=Windows NT 5.0*)]
+Parent=QuickTime 7.1
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=7.1*;os=Windows NT 5.1*)]
+Parent=QuickTime 7.1
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=7.1*;os=Windows NT 5.2*)]
+Parent=QuickTime 7.1
+Platform=Win2003
+Win32=true
+
+[QuickTime/7.1.* (qtver=7.1.*;*;os=Mac 10.*)*]
+Parent=QuickTime 7.1
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.2
+
+[QuickTime 7.2]
+Parent=DefaultProperties
+Browser="QuickTime 7.2"
+Version=7.2
+MajorVer=7
+MinorVer=2
+Platform=MacOSX
+Cookies=true
+
+[QuickTime (qtver=7.2*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 7.2
+Platform=MacOSX
+
+[QuickTime (qtver=7.2*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 7.2
+Platform=MacPPC
+
+[QuickTime (qtver=7.2*;os=Windows 98*)]
+Parent=QuickTime 7.2
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=7.2*;os=Windows NT 4.0*)]
+Parent=QuickTime 7.2
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=7.2*;os=Windows NT 5.0*)]
+Parent=QuickTime 7.2
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=7.2*;os=Windows NT 5.1*)]
+Parent=QuickTime 7.2
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=7.2*;os=Windows NT 5.2*)]
+Parent=QuickTime 7.2
+Platform=Win2003
+Win32=true
+
+[QuickTime/7.2.* (qtver=7.2.*;*;os=Mac 10.*)*]
+Parent=QuickTime 7.2
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.3
+
+[QuickTime 7.3]
+Parent=DefaultProperties
+Browser="QuickTime 7.3"
+Version=7.3
+MajorVer=7
+MinorVer=3
+Platform=MacOSX
+Cookies=true
+
+[QuickTime (qtver=7.3*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 7.3
+Platform=MacOSX
+
+[QuickTime (qtver=7.3*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 7.3
+Platform=MacPPC
+
+[QuickTime (qtver=7.3*;os=Windows 98*)]
+Parent=QuickTime 7.3
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=7.3*;os=Windows NT 4.0*)]
+Parent=QuickTime 7.3
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=7.3*;os=Windows NT 5.0*)]
+Parent=QuickTime 7.3
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=7.3*;os=Windows NT 5.1*)]
+Parent=QuickTime 7.3
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=7.3*;os=Windows NT 5.2*)]
+Parent=QuickTime 7.3
+Platform=Win2003
+Win32=true
+
+[QuickTime/7.3.* (qtver=7.3.*;*;os=Mac 10.*)*]
+Parent=QuickTime 7.3
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.4
+
+[QuickTime 7.4]
+Parent=DefaultProperties
+Browser="QuickTime 7.4"
+Version=7.4
+MajorVer=7
+MinorVer=4
+Platform=MacOSX
+Cookies=true
+
+[QuickTime (qtver=7.4*;cpu=PPC;os=Mac 10.*)]
+Parent=QuickTime 7.4
+Platform=MacOSX
+
+[QuickTime (qtver=7.4*;cpu=PPC;os=Mac 9.*)]
+Parent=QuickTime 7.4
+Platform=MacPPC
+
+[QuickTime (qtver=7.4*;os=Windows 98*)]
+Parent=QuickTime 7.4
+Platform=Win98
+Win32=true
+
+[QuickTime (qtver=7.4*;os=Windows NT 4.0*)]
+Parent=QuickTime 7.4
+Platform=WinNT
+Win32=true
+
+[QuickTime (qtver=7.4*;os=Windows NT 5.0*)]
+Parent=QuickTime 7.4
+Platform=Win2000
+Win32=true
+
+[QuickTime (qtver=7.4*;os=Windows NT 5.1*)]
+Parent=QuickTime 7.4
+Platform=WinXP
+Win32=true
+
+[QuickTime (qtver=7.4*;os=Windows NT 5.2*)]
+Parent=QuickTime 7.4
+Platform=Win2003
+Win32=true
+
+[QuickTime/7.4.* (qtver=7.4.*;*;os=Mac 10.*)*]
+Parent=QuickTime 7.4
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AvantGo
+
+[AvantGo]
+Parent=DefaultProperties
+Browser="AvantGo"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+
+[*AvantGo*]
+Parent=AvantGo
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BlackBerry
+
+[BlackBerry]
+Parent=DefaultProperties
+Browser="BlackBerry"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+
+[*BlackBerry*]
+Parent=BlackBerry
+
+[*BlackBerrySimulator/*]
+Parent=BlackBerry
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Handspring Blazer
+
+[Blazer]
+Parent=DefaultProperties
+Browser="Handspring Blazer"
+Platform=Palm
+Frames=true
+Tables=true
+Cookies=true
+WAP=true
+isMobileDevice=true
+
+[*Blazer*]
+Parent=Blazer
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Danger
+
+[Danger]
+Parent=DefaultProperties
+Browser="Danger"
+Platform=JAVA
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/* (*Danger hiptop *.*)]
+Parent=Danger
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DoCoMo
+
+[DoCoMo]
+Parent=DefaultProperties
+Browser="DoCoMo"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+
+[DoCoMo/*]
+Parent=DoCoMo
+Platform=WAP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Doris
+
+[Doris]
+Parent=DefaultProperties
+Browser="Doris"
+Platform=SymbianOS
+Frames=true
+Tables=true
+Cookies=true
+WAP=true
+isMobileDevice=true
+
+[Doris/*]
+Parent=Doris
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iPhone
+
+[iPhone]
+Parent=DefaultProperties
+Browser="iPhone"
+Platform=MacOSX
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (iPhone; ?; *Mac OS X*) AppleWebKit/* (*) Version/*.* Mobile/* Safari/*]
+Parent=iPhone
+Browser="Safari"
+Platform=MacOSX
+
+[Mozilla/5.0 (iPod; ?; CPU iPhone OS 2_0 like Mac OS X; *) AppleWebKit/* (KHTML, like Gecko) Version/3.1.* Mobile/* Safari/*]
+Parent=iPhone
+Version=3.1
+MajorVer=3
+MinorVer=1
+
+[Mozilla/5.0 (iPod; U; *iPhone*Mac OS X; *) AppleWebKit/* (*) Version/3.1* Mobile/* Safari/*]
+Parent=iPhone
+Browser="Safari"
+Version=3.1
+MajorVer=3
+MinorVer=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; jig
+
+[jig]
+Parent=DefaultProperties
+Browser="jig"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+
+[Mozilla/* (jig browser*; *)]
+Parent=jig
+Browser="jig browser web"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KDDI
+
+[KDDI]
+Parent=DefaultProperties
+Browser="KDDI"
+Frames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+VBScript=true
+JavaScript=true
+ActiveXControls=true
+WAP=true
+isMobileDevice=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[KDDI-* UP.Browser/* (GUI) MMP/*]
+Parent=KDDI
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Motorola Internet Browser
+
+[Motorola Internet Browser]
+Parent=DefaultProperties
+Browser="Motorola Internet Browser"
+Frames=true
+Tables=true
+Cookies=true
+WAP=true
+isMobileDevice=true
+
+[MOT-*/*]
+Parent=Motorola Internet Browser
+
+[MOT-1*/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-8700_/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-A-0A/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-A-2B/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-A-88/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-C???/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-GATW_/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-L6/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-L7/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-M*/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-MP*/* Mozilla/* (compatible; MSIE *; Windows CE; *)]
+Parent=Motorola Internet Browser
+Win32=true
+
+[MOT-MP*/* Mozilla/4.0 (compatible; MSIE *; Windows CE; *)]
+Parent=Motorola Internet Browser
+Win32=true
+
+[MOT-SAP4_/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-T*/*]
+Parent=Motorola Internet Browser
+
+[MOT-T7*/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-T721*]
+Parent=Motorola Internet Browser
+
+[MOT-TA02/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-V*/*]
+Parent=Motorola Internet Browser
+
+[MOT-V*/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-V*/* UP.Browser/*]
+Parent=Motorola Internet Browser
+
+[MOT-V3/* MIB/*]
+Parent=Motorola Internet Browser
+
+[MOT-V4*/* MIB/*]
+Parent=Motorola Internet Browser
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MSN Mobile Proxy
+
+[MSN Mobile Proxy]
+Parent=DefaultProperties
+Browser="MSN Mobile Proxy"
+Win32=true
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+ActiveXControls=true
+WAP=true
+isMobileDevice=true
+
+[Mozilla/* (compatible; MSIE *; Windows*; MSN Mobile Proxy)]
+Parent=MSN Mobile Proxy
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront
+
+[NetFront]
+Parent=DefaultProperties
+Browser="NetFront"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+
+[*NetFront/*]
+Parent=NetFront
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Nokia
+
+[Nokia]
+Parent=DefaultProperties
+Browser="Nokia"
+Tables=true
+Cookies=true
+WAP=true
+isMobileDevice=true
+
+[*Nokia*/*]
+Parent=Nokia
+
+[Mozilla/* (SymbianOS/*; ?; *) AppleWebKit/* (KHTML, like Gecko) Safari/*]
+Parent=Nokia
+Platform=SymbianOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Openwave Mobile Browser
+
+[Openwave Mobile Browser]
+Parent=DefaultProperties
+Browser="Openwave Mobile Browser"
+Alpha=true
+Win32=true
+Win64=true
+Frames=true
+Tables=true
+Cookies=true
+WAP=true
+isMobileDevice=true
+isSyndicationReader=true
+
+[*UP.Browser/*]
+Parent=Openwave Mobile Browser
+
+[*UP.Link/*]
+Parent=Openwave Mobile Browser
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera
+
+[Opera]
+Parent=DefaultProperties
+Browser="Opera"
+Platform=SymbianOS
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+
+[Mozilla/*(WILLCOM;KYOCERA/*) Opera *]
+Parent=Opera
+
+[Mozilla/4.* (compatible; MSIE *.*; Symbian*; *Opera*]
+Parent=Opera
+Platform=SymbianOS
+
+[Opera/* (*Nintendo Wii*)]
+Parent=Opera
+Browser="Wii Web Browser"
+
+[Opera/* (*Opera Mini/*)*]
+Parent=Opera
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Playstation
+
+[Playstation]
+Parent=DefaultProperties
+Browser="Playstation"
+Platform=WAP
+Frames=true
+Tables=true
+Cookies=true
+WAP=true
+isMobileDevice=true
+
+[Mozilla/* (PLAYSTATION *; *)]
+Parent=Playstation
+Browser="PlayStation 3"
+Frames=false
+
+[Mozilla/* (PSP (PlayStation Portable); *)]
+Parent=Playstation
+
+[Sony PS2 (Linux)]
+Parent=Playstation
+Browser="Sony PS2"
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Pocket PC
+
+[Pocket PC]
+Parent=DefaultProperties
+Browser="Pocket PC"
+Platform=WinCE
+Win32=true
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+ActiveXControls=true
+WAP=true
+isMobileDevice=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[*(compatible; MSIE *.*; Windows CE; PPC; *)]
+Parent=Pocket PC
+
+[HTC-*/* Mozilla/* (compatible; MSIE *.*; Windows CE*)*]
+Parent=Pocket PC
+Win32=true
+
+[Mozilla/* (compatible; MSPIE *.*; *Windows CE*)*]
+Parent=Pocket PC
+Win32=true
+
+[T-Mobile* Mozilla/* (compatible; MSIE *.*; Windows CE; *)]
+Parent=Pocket PC
+
+[Vodafone* Mozilla/* (compatible; MSIE *.*; Windows CE; *)*]
+Parent=Pocket PC
+
+[Windows CE (Pocket PC) - Version *.*]
+Parent=Pocket PC
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SEMC Browser
+
+[SEMC Browser]
+Parent=DefaultProperties
+Browser="SEMC Browser"
+Platform=JAVA
+Tables=true
+WAP=true
+isMobileDevice=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[*SEMC-Browser/*]
+Parent=SEMC Browser
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SonyEricsson
+
+[SonyEricsson]
+Parent=DefaultProperties
+Browser="SonyEricsson"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[*Ericsson*]
+Parent=SonyEricsson
+
+[*SonyEricsson*]
+Parent=SonyEricsson
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netbox
+
+[Netbox]
+Parent=DefaultProperties
+Browser="Netbox"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/3.01 (compatible; Netbox/*; Linux*)]
+Parent=Netbox
+Browser="Netbox"
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PowerTV
+
+[PowerTV]
+Parent=DefaultProperties
+Browser="PowerTV"
+Platform=PowerTV
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+
+[Mozilla/4.0 PowerTV/1.5 (Compatible; Spyglass DM 3.2.1, EXPLORER)]
+Parent=PowerTV
+Version=1.5
+MajorVer=1
+MinorVer=5
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WebTV/MSNTV
+
+[WebTV]
+Parent=DefaultProperties
+Browser="WebTV/MSNTV"
+Platform=WebTV
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+
+[Mozilla/3.0 WebTV/1.*(compatible; MSIE 2.0)]
+Parent=WebTV
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Mozilla/4.0 WebTV/2.0*(compatible; MSIE 3.0)]
+Parent=WebTV
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/4.0 WebTV/2.1*(compatible; MSIE 3.0)]
+Parent=WebTV
+Version=2.1
+MajorVer=2
+MinorVer=1
+
+[Mozilla/4.0 WebTV/2.2*(compatible; MSIE 3.0)]
+Parent=WebTV
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+[Mozilla/4.0 WebTV/2.3*(compatible; MSIE 3.0)]
+Parent=WebTV
+Version=2.3
+MajorVer=2
+MinorVer=3
+
+[Mozilla/4.0 WebTV/2.4*(compatible; MSIE 3.0)]
+Parent=WebTV
+Version=2.4
+MajorVer=2
+MinorVer=4
+
+[Mozilla/4.0 WebTV/2.5*(compatible; MSIE 4.0)]
+Parent=WebTV
+Version=2.5
+MajorVer=2
+MinorVer=5
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.0 WebTV/2.6*(compatible; MSIE 4.0)]
+Parent=WebTV
+Version=2.6
+MajorVer=2
+MinorVer=6
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.0 WebTV/2.7*(compatible; MSIE 4.0)]
+Parent=WebTV
+Version=2.7
+MajorVer=2
+MinorVer=7
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.0 WebTV/2.8*(compatible; MSIE 4.0)]
+Parent=WebTV
+Version=2.8
+MajorVer=2
+MinorVer=8
+JavaApplets=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.0 WebTV/2.9*(compatible; MSIE 4.0)]
+Parent=WebTV
+Version=2.9
+MajorVer=2
+MinorVer=9
+JavaApplets=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Amaya
+
+[Amaya]
+Parent=DefaultProperties
+Browser="Amaya"
+Tables=true
+Cookies=true
+
+[amaya/7.*]
+Parent=Amaya
+Version=7.0
+MajorVer=7
+MinorVer=0
+
+[amaya/8.0*]
+Parent=Amaya
+Version=8.0
+MajorVer=8
+MinorVer=0
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.1*]
+Parent=Amaya
+Version=8.1
+MajorVer=8
+MinorVer=1
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.2*]
+Parent=Amaya
+Version=8.2
+MajorVer=8
+MinorVer=2
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.3*]
+Parent=Amaya
+Version=8.3
+MajorVer=8
+MinorVer=3
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.4*]
+Parent=Amaya
+Version=8.4
+MajorVer=8
+MinorVer=4
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.5*]
+Parent=Amaya
+Version=8.5
+MajorVer=8
+MinorVer=5
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.6*]
+Parent=Amaya
+Version=8.6
+MajorVer=8
+MinorVer=6
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.7*]
+Parent=Amaya
+Version=8.7
+MajorVer=8
+MinorVer=7
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.8*]
+Parent=Amaya
+Version=8.8
+MajorVer=8
+MinorVer=8
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/8.9*]
+Parent=Amaya
+Version=8.9
+MajorVer=8
+MinorVer=9
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/9.0*]
+Parent=Amaya
+Version=9.0
+MajorVer=8
+MinorVer=0
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/9.1*]
+Parent=Amaya
+Version=9.1
+MajorVer=9
+MinorVer=1
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/9.2*]
+Parent=Amaya
+Version=9.2
+MajorVer=9
+MinorVer=2
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[amaya/9.3*]
+Parent=Amaya
+Version=9.3
+MajorVer=9
+MinorVer=3
+
+[amaya/9.4*]
+Parent=Amaya
+Version=9.4
+MajorVer=9
+MinorVer=4
+
+[amaya/9.5*]
+Parent=Amaya
+Version=9.5
+MajorVer=9
+MinorVer=5
+
+[Emacs-w3m/*]
+Parent=Emacs/W3
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Links
+
+[Links]
+Parent=DefaultProperties
+Browser="Links"
+Frames=true
+Tables=true
+
+[Links (0.9*; CYGWIN_NT-5.1*)]
+Parent=Links
+Browser="Links"
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=WinXP
+
+[Links (0.9*; Darwin*)]
+Parent=Links
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=MacPPC
+
+[Links (0.9*; FreeBSD*)]
+Parent=Links
+Browser="Links"
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=FreeBSD
+
+[Links (0.9*; Linux*)]
+Parent=Links
+Browser="Links"
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Linux
+
+[Links (0.9*; OS/2*)]
+Parent=Links
+Browser="Links"
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=OS/2
+
+[Links (0.9*; Unix*)]
+Parent=Links
+Browser="Links"
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Unix
+
+[Links (0.9*; Win32*)]
+Parent=Links
+Browser="Links"
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Win32
+Win32=true
+
+[Links (1.0*; CYGWIN_NT-5.1*)]
+Parent=Links
+Browser="Links"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=WinXP
+
+[Links (1.0*; FreeBSD*)]
+Parent=Links
+Browser="Links"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=FreeBSD
+
+[Links (1.0*; Linux*)]
+Parent=Links
+Browser="Links"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Linux
+
+[Links (1.0*; OS/2*)]
+Parent=Links
+Browser="Links"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=OS/2
+
+[Links (1.0*; Unix*)]
+Parent=Links
+Browser="Links"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Unix
+
+[Links (1.0*; Win32*)]
+Parent=Links
+Browser="Links"
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Win32
+Win32=true
+
+[Links (2.0*; Linux*)]
+Parent=Links
+Browser="Links"
+Version=2.0
+MajorVer=2
+MinorVer=0
+Platform=Linux
+
+[Links (2.1*; FreeBSD*)]
+Parent=Links
+Browser="Links"
+Version=2.1
+MajorVer=2
+MinorVer=1
+Platform=FreeBSD
+
+[Links (2.1*; Linux *)]
+Parent=Links
+Browser="Links"
+Version=2.1
+MajorVer=2
+MinorVer=1
+Platform=Linux
+
+[Links (2.1*; OpenBSD*)]
+Parent=Links
+Browser="Links"
+Version=2.1
+MajorVer=2
+MinorVer=1
+Platform=OpenBSD
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lynx
+
+[Lynx]
+Parent=DefaultProperties
+Browser="Lynx"
+Frames=true
+Tables=true
+
+[Lynx *]
+Parent=Lynx
+Browser="Lynx"
+
+[Lynx/2.3*]
+Parent=Lynx
+Browser="Lynx"
+Version=2.3
+MajorVer=2
+MinorVer=3
+
+[Lynx/2.4*]
+Parent=Lynx
+Browser="Lynx"
+Version=2.4
+MajorVer=2
+MinorVer=4
+
+[Lynx/2.5*]
+Parent=Lynx
+Browser="Lynx"
+Version=2.5
+MajorVer=2
+MinorVer=5
+
+[Lynx/2.6*]
+Parent=Lynx
+Browser="Lynx"
+Version=2.6
+MajorVer=2
+MinorVer=6
+
+[Lynx/2.7*]
+Parent=Lynx
+Browser="Lynx"
+Version=2.7
+MajorVer=2
+MinorVer=7
+
+[Lynx/2.8*]
+Parent=Lynx
+Browser="Lynx"
+Version=2.8
+MajorVer=2
+MinorVer=8
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; w3m
+
+[w3m]
+Parent=DefaultProperties
+Browser="w3m"
+Frames=true
+Tables=true
+
+[w3m/0.1*]
+Parent=w3m
+Browser="w3m"
+Version=0.1
+MajorVer=0
+MinorVer=1
+
+[w3m/0.2*]
+Parent=w3m
+Browser="w3m"
+Version=0.2
+MajorVer=0
+MinorVer=2
+
+[w3m/0.3*]
+Parent=w3m
+Browser="w3m"
+Version=0.3
+MajorVer=0
+MinorVer=3
+
+[w3m/0.4*]
+Parent=w3m
+Browser="w3m"
+Version=0.4
+MajorVer=0
+MinorVer=4
+Cookies=true
+
+[w3m/0.5*]
+Parent=w3m
+Browser="w3m"
+Version=0.5
+MajorVer=0
+MinorVer=5
+Cookies=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.10
+
+[ELinks 0.10]
+Parent=DefaultProperties
+Browser="ELinks"
+Version=0.10
+MinorVer=10
+Frames=true
+Tables=true
+
+[ELinks (0.10*; *AIX*)]
+Parent=ELinks 0.10
+Platform=AIX
+
+[ELinks (0.10*; *BeOS*)]
+Parent=ELinks 0.10
+Platform=BeOS
+
+[ELinks (0.10*; *CygWin*)]
+Parent=ELinks 0.10
+Platform=CygWin
+
+[ELinks (0.10*; *Darwin*)]
+Parent=ELinks 0.10
+Platform=Darwin
+
+[ELinks (0.10*; *Digital Unix*)]
+Parent=ELinks 0.10
+Platform=Digital Unix
+
+[ELinks (0.10*; *FreeBSD*)]
+Parent=ELinks 0.10
+Platform=FreeBSD
+
+[ELinks (0.10*; *HPUX*)]
+Parent=ELinks 0.10
+Platform=HP-UX
+
+[ELinks (0.10*; *IRIX*)]
+Parent=ELinks 0.10
+Platform=IRIX
+
+[ELinks (0.10*; *Linux*)]
+Parent=ELinks 0.10
+Platform=Linux
+
+[ELinks (0.10*; *NetBSD*)]
+Parent=ELinks 0.10
+Platform=NetBSD
+
+[ELinks (0.10*; *OpenBSD*)]
+Parent=ELinks 0.10
+Platform=OpenBSD
+
+[ELinks (0.10*; *OS/2*)]
+Parent=ELinks 0.10
+Platform=OS/2
+
+[ELinks (0.10*; *RISC*)]
+Parent=ELinks 0.10
+Platform=RISC OS
+
+[ELinks (0.10*; *Solaris*)]
+Parent=ELinks 0.10
+Platform=Solaris
+
+[ELinks (0.10*; *Unix*)]
+Parent=ELinks 0.10
+Platform=Unix
+
+[ELinks/0.10* (*AIX*)]
+Parent=ELinks 0.10
+Platform=AIX
+
+[ELinks/0.10* (*BeOS*)]
+Parent=ELinks 0.10
+Platform=BeOS
+
+[ELinks/0.10* (*CygWin*)]
+Parent=ELinks 0.10
+Platform=CygWin
+
+[ELinks/0.10* (*Darwin*)]
+Parent=ELinks 0.10
+Platform=Darwin
+
+[ELinks/0.10* (*Digital Unix*)]
+Parent=ELinks 0.10
+Platform=Digital Unix
+
+[ELinks/0.10* (*FreeBSD*)]
+Parent=ELinks 0.10
+Platform=FreeBSD
+
+[ELinks/0.10* (*HPUX*)]
+Parent=ELinks 0.10
+Platform=HP-UX
+
+[ELinks/0.10* (*IRIX*)]
+Parent=ELinks 0.10
+Platform=IRIX
+
+[ELinks/0.10* (*Linux*)]
+Parent=ELinks 0.10
+Platform=Linux
+
+[ELinks/0.10* (*NetBSD*)]
+Parent=ELinks 0.10
+Platform=NetBSD
+
+[ELinks/0.10* (*OpenBSD*)]
+Parent=ELinks 0.10
+Platform=OpenBSD
+
+[ELinks/0.10* (*OS/2*)]
+Parent=ELinks 0.10
+Platform=OS/2
+
+[ELinks/0.10* (*RISC*)]
+Parent=ELinks 0.10
+Platform=RISC OS
+
+[ELinks/0.10* (*Solaris*)]
+Parent=ELinks 0.10
+Platform=Solaris
+
+[ELinks/0.10* (*Unix*)]
+Parent=ELinks 0.10
+Platform=Unix
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.11
+
+[ELinks 0.11]
+Parent=DefaultProperties
+Browser="ELinks"
+Version=0.11
+MinorVer=11
+Frames=true
+Tables=true
+
+[ELinks (0.11*; *AIX*)]
+Parent=ELinks 0.11
+Platform=AIX
+
+[ELinks (0.11*; *BeOS*)]
+Parent=ELinks 0.11
+Platform=BeOS
+
+[ELinks (0.11*; *CygWin*)]
+Parent=ELinks 0.11
+Platform=CygWin
+
+[ELinks (0.11*; *Darwin*)]
+Parent=ELinks 0.11
+Platform=Darwin
+
+[ELinks (0.11*; *Digital Unix*)]
+Parent=ELinks 0.11
+Platform=Digital Unix
+
+[ELinks (0.11*; *FreeBSD*)]
+Parent=ELinks 0.11
+Platform=FreeBSD
+
+[ELinks (0.11*; *HPUX*)]
+Parent=ELinks 0.11
+Platform=HP-UX
+
+[ELinks (0.11*; *IRIX*)]
+Parent=ELinks 0.11
+Platform=IRIX
+
+[ELinks (0.11*; *Linux*)]
+Parent=ELinks 0.11
+Platform=Linux
+
+[ELinks (0.11*; *NetBSD*)]
+Parent=ELinks 0.11
+Platform=NetBSD
+
+[ELinks (0.11*; *OpenBSD*)]
+Parent=ELinks 0.11
+Platform=OpenBSD
+
+[ELinks (0.11*; *OS/2*)]
+Parent=ELinks 0.11
+Platform=OS/2
+
+[ELinks (0.11*; *RISC*)]
+Parent=ELinks 0.11
+Platform=RISC OS
+
+[ELinks (0.11*; *Solaris*)]
+Parent=ELinks 0.11
+Platform=Solaris
+
+[ELinks (0.11*; *Unix*)]
+Parent=ELinks 0.11
+Platform=Unix
+
+[ELinks/0.11* (*AIX*)]
+Parent=ELinks 0.11
+Platform=AIX
+
+[ELinks/0.11* (*BeOS*)]
+Parent=ELinks 0.11
+Platform=BeOS
+
+[ELinks/0.11* (*CygWin*)]
+Parent=ELinks 0.11
+Platform=CygWin
+
+[ELinks/0.11* (*Darwin*)]
+Parent=ELinks 0.11
+Platform=Darwin
+
+[ELinks/0.11* (*Digital Unix*)]
+Parent=ELinks 0.11
+Platform=Digital Unix
+
+[ELinks/0.11* (*FreeBSD*)]
+Parent=ELinks 0.11
+Platform=FreeBSD
+
+[ELinks/0.11* (*HPUX*)]
+Parent=ELinks 0.11
+Platform=HP-UX
+
+[ELinks/0.11* (*IRIX*)]
+Parent=ELinks 0.11
+Platform=IRIX
+
+[ELinks/0.11* (*Linux*)]
+Parent=ELinks 0.11
+Platform=Linux
+
+[ELinks/0.11* (*NetBSD*)]
+Parent=ELinks 0.11
+Platform=NetBSD
+
+[ELinks/0.11* (*OpenBSD*)]
+Parent=ELinks 0.11
+Platform=OpenBSD
+
+[ELinks/0.11* (*OS/2*)]
+Parent=ELinks 0.11
+Platform=OS/2
+
+[ELinks/0.11* (*RISC*)]
+Parent=ELinks 0.11
+Platform=RISC OS
+
+[ELinks/0.11* (*Solaris*)]
+Parent=ELinks 0.11
+Platform=Solaris
+
+[ELinks/0.11* (*Unix*)]
+Parent=ELinks 0.11
+Platform=Unix
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.12
+
+[ELinks 0.12]
+Parent=DefaultProperties
+Browser="ELinks"
+Version=0.12
+MinorVer=12
+Frames=true
+Tables=true
+
+[ELinks (0.12*; *AIX*)]
+Parent=ELinks 0.12
+Platform=AIX
+
+[ELinks (0.12*; *BeOS*)]
+Parent=ELinks 0.12
+Platform=BeOS
+
+[ELinks (0.12*; *CygWin*)]
+Parent=ELinks 0.12
+Platform=CygWin
+
+[ELinks (0.12*; *Darwin*)]
+Parent=ELinks 0.12
+Platform=Darwin
+
+[ELinks (0.12*; *Digital Unix*)]
+Parent=ELinks 0.12
+Platform=Digital Unix
+
+[ELinks (0.12*; *FreeBSD*)]
+Parent=ELinks 0.12
+Platform=FreeBSD
+
+[ELinks (0.12*; *HPUX*)]
+Parent=ELinks 0.12
+Platform=HP-UX
+
+[ELinks (0.12*; *IRIX*)]
+Parent=ELinks 0.12
+Platform=IRIX
+
+[ELinks (0.12*; *Linux*)]
+Parent=ELinks 0.12
+Platform=Linux
+
+[ELinks (0.12*; *NetBSD*)]
+Parent=ELinks 0.12
+Platform=NetBSD
+
+[ELinks (0.12*; *OpenBSD*)]
+Parent=ELinks 0.12
+Platform=OpenBSD
+
+[ELinks (0.12*; *OS/2*)]
+Parent=ELinks 0.12
+Platform=OS/2
+
+[ELinks (0.12*; *RISC*)]
+Parent=ELinks 0.12
+Platform=RISC OS
+
+[ELinks (0.12*; *Solaris*)]
+Parent=ELinks 0.12
+Platform=Solaris
+
+[ELinks (0.12*; *Unix*)]
+Parent=ELinks 0.12
+Platform=Unix
+
+[ELinks/0.12* (*AIX*)]
+Parent=ELinks 0.12
+Platform=AIX
+
+[ELinks/0.12* (*BeOS*)]
+Parent=ELinks 0.12
+Platform=BeOS
+
+[ELinks/0.12* (*CygWin*)]
+Parent=ELinks 0.12
+Platform=CygWin
+
+[ELinks/0.12* (*Darwin*)]
+Parent=ELinks 0.12
+Platform=Darwin
+
+[ELinks/0.12* (*Digital Unix*)]
+Parent=ELinks 0.12
+Platform=Digital Unix
+
+[ELinks/0.12* (*FreeBSD*)]
+Parent=ELinks 0.12
+Platform=FreeBSD
+
+[ELinks/0.12* (*HPUX*)]
+Parent=ELinks 0.12
+Platform=HP-UX
+
+[ELinks/0.12* (*IRIX*)]
+Parent=ELinks 0.12
+Platform=IRIX
+
+[ELinks/0.12* (*Linux*)]
+Parent=ELinks 0.12
+Platform=Linux
+
+[ELinks/0.12* (*NetBSD*)]
+Parent=ELinks 0.12
+Platform=NetBSD
+
+[ELinks/0.12* (*OpenBSD*)]
+Parent=ELinks 0.12
+Platform=OpenBSD
+
+[ELinks/0.12* (*OS/2*)]
+Parent=ELinks 0.12
+Platform=OS/2
+
+[ELinks/0.12* (*RISC*)]
+Parent=ELinks 0.12
+Platform=RISC OS
+
+[ELinks/0.12* (*Solaris*)]
+Parent=ELinks 0.12
+Platform=Solaris
+
+[ELinks/0.12* (*Unix*)]
+Parent=ELinks 0.12
+Platform=Unix
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.9
+
+[ELinks 0.9]
+Parent=DefaultProperties
+Browser="ELinks"
+Version=0.9
+MinorVer=9
+Frames=true
+Tables=true
+
+[ELinks (0.9*; *AIX*)]
+Parent=ELinks 0.9
+Platform=AIX
+
+[ELinks (0.9*; *BeOS*)]
+Parent=ELinks 0.9
+Platform=BeOS
+
+[ELinks (0.9*; *CygWin*)]
+Parent=ELinks 0.9
+Platform=CygWin
+
+[ELinks (0.9*; *Darwin*)]
+Parent=ELinks 0.9
+Platform=Darwin
+
+[ELinks (0.9*; *Digital Unix*)]
+Parent=ELinks 0.9
+Platform=Digital Unix
+
+[ELinks (0.9*; *FreeBSD*)]
+Parent=ELinks 0.9
+Platform=FreeBSD
+
+[ELinks (0.9*; *HPUX*)]
+Parent=ELinks 0.9
+Platform=HP-UX
+
+[ELinks (0.9*; *IRIX*)]
+Parent=ELinks 0.9
+Platform=IRIX
+
+[ELinks (0.9*; *Linux*)]
+Parent=ELinks 0.9
+Platform=Linux
+
+[ELinks (0.9*; *NetBSD*)]
+Parent=ELinks 0.9
+Platform=NetBSD
+
+[ELinks (0.9*; *OpenBSD*)]
+Parent=ELinks 0.9
+Platform=OpenBSD
+
+[ELinks (0.9*; *OS/2*)]
+Parent=ELinks 0.9
+Platform=OS/2
+
+[ELinks (0.9*; *RISC*)]
+Parent=ELinks 0.9
+Platform=RISC OS
+
+[ELinks (0.9*; *Solaris*)]
+Parent=ELinks 0.9
+Platform=Solaris
+
+[ELinks (0.9*; *Unix*)]
+Parent=ELinks 0.9
+Platform=Unix
+
+[ELinks/0.9* (*AIX*)]
+Parent=ELinks 0.9
+Platform=AIX
+
+[ELinks/0.9* (*BeOS*)]
+Parent=ELinks 0.9
+Platform=BeOS
+
+[ELinks/0.9* (*CygWin*)]
+Parent=ELinks 0.9
+Platform=CygWin
+
+[ELinks/0.9* (*Darwin*)]
+Parent=ELinks 0.9
+Platform=Darwin
+
+[ELinks/0.9* (*Digital Unix*)]
+Parent=ELinks 0.9
+Platform=Digital Unix
+
+[ELinks/0.9* (*FreeBSD*)]
+Parent=ELinks 0.9
+Platform=FreeBSD
+
+[ELinks/0.9* (*HPUX*)]
+Parent=ELinks 0.9
+Platform=HP-UX
+
+[ELinks/0.9* (*IRIX*)]
+Parent=ELinks 0.9
+Platform=IRIX
+
+[ELinks/0.9* (*Linux*)]
+Parent=ELinks 0.9
+Platform=Linux
+
+[ELinks/0.9* (*NetBSD*)]
+Parent=ELinks 0.9
+Platform=NetBSD
+
+[ELinks/0.9* (*OpenBSD*)]
+Parent=ELinks 0.9
+Platform=OpenBSD
+
+[ELinks/0.9* (*OS/2*)]
+Parent=ELinks 0.9
+Platform=OS/2
+
+[ELinks/0.9* (*RISC*)]
+Parent=ELinks 0.9
+Platform=RISC OS
+
+[ELinks/0.9* (*Solaris*)]
+Parent=ELinks 0.9
+Platform=Solaris
+
+[ELinks/0.9* (*Unix*)]
+Parent=ELinks 0.9
+Platform=Unix
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AppleWebKit
+
+[AppleWebKit]
+Parent=DefaultProperties
+Browser="AppleWebKit"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (KHTML, like Gecko)]
+Parent=AppleWebKit
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Camino
+
+[Camino]
+Parent=DefaultProperties
+Browser="Camino"
+Platform=MacOSX
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/0.7*]
+Parent=Camino
+Version=0.7
+MajorVer=0
+MinorVer=7
+Beta=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/0.8*]
+Parent=Camino
+Version=0.8
+MajorVer=0
+MinorVer=8
+Beta=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/0.9*]
+Parent=Camino
+Version=0.9
+MajorVer=0
+MinorVer=9
+Beta=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.0*]
+Parent=Camino
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.2*]
+Parent=Camino
+Version=1.2
+MajorVer=1
+MinorVer=2
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.3*]
+Parent=Camino
+Version=1.3
+MajorVer=1
+MinorVer=3
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.4*]
+Parent=Camino
+Version=1.4
+MajorVer=1
+MinorVer=4
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.5*]
+Parent=Camino
+Version=1.5
+MajorVer=1
+MinorVer=5
+Platform=MacOSX
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chimera
+
+[Chimera]
+Parent=DefaultProperties
+Browser="Chimera"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+
+[Mozilla/5.0 (Macintosh; U; *Mac OS X*; *; rv:1.*) Gecko/* Chimera/*]
+Parent=Chimera
+Platform=MacOSX
+
+[Mozilla/5.0 Gecko/* Chimera/*]
+Parent=Chimera
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dillo
+
+[Dillo]
+Parent=DefaultProperties
+Browser="Dillo"
+Platform=Linux
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Dillo/0.6*]
+Parent=Dillo
+Version=0.6
+MajorVer=0
+MinorVer=6
+
+[Dillo/0.7*]
+Parent=Dillo
+Version=0.7
+MajorVer=0
+MinorVer=7
+
+[Dillo/0.8*]
+Parent=Dillo
+Version=0.8
+MajorVer=0
+MinorVer=8
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Emacs/W3
+
+[Emacs/W3]
+Parent=DefaultProperties
+Browser="Emacs/W3"
+Frames=true
+Tables=true
+Cookies=true
+
+[Emacs/W3/2.* (Unix*]
+Parent=Emacs/W3
+Version=2.0
+MajorVer=2
+MinorVer=0
+Platform=Unix
+
+[Emacs/W3/2.* (X11*]
+Parent=Emacs/W3
+Version=2.0
+MajorVer=2
+MinorVer=0
+Platform=Linux
+
+[Emacs/W3/3.* (Unix*]
+Parent=Emacs/W3
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=Unix
+
+[Emacs/W3/3.* (X11*]
+Parent=Emacs/W3
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=Linux
+
+[Emacs/W3/4.* (Unix*]
+Parent=Emacs/W3
+Version=4.0
+MajorVer=4
+MinorVer=0
+Platform=Unix
+
+[Emacs/W3/4.* (X11*]
+Parent=Emacs/W3
+Version=4.0
+MajorVer=4
+MinorVer=0
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; fantomas
+
+[fantomas]
+Parent=DefaultProperties
+Browser="fantomas"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaScript=true
+
+[Mozilla/4.0 (cloakBrowser)]
+Parent=fantomas
+Browser="fantomas cloakBrowser"
+
+[Mozilla/4.0 (fantomas shadowMaker Browser)]
+Parent=fantomas
+Browser="fantomas shadowMaker Browser"
+
+[Mozilla/4.0 (fantomBrowser)]
+Parent=fantomas
+Browser="fantomas fantomBrowser"
+
+[Mozilla/4.0 (fantomCrew Browser)]
+Parent=fantomas
+Browser="fantomas fantomCrew Browser"
+
+[Mozilla/4.0 (stealthBrowser)]
+Parent=fantomas
+Browser="fantomas stealthBrowser"
+
+[multiBlocker browser*]
+Parent=fantomas
+Browser="fantomas multiBlocker browser"
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FrontPage
+
+[FrontPage]
+Parent=DefaultProperties
+Browser="FrontPage"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaScript=true
+
+[Mozilla/?* (compatible; MS FrontPage*)]
+Parent=FrontPage
+
+[MSFrontPage/*]
+Parent=FrontPage
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Galeon
+
+[Galeon]
+Parent=DefaultProperties
+Browser="Galeon"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (X11; U; Linux*) Gecko/* Galeon/1.0*]
+Parent=Galeon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Linux
+
+[Mozilla/5.0 (X11; U; Linux*) Gecko/* Galeon/1.1*]
+Parent=Galeon
+Version=1.1
+MajorVer=1
+MinorVer=1
+Platform=Linux
+
+[Mozilla/5.0 (X11; U; Linux*) Gecko/* Galeon/1.2*]
+Parent=Galeon
+Version=1.2
+MajorVer=1
+MinorVer=2
+Platform=Linux
+
+[Mozilla/5.0 (X11; U; Linux*) Gecko/* Galeon/1.3*]
+Parent=Galeon
+Version=1.3
+MajorVer=1
+MinorVer=3
+Platform=Linux
+
+[Mozilla/5.0 (X11; U; Linux*; Debian/*) Gecko/* Galeon/1.0*]
+Parent=Galeon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Debian
+
+[Mozilla/5.0 (X11; U; Linux*; Debian/*) Gecko/* Galeon/1.1*]
+Parent=Galeon
+Version=1.1
+MajorVer=1
+MinorVer=1
+Platform=Debian
+
+[Mozilla/5.0 (X11; U; Linux*; Debian/*) Gecko/* Galeon/1.2*]
+Parent=Galeon
+Version=1.2
+MajorVer=1
+MinorVer=2
+Platform=Debian
+
+[Mozilla/5.0 (X11; U; Linux*; Debian/*) Gecko/* Galeon/1.3*]
+Parent=Galeon
+Version=1.3
+MajorVer=1
+MinorVer=3
+Platform=Debian
+
+[Mozilla/5.0 Galeon/1.0* (X11; Linux*)*]
+Parent=Galeon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Linux
+
+[Mozilla/5.0 Galeon/1.1* (X11; Linux*)*]
+Parent=Galeon
+Version=1.1
+MajorVer=1
+MinorVer=1
+Platform=Linux
+
+[Mozilla/5.0 Galeon/1.2* (X11; Linux*)*]
+Parent=Galeon
+Version=1.2
+MajorVer=1
+MinorVer=2
+Platform=Linux
+
+[Mozilla/5.0 Galeon/1.3* (X11; Linux*)*]
+Parent=Galeon
+Version=1.3
+MajorVer=1
+MinorVer=3
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HP Secure Web Browser
+
+[HP Secure Web Browser]
+Parent=DefaultProperties
+Browser="HP Secure Web Browser"
+Platform=OpenVMS
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.0*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.1*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.1
+MajorVer=1
+MinorVer=1
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.2*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.2
+MajorVer=1
+MinorVer=2
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.3*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.3
+MajorVer=1
+MinorVer=3
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.4*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.4
+MajorVer=1
+MinorVer=4
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.5*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.5
+MajorVer=1
+MinorVer=5
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.6*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.6
+MajorVer=1
+MinorVer=6
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.7*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.7
+MajorVer=1
+MinorVer=7
+
+[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.8*) Gecko/*]
+Parent=HP Secure Web Browser
+Version=1.8
+MajorVer=1
+MinorVer=8
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IBrowse
+
+[IBrowse]
+Parent=DefaultProperties
+Browser="IBrowse"
+Platform=Amiga
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+
+[Arexx (compatible; MSIE 6.0; AmigaOS5.0) IBrowse 4.0]
+Parent=IBrowse
+Version=4.0
+MajorVer=4
+MinorVer=0
+
+[IBrowse/1.22 (AmigaOS *)]
+Parent=IBrowse
+Version=1.22
+MajorVer=1
+MinorVer=22
+
+[IBrowse/2.1 (AmigaOS *)]
+Parent=IBrowse
+Version=2.1
+MajorVer=2
+MinorVer=1
+
+[IBrowse/2.2 (AmigaOS *)]
+Parent=IBrowse
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+[IBrowse/2.3 (AmigaOS *)]
+Parent=IBrowse
+Version=2.2
+MajorVer=2
+MinorVer=3
+
+[Mozilla/* (Win98; I) IBrowse/2.1 (AmigaOS 3.1)]
+Parent=IBrowse
+Version=2.1
+MajorVer=2
+MinorVer=1
+
+[Mozilla/* (Win98; I) IBrowse/2.2 (AmigaOS 3.1)]
+Parent=IBrowse
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+[Mozilla/* (Win98; I) IBrowse/2.3 (AmigaOS 3.1)]
+Parent=IBrowse
+Version=2.3
+MajorVer=2
+MinorVer=3
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iCab
+
+[iCab]
+Parent=DefaultProperties
+Browser="iCab"
+Frames=true
+Tables=true
+Cookies=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[iCab/2.7* (Macintosh; ?; 68K*)]
+Parent=iCab
+Version=2.7
+MajorVer=2
+MinorVer=7
+Platform=Mac68K
+
+[iCab/2.7* (Macintosh; ?; PPC*)]
+Parent=iCab
+Version=2.7
+MajorVer=2
+MinorVer=7
+Platform=MacPPC
+
+[iCab/2.8* (Macintosh; ?; *Mac OS X*)]
+Parent=iCab
+Version=2.8
+MajorVer=2
+MinorVer=8
+Platform=MacOSX
+
+[iCab/2.8* (Macintosh; ?; 68K*)]
+Parent=iCab
+Version=2.8
+MajorVer=2
+MinorVer=8
+Platform=Mac68K
+
+[iCab/2.8* (Macintosh; ?; PPC)]
+Parent=iCab
+Version=2.8
+MajorVer=2
+MinorVer=8
+Platform=MacPPC
+
+[iCab/2.9* (Macintosh; ?; *Mac OS X*)]
+Parent=iCab
+Version=2.9
+MajorVer=2
+MinorVer=9
+Platform=MacOSX
+
+[iCab/2.9* (Macintosh; ?; 68K*)]
+Parent=iCab
+Version=2.9
+MajorVer=2
+MinorVer=9
+Platform=Mac68K
+
+[iCab/2.9* (Macintosh; ?; PPC*)]
+Parent=iCab
+Version=2.9
+MajorVer=2
+MinorVer=9
+Platform=MacPPC
+
+[iCab/3.0* (Macintosh; ?; *Mac OS X*)]
+Parent=iCab
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=MacOSX
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[iCab/3.0* (Macintosh; ?; PPC*)]
+Parent=iCab
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=MacPPC
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; iCab 3.0*; Macintosh; *Mac OS X*)]
+Parent=iCab
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=MacOSX
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; iCab 3.0*; Macintosh; ?; PPC*)]
+Parent=iCab
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=MacPPC
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/4.5 (compatible; iCab 2.7*; Macintosh; ?; 68K*)]
+Parent=iCab
+Version=2.7
+MajorVer=2
+MinorVer=7
+Platform=Mac68K
+
+[Mozilla/4.5 (compatible; iCab 2.7*; Macintosh; ?; PPC*)]
+Parent=iCab
+Version=2.7
+MajorVer=2
+MinorVer=7
+Platform=MacPPC
+
+[Mozilla/4.5 (compatible; iCab 2.8*; Macintosh; ?; *Mac OS X*)]
+Parent=iCab
+Version=2.8
+MajorVer=2
+MinorVer=8
+Platform=MacOSX
+
+[Mozilla/4.5 (compatible; iCab 2.8*; Macintosh; ?; PPC*)]
+Parent=iCab
+Version=2.8
+MajorVer=2
+MinorVer=8
+Platform=MacPPC
+
+[Mozilla/4.5 (compatible; iCab 2.9*; Macintosh; *Mac OS X*)]
+Parent=iCab
+Version=2.9
+MajorVer=2
+MinorVer=9
+Platform=MacOSX
+
+[Mozilla/4.5 (compatible; iCab 2.9*; Macintosh; ?; PPC*)]
+Parent=iCab
+Version=2.9
+MajorVer=2
+MinorVer=9
+Platform=MacPPC
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iSiloX
+
+[iSiloX]
+Parent=DefaultProperties
+Browser="iSiloX"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaScript=true
+Crawler=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[iSiloX/4.0* MacOS]
+Parent=iSiloX
+Version=4.0
+MajorVer=4
+MinorVer=0
+Platform=MacPPC
+
+[iSiloX/4.0* Windows/32]
+Parent=iSiloX
+Version=4.0
+MajorVer=4
+MinorVer=0
+Platform=Win32
+Win32=true
+
+[iSiloX/4.1* MacOS]
+Parent=iSiloX
+Version=4.1
+MajorVer=4
+MinorVer=1
+Platform=MacPPC
+
+[iSiloX/4.1* Windows/32]
+Parent=iSiloX
+Version=4.1
+MajorVer=4
+MinorVer=1
+Platform=Win32
+Win32=true
+
+[iSiloX/4.2* MacOS]
+Parent=iSiloX
+Version=4.2
+MajorVer=4
+MinorVer=2
+Platform=MacPPC
+
+[iSiloX/4.2* Windows/32]
+Parent=iSiloX
+Version=4.2
+MajorVer=4
+MinorVer=2
+Platform=Win32
+Win32=true
+
+[iSiloX/4.3* MacOS]
+Parent=iSiloX
+Version=4.3
+MajorVer=4
+MinorVer=4
+Platform=MacOSX
+
+[iSiloX/4.3* Windows/32]
+Parent=iSiloX
+Version=4.3
+MajorVer=4
+MinorVer=3
+Platform=Win32
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; K-Meleon
+
+[K-Meleon]
+Parent=DefaultProperties
+Browser="K-Meleon"
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon 0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon/0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon/0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon/1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* K-Meleon?0.7*]
+Parent=K-Meleon
+Version=0.7
+MajorVer=0
+MinorVer=7
+Platform=Linux
+Win32=false
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* K-Meleon?0.8*]
+Parent=K-Meleon
+Version=0.8
+MajorVer=0
+MinorVer=8
+Platform=Linux
+Win32=false
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* K-Meleon?0.9*]
+Parent=K-Meleon
+Version=0.9
+MajorVer=0
+MinorVer=9
+Platform=Linux
+Win32=false
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* K-Meleon?1.0*]
+Parent=K-Meleon
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Linux
+Win32=false
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror
+
+[Konqueror]
+Parent=DefaultProperties
+Browser="Konqueror"
+Platform=Linux
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[*Konqueror/2.*]
+Parent=Konqueror
+IFrames=false
+
+[*Konqueror/3.0*]
+Parent=Konqueror
+Version=3.0
+MajorVer=3
+MinorVer=0
+IFrames=false
+
+[*Konqueror/3.0*FreeBSD*]
+Parent=Konqueror
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=FreeBSD
+IFrames=false
+
+[*Konqueror/3.0*Linux*]
+Parent=Konqueror
+Version=3.0
+MajorVer=3
+MinorVer=0
+Platform=Linux
+IFrames=false
+
+[*Konqueror/3.1*]
+Parent=Konqueror
+Version=3.1
+MajorVer=3
+MinorVer=1
+
+[*Konqueror/3.1*FreeBSD*]
+Parent=Konqueror
+Version=3.1
+MajorVer=3
+MinorVer=1
+Platform=FreeBSD
+
+[*Konqueror/3.1*Linux*]
+Parent=Konqueror
+Version=3.1
+MajorVer=3
+MinorVer=1
+
+[*Konqueror/3.2*]
+Parent=Konqueror
+Version=3.2
+MajorVer=3
+MinorVer=2
+
+[*Konqueror/3.2*FreeBSD*]
+Parent=Konqueror
+Version=3.2
+MajorVer=3
+MinorVer=2
+Platform=FreeBSD
+
+[*Konqueror/3.2*Linux*]
+Parent=Konqueror
+Version=3.2
+MajorVer=3
+MinorVer=2
+Platform=Linux
+
+[*Konqueror/3.3*]
+Parent=Konqueror
+Version=3.3
+MajorVer=3
+MinorVer=3
+
+[*Konqueror/3.3*FreeBSD*]
+Parent=Konqueror
+Version=3.3
+MajorVer=3
+MinorVer=3
+Platform=FreeBSD
+
+[*Konqueror/3.3*Linux*]
+Parent=Konqueror
+Version=3.3
+MajorVer=3
+MinorVer=3
+Platform=Linux
+
+[*Konqueror/3.3*OpenBSD*]
+Parent=Konqueror
+Version=3.3
+MajorVer=3
+MinorVer=3
+Platform=OpenBSD
+
+[*Konqueror/3.4*]
+Parent=Konqueror
+Version=3.4
+MajorVer=3
+MinorVer=4
+
+[*Konqueror/3.4*FreeBSD*]
+Parent=Konqueror
+Version=3.4
+MajorVer=3
+MinorVer=4
+Platform=FreeBSD
+
+[*Konqueror/3.4*Linux*]
+Parent=Konqueror
+Version=3.4
+MajorVer=3
+MinorVer=4
+Platform=Linux
+
+[*Konqueror/3.4*OpenBSD*]
+Parent=Konqueror
+Version=3.4
+MajorVer=3
+MinorVer=4
+Platform=OpenBSD
+
+[*Konqueror/3.5*]
+Parent=Konqueror
+Version=3.5
+MajorVer=3
+MinorVer=5
+
+[*Konqueror/3.5*FreeBSD*]
+Parent=Konqueror
+Version=3.5
+MajorVer=3
+MinorVer=5
+Platform=FreeBSD
+
+[*Konqueror/3.5*Linux*]
+Parent=Konqueror
+Version=3.5
+MajorVer=3
+MinorVer=5
+Platform=Linux
+
+[*Konqueror/3.5*OpenBSD*]
+Parent=Konqueror
+Version=3.5
+MajorVer=3
+MinorVer=5
+Platform=OpenBSD
+
+[Konqueror*]
+Parent=Konqueror
+IFrames=false
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lycoris Desktop/LX
+
+[Lycoris Desktop/LX]
+Parent=DefaultProperties
+Browser="Lycoris Desktop/LX"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+Crawler=true
+
+[Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.*: Desktop/LX Amethyst) Gecko/*]
+Parent=Lycoris Desktop/LX
+Version=1.1
+MajorVer=1
+MinorVer=1
+Platform=Linux
+
+[Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.*; Desktop/LX Amethyst) Gecko/*]
+Parent=Lycoris Desktop/LX
+Version=1.0
+MajorVer=1
+MinorVer=0
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mosaic
+
+[Mosaic]
+Parent=DefaultProperties
+Browser="Mosaic"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+
+[Mozilla/4.0 (VMS_Mosaic)]
+Parent=Mosaic
+Platform=OpenVMS
+
+[VMS_Mosaic/3.7*]
+Parent=Mosaic
+Version=3.7
+MajorVer=3
+MinorVer=7
+Platform=OpenVMS
+
+[VMS_Mosaic/3.8*]
+Parent=Mosaic
+Version=3.8
+MajorVer=3
+MinorVer=8
+Platform=OpenVMS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetPositive
+
+[NetPositive]
+Parent=DefaultProperties
+Browser="NetPositive"
+Platform=BeOS
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+
+[*NetPositive/2.2*]
+Parent=NetPositive
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+[*NetPositive/2.2*BeOS*]
+Parent=NetPositive
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OmniWeb
+
+[OmniWeb]
+Parent=DefaultProperties
+Browser="OmniWeb"
+Platform=MacOSX
+Frames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+WAP=true
+isMobileDevice=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (Macintosh; ?; *Mac OS X; *) AppleWebKit/* (*) OmniWeb/v4*]
+Parent=OmniWeb
+Version=4.5
+MajorVer=4
+MinorVer=5
+Platform=MacOSX
+
+[Mozilla/* (Macintosh; ?; *Mac OS X; *) AppleWebKit/* (*) OmniWeb/v5*]
+Parent=OmniWeb
+Version=5.
+MajorVer=5
+MinorVer=0
+Platform=MacOSX
+
+[Mozilla/* (Macintosh; ?; *Mac OS X; *) AppleWebKit/* (*) OmniWeb/v6*]
+Parent=OmniWeb
+Version=6.0
+MajorVer=6
+MinorVer=0
+Platform=MacOSX
+
+[Mozilla/* (Macintosh; ?; PPC) OmniWeb/4*]
+Parent=OmniWeb
+Version=4.0
+MajorVer=4
+MinorVer=0
+Platform=MacPPC
+
+[Mozilla/* (Macintosh; ?; PPC) OmniWeb/5*]
+Parent=OmniWeb
+Version=5.0
+MajorVer=5
+MinorVer=0
+Platform=MacOSX
+
+[Mozilla/* (Macintosh; ?; PPC) OmniWeb/6*]
+Parent=OmniWeb
+Version=6.0
+MajorVer=6
+MinorVer=0
+Platform=MacPPC
+
+[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/125.4 (KHTML, like Gecko, Safari) OmniWeb/v563.34]
+Parent=OmniWeb
+Version=5.1
+MajorVer=5
+MinorVer=1
+
+[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/420+ (KHTML, like Gecko, Safari/420) OmniWeb/v607]
+Parent=OmniWeb
+Version=5.5
+MajorVer=5
+MinorVer=5
+
+[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/522+ (KHTML, like Gecko, Safari/522) OmniWeb/v613]
+Parent=OmniWeb
+Version=5.6
+MajorVer=5
+MinorVer=6
+
+[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v496]
+Parent=OmniWeb
+Version=4.5
+MajorVer=4
+MinorVer=5
+
+[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.36 ]
+Parent=OmniWeb
+Version=5.0
+MajorVer=5
+MinorVer=0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari
+
+[Safari]
+Parent=DefaultProperties
+Browser="Safari"
+Platform=MacOSX
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/100*]
+Parent=Safari
+Version=1.1
+MajorVer=1
+MinorVer=1
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/125*]
+Parent=Safari
+Version=1.2
+MajorVer=1
+MinorVer=2
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/312*]
+Parent=Safari
+Version=1.3
+MajorVer=1
+MinorVer=3
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/412*]
+Parent=Safari
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/416*]
+Parent=Safari
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/417*]
+Parent=Safari
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/418*]
+Parent=Safari
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/419*]
+Parent=Safari
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/52*]
+Parent=Safari
+Beta=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/85*]
+Parent=Safari
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 3.0
+
+[Safari 3.0]
+Parent=DefaultProperties
+Browser="Safari"
+Version=3.0
+MajorVer=3
+Platform=MacOSX
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.0* Safari/*]
+Parent=Safari 3.0
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) AppleWebKit/* (*) Version/3.0* Safari/*]
+Parent=Safari 3.0
+Platform=WinXP
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) AppleWebKit/* (*) Version/3.0* Safari/*]
+Parent=Safari 3.0
+Platform=Win2003
+
+[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/3.0* Safari/*]
+Parent=Safari 3.0
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 3.1
+
+[Safari 3.1]
+Parent=DefaultProperties
+Browser="Safari"
+Version=3.1
+MajorVer=3
+MinorVer=1
+Platform=MacOSX
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.1* Safari/*]
+Parent=Safari 3.1
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) AppleWebKit/* (*) Version/3.1* Safari/*]
+Parent=Safari 3.1
+Platform=WinXP
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) AppleWebKit/* (*) Version/3.1* Safari/*]
+Parent=Safari 3.1
+Platform=Win2003
+
+[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/3.1* Safari/*]
+Parent=Safari 3.1
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 4.0
+
+[Safari 4.0]
+Parent=DefaultProperties
+Browser="Safari"
+Version=4.0
+MajorVer=4
+Platform=MacOSX
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *s) AppleWebKit/* (KHTML, like Gecko) Version/4.0* Safari/*]
+Parent=Safari 4.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Shiira
+
+[Shiira]
+Parent=DefaultProperties
+Browser="Shiira"
+Platform=MacOSX
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/0.9*]
+Parent=Shiira
+Version=0.9
+MajorVer=0
+MinorVer=9
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/1.0*]
+Parent=Shiira
+Version=1.0
+MajorVer=1
+MinorVer=0
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/1.1*]
+Parent=Shiira
+Version=1.1
+MajorVer=1
+MinorVer=1
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/1.2*]
+Parent=Shiira
+Version=1.2
+MajorVer=1
+MinorVer=2
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/2.1*]
+Parent=Shiira
+Version=2.1
+MajorVer=2
+MinorVer=1
+
+[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/2.2*]
+Parent=Shiira
+Version=2.2
+MajorVer=2
+MinorVer=2
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 4.0
+
+[Opera 4.0]
+Parent=DefaultProperties
+Browser="Opera"
+Version=4
+MajorVer=4
+Frames=true
+Tables=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/3.0 (Linux*; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Linux
+
+[Mozilla/3.0 (Mac_PowerPC; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=MacPPC
+
+[Mozilla/3.0 (Windows 2000; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/3.0 (Windows 95; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win95
+Win32=true
+
+[Mozilla/3.0 (Windows 98; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win98
+Win32=true
+
+[Mozilla/3.0 (Windows ME; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinME
+Win32=true
+
+[Mozilla/3.0 (Windows NT 4.0; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/3.0 (Windows XP; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 4.*]
+Parent=Opera 4.0
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 4.*]
+Parent=Opera 4.0
+Platform=MacPPC
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.73 (Windows 98; U) Opera 4.*]
+Parent=Opera 4.0
+MinorVer=02
+Win32=true
+
+[Mozilla/4.76 (Macintosh;US;PPC) Opera 4.*]
+Parent=Opera 4.0
+Platform=MacPPC
+
+[Mozilla/4.78 (Linux*; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Linux
+
+[Mozilla/4.78 (Mac_PowerPC; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=MacPPC
+
+[Mozilla/4.78 (Windows 2000; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78 (Windows 95; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.78 (Windows 98; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.78 (Windows ME; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.78 (Windows NT 4.0; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.78 (Windows XP; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Linux*; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Linux
+
+[Mozilla/5.0 (Mac_PowerPC; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows 2000; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows 95; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows 98; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows ME; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows NT 4.0; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows XP; U) Opera 4.*]
+Parent=Opera 4.0
+Platform=WinXP
+Win32=true
+
+[Opera/4.* (Linux*; U)*]
+Parent=Opera 4.0
+Platform=Linux
+
+[Opera/4.* (Mac_PowerPC; U)*]
+Parent=Opera 4.0
+Platform=MacPPC
+
+[Opera/4.* (Windows 2000; U)*]
+Parent=Opera 4.0
+Platform=Win2000
+Win32=true
+
+[Opera/4.* (Windows 95; U)*]
+Parent=Opera 4.0
+Platform=Win95
+Win32=true
+
+[Opera/4.* (Windows 98; U)*]
+Parent=Opera 4.0
+Platform=Win98
+Win32=true
+
+[Opera/4.* (Windows ME; U)*]
+Parent=Opera 4.0
+Platform=WinME
+Win32=true
+
+[Opera/4.* (Windows NT 4.0; U)*]
+Parent=Opera 4.0
+Platform=WinNT
+Win32=true
+
+[Opera/4.* (Windows XP; U)*]
+Parent=Opera 4.0
+Platform=WinXP
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 5.0
+
+[Opera 5.0]
+Parent=DefaultProperties
+Browser="Opera"
+Version=5.0
+MajorVer=5
+Frames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/3.0 (Linux*; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Linux
+
+[Mozilla/3.0 (Mac_PowerPC; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=MacPPC
+
+[Mozilla/3.0 (Windows 2000; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/3.0 (Windows 95; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win95
+Win32=true
+
+[Mozilla/3.0 (Windows 98; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win98
+Win32=true
+
+[Mozilla/3.0 (Windows ME; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinME
+Win32=true
+
+[Mozilla/3.0 (Windows NT 4.0; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/3.0 (Windows XP; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0*]
+Parent=Opera 5.0
+Platform=MacPPC
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.76 (Macintosh;US;PPC) Opera 5.0*]
+Parent=Opera 5.0
+Platform=MacPPC
+
+[Mozilla/4.78 (Linux*; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Linux
+
+[Mozilla/4.78 (Mac_PowerPC; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=MacPPC
+
+[Mozilla/4.78 (Windows 2000; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78 (Windows 95; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.78 (Windows 98; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.78 (Windows ME; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.78 (Windows NT 4.0; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.78 (Windows XP; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Linux*; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Linux
+
+[Mozilla/5.0 (Mac_PowerPC; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=MacPPC
+
+[Mozilla/5.0 (SunOS*; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=SunOS
+
+[Mozilla/5.0 (Windows 2000; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows 95; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows 98; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows ME; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows NT 4.0; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows XP; ?) Opera 5.0*]
+Parent=Opera 5.0
+Platform=WinXP
+Win32=true
+
+[Opera/5.0*(Linux*; ?)*]
+Parent=Opera 5.0
+Platform=Linux
+
+[Opera/5.0*(Mac_PowerPC; ?)*]
+Parent=Opera 5.0
+Platform=MacPPC
+
+[Opera/5.0*(Windows 2000; ?)*]
+Parent=Opera 5.0
+Platform=Win2000
+Win32=true
+
+[Opera/5.0*(Windows 95; ?)*]
+Parent=Opera 5.0
+Platform=Win95
+Win32=true
+
+[Opera/5.0*(Windows 98; ?)*]
+Parent=Opera 5.0
+Platform=Win98
+Win32=true
+
+[Opera/5.0*(Windows ME; ?)*]
+Parent=Opera 5.0
+Platform=WinME
+Win32=true
+
+[Opera/5.0*(Windows NT 4.0; ?)*]
+Parent=Opera 5.0
+Platform=WinNT
+Win32=true
+
+[Opera/5.0*(Windows XP; ?)*]
+Parent=Opera 5.0
+Platform=WinXP
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 5.12
+
+[Opera 5.12]
+Parent=DefaultProperties
+Browser="Opera"
+Version=5.12
+MajorVer=5
+MinorVer=12
+Frames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/3.0 (Linux*; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Linux
+
+[Mozilla/3.0 (OS/2*; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=OS/2
+
+[Mozilla/3.0 (Windows 2000; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win2000
+Win32=true
+
+[Mozilla/3.0 (Windows 95; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win95
+Win32=true
+
+[Mozilla/3.0 (Windows 98; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win98
+Win32=true
+
+[Mozilla/3.0 (Windows ME; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinME
+Win32=true
+
+[Mozilla/3.0 (Windows NT 4.0; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinNT
+Win32=true
+
+[Mozilla/3.0 (Windows XP; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; OS/2*) Opera 5.12*]
+Parent=Opera 5.12
+Platform=OS/2
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win95
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win98
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinME
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.76 (Macintosh;US;PPC) Opera 5.12*]
+Parent=Opera 5.12
+Platform=MacPPC
+
+[Mozilla/4.76 (Windows ME; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinME
+Win32=true
+
+[Mozilla/4.78 (Linux*; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Linux
+
+[Mozilla/4.78 (OS/2*; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=OS/2
+
+[Mozilla/4.78 (Windows 2000; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78 (Windows 95; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win95
+Win32=true
+
+[Mozilla/4.78 (Windows 98; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win98
+Win32=true
+
+[Mozilla/4.78 (Windows ME; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinME
+Win32=true
+
+[Mozilla/4.78 (Windows NT 4.0; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.78 (Windows XP; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Linux*; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Linux
+
+[Mozilla/5.0 (OS/2*; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=OS/2
+
+[Mozilla/5.0 (Windows 2000; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows 95; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows 98; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows ME; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows NT 4.0; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows XP; ?) Opera 5.12*]
+Parent=Opera 5.12
+Platform=WinXP
+Win32=true
+
+[Opera/5.12 (Linux*; ?)*]
+Parent=Opera 5.12
+Platform=Linux
+
+[Opera/5.12 (OS/2*; ?)*]
+Parent=Opera 5.12
+Platform=OS/2
+
+[Opera/5.12 (Windows 2000; ?)*]
+Parent=Opera 5.12
+Platform=Win2000
+Win32=true
+
+[Opera/5.12 (Windows 95; ?)*]
+Parent=Opera 5.12
+Platform=Win95
+Win32=true
+
+[Opera/5.12 (Windows 98; ?)*]
+Parent=Opera 5.12
+Platform=Win98
+Win32=true
+
+[Opera/5.12 (Windows ME; ?)*]
+Parent=Opera 5.12
+Platform=WinME
+Win32=true
+
+[Opera/5.12 (Windows NT 4.0; ?)*]
+Parent=Opera 5.12
+Platform=WinNT
+Win32=true
+
+[Opera/5.12 (Windows XP; ?)*]
+Parent=Opera 5.12
+Platform=WinXP
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 6.0
+
+[Opera 6.0]
+Parent=DefaultProperties
+Browser="Opera"
+Version=6.0
+MajorVer=6
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/3.0 (Linux*; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Linux
+
+[Mozilla/3.0 (Mac_PowerPC; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Mozilla/3.0 (Windows 2000; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/3.0 (Windows 95; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win95
+Win32=true
+
+[Mozilla/3.0 (Windows 98; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win98
+Win32=true
+
+[Mozilla/3.0 (Windows ME; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinME
+Win32=true
+
+[Mozilla/3.0 (Windows NT 4.0; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/3.0 (Windows XP; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 6.0*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Macintosh; PPC) Opera 6.0*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.76 (Macintosh;US;PPC) Opera 6.0*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Mozilla/4.78 (Linux*; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Linux
+
+[Mozilla/4.78 (Mac_PowerPC; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Mozilla/4.78 (Windows 2000; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78 (Windows 95; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.78 (Windows 98; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.78 (Windows ME; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.78 (Windows NT 4.0; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.78 (Windows XP; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Linux*; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Linux
+
+[Mozilla/5.0 (Mac_PowerPC; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows 2000; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows 95; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows 98; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows ME; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows NT 4.0; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows XP; ?) Opera 6.0*]
+Parent=Opera 6.0
+Platform=WinXP
+Win32=true
+
+[Opera/6.0* (Linux*; ?)*]
+Parent=Opera 6.0
+Platform=Linux
+
+[Opera/6.0* (Mac_PowerPC; ?)*]
+Parent=Opera 6.0
+Platform=MacPPC
+
+[Opera/6.0* (Windows 2000; ?)*]
+Parent=Opera 6.0
+Platform=Win2000
+Win32=true
+
+[Opera/6.0* (Windows 95; ?)*]
+Parent=Opera 6.0
+Platform=Win95
+Win32=true
+
+[Opera/6.0* (Windows 98; ?)*]
+Parent=Opera 6.0
+Platform=Win98
+Win32=true
+
+[Opera/6.0* (Windows ME; ?)*]
+Parent=Opera 6.0
+Platform=WinME
+Win32=true
+
+[Opera/6.0* (Windows NT 4.0; ?)*]
+Parent=Opera 6.0
+Platform=WinNT
+Win32=true
+
+[Opera/6.0* (Windows NT 5.0; ?)*]
+Parent=Opera 6.0
+Platform=Win2000
+Win32=true
+
+[Opera/6.0* (Windows NT 5.1; ?)*]
+Parent=Opera 6.0
+Platform=WinXP
+Win32=true
+
+[Opera/6.0* (Windows NT 5.2; ?)*]
+Parent=Opera 6.0
+Platform=Win2003
+Win32=true
+
+[Opera/6.0* (Windows XP; ?)*]
+Parent=Opera 6.0
+Platform=WinXP
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 6.1
+
+[Opera 6.1]
+Parent=DefaultProperties
+Browser="Opera"
+Version=6.1
+MajorVer=6
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/3.0 (FreeBSD*; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=FreeBSD
+
+[Mozilla/3.0 (Linux*; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=Linux
+
+[Mozilla/3.0 (Linux*; ?) Opera 6.11 *]
+Parent=Opera 6.1
+Version=6.11
+MinorVer=11
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; FreeBSD*) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=FreeBSD
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 6.11 *]
+Parent=Opera 6.1
+MinorVer=11
+Platform=Linux
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.0 (compatible; MSIE 5.0; Linux*) Opera 6.12 *]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=Linux
+
+[Mozilla/4.0 (compatible; MSIE 5.0; UNIX) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=Unix
+
+[Mozilla/4.0 (compatible; MSIE 5.0; UNIX) Opera 6.11 *]
+Parent=Opera 6.1
+MinorVer=11
+
+[Mozilla/4.0 (compatible; MSIE 5.0; UNIX) Opera 6.12 *]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=Unix
+
+[Mozilla/4.78 (FreeBSD*; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=FreeBSD
+
+[Mozilla/4.78 (Linux*; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=Linux
+
+[Mozilla/4.78 (Linux*; ?) Opera 6.11 *]
+Parent=Opera 6.1
+Version=6.11
+MinorVer=11
+Platform=Linux
+
+[Mozilla/4.78 (Linux*; ?) Opera 6.12 *]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=Linux
+
+[Mozilla/4.78 (UNIX; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=Unix
+
+[Mozilla/5.0 (FreeBSD*; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=FreeBSD
+
+[Mozilla/5.0 (Linux*; ?) Opera 6.1 *]
+Parent=Opera 6.1
+Platform=Linux
+
+[Mozilla/5.0 (Linux*; ?) Opera 6.11 *]
+Parent=Opera 6.1
+MinorVer=11
+
+[Mozilla/5.0 (UNIX; ?) Opera 6.11 *]
+Parent=Opera 6.1
+Version=6.11
+MajorVer=6
+MinorVer=11
+Platform=Unix
+
+[Opera/6.1 (FreeBSD*; ?)*]
+Parent=Opera 6.1
+Platform=FreeBSD
+
+[Opera/6.1 (Linux*; ?)*]
+Parent=Opera 6.1
+Platform=Linux
+
+[Opera/6.1 (UNIX*; ?)*]
+Parent=Opera 6.1
+Platform=Unix
+
+[Opera/6.11 (FreeBSD*; ?)*]
+Parent=Opera 6.1
+Version=6.11
+MinorVer=11
+Platform=FreeBSD
+
+[Opera/6.11 (Linux*; ?)*]
+Parent=Opera 6.1
+Version=6.11
+MinorVer=11
+Platform=Linux
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Opera/6.11 (UNIX*; ?)*]
+Parent=Opera 6.1
+Platform=Unix
+
+[Opera/6.12 (FreeBSD*; ?)*]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=FreeBSD
+
+[Opera/6.12 (Linux*; ?)*]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=Linux
+
+[Opera/6.12 (OpenBSD*; ?) *]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=OpenBSD
+
+[Opera/6.12 (SunOS*; ?)*]
+Parent=Opera 6.1
+Version=6.12
+MajorVer=6
+MinorVer=12
+Platform=SunOS
+IFrames=false
+
+[Opera/6.12 (UNIX*; ?)*]
+Parent=Opera 6.1
+Version=6.12
+MinorVer=12
+Platform=Unix
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.0
+
+[Opera 7.0]
+Parent=DefaultProperties
+Browser="Opera"
+Version=7.0
+MajorVer=7
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/3.0 (Windows 2000; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/3.0 (Windows 95; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win95
+Win32=true
+
+[Mozilla/3.0 (Windows 98; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win98
+Win32=true
+
+[Mozilla/3.0 (Windows ME; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinME
+Win32=true
+
+[Mozilla/3.0 (Windows NT 4.0; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/3.0 (Windows XP; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 2000) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 95) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows XP) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.78 (Windows 2000; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78 (Windows 95; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win95
+Win32=true
+
+[Mozilla/4.78 (Windows 98; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win98
+Win32=true
+
+[Mozilla/4.78 (Windows ME; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinME
+Win32=true
+
+[Mozilla/4.78 (Windows NT 4.0; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.78 (Windows NT 5.1; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.78 (Windows Windows NT 5.0; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78 (Windows XP; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows 2000; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows 95; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows 98; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows ME; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows NT 4.0; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows NT 5.1; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows XP; ?) Opera 7.0*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Opera/7.0* (Windows 2000; ?)*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Opera/7.0* (Windows 95; ?)*]
+Parent=Opera 7.0
+Platform=Win95
+Win32=true
+
+[Opera/7.0* (Windows 98; ?)*]
+Parent=Opera 7.0
+Platform=Win98
+Win32=true
+
+[Opera/7.0* (Windows ME; ?)*]
+Parent=Opera 7.0
+Platform=WinME
+Win32=true
+
+[Opera/7.0* (Windows NT 4.0; ?)*]
+Parent=Opera 7.0
+Platform=WinNT
+Win32=true
+
+[Opera/7.0* (Windows NT 5.0; ?)*]
+Parent=Opera 7.0
+Platform=Win2000
+Win32=true
+
+[Opera/7.0* (Windows NT 5.1; ?)*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+[Opera/7.0* (Windows XP; ?)*]
+Parent=Opera 7.0
+Platform=WinXP
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.1
+
+[Opera 7.1]
+Parent=DefaultProperties
+Browser="Opera"
+Version=7.1
+MajorVer=7
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows 2000; ?) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; ?) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; ?) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; ?) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; U) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; U) Opera 7.1*]
+Parent=Opera 7.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.1*]
+Parent=Opera 7.1
+Platform=WinXP
+Win32=true
+
+[Opera/7.1* (Linux*; ?)*]
+Parent=Opera 7.1
+Platform=Linux
+
+[Opera/7.1* (Windows 95; ?)*]
+Parent=Opera 7.1
+Platform=Win95
+Win32=true
+
+[Opera/7.1* (Windows 98; ?)*]
+Parent=Opera 7.1
+Platform=Win98
+Win32=true
+
+[Opera/7.1* (Windows ME; ?)*]
+Parent=Opera 7.1
+Platform=WinME
+Win32=true
+
+[Opera/7.1* (Windows NT 4.0; ?)*]
+Parent=Opera 7.1
+Platform=WinNT
+Win32=true
+
+[Opera/7.1* (Windows NT 5.0; ?)*]
+Parent=Opera 7.1
+Platform=Win2000
+Win32=true
+
+[Opera/7.1* (Windows NT 5.1; ?)*]
+Parent=Opera 7.1
+Platform=WinXP
+Win32=true
+
+[Opera/7.1* (Windows XP; ?)*]
+Parent=Opera 7.1
+Platform=WinXP
+Win32=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.2
+
+[Opera 7.2]
+Parent=DefaultProperties
+Browser="Opera"
+Version=7.2
+MajorVer=7
+MinorVer=2
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Linux
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows 2000; ?) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; ?) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; ?) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; ?) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; U) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; U) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.2*]
+Parent=Opera 7.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.2; ?) Opera 7.2*]
+Parent=Opera 7.2
+Platform=Win2003
+Win32=true
+
+[Opera/7.2* (Linux*; ?)*]
+Parent=Opera 7.2
+Platform=Linux
+
+[Opera/7.2* (Windows 95; ?)*]
+Parent=Opera 7.2
+Platform=Win95
+Win32=true
+
+[Opera/7.2* (Windows 98; ?)*]
+Parent=Opera 7.2
+Platform=Win98
+Win32=true
+
+[Opera/7.2* (Windows ME; ?)*]
+Parent=Opera 7.2
+Platform=WinME
+Win32=true
+
+[Opera/7.2* (Windows NT 4.0; ?)*]
+Parent=Opera 7.2
+Platform=WinNT
+Win32=true
+
+[Opera/7.2* (Windows NT 5.0; ?)*]
+Parent=Opera 7.2
+Platform=Win2000
+Win32=true
+
+[Opera/7.2* (Windows NT 5.1; ?)*]
+Parent=Opera 7.2
+Platform=WinXP
+Win32=true
+
+[Opera/7.2* (Windows NT 5.2; ?)*]
+Parent=Opera 7.2
+Platform=Win2003
+Win32=true
+
+[Opera/7.2* (Windows XP; ?)*]
+Parent=Opera 7.2
+Platform=WinXP
+Win32=true
+
+[Opera/7.2* (X11; FreeBSD*; ?)*]
+Parent=Opera 7.2
+Platform=FreeBSD
+
+[Opera/7.2* (X11; Linux*; ?)*]
+Parent=Opera 7.2
+Platform=Linux
+
+[Opera/7.2* (X11; SunOS*)*]
+Parent=Opera 7.2
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.5
+
+[Opera 7.5]
+Parent=DefaultProperties
+Browser="Opera"
+Version=7.5
+MajorVer=7
+MinorVer=5
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Linux
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 7.5*]
+Parent=Opera 7.5
+Platform=MacPPC
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Linux
+
+[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=MacOSX
+
+[Mozilla/?.* (Windows 2000; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; U) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; U) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.2; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (X11; Linux*; ?) Opera 7.5*]
+Parent=Opera 7.5
+Platform=Linux
+
+[Opera/7.5* (Linux*; ?)*]
+Parent=Opera 7.5
+Platform=Linux
+
+[Opera/7.5* (Macintosh; *Mac OS X; ?)*]
+Parent=Opera 7.5
+Platform=MacOSX
+
+[Opera/7.5* (Windows 95; ?)*]
+Parent=Opera 7.5
+Platform=Win95
+Win32=true
+
+[Opera/7.5* (Windows 98; ?)*]
+Parent=Opera 7.5
+Platform=Win98
+Win32=true
+
+[Opera/7.5* (Windows ME; ?)*]
+Parent=Opera 7.5
+Platform=WinME
+Win32=true
+
+[Opera/7.5* (Windows NT 4.0; ?)*]
+Parent=Opera 7.5
+Platform=WinNT
+Win32=true
+
+[Opera/7.5* (Windows NT 5.0; ?)*]
+Parent=Opera 7.5
+Platform=Win2000
+Win32=true
+
+[Opera/7.5* (Windows NT 5.1; ?)*]
+Parent=Opera 7.5
+Platform=WinXP
+Win32=true
+
+[Opera/7.5* (Windows NT 5.2; ?)*]
+Parent=Opera 7.5
+Platform=Win2003
+Win32=true
+
+[Opera/7.5* (Windows XP; ?)*]
+Parent=Opera 7.5
+Platform=WinXP
+Win32=true
+
+[Opera/7.5* (X11; FreeBSD*; ?)*]
+Parent=Opera 7.5
+Platform=FreeBSD
+
+[Opera/7.5* (X11; Linux*; ?)*]
+Parent=Opera 7.5
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.6
+
+[Opera 7.6]
+Parent=DefaultProperties
+Browser="Opera"
+Version=7.6
+MajorVer=7
+MinorVer=6
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Linux
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 7.6*]
+Parent=Opera 7.6
+Platform=MacPPC
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Linux
+
+[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=MacOSX
+
+[Mozilla/?.* (Windows 2000; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; U) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; U) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.2; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (X11; Linux*; ?) Opera 7.6*]
+Parent=Opera 7.6
+Platform=Linux
+
+[Opera/7.6* (Linux*)*]
+Parent=Opera 7.6
+Platform=Linux
+
+[Opera/7.6* (Macintosh; *Mac OS X; ?)*]
+Parent=Opera 7.6
+Platform=MacOSX
+
+[Opera/7.6* (Windows 95*)*]
+Parent=Opera 7.6
+Platform=Win95
+Win32=true
+
+[Opera/7.6* (Windows 98*)*]
+Parent=Opera 7.6
+Platform=Win98
+Win32=true
+
+[Opera/7.6* (Windows ME*)*]
+Parent=Opera 7.6
+Platform=WinME
+Win32=true
+
+[Opera/7.6* (Windows NT 4.0*)*]
+Parent=Opera 7.6
+Platform=WinNT
+Win32=true
+
+[Opera/7.6* (Windows NT 5.0*)*]
+Parent=Opera 7.6
+Platform=Win2000
+Win32=true
+
+[Opera/7.6* (Windows NT 5.1*)*]
+Parent=Opera 7.6
+Platform=WinXP
+Win32=true
+
+[Opera/7.6* (Windows NT 5.2*)*]
+Parent=Opera 7.6
+Platform=Win2003
+Win32=true
+
+[Opera/7.6* (Windows XP*)*]
+Parent=Opera 7.6
+Platform=WinXP
+Win32=true
+
+[Opera/7.6* (X11; FreeBSD*)*]
+Parent=Opera 7.6
+Platform=FreeBSD
+
+[Opera/7.6* (X11; Linux*)*]
+Parent=Opera 7.6
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 8.0
+
+[Opera 8.0]
+Parent=DefaultProperties
+Browser="Opera"
+Version=8.0
+MajorVer=8
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Linux
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC Mac OS X; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=MacOSX
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 8.0*]
+Parent=Opera 8.0
+Platform=MacPPC
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows CE) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinCE
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; FreeBSD*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=FreeBSD
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Linux
+
+[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 8.0*]
+Parent=Opera 8.0
+Platform=MacOSX
+
+[Mozilla/?.* (Windows 2000; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.2; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (X11; Linux*; *) Opera 8.0*]
+Parent=Opera 8.0
+Platform=Linux
+
+[Opera/8.0* (Linux*)*]
+Parent=Opera 8.0
+Platform=Linux
+
+[Opera/8.0* (Macintosh; *Mac OS X; *)*]
+Parent=Opera 8.0
+Platform=MacOSX
+
+[Opera/8.0* (Windows 95*)*]
+Parent=Opera 8.0
+Platform=Win95
+Win32=true
+
+[Opera/8.0* (Windows 98*)*]
+Parent=Opera 8.0
+Platform=Win98
+Win32=true
+
+[Opera/8.0* (Windows CE*)*]
+Parent=Opera 8.0
+Platform=WinCE
+Win32=true
+
+[Opera/8.0* (Windows ME*)*]
+Parent=Opera 8.0
+Platform=WinME
+Win32=true
+
+[Opera/8.0* (Windows NT 4.0*)*]
+Parent=Opera 8.0
+Platform=WinNT
+Win32=true
+
+[Opera/8.0* (Windows NT 5.0*)*]
+Parent=Opera 8.0
+Platform=Win2000
+Win32=true
+
+[Opera/8.0* (Windows NT 5.1*)*]
+Parent=Opera 8.0
+Platform=WinXP
+Win32=true
+
+[Opera/8.0* (Windows NT 5.2*)*]
+Parent=Opera 8.0
+Platform=Win2003
+Win32=true
+
+[Opera/8.0* (Windows XP*)*]
+Parent=Opera 8.0
+Platform=WinXP
+Win32=true
+
+[Opera/8.0* (X11; FreeBSD*)*]
+Parent=Opera 8.0
+Platform=FreeBSD
+
+[Opera/8.0* (X11; Linux*)*]
+Parent=Opera 8.0
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 8.1
+
+[Opera 8.1]
+Parent=DefaultProperties
+Browser="Opera"
+Version=8.1
+MajorVer=8
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Linux
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 8.1*]
+Parent=Opera 8.1
+Platform=MacPPC
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows CE) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinCE
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; FreeBSD*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=FreeBSD
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Linux
+
+[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 8.1*]
+Parent=Opera 8.1
+Platform=MacOSX
+
+[Mozilla/?.* (Windows 2000; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.2; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (X11; Linux*; *) Opera 8.1*]
+Parent=Opera 8.1
+Platform=Linux
+
+[Opera/8.1* (Linux*)*]
+Parent=Opera 8.1
+Platform=Linux
+
+[Opera/8.1* (Macintosh; *Mac OS X; *)*]
+Parent=Opera 8.1
+Platform=MacOSX
+
+[Opera/8.1* (Windows 95*)*]
+Parent=Opera 8.1
+Platform=Win95
+Win32=true
+
+[Opera/8.1* (Windows 98*)*]
+Parent=Opera 8.1
+Platform=Win98
+Win32=true
+
+[Opera/8.1* (Windows CE*)*]
+Parent=Opera 8.1
+Platform=WinCE
+Win32=true
+
+[Opera/8.1* (Windows ME*)*]
+Parent=Opera 8.1
+Platform=WinME
+Win32=true
+
+[Opera/8.1* (Windows NT 4.0*)*]
+Parent=Opera 8.1
+Platform=WinNT
+Win32=true
+
+[Opera/8.1* (Windows NT 5.0*)*]
+Parent=Opera 8.1
+Platform=Win2000
+Win32=true
+
+[Opera/8.1* (Windows NT 5.1*)*]
+Parent=Opera 8.1
+Platform=WinXP
+Win32=true
+
+[Opera/8.1* (Windows NT 5.2*)*]
+Parent=Opera 8.1
+Platform=Win2003
+Win32=true
+
+[Opera/8.1* (Windows XP*)*]
+Parent=Opera 8.1
+Platform=WinXP
+Win32=true
+
+[Opera/8.1* (X11; FreeBSD*)*]
+Parent=Opera 8.1
+Platform=FreeBSD
+
+[Opera/8.1* (X11; Linux*)*]
+Parent=Opera 8.1
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 8.5
+
+[Opera 8.5]
+Parent=DefaultProperties
+Browser="Opera"
+Version=8.5
+MajorVer=8
+MinorVer=5
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Linux
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC Mac OS X;*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=MacOSX
+
+[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 8.5*]
+Parent=Opera 8.5
+Platform=MacPPC
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 95*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows 98*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows CE) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinCE
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows ME*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; Windows XP*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; FreeBSD*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=FreeBSD
+
+[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Linux
+
+[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 8.5*]
+Parent=Opera 8.5
+Platform=MacOSX
+
+[Mozilla/?.* (Macintosh; PPC Mac OS X;*) Opera 8.5*]
+Parent=Opera 8.5
+Platform=MacOSX
+
+[Mozilla/?.* (Windows 2000; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows 95; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win95
+Win32=true
+
+[Mozilla/?.* (Windows 98; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win98
+Win32=true
+
+[Mozilla/?.* (Windows ME; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinME
+Win32=true
+
+[Mozilla/?.* (Windows NT 4.0; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.0; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.1; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/?.* (Windows NT 5.2; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/?.* (X11; Linux*; *) Opera 8.5*]
+Parent=Opera 8.5
+Platform=Linux
+
+[Opera/8.5* (Linux*)*]
+Parent=Opera 8.5
+Platform=Linux
+
+[Opera/8.5* (Macintosh; *Mac OS X; *)*]
+Parent=Opera 8.5
+Platform=MacOSX
+
+[Opera/8.5* (Windows 95*)*]
+Parent=Opera 8.5
+Platform=Win95
+Win32=true
+
+[Opera/8.5* (Windows 98*)*]
+Parent=Opera 8.5
+Platform=Win98
+Win32=true
+
+[Opera/8.5* (Windows CE*)*]
+Parent=Opera 8.5
+Platform=WinCE
+Win32=true
+
+[Opera/8.5* (Windows ME*)*]
+Parent=Opera 8.5
+Platform=WinME
+Win32=true
+
+[Opera/8.5* (Windows NT 4.0*)*]
+Parent=Opera 8.5
+Platform=WinNT
+Win32=true
+
+[Opera/8.5* (Windows NT 5.0*)*]
+Parent=Opera 8.5
+Platform=Win2000
+Win32=true
+
+[Opera/8.5* (Windows NT 5.1*)*]
+Parent=Opera 8.5
+Platform=WinXP
+Win32=true
+
+[Opera/8.5* (Windows NT 5.2*)*]
+Parent=Opera 8.5
+Platform=Win2003
+Win32=true
+
+[Opera/8.5* (Windows XP*)*]
+Parent=Opera 8.5
+Platform=WinXP
+Win32=true
+
+[Opera/8.5* (X11; FreeBSD*)*]
+Parent=Opera 8.5
+Platform=FreeBSD
+
+[Opera/8.5* (X11; Linux*)*]
+Parent=Opera 8.5
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.0
+
+[Opera 9.0]
+Parent=DefaultProperties
+Browser="Opera"
+Version=9.0
+MajorVer=9
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=MacOSX
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.0*]
+Parent=Opera 9.0
+Platform=MacPPC
+
+[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win95
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win98
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinCE
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinME
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinVista
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=FreeBSD
+
+[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=SunOS
+
+[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.0*]
+Parent=Opera 9.0
+Platform=MacOSX
+
+[Mozilla/* (Windows 2000;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows 95;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win95
+Win32=true
+
+[Mozilla/* (Windows 98;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win98
+Win32=true
+
+[Mozilla/* (Windows ME;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinME
+Win32=true
+
+[Mozilla/* (Windows NT 4.0;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (Windows NT 5.0;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows NT 5.1;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (Windows NT 5.2;*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (X11; Linux*) Opera 9.0*]
+Parent=Opera 9.0
+Platform=Linux
+
+[Opera/9.0* (Linux*)*]
+Parent=Opera 9.0
+Platform=Linux
+
+[Opera/9.0* (Macintosh; *Mac OS X;*)*]
+Parent=Opera 9.0
+Platform=MacOSX
+
+[Opera/9.0* (Windows 95*)*]
+Parent=Opera 9.0
+Platform=Win95
+Win32=true
+
+[Opera/9.0* (Windows 98*)*]
+Parent=Opera 9.0
+Platform=Win98
+Win32=true
+
+[Opera/9.0* (Windows CE*)*]
+Parent=Opera 9.0
+Platform=WinCE
+Win32=true
+
+[Opera/9.0* (Windows ME*)*]
+Parent=Opera 9.0
+Platform=WinME
+Win32=true
+
+[Opera/9.0* (Windows NT 4.0*)*]
+Parent=Opera 9.0
+Platform=WinNT
+Win32=true
+
+[Opera/9.0* (Windows NT 5.0*)*]
+Parent=Opera 9.0
+Platform=Win2000
+Win32=true
+
+[Opera/9.0* (Windows NT 5.1*)*]
+Parent=Opera 9.0
+Platform=WinXP
+Win32=true
+
+[Opera/9.0* (Windows NT 5.2*)*]
+Parent=Opera 9.0
+Platform=Win2003
+Win32=true
+
+[Opera/9.0* (Windows NT 6.0*)*]
+Parent=Opera 9.0
+Platform=WinVista
+Win32=true
+
+[Opera/9.0* (Windows XP*)*]
+Parent=Opera 9.0
+Platform=WinXP
+Win32=true
+
+[Opera/9.0* (X11; FreeBSD*)*]
+Parent=Opera 9.0
+Platform=FreeBSD
+
+[Opera/9.0* (X11; Linux*)*]
+Parent=Opera 9.0
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.1
+
+[Opera 9.1]
+Parent=DefaultProperties
+Browser="Opera"
+Version=9.1
+MajorVer=9
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=MacOSX
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=MacPPC
+
+[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win95
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win98
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinCE
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinME
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinVista
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=FreeBSD
+
+[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=SunOS
+
+[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.1*]
+Parent=Opera 9.1
+Platform=MacOSX
+
+[Mozilla/* (Windows 2000;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows 95;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win95
+Win32=true
+
+[Mozilla/* (Windows 98;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win98
+Win32=true
+
+[Mozilla/* (Windows ME;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinME
+Win32=true
+
+[Mozilla/* (Windows NT 4.0;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (Windows NT 5.0;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows NT 5.1;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (Windows NT 5.2;*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (X11; Linux*) Opera 9.1*]
+Parent=Opera 9.1
+Platform=Linux
+
+[Opera/9.1* (Linux*)*]
+Parent=Opera 9.1
+Platform=Linux
+
+[Opera/9.1* (Macintosh; *Mac OS X;*)*]
+Parent=Opera 9.1
+Platform=MacOSX
+
+[Opera/9.1* (Windows 95*)*]
+Parent=Opera 9.1
+Platform=Win95
+Win32=true
+
+[Opera/9.1* (Windows 98*)*]
+Parent=Opera 9.1
+Platform=Win98
+Win32=true
+
+[Opera/9.1* (Windows CE*)*]
+Parent=Opera 9.1
+Platform=WinCE
+Win32=true
+
+[Opera/9.1* (Windows ME*)*]
+Parent=Opera 9.1
+Platform=WinME
+Win32=true
+
+[Opera/9.1* (Windows NT 4.0*)*]
+Parent=Opera 9.1
+Platform=WinNT
+Win32=true
+
+[Opera/9.1* (Windows NT 5.0*)*]
+Parent=Opera 9.1
+Platform=Win2000
+Win32=true
+
+[Opera/9.1* (Windows NT 5.1*)*]
+Parent=Opera 9.1
+Platform=WinXP
+Win32=true
+
+[Opera/9.1* (Windows NT 5.2*)*]
+Parent=Opera 9.1
+Platform=Win2003
+Win32=true
+
+[Opera/9.1* (Windows NT 6.0*)*]
+Parent=Opera 9.1
+Platform=WinVista
+Win32=true
+
+[Opera/9.1* (Windows XP*)*]
+Parent=Opera 9.1
+Platform=WinXP
+Win32=true
+
+[Opera/9.1* (X11; FreeBSD*)*]
+Parent=Opera 9.1
+Platform=FreeBSD
+
+[Opera/9.1* (X11; Linux*)*]
+Parent=Opera 9.1
+Platform=Linux
+
+[Opera/9.1* (X11; SunOS*)*]
+Parent=Opera 9.1
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.2
+
+[Opera 9.2]
+Parent=DefaultProperties
+Browser="Opera"
+Version=9.2
+MajorVer=9
+MinorVer=2
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=MacOSX
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.2*]
+Parent=Opera 9.2
+Platform=MacPPC
+
+[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win95
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win98
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinCE
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinME
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinVista
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=FreeBSD
+
+[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=SunOS
+
+[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.2*]
+Parent=Opera 9.2
+Platform=MacOSX
+
+[Mozilla/* (Windows 2000;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows 95;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win95
+Win32=true
+
+[Mozilla/* (Windows 98;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win98
+Win32=true
+
+[Mozilla/* (Windows ME;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinME
+Win32=true
+
+[Mozilla/* (Windows NT 4.0;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (Windows NT 5.0;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows NT 5.1;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (Windows NT 5.2;*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (X11; Linux*) Opera 9.2*]
+Parent=Opera 9.2
+Platform=Linux
+
+[Opera/9.2* (Linux*)*]
+Parent=Opera 9.2
+Platform=Linux
+
+[Opera/9.2* (Macintosh; *Mac OS X;*)*]
+Parent=Opera 9.2
+Platform=MacOSX
+
+[Opera/9.2* (Windows 95*)*]
+Parent=Opera 9.2
+Platform=Win95
+Win32=true
+
+[Opera/9.2* (Windows 98*)*]
+Parent=Opera 9.2
+Platform=Win98
+Win32=true
+
+[Opera/9.2* (Windows CE*)*]
+Parent=Opera 9.2
+Platform=WinCE
+Win32=true
+
+[Opera/9.2* (Windows ME*)*]
+Parent=Opera 9.2
+Platform=WinME
+Win32=true
+
+[Opera/9.2* (Windows NT 4.0*)*]
+Parent=Opera 9.2
+Platform=WinNT
+Win32=true
+
+[Opera/9.2* (Windows NT 5.0*)*]
+Parent=Opera 9.2
+Platform=Win2000
+Win32=true
+
+[Opera/9.2* (Windows NT 5.1*)*]
+Parent=Opera 9.2
+Platform=WinXP
+Win32=true
+
+[Opera/9.2* (Windows NT 5.2*)*]
+Parent=Opera 9.2
+Platform=Win2003
+Win32=true
+
+[Opera/9.2* (Windows NT 6.0*)*]
+Parent=Opera 9.2
+Platform=WinVista
+Win32=true
+
+[Opera/9.2* (Windows XP*)*]
+Parent=Opera 9.2
+Platform=WinXP
+Win32=true
+
+[Opera/9.2* (X11; FreeBSD*)*]
+Parent=Opera 9.2
+Platform=FreeBSD
+
+[Opera/9.2* (X11; Linux*)*]
+Parent=Opera 9.2
+Platform=Linux
+
+[Opera/9.2* (X11; SunOS*)*]
+Parent=Opera 9.2
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.3
+
+[Opera 9.3]
+Parent=DefaultProperties
+Browser="Opera"
+Version=9.3
+MajorVer=9
+MinorVer=3
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=MacOSX
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.3*]
+Parent=Opera 9.3
+Platform=MacPPC
+
+[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win95
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win98
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinCE
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinME
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinVista
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=FreeBSD
+
+[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=SunOS
+
+[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.3*]
+Parent=Opera 9.3
+Platform=MacOSX
+
+[Mozilla/* (Windows 2000;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows 95;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win95
+Win32=true
+
+[Mozilla/* (Windows 98;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win98
+Win32=true
+
+[Mozilla/* (Windows ME;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinME
+Win32=true
+
+[Mozilla/* (Windows NT 4.0;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (Windows NT 5.0;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows NT 5.1;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (Windows NT 5.2;*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (X11; Linux*) Opera 9.3*]
+Parent=Opera 9.3
+Platform=Linux
+
+[Opera/9.3* (Linux*)*]
+Parent=Opera 9.3
+Platform=Linux
+
+[Opera/9.3* (Macintosh; *Mac OS X;*)*]
+Parent=Opera 9.3
+Platform=MacOSX
+
+[Opera/9.3* (Windows 95*)*]
+Parent=Opera 9.3
+Platform=Win95
+Win32=true
+
+[Opera/9.3* (Windows 98*)*]
+Parent=Opera 9.3
+Platform=Win98
+Win32=true
+
+[Opera/9.3* (Windows CE*)*]
+Parent=Opera 9.3
+Platform=WinCE
+Win32=true
+
+[Opera/9.3* (Windows ME*)*]
+Parent=Opera 9.3
+Platform=WinME
+Win32=true
+
+[Opera/9.3* (Windows NT 4.0*)*]
+Parent=Opera 9.3
+Platform=WinNT
+Win32=true
+
+[Opera/9.3* (Windows NT 5.0*)*]
+Parent=Opera 9.3
+Platform=Win2000
+Win32=true
+
+[Opera/9.3* (Windows NT 5.1*)*]
+Parent=Opera 9.3
+Platform=WinXP
+Win32=true
+
+[Opera/9.3* (Windows NT 5.2*)*]
+Parent=Opera 9.3
+Platform=Win2003
+Win32=true
+
+[Opera/9.3* (Windows NT 6.0*)*]
+Parent=Opera 9.3
+Platform=WinVista
+Win32=true
+
+[Opera/9.3* (Windows XP*)*]
+Parent=Opera 9.3
+Platform=WinXP
+Win32=true
+
+[Opera/9.3* (X11; FreeBSD*)*]
+Parent=Opera 9.3
+Platform=FreeBSD
+
+[Opera/9.3* (X11; Linux*)*]
+Parent=Opera 9.3
+Platform=Linux
+
+[Opera/9.3* (X11; SunOS*)*]
+Parent=Opera 9.3
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.4
+
+[Opera 9.4]
+Parent=DefaultProperties
+Browser="Opera"
+Version=9.4
+MajorVer=9
+MinorVer=4
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=MacOSX
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.4*]
+Parent=Opera 9.4
+Platform=MacPPC
+
+[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win95
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win98
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinCE
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinME
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinVista
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=FreeBSD
+
+[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=SunOS
+
+[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.4*]
+Parent=Opera 9.4
+Platform=MacOSX
+
+[Mozilla/* (Windows 2000;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows 95;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win95
+Win32=true
+
+[Mozilla/* (Windows 98;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win98
+Win32=true
+
+[Mozilla/* (Windows ME;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinME
+Win32=true
+
+[Mozilla/* (Windows NT 4.0;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (Windows NT 5.0;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows NT 5.1;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (Windows NT 5.2;*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (X11; Linux*) Opera 9.4*]
+Parent=Opera 9.4
+Platform=Linux
+
+[Opera/9.4* (Linux*)*]
+Parent=Opera 9.4
+Platform=Linux
+
+[Opera/9.4* (Macintosh; *Mac OS X;*)*]
+Parent=Opera 9.4
+Platform=MacOSX
+
+[Opera/9.4* (Windows 95*)*]
+Parent=Opera 9.4
+Platform=Win95
+Win32=true
+
+[Opera/9.4* (Windows 98*)*]
+Parent=Opera 9.4
+Platform=Win98
+Win32=true
+
+[Opera/9.4* (Windows CE*)*]
+Parent=Opera 9.4
+Platform=WinCE
+Win32=true
+
+[Opera/9.4* (Windows ME*)*]
+Parent=Opera 9.4
+Platform=WinME
+Win32=true
+
+[Opera/9.4* (Windows NT 4.0*)*]
+Parent=Opera 9.4
+Platform=WinNT
+Win32=true
+
+[Opera/9.4* (Windows NT 5.0*)*]
+Parent=Opera 9.4
+Platform=Win2000
+Win32=true
+
+[Opera/9.4* (Windows NT 5.1*)*]
+Parent=Opera 9.4
+Platform=WinXP
+Win32=true
+
+[Opera/9.4* (Windows NT 5.2*)*]
+Parent=Opera 9.4
+Platform=Win2003
+Win32=true
+
+[Opera/9.4* (Windows NT 6.0*)*]
+Parent=Opera 9.4
+Platform=WinVista
+Win32=true
+
+[Opera/9.4* (Windows XP*)*]
+Parent=Opera 9.4
+Platform=WinXP
+Win32=true
+
+[Opera/9.4* (X11; FreeBSD*)*]
+Parent=Opera 9.4
+Platform=FreeBSD
+
+[Opera/9.4* (X11; Linux*)*]
+Parent=Opera 9.4
+Platform=Linux
+
+[Opera/9.4* (X11; SunOS*)*]
+Parent=Opera 9.4
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.5
+
+[Opera 9.5]
+Parent=DefaultProperties
+Browser="Opera"
+Version=9.5
+MajorVer=9
+MinorVer=5
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=MacOSX
+
+[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.5*]
+Parent=Opera 9.5
+Platform=MacPPC
+
+[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win95
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win98
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinCE
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinME
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinVista
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=FreeBSD
+
+[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Linux
+
+[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=SunOS
+
+[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.5*]
+Parent=Opera 9.5
+Platform=MacOSX
+
+[Mozilla/* (Windows 2000;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows 95;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win95
+Win32=true
+
+[Mozilla/* (Windows 98;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win98
+Win32=true
+
+[Mozilla/* (Windows ME;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinME
+Win32=true
+
+[Mozilla/* (Windows NT 4.0;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/* (Windows NT 5.0;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/* (Windows NT 5.1;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/* (Windows NT 5.2;*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/* (X11; Linux*) Opera 9.5*]
+Parent=Opera 9.5
+Platform=Linux
+
+[Opera/9.5* (Linux*)*]
+Parent=Opera 9.5
+Platform=Linux
+
+[Opera/9.5* (Macintosh; *Mac OS X;*)*]
+Parent=Opera 9.5
+Platform=MacOSX
+
+[Opera/9.5* (Windows 95*)*]
+Parent=Opera 9.5
+Platform=Win95
+Win32=true
+
+[Opera/9.5* (Windows 98*)*]
+Parent=Opera 9.5
+Platform=Win98
+Win32=true
+
+[Opera/9.5* (Windows CE*)*]
+Parent=Opera 9.5
+Platform=WinCE
+Win32=true
+
+[Opera/9.5* (Windows ME*)*]
+Parent=Opera 9.5
+Platform=WinME
+Win32=true
+
+[Opera/9.5* (Windows NT 4.0*)*]
+Parent=Opera 9.5
+Platform=WinNT
+Win32=true
+
+[Opera/9.5* (Windows NT 5.0*)*]
+Parent=Opera 9.5
+Platform=Win2000
+Win32=true
+
+[Opera/9.5* (Windows NT 5.1*)*]
+Parent=Opera 9.5
+Platform=WinXP
+Win32=true
+
+[Opera/9.5* (Windows NT 5.2*)*]
+Parent=Opera 9.5
+Platform=Win2003
+Win32=true
+
+[Opera/9.5* (Windows NT 6.0*)*]
+Parent=Opera 9.5
+Platform=WinVista
+Win32=true
+
+[Opera/9.5* (Windows XP*)*]
+Parent=Opera 9.5
+Platform=WinXP
+Win32=true
+
+[Opera/9.5* (X11; FreeBSD*)*]
+Parent=Opera 9.5
+Platform=FreeBSD
+
+[Opera/9.5* (X11; Linux*)*]
+Parent=Opera 9.5
+Platform=Linux
+
+[Opera/9.5* (X11; SunOS*)*]
+Parent=Opera 9.5
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.0
+
+[Netscape 4.0]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=4.0
+MajorVer=4
+Frames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.0*(Macintosh*]
+Parent=Netscape 4.0
+Version=4.03
+MinorVer=03
+Platform=MacPPC
+
+[Mozilla/4.0*(Win95;*]
+Parent=Netscape 4.0
+Platform=Win95
+
+[Mozilla/4.0*(Win98;*]
+Parent=Netscape 4.0
+Version=4.03
+MinorVer=03
+Platform=Win98
+
+[Mozilla/4.0*(WinNT*]
+Parent=Netscape 4.0
+Version=4.03
+MinorVer=03
+Platform=WinNT
+
+[Mozilla/4.0*(X11;*)]
+Parent=Netscape 4.0
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.5
+
+[Netscape 4.5]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=4.5
+MajorVer=4
+MinorVer=5
+Frames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.5*(Macintosh; ?; PPC)]
+Parent=Netscape 4.5
+Platform=MacPPC
+
+[Mozilla/4.5*(Win2000; ?)]
+Parent=Netscape 4.5
+Platform=Win2000
+
+[Mozilla/4.5*(Win95; ?)]
+Parent=Netscape 4.5
+Platform=Win95
+
+[Mozilla/4.5*(Win98; ?)]
+Parent=Netscape 4.5
+Platform=Win98
+
+[Mozilla/4.5*(WinME; ?)]
+Parent=Netscape 4.5
+Platform=WinME
+
+[Mozilla/4.5*(WinNT; ?)]
+Parent=Netscape 4.5
+Platform=WinNT
+
+[Mozilla/4.5*(WinXP; ?)]
+Parent=Netscape 4.5
+Platform=WinXP
+
+[Mozilla/4.5*(X11*)]
+Parent=Netscape 4.5
+Platform=Linux
+
+[Mozilla/4.51*(Macintosh; ?; PPC)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+
+[Mozilla/4.51*(Win2000; ?)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=Win2000
+
+[Mozilla/4.51*(Win95; ?)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=Win95
+
+[Mozilla/4.51*(Win98; ?)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=Win98
+
+[Mozilla/4.51*(WinME; ?)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=WinME
+
+[Mozilla/4.51*(WinNT; ?)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=WinNT
+
+[Mozilla/4.51*(WinXP; ?)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=WinXP
+
+[Mozilla/4.51*(X11*)]
+Parent=Netscape 4.5
+Version=4.51
+MinorVer=51
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.6
+
+[Netscape 4.6]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=4.6
+MajorVer=4
+MinorVer=6
+Frames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.6 * (OS/2; ?)]
+Parent=Netscape 4.6
+Platform=OS/2
+
+[Mozilla/4.6*(CJPENNYCATE 3.2.11££tst 101000562$$)]
+Parent=Netscape 4.6
+
+[Mozilla/4.6*(Macintosh; ?; PPC)]
+Parent=Netscape 4.6
+Platform=MacPPC
+
+[Mozilla/4.6*(Win95; ?)]
+Parent=Netscape 4.6
+Platform=Win95
+
+[Mozilla/4.6*(Win98; ?)]
+Parent=Netscape 4.6
+Platform=Win98
+
+[Mozilla/4.6*(WinNT; ?)]
+Parent=Netscape 4.6
+Platform=WinNT
+
+[Mozilla/4.61*(Macintosh; ?; PPC)]
+Parent=Netscape 4.6
+Version=4.61
+MajorVer=4
+MinorVer=61
+Platform=MacPPC
+
+[Mozilla/4.61*(OS/2; ?)]
+Parent=Netscape 4.6
+Version=4.61
+MajorVer=4
+MinorVer=61
+Platform=OS/2
+
+[Mozilla/4.61*(Win95; ?)]
+Parent=Netscape 4.6
+Version=4.61
+MajorVer=4
+MinorVer=61
+Platform=Win95
+
+[Mozilla/4.61*(Win98; ?)]
+Parent=Netscape 4.6
+Version=4.61
+Platform=Win98
+
+[Mozilla/4.61*(WinNT; ?)]
+Parent=Netscape 4.6
+Version=4.61
+MajorVer=4
+MinorVer=61
+Platform=WinNT
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.7
+
+[Netscape 4.7]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=4.7
+MajorVer=4
+MinorVer=7
+Frames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.7 * (Win2000; ?)]
+Parent=Netscape 4.7
+Platform=Win2000
+
+[Mozilla/4.7*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=7
+Platform=MacPPC
+
+[Mozilla/4.7*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=7
+Platform=Win95
+
+[Mozilla/4.7*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=7
+Platform=Win98
+
+[Mozilla/4.7*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=7
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.7*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=7
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.7*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=7
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.7*(WinNT; ?)*]
+Parent=Netscape 4.7
+Platform=WinNT
+
+[Mozilla/4.7*(X11*)*]
+Parent=Netscape 4.7
+Platform=Linux
+
+[Mozilla/4.7*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+Platform=SunOS
+
+[Mozilla/4.71*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=MacPPC
+
+[Mozilla/4.71*(Win95; ?)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=Win95
+
+[Mozilla/4.71*(Win98; ?)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=Win98
+
+[Mozilla/4.71*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.71*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.71*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.71*(WinNT; ?)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=WinNT
+
+[Mozilla/4.71*(X11*)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=Linux
+
+[Mozilla/4.71*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+Version=4.71
+MinorVer=71
+Platform=SunOS
+
+[Mozilla/4.72*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=MacPPC
+
+[Mozilla/4.72*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=Win95
+
+[Mozilla/4.72*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=Win98
+
+[Mozilla/4.72*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.72*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.72*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.72*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=WinNT
+
+[Mozilla/4.72*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=Linux
+
+[Mozilla/4.72*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=72
+Platform=SunOS
+
+[Mozilla/4.73*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=MacPPC
+
+[Mozilla/4.73*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=Win95
+
+[Mozilla/4.73*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=Win98
+
+[Mozilla/4.73*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.73*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.73*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.73*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=WinNT
+
+[Mozilla/4.73*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=Linux
+
+[Mozilla/4.73*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=73
+Platform=SunOS
+
+[Mozilla/4.74*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=MacPPC
+
+[Mozilla/4.74*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=Win95
+
+[Mozilla/4.74*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=Win98
+
+[Mozilla/4.74*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.74*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.74*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.74*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=WinNT
+
+[Mozilla/4.74*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=Linux
+
+[Mozilla/4.74*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=74
+Platform=SunOS
+
+[Mozilla/4.75*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=MacPPC
+
+[Mozilla/4.75*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=Win95
+
+[Mozilla/4.75*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=Win98
+
+[Mozilla/4.75*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.75*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.75*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.75*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=WinNT
+
+[Mozilla/4.75*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=Linux
+
+[Mozilla/4.75*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=75
+Platform=SunOS
+
+[Mozilla/4.76*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=MacPPC
+
+[Mozilla/4.76*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=Win95
+
+[Mozilla/4.76*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=Win98
+
+[Mozilla/4.76*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.76*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.76*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.76*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=WinNT
+
+[Mozilla/4.76*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=Linux
+
+[Mozilla/4.76*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=76
+Platform=SunOS
+
+[Mozilla/4.77*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=MacPPC
+
+[Mozilla/4.77*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=Win95
+
+[Mozilla/4.77*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=Win98
+
+[Mozilla/4.77*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.77*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.77*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.77*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=WinNT
+
+[Mozilla/4.77*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=Linux
+
+[Mozilla/4.77*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=77
+Platform=SunOS
+
+[Mozilla/4.78*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=MacPPC
+
+[Mozilla/4.78*(Win95; ?)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=Win95
+
+[Mozilla/4.78*(Win98; ?)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=Win98
+
+[Mozilla/4.78*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.78*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.78*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.78*(WinNT; ?)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=WinNT
+
+[Mozilla/4.78*(X11*)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=Linux
+
+[Mozilla/4.78*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+MinorVer=78
+Platform=SunOS
+
+[Mozilla/4.79*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=MacPPC
+
+[Mozilla/4.79*(Win95; ?)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=Win95
+
+[Mozilla/4.79*(Win98; ?)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=Win98
+
+[Mozilla/4.79*(Windows NT 4.0; ?)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.79*(Windows NT 5.0; ?)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.79*(Windows NT 5.1; ?)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.79*(WinNT; ?)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=WinNT
+
+[Mozilla/4.79*(X11*)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=Linux
+
+[Mozilla/4.79*(X11; ?; SunOS*)*]
+Parent=Netscape 4.7
+Version=4.79
+MinorVer=79
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.8
+
+[Netscape 4.8]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=4.8
+MajorVer=4
+MinorVer=8
+Frames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+[Mozilla/4.8*(Macintosh; ?; MacPPC)*]
+Parent=Netscape 4.8
+Platform=MacPPC
+
+[Mozilla/4.8*(Macintosh; ?; PPC Mac OS X*]
+Parent=Netscape 4.8
+Platform=MacOSX
+
+[Mozilla/4.8*(Macintosh; ?; PPC)*]
+Parent=Netscape 4.8
+Platform=MacPPC
+
+[Mozilla/4.8*(Win95; *)*]
+Parent=Netscape 4.8
+
+[Mozilla/4.8*(Win98; *)*]
+Parent=Netscape 4.8
+Platform=Win98
+
+[Mozilla/4.8*(Windows NT 4.0; *)*]
+Parent=Netscape 4.8
+Platform=WinNT
+Win32=true
+
+[Mozilla/4.8*(Windows NT 5.0; *)*]
+Parent=Netscape 4.8
+Platform=Win2000
+Win32=true
+
+[Mozilla/4.8*(Windows NT 5.1; *)*]
+Parent=Netscape 4.8
+Platform=WinXP
+Win32=true
+
+[Mozilla/4.8*(WinNT; *)*]
+Parent=Netscape 4.8
+Platform=WinNT
+
+[Mozilla/4.8*(X11; *)*]
+Parent=Netscape 4.8
+Platform=Linux
+
+[Mozilla/4.8*(X11; *SunOS*)*]
+Parent=Netscape 4.8
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 6.0
+
+[Netscape 6.0]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=6.0
+MajorVer=6
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape6/6.0*]
+Parent=Netscape 6.0
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 6.1
+
+[Netscape 6.1]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=6.1
+MajorVer=6
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape6/6.1*]
+Parent=Netscape 6.1
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 6.2
+
+[Netscape 6.2]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=6.2
+MajorVer=6
+MinorVer=2
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X*) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape6/6.2*]
+Parent=Netscape 6.2
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 7.0
+
+[Netscape 7.0]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=7.0
+MajorVer=7
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win*9x 4.90; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/7.0*]
+Parent=Netscape 7.0
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 7.1
+
+[Netscape 7.1]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=7.1
+MajorVer=7
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X Mach-O; *; rv:*) Gecko/* Netscape*/7.1]
+Parent=Netscape 7.1
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/7.1*]
+Parent=Netscape 7.1
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 7.2
+
+[Netscape 7.2]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=7.2
+MajorVer=7
+MinorVer=2
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X Mach-O; *; rv:*) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/7.2*]
+Parent=Netscape 7.2
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 8.0
+
+[Netscape 8.0]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=8.0
+MajorVer=8
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X Mach-O; *; rv:*) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/8.0*]
+Parent=Netscape 8.0
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 8.1
+
+[Netscape 8.1]
+Parent=DefaultProperties
+Browser="Netscape"
+Version=8.1
+MajorVer=8
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=MacPPC
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/8.1*]
+Parent=Netscape 8.1
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firebird
+
+[Firebird]
+Parent=DefaultProperties
+Browser="Firebird"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Linux; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.?; *; rv:1.*) Gecko/* Firebird Browser/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.?; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.?; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.?; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.*; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+Win32=true
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (X11; *; IRIX*; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firebird/0.*]
+Parent=Firebird
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Mozilla Firebird/0.*]
+Parent=Firebird
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox
+
+[Firefox]
+Parent=DefaultProperties
+Browser="Firefox"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=MacOSX
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+
+[Mozilla/5.0 (OS/2; *; Warp*; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+
+[Mozilla/5.0 (Windows NT 5.?; ?; rv:1.*) Gecko/* Firefox]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.*; *; rv:1.*) Gecko/* Deer Park/Alpha*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.?; *; rv:1.*) Gecko/* Firefox/10.5]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0*; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Win32=true
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *; FreeBSD*; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+
+[Mozilla/5.0 (X11; *; HP-UX*; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=HP-UX
+
+[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=IRIX64
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+
+[Mozilla/5.0 (X11; *; Linux*; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/0.*]
+Parent=Firefox
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.0
+
+[Firefox 1.0]
+Parent=DefaultProperties
+Browser="Firefox"
+Version=1.0
+MajorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=MacPPC
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=MacOSX
+
+[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=OS/2
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; *; *Linux*; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; *; DragonFly*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=HP-UX
+
+[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=IRIX64
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/1.0*]
+Parent=Firefox 1.0
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.4
+
+[Firefox 1.4]
+Parent=DefaultProperties
+Browser="Firefox"
+Version=1.4
+MajorVer=1
+MinorVer=4
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=Linux
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=MacOSX
+
+[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=OS/2
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=Linux
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=HP-UX
+
+[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=IRIX64
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/1.4*]
+Parent=Firefox 1.4
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.5
+
+[Firefox 1.5]
+Parent=DefaultProperties
+Browser="Firefox"
+Version=1.5
+MajorVer=1
+MinorVer=5
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=Linux
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=MacOSX
+
+[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=OS/2
+
+[Mozilla/5.0 (rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2 x64; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=Linux
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=HP-UX
+
+[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=IRIX64
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/1.5*]
+Parent=Firefox 1.5
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 2.0
+
+[Firefox 2.0]
+Parent=DefaultProperties
+Browser="Firefox"
+Version=2.0
+MajorVer=2
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=Linux
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=MacOSX
+
+[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=OS/2
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win95; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=HP-UX
+
+[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=IRIX64
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.8*) Gecko/* Firefox/2.0*]
+Parent=Firefox 2.0
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 3.0 Alpha
+
+[Firefox 3.0]
+Parent=DefaultProperties
+Browser="Firefox"
+Version=3.0
+MajorVer=3
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=WinVista
+Win32=true
+
+[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (Windows; U; Windows NT 5.1 x64; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=WinXP
+Win32=false
+Win64=true
+
+[Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=Win2003
+Win32=false
+Win64=true
+
+[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=HP-UX
+
+[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=IRIX64
+
+[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.9*) Gecko/* Firefox/3.0*]
+Parent=Firefox 3.0
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Phoenix
+
+[Phoenix]
+Parent=DefaultProperties
+Browser="Phoenix"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.4*) Gecko/* Phoenix/0.5*]
+Parent=Phoenix
+Version=0.5
+MajorVer=0
+MinorVer=5
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Win98; *; rv:1.4*) Gecko/* Phoenix/0.5*]
+Parent=Phoenix
+Version=0.5
+MajorVer=0
+MinorVer=5
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.0*; *; rv:1.4*) Gecko/* Phoenix/0.5*]
+Parent=Phoenix
+Version=0.5
+MajorVer=0
+MinorVer=5
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.4*) Gecko/* Phoenix/0.5*]
+Parent=Phoenix
+Version=0.5
+MajorVer=0
+MinorVer=5
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; *; Windows NT 5.2*; *; rv:1.4*) Gecko/* Phoenix/0.5*]
+Parent=Phoenix
+Version=0.5
+MajorVer=0
+MinorVer=5
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (X11; *; Linux*; *; rv:1.4*) Gecko/* Phoenix/0.5*]
+Parent=Phoenix
+Version=0.5
+MajorVer=0
+MinorVer=5
+Platform=Linux
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SeaMonkey 1.0
+
+[SeaMonkey 1.0]
+Parent=DefaultProperties
+Browser="SeaMonkey"
+Version=1.0
+MajorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=WinME
+
+[Mozilla/5.0 (Windows; ?; Win98; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=Win98
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=Win2000
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=WinXP
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=Win2003
+
+[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=WinVista
+
+[Mozilla/5.0 (X11; ?; FreeBSD*; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; ?; Linux*; *; rv:1.8*) Gecko/20060221 SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]
+Parent=SeaMonkey 1.0
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SeaMonkey 1.1
+
+[SeaMonkey 1.1]
+Parent=DefaultProperties
+Browser="SeaMonkey"
+Version=1.1
+MajorVer=1
+MinorVer=1
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=WinME
+
+[Mozilla/5.0 (Windows; ?; Win98; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=Win98
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=Win2000
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=WinXP
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=Win2003
+
+[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=WinVista
+
+[Mozilla/5.0 (X11; ?; FreeBSD*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; ?; Linux*; *; rv:1.8*) Gecko/20060221 SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=Linux
+
+[Mozilla/5.0 (X11; ?; SunOS*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]
+Parent=SeaMonkey 1.1
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iceweasel
+
+[Iceweasel]
+Parent=DefaultProperties
+Browser="Iceweasel"
+Platform=Linux
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (X11; U; Linux*; *; rv:1.8*) Gecko/* Iceweasel/2.0* (Debian-*)]
+Parent=Iceweasel
+Version=2.0
+MajorVer=2
+MinorVer=0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.0
+
+[Mozilla 1.0]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.0
+MajorVer=1
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.0.*) Gecko/*]
+Parent=Mozilla 1.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.1
+
+[Mozilla 1.1]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.1
+MajorVer=1
+MinorVer=1
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.1.*) Gecko/*]
+Parent=Mozilla 1.1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.2
+
+[Mozilla 1.2]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.2
+MajorVer=1
+MinorVer=2
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.2.*) Gecko/*]
+Parent=Mozilla 1.2
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.3
+
+[Mozilla 1.3]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.3
+MajorVer=1
+MinorVer=3
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.3.*) Gecko/*]
+Parent=Mozilla 1.3
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.4
+
+[Mozilla 1.4]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.4
+MajorVer=1
+MinorVer=4
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=Win31
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=Win31
+Win16=true
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *Linux*; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=Linux
+
+[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *SunOS*; *rv:1.4*) Gecko/*]
+Parent=Mozilla 1.4
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.5
+
+[Mozilla 1.5]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.5
+MajorVer=1
+MinorVer=5
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=Win31
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=Win31
+Win16=true
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *Linux*; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=Linux
+
+[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *SunOS*; *rv:1.5*) Gecko/*]
+Parent=Mozilla 1.5
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.6
+
+[Mozilla 1.6]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.6
+MajorVer=1
+MinorVer=6
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=Win31
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=Win31
+Win16=true
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *Linux*; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=Linux
+
+[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *SunOS*; *rv:1.6*) Gecko/*]
+Parent=Mozilla 1.6
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.7
+
+[Mozilla 1.7]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.7
+MajorVer=1
+MinorVer=7
+Beta=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Win31
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Win31
+Win16=true
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *Linux*; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=Linux
+
+[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *SunOS*; *rv:1.7*) Gecko/*]
+Parent=Mozilla 1.7
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.8
+
+[Mozilla 1.8]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.8
+MajorVer=1
+MinorVer=8
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=Win31
+Win16=true
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *Linux*; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=Linux
+
+[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *SunOS*; *rv:1.8*) Gecko/*]
+Parent=Mozilla 1.8
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.9
+
+[Mozilla 1.9]
+Parent=DefaultProperties
+Browser="Mozilla"
+Version=1.9
+MajorVer=1
+MinorVer=9
+Alpha=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+JavaApplets=true
+JavaScript=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/5.0 (*rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+
+[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=MacOSX
+
+[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=WinME
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=Win31
+Win16=true
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win95; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=Win95
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Win98; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=Win98
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=Win2000
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=WinXP
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=Win2003
+Win32=true
+
+[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=WinNT
+Win32=true
+
+[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=FreeBSD
+
+[Mozilla/5.0 (X11; *Linux*; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=Linux
+
+[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=OpenBSD
+
+[Mozilla/5.0 (X11; *SunOS*; *rv:1.9*) Gecko/*]
+Parent=Mozilla 1.9
+Platform=SunOS
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE Mac
+
+[IE Mac]
+Parent=DefaultProperties
+Browser="IE"
+Platform=MacPPC
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+JavaApplets=true
+JavaScript=true
+CSS=1
+CssVersion=1
+supportsCSS=true
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 5.5
+
+[AOL 9.0/IE 5.5]
+Parent=DefaultProperties
+Browser="AOL"
+Version=5.5
+MajorVer=5
+MinorVer=5
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+AOL=true
+aolVersion=9.0
+
+[Mozilla/?.* (?compatible; *MSIE 5.5; *AOL 9.0*)*]
+Parent=AOL 9.0/IE 5.5
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Win 9x 4.90*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 95*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98; Win 9x 4.90*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 4.0*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.0*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.0*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.0*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.0*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.0*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.01*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.01*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.01*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.01*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.01*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.1*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.1*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.1*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.2*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.2*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 5.2*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 6.0*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 6.0*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 6.0*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 6.0*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0; *Windows NT 6.0*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 5.5
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 6.0
+
+[AOL 9.0/IE 6.0]
+Parent=DefaultProperties
+Browser="AOL"
+Version=6.0
+MajorVer=6
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+AOL=true
+aolVersion=9.0
+
+[Mozilla/?.* (?compatible; *MSIE 6.0; *AOL 9.0*)*]
+Parent=AOL 9.0/IE 6.0
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Win 9x 4.90*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 95*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98; Win 9x 4.90*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 4.0*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.0*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.01*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 6.0*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 6.0
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 7.0
+
+[AOL 9.0/IE 7.0]
+Parent=DefaultProperties
+Browser="AOL"
+Version=7.0
+MajorVer=7
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+AOL=true
+aolVersion=9.0
+
+[Mozilla/?.* (?compatible; *MSIE 7.0; *AOL 9.0*)*]
+Parent=AOL 9.0/IE 7.0
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Win 9x 4.90*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 95*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98; Win 9x 4.90*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows 98; Win 9x 4.90*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 4.0*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.0*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.0*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.01*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.01*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.1*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 5.2*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 6.0*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 1*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 2*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0; *Windows NT 6.0*.NET CLR 2*.NET CLR 1*)*]
+Parent=AOL 9.0/IE 7.0
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Avant Browser
+
+[Avant Browser]
+Parent=DefaultProperties
+Browser="Avant Browser"
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Advanced Browser (http://www.avantbrowser.com)]
+Parent=Avant Browser
+
+[Avant Browser*]
+Parent=Avant Browser
+
+[Avant Browser/*]
+Parent=Avant Browser
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 4.01
+
+[IE 4.01]
+Parent=DefaultProperties
+Browser="IE"
+Version=4.01
+MajorVer=4
+MinorVer=01
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (?compatible; *MSIE 4.01*)*]
+Parent=IE 4.01
+
+[Mozilla/4.0 (compatible; MSIE 4.01; *Windows 95*)*]
+Parent=IE 4.01
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 4.01; *Windows 98*)*]
+Parent=IE 4.01
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 4.01; *Windows NT 4.0*)*]
+Parent=IE 4.01
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 4.01; *Windows NT 5.0*)*]
+Parent=IE 4.01
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 4.01; *Windows NT 5.01*)*]
+Parent=IE 4.01
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)]
+Parent=IE 4.01
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 98; Win 9x 4.90;*)*]
+Parent=IE 4.01
+Platform=WinME
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 5.0
+
+[IE 5.0]
+Parent=DefaultProperties
+Browser="IE"
+Version=5.0
+MajorVer=5
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (?compatible; *MSIE 5.0*)*]
+Parent=IE 5.0
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 95*)*]
+Parent=IE 5.0
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 98*)*]
+Parent=IE 5.0
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 98; Win 9x 4.90;*)*]
+Parent=IE 5.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows NT 4.0*)*]
+Parent=IE 5.0
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows NT 5.0*)*]
+Parent=IE 5.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.0; *Windows NT 5.01*)*]
+Parent=IE 5.0
+Platform=Win2000
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 5.01
+
+[IE 5.01]
+Parent=DefaultProperties
+Browser="IE"
+Version=5.01
+MajorVer=5
+MinorVer=01
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (?compatible; *MSIE 5.01*)*]
+Parent=IE 5.01
+
+[Mozilla/4.0 (compatible; MSIE 5.01; *Windows 95*)*]
+Parent=IE 5.01
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 5.01; *Windows 98*)*]
+Parent=IE 5.01
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 5.01; *Windows 98; Win 9x 4.90;*)*]
+Parent=IE 5.01
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.01; *Windows NT 4.0*)*]
+Parent=IE 5.01
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 5.01; *Windows NT 5.0*)*]
+Parent=IE 5.01
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.01; *Windows NT 5.01*)*]
+Parent=IE 5.01
+Platform=Win2000
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 5.5
+
+[IE 5.5]
+Parent=DefaultProperties
+Browser="IE"
+Version=5.5
+MajorVer=5
+MinorVer=5
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (?compatible; *MSIE 5.5*)*]
+Parent=IE 5.5
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows 95*)*]
+Parent=IE 5.5
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows 98*)*]
+Parent=IE 5.5
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows 98; Win 9x 4.90*)*]
+Parent=IE 5.5
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 4.0*)*]
+Parent=IE 5.5
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.0*)*]
+Parent=IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.01*)*]
+Parent=IE 5.5
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.1*)*]
+Parent=IE 5.5
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.2*)*]
+Parent=IE 5.5
+Platform=Win2003
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 6.0
+
+[IE 6.0]
+Parent=DefaultProperties
+Browser="IE"
+Version=6.0
+MajorVer=6
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (?compatible; *MSIE 6.0*)*]
+Parent=IE 6.0
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows 95*)*]
+Parent=IE 6.0
+Platform=Win95
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows 98*)*]
+Parent=IE 6.0
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows 98; Win 9x 4.90*)*]
+Parent=IE 6.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 4.0*)*]
+Parent=IE 6.0
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.0*)*]
+Parent=IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.01*)*]
+Parent=IE 6.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.1*)*]
+Parent=IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.2*)*]
+Parent=IE 6.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.2;*Win64;*)*]
+Parent=IE 6.0
+Platform=WinXP
+Win32=false
+Win64=true
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.2;*WOW64;*)*]
+Parent=IE 6.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 6.0*)*]
+Parent=IE 6.0
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 7.0
+
+[IE 7.0]
+Parent=DefaultProperties
+Browser="IE"
+Version=7.0
+MajorVer=7
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/?.* (?compatible; *MSIE 7.0*)*]
+Parent=IE 7.0
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows 98*)*]
+Parent=IE 7.0
+Platform=Win98
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows 98; Win 9x 4.90;*)*]
+Parent=IE 7.0
+Platform=WinME
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 4.0*)*]
+Parent=IE 7.0
+Platform=WinNT
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.0*)*]
+Parent=IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.01*)*]
+Parent=IE 7.0
+Platform=Win2000
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.1*)*]
+Parent=IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2*)*]
+Parent=IE 7.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2;*Win64;*)*]
+Parent=IE 7.0
+Platform=WinXP
+Win32=false
+Win64=true
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2;*WOW64;*)*]
+Parent=IE 7.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 6.0*)*]
+Parent=IE 7.0
+Platform=WinVista
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 8.0
+
+[IE 8.0]
+Parent=DefaultProperties
+Browser="IE 8.0"
+Version=8.0
+MajorVer=8
+Win32=true
+Frames=true
+IFrames=true
+Tables=true
+Cookies=true
+BackgroundSounds=true
+CDF=true
+VBScript=true
+JavaApplets=true
+JavaScript=true
+ActiveXControls=true
+CSS=2
+CssVersion=2
+supportsCSS=true
+
+[Mozilla/4.0 (compatible; MSIE 8.0; *Windows NT 5.1*)*]
+Parent=IE 8.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 8.0; *Windows NT 5.2*)*]
+Parent=IE 8.0
+Platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 8.0; *Windows NT 5.2;*Win64;*)*]
+Parent=IE 8.0
+Platform=WinXP
+Win32=false
+Win64=true
+
+[Mozilla/4.0 (compatible; MSIE 8.0; *Windows NT 5.2;*WOW64;*)*]
+Parent=IE 8.0
+Platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 8.0; *Windows NT 6.0*)*]
+Parent=IE 8.0
+Platform=WinVista
+
+[Mozilla/4.0 (compatible; MSIE 8.0; *Windows NT 6.0;*WOW64;*)*]
+Parent=IE 8.0
+Platform=WinVista
+
+[Mozilla/?.? (compatible; MSIE 4.0*; *Mac_PowerPC*]
+Parent=IE Mac
+Version=4.0
+MajorVer=4
+MinorVer=0
+
+[Mozilla/?.? (compatible; MSIE 4.5*; *Mac_PowerPC*]
+Parent=IE Mac
+Version=4.5
+MajorVer=4
+MinorVer=5
+
+[Mozilla/?.? (compatible; MSIE 5.0*; *Mac_PowerPC*]
+Parent=IE Mac
+Version=5.0
+MajorVer=5
+MinorVer=0
+
+[Mozilla/?.? (compatible; MSIE 5.1*; *Mac_PowerPC*]
+Parent=IE Mac
+Version=5.1
+MajorVer=5
+MinorVer=1
+
+[Mozilla/?.? (compatible; MSIE 5.2*; *Mac_PowerPC*]
+Parent=IE Mac
+Version=5.2
+MajorVer=5
+MinorVer=2
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Default Browser
+
+[*]
+Browser="Default Browser"
+Version=0
+MajorVer=0
+MinorVer=0
+Platform=unknown
+Alpha=false
+Beta=false
+Win16=false
+Win32=false
+Win64=false
+Frames=true
+IFrames=false
+Tables=true
+Cookies=false
+BackgroundSounds=false
+AuthenticodeUpdate=0
+CDF=false
+VBScript=false
+JavaApplets=false
+JavaScript=false
+ActiveXControls=false
+Stripper=false
+isBanned=false
+WAP=false
+isMobileDevice=false
+isSyndicationReader=false
+Crawler=false
+CSS=0
+CssVersion=0
+supportsCSS=false
+AOL=false
+aolVersion=0
diff --git a/ext/standard/tests/misc/browsernames.inc b/ext/standard/tests/misc/browsernames.inc
new file mode 100644
index 0000000..cac8f9a
--- /dev/null
+++ b/ext/standard/tests/misc/browsernames.inc
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Common browser names. Used with: get_browser()
+*/
+return array(
+ "Opera/7.11 (Windows NT 5.1; U) [en]",
+ "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]",
+ "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]",
+ "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]",
+ "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.60 [en]",
+ "Opera/9.00 (Windows NT 5.1; U; en)",
+ "Opera/9.26 (Macintosh; PPC Mac OS X; U; en)",
+
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)",
+ "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)",
+ "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC; e504460WanadooNL)",
+ "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)",
+ "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1)",
+ "Mozilla/4.0 (compatible;MSIE 7.0;Windows NT 6.0)",
+
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51",
+ "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3",
+ "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3",
+ "Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3",
+ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; ru-ru) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5",
+
+ "Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686)",
+ "Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.19-32mdkenterprise; X11; i686; ar, en_US)",
+ "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)",
+
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030504 Mozilla",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2a) Gecko/20020910",
+ "Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611",
+ "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.9) Gecko/20050711",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9) Gecko/2008052906",
+
+ "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5",
+ "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6",
+ "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4a) Gecko/20030423 Firebird Browser/0.6",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8",
+ "Mozilla/5.0 (Windows 98; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0",
+ "Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0",
+ "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.12) Gecko/20080210 Firefox/2.0.0.12",
+ "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12",
+);
diff --git a/ext/standard/tests/misc/get_browser_basic.phpt b/ext/standard/tests/misc/get_browser_basic.phpt
new file mode 100644
index 0000000..5f67339
--- /dev/null
+++ b/ext/standard/tests/misc/get_browser_basic.phpt
@@ -0,0 +1,1468 @@
+--TEST--
+Test get_browser() function : basic functionality
+--INI--
+browscap={PWD}/browscap.ini
+--SKIPIF--
+<?php
+ /**
+ * Basic test, it would be pretty much coincidence if there's
+ * a browscap.ini on another place that isn't valid.
+ */
+ if(! is_readable( ini_get( 'browscap' ) ) ) {
+ die( 'skip: browscap.ini file ' . ini_get('browscap') . " not readable" );
+ }
+?>
+--FILE--
+<?php
+/* Prototype : mixed get_browser([string browser_name [, bool return_array]])
+ * Description: 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.
+ *
+ * Source code: ext/standard/browscap.c
+ * Alias to functions:
+ */
+
+$browsers = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'browsernames.inc';
+
+echo "*** Testing get_browser() : basic functionality ***\n";
+
+for( $x = 0; $x < 20; $x++) {
+ var_dump( get_browser( $browsers[$x], true ) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_browser() : basic functionality ***
+array(35) {
+ ["browser_name_regex"]=>
+ string(41) "§^opera/7\.1.* \(windows nt 5\.1; .\).*$§"
+ ["browser_name_pattern"]=>
+ string(31) "Opera/7.1* (Windows NT 5.1; ?)*"
+ ["parent"]=>
+ string(9) "Opera 7.1"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "7.1"
+ ["majorver"]=>
+ string(1) "7"
+ ["minorver"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(83) "§^mozilla/4\.0 \(compatible; msie 6\.0; msie 5\.5; windows nt 5\.0\) opera 7\.0.*$§"
+ ["browser_name_pattern"]=>
+ string(71) "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.0*"
+ ["parent"]=>
+ string(9) "Opera 7.0"
+ ["platform"]=>
+ string(7) "Win2000"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "7.0"
+ ["majorver"]=>
+ string(1) "7"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(83) "§^mozilla/4\.0 \(compatible; msie 6\.0; msie 5\.5; windows nt 4\.0\) opera 7\.0.*$§"
+ ["browser_name_pattern"]=>
+ string(71) "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0*"
+ ["parent"]=>
+ string(9) "Opera 7.0"
+ ["platform"]=>
+ string(5) "WinNT"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "7.0"
+ ["majorver"]=>
+ string(1) "7"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(69) "§^mozilla/4\.0 \(compatible; msie 5\.0; windows 2000\) opera 6\.0.*$§"
+ ["browser_name_pattern"]=>
+ string(59) "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0*"
+ ["parent"]=>
+ string(9) "Opera 6.0"
+ ["platform"]=>
+ string(7) "Win2000"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "6.0"
+ ["majorver"]=>
+ string(1) "6"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "1"
+ ["cssversion"]=>
+ string(1) "1"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(68) "§^mozilla/4\.0 \(compatible; msie 5\.0; mac_powerpc\) opera 5\.0.*$§"
+ ["browser_name_pattern"]=>
+ string(58) "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0*"
+ ["parent"]=>
+ string(9) "Opera 5.0"
+ ["platform"]=>
+ string(6) "MacPPC"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "5.0"
+ ["majorver"]=>
+ string(1) "5"
+ ["frames"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "1"
+ ["cssversion"]=>
+ string(1) "1"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["iframes"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(65) "§^mozilla/4\.0 \(compatible; msie 6\.0; .*windows nt 5\.1.*\).*$§"
+ ["browser_name_pattern"]=>
+ string(53) "Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.1*)*"
+ ["parent"]=>
+ string(6) "IE 6.0"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["browser"]=>
+ string(2) "IE"
+ ["version"]=>
+ string(3) "6.0"
+ ["majorver"]=>
+ string(1) "6"
+ ["win32"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["cdf"]=>
+ string(1) "1"
+ ["vbscript"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["activexcontrols"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(40) "§^opera/9\.0.* \(windows nt 5\.1.*\).*$§"
+ ["browser_name_pattern"]=>
+ string(29) "Opera/9.0* (Windows NT 5.1*)*"
+ ["parent"]=>
+ string(9) "Opera 9.0"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "9.0"
+ ["majorver"]=>
+ string(1) "9"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(47) "§^opera/9\.2.* \(macintosh; .*mac os x;.*\).*$§"
+ ["browser_name_pattern"]=>
+ string(36) "Opera/9.2* (Macintosh; *Mac OS X;*)*"
+ ["parent"]=>
+ string(9) "Opera 9.2"
+ ["platform"]=>
+ string(6) "MacOSX"
+ ["browser"]=>
+ string(5) "Opera"
+ ["version"]=>
+ string(3) "9.2"
+ ["majorver"]=>
+ string(1) "9"
+ ["minorver"]=>
+ string(1) "2"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(65) "§^mozilla/4\.0 \(compatible; msie 6\.0; .*windows nt 5\.1.*\).*$§"
+ ["browser_name_pattern"]=>
+ string(53) "Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.1*)*"
+ ["parent"]=>
+ string(6) "IE 6.0"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["browser"]=>
+ string(2) "IE"
+ ["version"]=>
+ string(3) "6.0"
+ ["majorver"]=>
+ string(1) "6"
+ ["win32"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["cdf"]=>
+ string(1) "1"
+ ["vbscript"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["activexcontrols"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(65) "§^mozilla/4\.0 \(compatible; msie 6\.0; .*windows nt 5\.1.*\).*$§"
+ ["browser_name_pattern"]=>
+ string(53) "Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.1*)*"
+ ["parent"]=>
+ string(6) "IE 6.0"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["browser"]=>
+ string(2) "IE"
+ ["version"]=>
+ string(3) "6.0"
+ ["majorver"]=>
+ string(1) "6"
+ ["win32"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["cdf"]=>
+ string(1) "1"
+ ["vbscript"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["activexcontrols"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(59) "§^mozilla/.\.. \(compatible; msie 5\.2.*; .*mac_powerpc.*$§"
+ ["browser_name_pattern"]=>
+ string(49) "Mozilla/?.? (compatible; MSIE 5.2*; *Mac_PowerPC*"
+ ["parent"]=>
+ string(6) "IE Mac"
+ ["version"]=>
+ string(3) "5.2"
+ ["majorver"]=>
+ string(1) "5"
+ ["minorver"]=>
+ string(1) "2"
+ ["browser"]=>
+ string(2) "IE"
+ ["platform"]=>
+ string(6) "MacPPC"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["cdf"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "1"
+ ["cssversion"]=>
+ string(1) "1"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(59) "§^mozilla/.\.. \(compatible; msie 5\.0.*; .*mac_powerpc.*$§"
+ ["browser_name_pattern"]=>
+ string(49) "Mozilla/?.? (compatible; MSIE 5.0*; *Mac_PowerPC*"
+ ["parent"]=>
+ string(6) "IE Mac"
+ ["version"]=>
+ string(3) "5.0"
+ ["majorver"]=>
+ string(1) "5"
+ ["minorver"]=>
+ string(1) "0"
+ ["browser"]=>
+ string(2) "IE"
+ ["platform"]=>
+ string(6) "MacPPC"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["cdf"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "1"
+ ["cssversion"]=>
+ string(1) "1"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(99) "§^mozilla/5\.0 \(windows; .; windows nt 6\.0; .*\) applewebkit/.* \(.*\) version/3\.0.* safari/.*$§"
+ ["browser_name_pattern"]=>
+ string(83) "Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/3.0* Safari/*"
+ ["parent"]=>
+ string(10) "Safari 3.0"
+ ["platform"]=>
+ string(8) "WinVista"
+ ["browser"]=>
+ string(6) "Safari"
+ ["version"]=>
+ string(3) "3.0"
+ ["majorver"]=>
+ string(1) "3"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(99) "§^mozilla/.* \(iphone; .; .*mac os x.*\) applewebkit/.* \(.*\) version/.*\..* mobile/.* safari/.*$§"
+ ["browser_name_pattern"]=>
+ string(81) "Mozilla/* (iPhone; ?; *Mac OS X*) AppleWebKit/* (*) Version/*.* Mobile/* Safari/*"
+ ["parent"]=>
+ string(6) "iPhone"
+ ["browser"]=>
+ string(6) "Safari"
+ ["platform"]=>
+ string(6) "MacOSX"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["wap"]=>
+ string(1) "1"
+ ["ismobiledevice"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(99) "§^mozilla/5\.0 \(ipod; u; .*mac os x; en\) applewebkit/.* \(.*\) version/3\.0 mobile/.* safari/.*$§"
+ ["browser_name_pattern"]=>
+ string(84) "Mozilla/5.0 (iPod; U; *Mac OS X; en) AppleWebKit/* (*) Version/3.0 Mobile/* Safari/*"
+ ["parent"]=>
+ string(4) "iPod"
+ ["version"]=>
+ string(3) "3.0"
+ ["majorver"]=>
+ string(1) "3"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(6) "MacOSX"
+ ["browser"]=>
+ string(4) "iPod"
+ ["cookies"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(0) ""
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+===DONE===
diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt
new file mode 100644
index 0000000..1fd652e
--- /dev/null
+++ b/ext/standard/tests/misc/get_browser_error.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test get_browser() function : error functionality
+--INI--
+browscap={PWD}/browscap.ini
+--SKIPIF--
+<?php
+ /**
+ * Basic test, it would be pretty much coincidence if there's
+ * a browscap.ini on another place that isn't valid.
+ */
+ if(! is_readable( ini_get( 'browscap' ) ) ) {
+ die( 'skip: browscap.ini file ' . ini_get('browscap') . " not readable" );
+ }
+?>
+--FILE--
+<?php
+/* Prototype : mixed get_browser([string browser_name [, bool return_array]])
+ * Description: 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.
+ *
+ * Source code: ext/standard/browscap.c
+ * Alias to functions:
+ */
+
+$browsers = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'browsernames.inc';
+
+echo "*** Testing get_browser() : error functionality ***\n";
+
+/* Unknown browser uses defaults. */
+var_dump( get_browser( 'foobar', true ) );
+
+/* More than expected arguments */
+var_dump( get_browser( 'foobar', true, 15 ) );
+
+/* Some wrong parameters, no HTTP_USER_AGENT set */
+var_dump( get_browser( null, 'foobar' ) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_browser() : error functionality ***
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+
+Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/misc/get_browser_variation1.phpt b/ext/standard/tests/misc/get_browser_variation1.phpt
new file mode 100644
index 0000000..b85d3de
--- /dev/null
+++ b/ext/standard/tests/misc/get_browser_variation1.phpt
@@ -0,0 +1,1399 @@
+--TEST--
+Test get_browser() function : variation functionality: extra browser names
+--INI--
+browscap={PWD}/browscap.ini
+--SKIPIF--
+<?php
+ /**
+ * Basic test, it would be pretty much coincidence if there's
+ * a browscap.ini on another place that isn't valid.
+ */
+ if(! is_readable( ini_get( 'browscap' ) ) ) {
+ die( 'skip: browscap.ini file ' . ini_get('browscap') . " not readable" );
+ }
+?>
+--FILE--
+<?php
+/* Prototype : mixed get_browser([string browser_name [, bool return_array]])
+ * Description: 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.
+ *
+ * Source code: ext/standard/browscap.c
+ * Alias to functions:
+ */
+
+$browsers = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'browsernames.inc';
+
+echo "*** Testing get_browser() : variation functionality: extra browser names ***\n";
+
+$count = count( $browsers );
+for( $x = 20; $x < $count; $x++) {
+ var_dump( get_browser( $browsers[$x], true ) );
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_browser() : variation functionality: extra browser names ***
+array(35) {
+ ["browser_name_regex"]=>
+ string(94) "§^mozilla/5\.0 \(macintosh; .; .*mac os x.*\) applewebkit/.* \(.*\) version/3\.1.* safari/.*$§"
+ ["browser_name_pattern"]=>
+ string(78) "Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.1* Safari/*"
+ ["parent"]=>
+ string(10) "Safari 3.1"
+ ["platform"]=>
+ string(6) "MacOSX"
+ ["browser"]=>
+ string(6) "Safari"
+ ["version"]=>
+ string(3) "3.1"
+ ["majorver"]=>
+ string(1) "3"
+ ["minorver"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["backgroundsounds"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(67) "§^mozilla/5\.0 \(macintosh; .*mac os x.*\) gecko/.* camino/1\.5.*$§"
+ ["browser_name_pattern"]=>
+ string(55) "Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.5*"
+ ["parent"]=>
+ string(6) "Camino"
+ ["version"]=>
+ string(3) "1.5"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "5"
+ ["platform"]=>
+ string(6) "MacOSX"
+ ["browser"]=>
+ string(6) "Camino"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(29) "§^.*konqueror/3\.1.*linux.*$§"
+ ["browser_name_pattern"]=>
+ string(21) "*Konqueror/3.1*Linux*"
+ ["parent"]=>
+ string(9) "Konqueror"
+ ["version"]=>
+ string(3) "3.1"
+ ["majorver"]=>
+ string(1) "3"
+ ["minorver"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(9) "Konqueror"
+ ["platform"]=>
+ string(5) "Linux"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(29) "§^.*konqueror/3\.1.*linux.*$§"
+ ["browser_name_pattern"]=>
+ string(21) "*Konqueror/3.1*Linux*"
+ ["parent"]=>
+ string(9) "Konqueror"
+ ["version"]=>
+ string(3) "3.1"
+ ["majorver"]=>
+ string(1) "3"
+ ["minorver"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(9) "Konqueror"
+ ["platform"]=>
+ string(5) "Linux"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(21) "§^.*konqueror/2\..*$§"
+ ["browser_name_pattern"]=>
+ string(14) "*Konqueror/2.*"
+ ["parent"]=>
+ string(9) "Konqueror"
+ ["iframes"]=>
+ string(0) ""
+ ["browser"]=>
+ string(9) "Konqueror"
+ ["platform"]=>
+ string(5) "Linux"
+ ["frames"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(70) "§^mozilla/5\.0 \(windows; .; windows nt 5\.1; .*rv:1\.4.*\) gecko/.*$§"
+ ["browser_name_pattern"]=>
+ string(58) "Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.4*) Gecko/*"
+ ["parent"]=>
+ string(11) "Mozilla 1.4"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(7) "Mozilla"
+ ["version"]=>
+ string(3) "1.4"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "4"
+ ["beta"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(57) "§^mozilla/5\.0 \(x11; .*linux.*; .*rv:1\.7.*\) gecko/.*$§"
+ ["browser_name_pattern"]=>
+ string(44) "Mozilla/5.0 (X11; *Linux*; *rv:1.7*) Gecko/*"
+ ["parent"]=>
+ string(11) "Mozilla 1.7"
+ ["platform"]=>
+ string(5) "Linux"
+ ["browser"]=>
+ string(7) "Mozilla"
+ ["version"]=>
+ string(3) "1.7"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "7"
+ ["beta"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(70) "§^mozilla/5\.0 \(windows; .; windows nt 5\.1; .*rv:1\.9.*\) gecko/.*$§"
+ ["browser_name_pattern"]=>
+ string(58) "Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.9*) Gecko/*"
+ ["parent"]=>
+ string(11) "Mozilla 1.9"
+ ["platform"]=>
+ string(5) "WinXP"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(7) "Mozilla"
+ ["version"]=>
+ string(3) "1.9"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "9"
+ ["alpha"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(34) {
+ ["browser_name_regex"]=>
+ string(6) "§^.*$§"
+ ["browser_name_pattern"]=>
+ string(1) "*"
+ ["browser"]=>
+ string(15) "Default Browser"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(0) ""
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(1) "0"
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["javaapplets"]=>
+ string(0) ""
+ ["javascript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["css"]=>
+ string(1) "0"
+ ["cssversion"]=>
+ string(1) "0"
+ ["supportscss"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(75) "§^mozilla/5\.0 \(x11; .*; linux.*; .*; rv:1\..*\) gecko/.* firebird/0\..*$§"
+ ["browser_name_pattern"]=>
+ string(60) "Mozilla/5.0 (X11; *; Linux*; *; rv:1.*) Gecko/* Firebird/0.*"
+ ["parent"]=>
+ string(8) "Firebird"
+ ["browser"]=>
+ string(8) "Firebird"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(57) "§^mozilla/5\.0 \(x11; .*linux.*; .*rv:1\.4.*\) gecko/.*$§"
+ ["browser_name_pattern"]=>
+ string(44) "Mozilla/5.0 (X11; *Linux*; *rv:1.4*) Gecko/*"
+ ["parent"]=>
+ string(11) "Mozilla 1.4"
+ ["platform"]=>
+ string(5) "Linux"
+ ["browser"]=>
+ string(7) "Mozilla"
+ ["version"]=>
+ string(3) "1.4"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "4"
+ ["beta"]=>
+ string(1) "1"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["alpha"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(86) "§^mozilla/5\.0 \(windows; .*; windows nt 5\.1; .*; rv:1\..*\) gecko/.* firefox/0\..*$§"
+ ["browser_name_pattern"]=>
+ string(71) "Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/0.*"
+ ["parent"]=>
+ string(7) "Firefox"
+ ["win32"]=>
+ string(1) "1"
+ ["browser"]=>
+ string(7) "Firefox"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["version"]=>
+ string(1) "0"
+ ["majorver"]=>
+ string(1) "0"
+ ["minorver"]=>
+ string(1) "0"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(41) "§^mozilla/5\.0 \(.*rv:1\.8.*\) gecko/.*$§"
+ ["browser_name_pattern"]=>
+ string(30) "Mozilla/5.0 (*rv:1.8*) Gecko/*"
+ ["parent"]=>
+ string(11) "Mozilla 1.8"
+ ["browser"]=>
+ string(7) "Mozilla"
+ ["version"]=>
+ string(3) "1.8"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "8"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(41) "§^mozilla/5\.0 \(.*rv:1\.8.*\) gecko/.*$§"
+ ["browser_name_pattern"]=>
+ string(30) "Mozilla/5.0 (*rv:1.8*) Gecko/*"
+ ["parent"]=>
+ string(11) "Mozilla 1.8"
+ ["browser"]=>
+ string(7) "Mozilla"
+ ["version"]=>
+ string(3) "1.8"
+ ["majorver"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "8"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["platform"]=>
+ string(7) "unknown"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(76) "§^mozilla/5\.0 \(x11; .*; sunos.*; .*; rv:1\.8.*\) gecko/.* firefox/2\.0.*$§"
+ ["browser_name_pattern"]=>
+ string(61) "Mozilla/5.0 (X11; *; SunOS*; *; rv:1.8*) Gecko/* Firefox/2.0*"
+ ["parent"]=>
+ string(11) "Firefox 2.0"
+ ["platform"]=>
+ string(5) "SunOS"
+ ["browser"]=>
+ string(7) "Firefox"
+ ["version"]=>
+ string(3) "2.0"
+ ["majorver"]=>
+ string(1) "2"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+array(35) {
+ ["browser_name_regex"]=>
+ string(78) "§^mozilla/5\.0 \(x11; .*; .*linux.*; .*; rv:1\.8.*\) gecko/.* firefox/2\.0.*$§"
+ ["browser_name_pattern"]=>
+ string(62) "Mozilla/5.0 (X11; *; *Linux*; *; rv:1.8*) Gecko/* Firefox/2.0*"
+ ["parent"]=>
+ string(11) "Firefox 2.0"
+ ["platform"]=>
+ string(5) "Linux"
+ ["browser"]=>
+ string(7) "Firefox"
+ ["version"]=>
+ string(3) "2.0"
+ ["majorver"]=>
+ string(1) "2"
+ ["frames"]=>
+ string(1) "1"
+ ["iframes"]=>
+ string(1) "1"
+ ["tables"]=>
+ string(1) "1"
+ ["cookies"]=>
+ string(1) "1"
+ ["javaapplets"]=>
+ string(1) "1"
+ ["javascript"]=>
+ string(1) "1"
+ ["css"]=>
+ string(1) "2"
+ ["cssversion"]=>
+ string(1) "2"
+ ["supportscss"]=>
+ string(1) "1"
+ ["minorver"]=>
+ string(1) "0"
+ ["alpha"]=>
+ string(0) ""
+ ["beta"]=>
+ string(0) ""
+ ["win16"]=>
+ string(0) ""
+ ["win32"]=>
+ string(0) ""
+ ["win64"]=>
+ string(0) ""
+ ["backgroundsounds"]=>
+ string(0) ""
+ ["authenticodeupdate"]=>
+ string(0) ""
+ ["cdf"]=>
+ string(0) ""
+ ["vbscript"]=>
+ string(0) ""
+ ["activexcontrols"]=>
+ string(0) ""
+ ["stripper"]=>
+ string(0) ""
+ ["isbanned"]=>
+ string(0) ""
+ ["wap"]=>
+ string(0) ""
+ ["ismobiledevice"]=>
+ string(0) ""
+ ["issyndicationreader"]=>
+ string(0) ""
+ ["crawler"]=>
+ string(0) ""
+ ["aol"]=>
+ string(0) ""
+ ["aolversion"]=>
+ string(1) "0"
+}
+===DONE===
diff --git a/ext/standard/tests/misc/syslog_basic.phpt b/ext/standard/tests/misc/syslog_basic.phpt
new file mode 100644
index 0000000..6c627e9
--- /dev/null
+++ b/ext/standard/tests/misc/syslog_basic.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Basic syslog test
+--FILE--
+<?php
+openlog('phpt', LOG_NDELAY | LOG_PID, LOG_USER);
+
+syslog(LOG_WARNING, 'Basic syslog test');
+
+closelog();
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/standard/tests/misc/syslog_parameters.phpt b/ext/standard/tests/misc/syslog_parameters.phpt
new file mode 100644
index 0000000..fdb31ae
--- /dev/null
+++ b/ext/standard/tests/misc/syslog_parameters.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Syslog parameter parsing test
+--FILE--
+<?php
+openlog();
+openlog(NULL, 'string', 0);
+
+syslog();
+syslog('Wrong parameter order', LOG_WARNING);
+
+closelog('Doesnt take any parameters');
+?>
+--EXPECTF--
+Warning: openlog() expects exactly 3 parameters, 0 given in %s on line %d
+
+Warning: openlog() expects parameter 2 to be long, string given in %s on line %d
+
+Warning: syslog() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: syslog() expects parameter 1 to be long, string given in %s on line %d
+
+Warning: closelog() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_basic.phpt b/ext/standard/tests/misc/time_nanosleep_basic.phpt
new file mode 100644
index 0000000..3f20b00
--- /dev/null
+++ b/ext/standard/tests/misc/time_nanosleep_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+time_nanosleep — Delay for a number of seconds and nanoseconds
+--SKIPIF--
+<?php if (!function_exists('time_nanosleep')) die("skip");
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--CREDITS--
+Àlex Corretgé - alex@corretge.cat
+--FILE--
+<?php
+$nano = time_nanosleep(2, 100000);
+
+if ($nano === true) {
+ echo "Slept for 2 seconds, 100 milliseconds.\n";
+} elseif ($nano === false) {
+ echo "Sleeping failed.\n";
+} elseif (is_array($nano)) {
+ $seconds = $nano['seconds'];
+ $nanoseconds = $nano['nanoseconds'];
+ echo "Interrupted by a signal.\n";
+ echo "Time remaining: $seconds seconds, $nanoseconds nanoseconds.";
+}
+?>
+--EXPECT--
+Slept for 2 seconds, 100 milliseconds.
diff --git a/ext/standard/tests/misc/time_nanosleep_error1.phpt b/ext/standard/tests/misc/time_nanosleep_error1.phpt
new file mode 100644
index 0000000..1f0ad75
--- /dev/null
+++ b/ext/standard/tests/misc/time_nanosleep_error1.phpt
@@ -0,0 +1,14 @@
+--TEST--
+time_nanosleep — Delay for a number of seconds and nanoseconds
+--SKIPIF--
+<?php if (!function_exists('time_nanosleep')) die("skip"); ?>
+--CREDITS--
+Àlex Corretgé - alex@corretge.cat
+--FILE--
+<?php
+
+$nano = time_nanosleep('A', 100000);
+
+?>
+--EXPECTF--
+Warning: time_nanosleep() expects parameter 1 to be long, %unicode_string_optional% given in %s.php on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error2.phpt b/ext/standard/tests/misc/time_nanosleep_error2.phpt
new file mode 100644
index 0000000..008a07d
--- /dev/null
+++ b/ext/standard/tests/misc/time_nanosleep_error2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+time_nanosleep — Delay for a number of seconds and nanoseconds
+--SKIPIF--
+<?php if (!function_exists('time_nanosleep')) die("skip"); ?>
+--CREDITS--
+Àlex Corretgé - alex@corretge.cat
+--FILE--
+<?php
+
+$nano = time_nanosleep(2, 'B');
+
+?>
+--EXPECTF--
+Warning: time_nanosleep() expects parameter 2 to be long, %unicode_string_optional% given in %s.php on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error3.phpt b/ext/standard/tests/misc/time_nanosleep_error3.phpt
new file mode 100644
index 0000000..b6365f3
--- /dev/null
+++ b/ext/standard/tests/misc/time_nanosleep_error3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+time_nanosleep — Delay for a number of seconds and nanoseconds
+--SKIPIF--
+<?php
+if (strpos(strtoupper(PHP_OS), 'WIN') !== false) die("skip Test is not valid for Windows");
+if (!function_exists('time_nanosleep')) die("skip");
+?>
+--CREDITS--
+Àlex Corretgé - alex@corretge.cat
+--FILE--
+<?php
+
+$nano = time_nanosleep(-2, 1000);
+
+?>
+--EXPECTF--
+Warning: time_nanosleep(): The seconds value must be greater than 0 in %stime_nanosleep_error3.php on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error4.phpt b/ext/standard/tests/misc/time_nanosleep_error4.phpt
new file mode 100644
index 0000000..e3e522a
--- /dev/null
+++ b/ext/standard/tests/misc/time_nanosleep_error4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+time_nanosleep — Delay for a number of seconds and nanoseconds
+--SKIPIF--
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') die("skip Test is not valid for Windows");
+if (!function_exists('time_nanosleep')) die("skip");
+?>
+--CREDITS--
+Àlex Corretgé - alex@corretge.cat
+--FILE--
+<?php
+
+$nano = time_nanosleep(0, -10);
+
+?>
+--EXPECTF--
+Warning: time_nanosleep(): The nanoseconds value must be greater than 0 in %stime_nanosleep_error4.php on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error5.phpt b/ext/standard/tests/misc/time_nanosleep_error5.phpt
new file mode 100644
index 0000000..2f1f3a1
--- /dev/null
+++ b/ext/standard/tests/misc/time_nanosleep_error5.phpt
@@ -0,0 +1,14 @@
+--TEST--
+time_nanosleep — Delay for a number of seconds and nanoseconds
+--SKIPIF--
+<?php if (!function_exists('time_nanosleep')) die("skip"); ?>
+--CREDITS--
+Àlex Corretgé - alex@corretge.cat
+--FILE--
+<?php
+
+$nano = time_nanosleep(0, 1000000000);
+
+?>
+--EXPECTF--
+Warning: time_nanosleep(): nanoseconds was not in the range 0 to 999 999 999 or seconds was negative in %s.php on line %d
diff --git a/ext/standard/tests/misc/time_sleep_until_basic.phpt b/ext/standard/tests/misc/time_sleep_until_basic.phpt
new file mode 100644
index 0000000..05cc0e6
--- /dev/null
+++ b/ext/standard/tests/misc/time_sleep_until_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+time_sleep_until() function - basic test for time_sleep_until()
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');
+?>
+--CREDITS--
+Manuel Baldassarri mb@ideato.it
+Michele Orselli mo@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+ $time = microtime(true) + 2;
+ var_dump(time_sleep_until( (int)$time ));
+ $now = microtime(true);
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ // on windows, time_sleep_until has millisecond accuracy while microtime() is accurate
+ // to 10th of a second. this means there can be up to a .9 millisecond difference
+ // which will fail this test. this test randomly fails on Windows and this is the cause.
+ //
+ // fix: round to nearest millisecond
+ // passes for up to .5 milliseconds less, fails for more than .5 milliseconds
+ // should be fine since time_sleep_until() on Windows is accurate to the
+ // millisecond(.5 rounded up is 1 millisecond)
+ $now = round($now, 3);
+ }
+ var_dump($now >= (int)$time);
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/misc/time_sleep_until_error1.phpt b/ext/standard/tests/misc/time_sleep_until_error1.phpt
new file mode 100644
index 0000000..2a409a3
--- /dev/null
+++ b/ext/standard/tests/misc/time_sleep_until_error1.phpt
@@ -0,0 +1,15 @@
+--TEST--
+time_sleep_until() function - error test for time_sleep_until()
+--SKIPIF--
+<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?>
+--CREDITS--
+Fabio Fabbrucci fabbrucci@grupporetina.com
+Danilo Sanchi sanchi@grupporetina.com
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+ var_dump(time_sleep_until(time()-1));
+?>
+--EXPECTF--
+Warning: time_sleep_until(): Sleep until to time is less than current time in %s on line 2
+bool(false)
diff --git a/ext/standard/tests/misc/time_sleep_until_error2.phpt b/ext/standard/tests/misc/time_sleep_until_error2.phpt
new file mode 100644
index 0000000..bbfef1b
--- /dev/null
+++ b/ext/standard/tests/misc/time_sleep_until_error2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+time_sleep_until() function - error test for time_sleep_until()
+--SKIPIF--
+<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?>
+--CREDITS--
+Filippo De Santis fd@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+ var_dump(time_sleep_until('goofy'));
+?>
+--EXPECTF--
+Warning: time_sleep_until() expects parameter 1 to be double, string given in %s on line 2
+NULL
diff --git a/ext/standard/tests/misc/time_sleep_until_error3.phpt b/ext/standard/tests/misc/time_sleep_until_error3.phpt
new file mode 100644
index 0000000..f18e5b3
--- /dev/null
+++ b/ext/standard/tests/misc/time_sleep_until_error3.phpt
@@ -0,0 +1,14 @@
+--TEST--
+time_sleep_until() function - error test for time_sleep_until()
+--SKIPIF--
+<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?>
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+ var_dump(time_sleep_until());
+?>
+--EXPECTF--
+Warning: time_sleep_until() expects exactly 1 parameter, 0 given in %s on line 2
+NULL
diff --git a/ext/standard/tests/network/bug20134.phpt b/ext/standard/tests/network/bug20134.phpt
new file mode 100644
index 0000000..400e3fb
--- /dev/null
+++ b/ext/standard/tests/network/bug20134.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #20134 (UDP reads from invalid ports)
+--FILE--
+<?php
+# vim600:syn=php:
+$fp = fsockopen("udp://localhost", 65534, $errno, $errstr);
+if (!$fp) {
+ /* UDP will never cause a connection error, as it is
+ * a connection-LESS protocol */
+ echo "ERROR: $errno - $errstr<br>\n";
+}
+else {
+ /* Likewise, writes will always appear to succeed */
+ $x = fwrite($fp,b"\n");
+ var_dump($x);
+ /* But reads should always fail */
+ $content = fread($fp, 40);
+ var_dump($content);
+ fclose($fp);
+}
+?>
+--EXPECT--
+int(1)
+string(0) ""
diff --git a/ext/standard/tests/network/bug41347.phpt b/ext/standard/tests/network/bug41347.phpt
new file mode 100644
index 0000000..6ece098
--- /dev/null
+++ b/ext/standard/tests/network/bug41347.phpt
@@ -0,0 +1,9 @@
+--TEST--
+dns_check_record() segfault with empty host
+--FILE--
+<?php
+var_dump(dns_check_record(''));
+?>
+--EXPECTF--
+Warning: dns_check_record(): Host cannot be empty in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/network/closelog_basic.phpt b/ext/standard/tests/network/closelog_basic.phpt
new file mode 100644
index 0000000..06798a5
--- /dev/null
+++ b/ext/standard/tests/network/closelog_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test closelog() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool closelog(void)
+ * Description: Close connection to system logger
+ * Source code: ext/standard/syslog.c
+ * Alias to functions:
+ */
+
+echo "*** Testing closelog() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing closelog() function with Zero arguments --\n";
+var_dump( closelog() );
+?>
+===DONE===
+--EXPECT--
+*** Testing closelog() : basic functionality ***
+
+-- Testing closelog() function with Zero arguments --
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/network/closelog_error.phpt b/ext/standard/tests/network/closelog_error.phpt
new file mode 100644
index 0000000..ad3fdf5
--- /dev/null
+++ b/ext/standard/tests/network/closelog_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test closelog() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool closelog(void)
+ * Description: Close connection to system logger
+ * Source code: ext/standard/syslog.c
+ * Alias to functions:
+ */
+
+echo "*** Testing closelog() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing closelog() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( closelog($extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing closelog() : error conditions ***
+
+-- Testing closelog() function with one argument --
+
+Warning: closelog() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/network/fsockopen_basic.phpt b/ext/standard/tests/network/fsockopen_basic.phpt
new file mode 100644
index 0000000..3ec9366
--- /dev/null
+++ b/ext/standard/tests/network/fsockopen_basic.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test fsockopen() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto resource fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]])
+ * Description: Open Internet or Unix domain socket connection
+ * Source code: ext/standard/fsock.c
+ * Alias to functions:
+ */
+
+echo "*** Testing fsockopen() : basic functionality ***\n";
+
+echo "Open a server socket\n";
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+
+// Initialise all required variables
+$hostname = 'tcp://127.0.0.1'; // loopback address
+$port = 31337;
+$errno = null;
+$errstr = null;
+$timeout = 1.5;
+
+echo "\nCalling fsockopen() with all possible arguments:\n";
+$client = fsockopen($hostname, $port, $errno, $errstr, $timeout);
+var_dump($client);
+fclose($client);
+
+echo "\nCalling fsockopen() with mandatory arguments:\n";
+$second_client = fsockopen($hostname, $port);
+var_dump($second_client);
+fclose($second_client);
+
+echo "\nCalling fsockopen() with address and port in same string:\n";
+$address = $hostname . ':' . $port;
+$third_client = fsockopen($address);
+var_dump($third_client);
+fclose($third_client);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing fsockopen() : basic functionality ***
+Open a server socket
+
+Calling fsockopen() with all possible arguments:
+resource(%d) of type (stream)
+
+Calling fsockopen() with mandatory arguments:
+resource(%d) of type (stream)
+
+Calling fsockopen() with address and port in same string:
+resource(%d) of type (stream)
+Done
diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt
new file mode 100644
index 0000000..3b13b8c
--- /dev/null
+++ b/ext/standard/tests/network/fsockopen_error.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test fsockopen() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto resource fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]])
+ * Description: Open Internet or Unix domain socket connection
+ * Source code: ext/standard/fsock.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing fsockopen() : basic error conditions ***\n";
+
+
+echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n";
+$hostname = 'string_val';
+$port = 10;
+$errno = 10;
+$errstr = 'string_val';
+$timeout = 10.5;
+$extra_arg = 10;
+var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) );
+var_dump($errstr);
+var_dump($errno);
+
+echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n";
+var_dump( fsockopen() );
+
+echo "\n-- Attempting to connect to a non-existent socket --\n";
+$hostname = 'tcp://127.0.0.1'; // loopback address
+$port = 31337;
+$errno = null;
+$errstr = null;
+$timeout = 1.5;
+var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout) );
+var_dump($errstr);
+
+echo "\n-- Attempting to connect using an invalid protocol --\n";
+$hostname = 'invalid://127.0.0.1'; // loopback address
+$port = 31337;
+$errno = null;
+$errstr = null;
+$timeout = 1.5;
+var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout) );
+var_dump($errstr);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing fsockopen() : basic error conditions ***
+
+-- Testing fsockopen() function with more than expected no. of arguments --
+
+Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d
+bool(false)
+string(10) "string_val"
+int(10)
+
+-- Testing fsockopen() function with less than expected no. of arguments --
+
+Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Attempting to connect to a non-existent socket --
+
+Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d
+bool(false)
+string(%d) "%a"
+
+-- Attempting to connect using an invalid protocol --
+
+Warning: fsockopen(): unable to connect to invalid://127.0.0.1:31337 (Unable to find the socket transport "invalid" - did you forget to enable it when you configured PHP?) in %s on line %d
+bool(false)
+string(100) "Unable to find the socket transport "invalid" - did you forget to enable it when you configured PHP?"
+Done
diff --git a/ext/standard/tests/network/fsockopen_variation1.phpt b/ext/standard/tests/network/fsockopen_variation1.phpt
new file mode 100644
index 0000000..2e5f8d9
--- /dev/null
+++ b/ext/standard/tests/network/fsockopen_variation1.phpt
@@ -0,0 +1,32 @@
+--TEST--
+testing fsockopen without a protocol string
+--FILE--
+<?php
+
+echo "Open a server socket\n";
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+echo "\nCalling fsockopen() without a protocol in the hostname string:\n";
+$hostname = '127.0.0.1';
+$port = '31337';
+$client = fsockopen($hostname, $port);
+var_dump($client);
+fclose($client);
+
+echo "\nCalling fsockopen() with address and port in same string, without a protocol:\n";
+$address = $hostname . ':' . $port;
+$second_client = fsockopen($address);
+var_dump($second_client);
+fclose($second_client);
+
+echo "Done";
+?>
+--EXPECTF--
+Open a server socket
+
+Calling fsockopen() without a protocol in the hostname string:
+resource(%d) of type (stream)
+
+Calling fsockopen() with address and port in same string, without a protocol:
+resource(%d) of type (stream)
+Done
diff --git a/ext/standard/tests/network/fsockopen_variation2.phpt b/ext/standard/tests/network/fsockopen_variation2.phpt
new file mode 100644
index 0000000..262ae0b
--- /dev/null
+++ b/ext/standard/tests/network/fsockopen_variation2.phpt
@@ -0,0 +1,48 @@
+--TEST--
+testing fsockopen() with udp sockets
+--FILE--
+<?php
+
+$hostname = 'udp://127.0.0.1';
+$port = '31337';
+
+echo "Open a server socket\n";
+$server = stream_socket_server($hostname . ':' . $port, $errno, $errstr, STREAM_SERVER_BIND);
+
+echo "\nCalling fsockopen():\n";
+$client = fsockopen($hostname, $port);
+var_dump($client);
+
+echo "\nPass some data between the sockets:\n";
+fwrite($client, "0123456789");
+var_dump(fread($server, 10));
+fclose($client);
+
+echo "\nCalling fsockopen() with address and port in same string:\n";
+$address = $hostname . ':' . $port;
+$second_client = fsockopen($address);
+var_dump($second_client);
+
+echo "\nPass some data between the sockets:\n";
+fwrite($second_client, "0123456789");
+var_dump(fread($server, 10));
+fclose($second_client);
+
+echo "Done";
+
+?>
+--EXPECTF--
+Open a server socket
+
+Calling fsockopen():
+resource(%d) of type (stream)
+
+Pass some data between the sockets:
+string(10) "0123456789"
+
+Calling fsockopen() with address and port in same string:
+resource(%d) of type (stream)
+
+Pass some data between the sockets:
+string(10) "0123456789"
+Done
diff --git a/ext/standard/tests/network/gethostbyaddr_basic1.phpt b/ext/standard/tests/network/gethostbyaddr_basic1.phpt
new file mode 100644
index 0000000..a20b475
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyaddr_basic1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test gethostbyaddr() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gethostbyaddr ( string $ip_address )
+ * Description: Get the Internet host name corresponding to a given IP address
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbyaddr() : basic functionality ***\n";
+echo gethostbyaddr("127.0.0.1")."\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gethostbyaddr() : basic functionality ***
+%rloopback|localhost(\.localdomain)?|%s%r
+===DONE===
diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt
new file mode 100644
index 0000000..8909a30
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyaddr_error.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gethostbyaddr() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string gethostbyaddr(string ip_address)
+ * Description: Get the Internet host name corresponding to a given IP address
+ * Source code: ext/standard/dns.c
+ * Alias to functions:
+ */
+
+
+echo "Testing gethostbyaddr : error conditions\n";
+
+// Zero arguments
+echo "\n-- Testing gethostbyaddr function with Zero arguments --\n";
+var_dump( gethostbyaddr() );
+
+//Test gethostbyaddr with one more than the expected number of arguments
+echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n";
+$ip_address = 'string_val';
+$extra_arg = 10;
+var_dump( gethostbyaddr($ip_address, $extra_arg) );
+
+echo "\n-- Testing gethostbyaddr function with invalid addresses --\n";
+
+$ip_address = 'invalid';
+var_dump( gethostbyaddr($ip_address) );
+
+$ip_address = '300.1.2.3';
+var_dump( gethostbyaddr($ip_address) );
+
+$ip_address = '256.1.2.3';
+var_dump( gethostbyaddr($ip_address) );
+
+echo "Done";
+?>
+--EXPECTREGEX--
+Testing gethostbyaddr : error conditions
+
+-- Testing gethostbyaddr function with Zero arguments --
+
+Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+
+NULL
+
+-- Testing gethostbyaddr function with more than expected no. of arguments --
+
+Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+
+NULL
+
+-- Testing gethostbyaddr function with invalid addresses --
+
+Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
+bool\(false\)
+
+Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
+bool\(false\)
+
+Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
+bool\(false\)
+Done
diff --git a/ext/standard/tests/network/gethostbyname_basic001.phpt b/ext/standard/tests/network/gethostbyname_basic001.phpt
new file mode 100644
index 0000000..9171e22
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_basic001.phpt
@@ -0,0 +1,15 @@
+--TEST--
+gethostbyname() function - basic type return test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection");
+?>
+--FILE--
+<?php
+ var_dump(is_string(gethostbyname("www.php.net")));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_basic003.phpt b/ext/standard/tests/network/gethostbyname_basic003.phpt
new file mode 100644
index 0000000..711490c
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_basic003.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test gethostbyname() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string gethostbyname ( string $hostname )
+ * Description: Get the IPv4 address corresponding to a given Internet host name
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbyname() : basic functionality ***\n";
+
+echo gethostbyname("localhost")."\n";
+?>
+===DONE===
+--EXPECT--
+*** Testing gethostbyname() : basic functionality ***
+127.0.0.1
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/network/gethostbyname_error001.phpt b/ext/standard/tests/network/gethostbyname_error001.phpt
new file mode 100644
index 0000000..f141be8
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_error001.phpt
@@ -0,0 +1,10 @@
+--TEST--
+gethostbyname() function - basic type return error test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--FILE--
+<?php
+ var_dump(is_string(gethostbyname("192.168.0.101")));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error002.phpt b/ext/standard/tests/network/gethostbyname_error002.phpt
new file mode 100644
index 0000000..2430a7f
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_error002.phpt
@@ -0,0 +1,10 @@
+--TEST--
+gethostbyname() function - basic type return error test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--FILE--
+<?php
+ var_dump(is_string(gethostbyname("1234567890")));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error003.phpt b/ext/standard/tests/network/gethostbyname_error003.phpt
new file mode 100644
index 0000000..3d4bb7a
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_error003.phpt
@@ -0,0 +1,10 @@
+--TEST--
+gethostbyname() function - basic type return error test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--FILE--
+<?php
+ var_dump(is_string(gethostbyname("asdfasdf")));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error004.phpt b/ext/standard/tests/network/gethostbyname_error004.phpt
new file mode 100644
index 0000000..274301a
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_error004.phpt
@@ -0,0 +1,16 @@
+--TEST--
+gethostbyname() function - basic return valid ip address test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection");
+?>
+--FILE--
+<?php
+ $ip = gethostbyname("www.php.net");
+ var_dump((bool) ip2long($ip));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error005.phpt b/ext/standard/tests/network/gethostbyname_error005.phpt
new file mode 100644
index 0000000..be4b159
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_error005.phpt
@@ -0,0 +1,12 @@
+--TEST--
+gethostbyname() function - basic invalid parameter test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--INI--
+display_errors=false
+--FILE--
+<?php
+ var_dump(gethostbyname());
+?>
+--EXPECT--
+NULL
diff --git a/ext/standard/tests/network/gethostbyname_error006.phpt b/ext/standard/tests/network/gethostbyname_error006.phpt
new file mode 100644
index 0000000..dc509a1
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyname_error006.phpt
@@ -0,0 +1,10 @@
+--TEST--
+gethostbyname() function - basic invalid parameter test
+--CREDITS--
+"Sylvain R." <sracine@phpquebec.org>
+--FILE--
+<?php
+ var_dump(gethostbyname(".toto.toto.toto"));
+?>
+--EXPECTF--
+%string|unicode%(15) ".toto.toto.toto"
diff --git a/ext/standard/tests/network/gethostbynamel_basic1.phpt b/ext/standard/tests/network/gethostbynamel_basic1.phpt
new file mode 100644
index 0000000..5ce7c42
--- /dev/null
+++ b/ext/standard/tests/network/gethostbynamel_basic1.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test gethostbynamel() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array gethostbynamel ( string $hostname )
+ * Description: Get a list of IPv4 addresses corresponding to a given Internet host name
+ * Source code: ext/standard/dns.c
+*/
+
+echo "*** Testing gethostbynamel() : basic functionality ***\n";
+var_dump(gethostbynamel("localhost"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing gethostbynamel() : basic functionality ***
+array(%d) {
+ %a
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/network/gethostbynamel_error.phpt b/ext/standard/tests/network/gethostbynamel_error.phpt
new file mode 100644
index 0000000..7aa00e5
--- /dev/null
+++ b/ext/standard/tests/network/gethostbynamel_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test gethostbynamel() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array gethostbynamel(string hostname)
+ * Description: Return a list of IP addresses that a given hostname resolves to.
+ * Source code: ext/standard/dns.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gethostbynamel() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gethostbynamel() function with Zero arguments --\n";
+var_dump( gethostbynamel() );
+
+//Test gethostbynamel with one more than the expected number of arguments
+echo "\n-- Testing gethostbynamel() function with more than expected no. of arguments --\n";
+$hostname = 'string_val';
+$extra_arg = 10;
+var_dump( gethostbynamel($hostname, $extra_arg) );
+echo "Done";
+?>
+--EXPECTF--
+*** Testing gethostbynamel() : error conditions ***
+
+-- Testing gethostbynamel() function with Zero arguments --
+
+Warning: gethostbynamel() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing gethostbynamel() function with more than expected no. of arguments --
+
+Warning: gethostbynamel() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/network/getmxrr.phpt b/ext/standard/tests/network/getmxrr.phpt
new file mode 100644
index 0000000..c4a15c5
--- /dev/null
+++ b/ext/standard/tests/network/getmxrr.phpt
@@ -0,0 +1,24 @@
+--TEST--
+getmxrr() test
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip: no Windows support');
+}
+?>
+--FILE--
+<?php
+$domains = array( 'mx1.tests.php.net', 'mx2.tests.php.net' );
+foreach ( $domains as $domain )
+{
+ if ( getmxrr( $domain, $hosts, $weights ) )
+ {
+ echo "Hosts: " . count( $hosts ) . ", weights: " . count( $weights ) . "\n";
+ }
+}
+?>
+--EXPECT--
+Hosts: 1, weights: 1
+Hosts: 2, weights: 2
diff --git a/ext/standard/tests/network/http-stream.phpt b/ext/standard/tests/network/http-stream.phpt
new file mode 100644
index 0000000..99245f7
--- /dev/null
+++ b/ext/standard/tests/network/http-stream.phpt
@@ -0,0 +1,18 @@
+--TEST--
+http-stream test
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
+if (!extension_loaded("dom")) die("skip dom extension is not present");
+?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+$d = new DomDocument;
+$e = $d->load("http://php.net/news.rss");
+echo "ALIVE\n";
+?>
+--EXPECTF--
+ALIVE
diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt
new file mode 100644
index 0000000..851e1ba
--- /dev/null
+++ b/ext/standard/tests/network/inet.phpt
@@ -0,0 +1,75 @@
+--TEST--
+inet_ntop() & inet_pton() tests
+--SKIPIF--
+<?php
+if (!function_exists("inet_ntop")) die("skip no inet_ntop()");
+if (!function_exists("inet_pton")) die("skip no inet_pton()");
+?>
+--FILE--
+<?php
+
+$packed = chr(127) . chr(0) . chr(0) . chr(1);
+var_dump(inet_ntop((binary)$packed));
+
+$packed = chr(255) . chr(255) . chr(255) . chr(0);
+var_dump(inet_ntop((binary)$packed));
+
+var_dump(inet_ntop());
+var_dump(inet_ntop(-1));
+var_dump(inet_ntop(b""));
+var_dump(inet_ntop(b"blah-blah"));
+
+var_dump(inet_pton());
+var_dump(inet_pton(b""));
+var_dump(inet_pton(-1));
+var_dump(inet_pton(b"abra"));
+
+$array = array(
+ b"127.0.0.1",
+ b"66.163.161.116",
+ b"255.255.255.255",
+ b"0.0.0.0",
+ );
+foreach ($array as $val) {
+ var_dump(bin2hex($packed = inet_pton($val)));
+ var_dump(inet_ntop($packed));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+%unicode|string%(9) "127.0.0.1"
+%unicode|string%(13) "255.255.255.0"
+
+Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+
+Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: inet_pton(): Unrecognized address in %s on line %d
+bool(false)
+
+Warning: inet_pton(): Unrecognized address -1 in %s on line %d
+bool(false)
+
+Warning: inet_pton(): Unrecognized address abra in %s on line %d
+bool(false)
+%unicode|string%(%d) "7f000001"
+%unicode|string%(9) "127.0.0.1"
+%unicode|string%(%d) "42a3a174"
+%unicode|string%(14) "66.163.161.116"
+%unicode|string%(%d) "ffffffff"
+%unicode|string%(15) "255.255.255.255"
+%unicode|string%(%d) "00000000"
+%unicode|string%(7) "0.0.0.0"
+Done
diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt
new file mode 100644
index 0000000..3b280df
--- /dev/null
+++ b/ext/standard/tests/network/inet_ipv6.phpt
@@ -0,0 +1,50 @@
+--TEST--
+inet_ntop() & inet_pton() IPv6 tests
+--SKIPIF--
+<?php
+if (!function_exists("inet_ntop")) die("skip no inet_ntop()");
+if (!function_exists("inet_pton")) die("skip no inet_pton()");
+
+$packed = str_repeat(chr(0), 15) . chr(1);
+if (@inet_ntop($packed) === false) {
+ die("skip no IPv6 support");
+}
+if (stristr(PHP_OS, "darwin") !== false) die("skip MacOS has broken inet_*() funcs");
+?>
+--FILE--
+<?php
+
+$a = array(
+ '::1',
+ '::2',
+ '::35',
+ '::255',
+ '::1024',
+ '',
+ '2001:0db8:85a3:08d3:1319:8a2e:0370:7344',
+ '2001:0db8:1234:0000:0000:0000:0000:0000',
+ '2001:0db8:1234:FFFF:FFFF:FFFF:FFFF:FFFF',
+);
+
+foreach ($a as $address) {
+ $packed = inet_pton($address);
+ var_dump(inet_ntop($packed));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(3) "::1"
+string(3) "::2"
+string(4) "::35"
+string(5) "::255"
+string(6) "::1024"
+
+Warning: inet_pton(): Unrecognized address in %s on line %d
+
+Warning: inet_ntop(): Invalid in_addr value in %s on line %d
+bool(false)
+string(36) "2001:db8:85a3:8d3:1319:8a2e:370:7344"
+string(15) "2001:db8:1234::"
+string(38) "2001:db8:1234:ffff:ffff:ffff:ffff:ffff"
+Done
diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt
new file mode 100644
index 0000000..3fc1b9d
--- /dev/null
+++ b/ext/standard/tests/network/ip.phpt
@@ -0,0 +1,67 @@
+--TEST--
+ip2long() & long2ip() tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$array = array(
+ "127.0.0.1",
+ "10.0.0.1",
+ "255.255.255.255",
+ "255.255.255.0",
+ "0.0.0.0",
+ "66.163.161.116",
+);
+
+foreach ($array as $ip) {
+ var_dump($long = ip2long($ip));
+ var_dump(long2ip($long));
+}
+
+var_dump(ip2long());
+var_dump(ip2long(""));
+var_dump(ip2long("777.777.777.777"));
+var_dump(ip2long("111.111.111.111"));
+var_dump(ip2long(array()));
+
+var_dump(long2ip());
+var_dump(long2ip(-110000));
+var_dump(long2ip(""));
+var_dump(long2ip(array()));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(2130706433)
+string(9) "127.0.0.1"
+int(167772161)
+string(8) "10.0.0.1"
+int(-1)
+string(15) "255.255.255.255"
+int(-256)
+string(13) "255.255.255.0"
+int(0)
+string(7) "0.0.0.0"
+int(1118019956)
+string(14) "66.163.161.116"
+
+Warning: ip2long() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+bool(false)
+int(1869573999)
+
+Warning: ip2long() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: long2ip() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+string(13) "255.254.82.80"
+string(7) "0.0.0.0"
+
+Warning: long2ip() expects parameter 1 to be string, array given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/network/ip2long_error.phpt b/ext/standard/tests/network/ip2long_error.phpt
new file mode 100644
index 0000000..65e7315
--- /dev/null
+++ b/ext/standard/tests/network/ip2long_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test ip2long() function : error conditions
+--FILE--
+<?php
+/* Prototype : int ip2long(string ip_address)
+ * Description: Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ip2long() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ip2long() function with Zero arguments --\n";
+var_dump( ip2long() );
+
+//Test ip2long with one more than the expected number of arguments
+echo "\n-- Testing ip2long() function with more than expected no. of arguments --\n";
+$ip_address = '127.0.0.1';
+$extra_arg = 10;
+var_dump( ip2long($ip_address, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ip2long() : error conditions ***
+
+-- Testing ip2long() function with Zero arguments --
+
+Warning: ip2long() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ip2long() function with more than expected no. of arguments --
+
+Warning: ip2long() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/network/ip2long_variation1.phpt b/ext/standard/tests/network/ip2long_variation1.phpt
new file mode 100644
index 0000000..f87282a
--- /dev/null
+++ b/ext/standard/tests/network/ip2long_variation1.phpt
@@ -0,0 +1,204 @@
+--TEST--
+Test ip2long() function : usage variation
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip. Windows is more compliant (like 0 for localhost, etc.)");
+?>
+--FILE--
+<?php
+/* Prototype : int ip2long(string ip_address)
+ * Description: Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ip2long() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$res = fopen(__FILE__,'r');
+
+//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,
+
+ // resource
+ 'resource' => $res,
+);
+
+// loop through each element of the array for ip_address
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( ip2long($value) );
+};
+
+fclose($res);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ip2long() : 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--
+Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%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--
+Error: 2 - ip2long() expects parameter 1 to be string, object given, %s(%d)
+NULL
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+
+--resource--
+Error: 2 - ip2long() expects parameter 1 to be string, resource given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt
new file mode 100644
index 0000000..1fcb8b2
--- /dev/null
+++ b/ext/standard/tests/network/ip_x86_64.phpt
@@ -0,0 +1,67 @@
+--TEST--
+ip2long() & long2ip() tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only");
+?>
+--FILE--
+<?php
+
+$array = array(
+ "127.0.0.1",
+ "10.0.0.1",
+ "255.255.255.255",
+ "255.255.255.0",
+ "0.0.0.0",
+ "66.163.161.116",
+);
+
+foreach ($array as $ip) {
+ var_dump($long = ip2long($ip));
+ var_dump(long2ip($long));
+}
+
+var_dump(ip2long());
+var_dump(ip2long(""));
+var_dump(ip2long("777.777.777.777"));
+var_dump(ip2long("111.111.111.111"));
+var_dump(ip2long(array()));
+
+var_dump(long2ip());
+var_dump(long2ip(-110000));
+var_dump(long2ip(""));
+var_dump(long2ip(array()));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(2130706433)
+string(9) "127.0.0.1"
+int(167772161)
+string(8) "10.0.0.1"
+int(4294967295)
+string(15) "255.255.255.255"
+int(4294967040)
+string(13) "255.255.255.0"
+int(0)
+string(7) "0.0.0.0"
+int(1118019956)
+string(14) "66.163.161.116"
+
+Warning: ip2long() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+bool(false)
+int(1869573999)
+
+Warning: ip2long() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: long2ip() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+string(13) "255.254.82.80"
+string(7) "0.0.0.0"
+
+Warning: long2ip() expects parameter 1 to be string, array given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/network/long2ip_error.phpt b/ext/standard/tests/network/long2ip_error.phpt
new file mode 100644
index 0000000..d56397c
--- /dev/null
+++ b/ext/standard/tests/network/long2ip_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test long2ip() function : error conditions
+--FILE--
+<?php
+/* Prototype : string long2ip(int proper_address)
+ * Description: Converts an (IPv4) Internet network address into a string in Internet standard dotted format
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing long2ip() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing long2ip() function with Zero arguments --\n";
+var_dump( long2ip() );
+
+//Test long2ip with one more than the expected number of arguments
+echo "\n-- Testing long2ip() function with more than expected no. of arguments --\n";
+$proper_address = 10;
+$extra_arg = 10;
+var_dump( long2ip($proper_address, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing long2ip() : error conditions ***
+
+-- Testing long2ip() function with Zero arguments --
+
+Warning: long2ip() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing long2ip() function with more than expected no. of arguments --
+
+Warning: long2ip() 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/network/long2ip_variation1.phpt b/ext/standard/tests/network/long2ip_variation1.phpt
new file mode 100644
index 0000000..2dc6fb1
--- /dev/null
+++ b/ext/standard/tests/network/long2ip_variation1.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test long2ip() function : usage variation
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip don't run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string long2ip(int proper_address)
+ * Description: Converts an (IPv4) Internet network address into a string in Internet standard dotted format
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing long2ip() : usage variation ***\n";
+
+// 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');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+// resource
+$res = fopen(__FILE__,'r');
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ '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
+ 'resource' => $res,
+);
+
+// loop through each element of the array for proper_address
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( long2ip($value) );
+};
+
+fclose($res);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing long2ip() : usage variation ***
+
+--float 10.5--
+string(8) "0.0.0.10"
+
+--float -10.5--
+string(15) "255.255.255.246"
+
+--float .5--
+string(7) "0.0.0.0"
+
+--empty array--
+Error: 2 - long2ip() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - long2ip() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - long2ip() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - long2ip() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(7) "0.0.0.0"
+
+--lowercase null--
+string(7) "0.0.0.0"
+
+--lowercase true--
+string(7) "0.0.0.1"
+
+--lowercase false--
+string(7) "0.0.0.0"
+
+--uppercase TRUE--
+string(7) "0.0.0.1"
+
+--uppercase FALSE--
+string(7) "0.0.0.0"
+
+--empty string DQ--
+string(7) "0.0.0.0"
+
+--empty string SQ--
+string(7) "0.0.0.0"
+
+--string DQ--
+string(7) "0.0.0.0"
+
+--string SQ--
+string(7) "0.0.0.0"
+
+--mixed case string--
+string(7) "0.0.0.0"
+
+--heredoc--
+string(7) "0.0.0.0"
+
+--instance of classWithToString--
+string(7) "0.0.0.0"
+
+--instance of classWithoutToString--
+Error: 2 - long2ip() expects parameter 1 to be string, object given, %s(%d)
+NULL
+
+--undefined var--
+string(7) "0.0.0.0"
+
+--unset var--
+string(7) "0.0.0.0"
+
+--resource--
+Error: 2 - long2ip() expects parameter 1 to be string, resource given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/standard/tests/network/shutdown.phpt b/ext/standard/tests/network/shutdown.phpt
new file mode 100644
index 0000000..f9ab664
--- /dev/null
+++ b/ext/standard/tests/network/shutdown.phpt
@@ -0,0 +1,65 @@
+--TEST--
+stream_socket_shutdown() test on IPv4 TCP Loopback
+--SKIPIF--
+<?php
+ function_exists('stream_socket_shutdown') or die('skip stream_socket_shutdown() is not supported.');
+?>
+--FILE--
+<?php
+ /* Setup socket server */
+ $server = stream_socket_server('tcp://127.0.0.1:31337');
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]');
+ }
+
+ /* Connect and send request 1 */
+ $client1 = stream_socket_client('tcp://127.0.0.1:31337');
+ if (!$client1) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ @fwrite($client1, "Client 1\n");
+ stream_socket_shutdown($client1, STREAM_SHUT_WR);
+ @fwrite($client1, "Error 1\n");
+
+ /* Connect and send request 2 */
+ $client2 = stream_socket_client('tcp://127.0.0.1:31337');
+ if (!$client2) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ @fwrite($client2, "Client 2\n");
+ stream_socket_shutdown($client2, STREAM_SHUT_WR);
+ @fwrite($client2, "Error 2\n");
+
+ /* Accept connection 1 */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+ @fwrite($socket, fgets($socket));
+ @fwrite($socket, fgets($socket));
+ fclose($socket);
+
+ /* Read Response 1 */
+ echo fgets($client1);
+ echo fgets($client1);
+
+ /* Accept connection 2 */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+ @fwrite($socket, fgets($socket));
+ @fwrite($socket, fgets($socket));
+ fclose($socket);
+
+ /* Read Response 2 */
+ echo fgets($client2);
+ echo fgets($client2);
+
+ fclose($client1);
+ fclose($client2);
+ fclose($server);
+?>
+--EXPECT--
+Client 1
+Client 2
diff --git a/ext/standard/tests/network/socket_get_status_basic.phpt b/ext/standard/tests/network/socket_get_status_basic.phpt
new file mode 100644
index 0000000..f72662b
--- /dev/null
+++ b/ext/standard/tests/network/socket_get_status_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Testing socket_get_status()
+--FILE--
+<?php
+
+$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
+var_dump(socket_get_status($tcp_socket));
+fclose($tcp_socket);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socket%S"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/network/syslog_basic-win32.phpt b/ext/standard/tests/network/syslog_basic-win32.phpt
new file mode 100644
index 0000000..88d3c5a
--- /dev/null
+++ b/ext/standard/tests/network/syslog_basic-win32.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test syslog() function : basic functionality
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : bool syslog(int priority, string message)
+ * Description: Generate a system log message
+ * Source code: ext/standard/syslog.c
+ * Alias to functions:
+ */
+
+echo "*** Testing syslog() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$priority = LOG_WARNING;
+$message = 'A test syslog call invocation';
+
+// Calling syslog() with all possible arguments
+var_dump( syslog($priority, $message) );
+
+?>
+===DONE===
+--EXPECT--
+*** Testing syslog() : basic functionality ***
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/network/syslog_error.phpt b/ext/standard/tests/network/syslog_error.phpt
new file mode 100644
index 0000000..a99fd53
--- /dev/null
+++ b/ext/standard/tests/network/syslog_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test syslog() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool syslog(int priority, string message)
+ * Description: Generate a system log message
+ * Source code: ext/standard/syslog.c
+ * Alias to functions:
+ */
+
+echo "*** Testing syslog() : error conditions ***\n";
+
+
+//Test syslog with one more than the expected number of arguments
+echo "\n-- Testing syslog() function with more than expected no. of arguments --\n";
+$priority = 10;
+$message = 'string_val';
+$extra_arg = 10;
+var_dump( syslog($priority, $message, $extra_arg) );
+
+// Testing syslog with one less than the expected number of arguments
+echo "\n-- Testing syslog() function with less than expected no. of arguments --\n";
+$priority = 10;
+var_dump( syslog($priority) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing syslog() : error conditions ***
+
+-- Testing syslog() function with more than expected no. of arguments --
+
+Warning: syslog() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing syslog() function with less than expected no. of arguments --
+
+Warning: syslog() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/network/tcp4loop.phpt b/ext/standard/tests/network/tcp4loop.phpt
new file mode 100644
index 0000000..afd9559
--- /dev/null
+++ b/ext/standard/tests/network/tcp4loop.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Streams Based IPv4 TCP Loopback test
+--FILE--
+<?php # vim:ft=php:
+ /* Setup socket server */
+ $server = stream_socket_server('tcp://127.0.0.1:31337');
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]');
+ }
+
+ /* Connect to it */
+ $client = stream_socket_client('tcp://127.0.0.1:31337');
+ if (!$client) {
+ die('Unable to create AF_INET socket [client]');
+ }
+
+ /* Accept that connection */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+
+ fwrite($client, "ABCdef123\n");
+
+ $data = fread($socket, 10);
+ var_dump($data);
+
+ fclose($client);
+ fclose($socket);
+ fclose($server);
+?>
+--EXPECT--
+string(10) "ABCdef123
+"
diff --git a/ext/standard/tests/network/tcp6loop.phpt b/ext/standard/tests/network/tcp6loop.phpt
new file mode 100644
index 0000000..3f28cd4
--- /dev/null
+++ b/ext/standard/tests/network/tcp6loop.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Streams Based IPv6 TCP Loopback test
+--SKIPIF--
+<?php
+ /* If IPv6 is supported on the platform this will error out with code 111 - Connection refused.
+ If IPv6 is NOT supported, $errno will be set to something else (indicating parse/getaddrinfo error)
+ Note: Might be a good idea to export an IPv6 support indicator (such as AF_INET6 exported by ext/sockets) */
+ @stream_socket_client('tcp://[::1]:0', $errno);
+ if ($errno != 111) die('skip IPv6 not supported.');
+?>
+--FILE--
+<?php
+ /* Setup socket server */
+ $server = stream_socket_server('tcp://[::1]:31337');
+ if (!$server) {
+ die('Unable to create AF_INET6 socket [server]');
+ }
+
+ /* Connect to it */
+ $client = stream_socket_client('tcp://[::1]:31337');
+ if (!$client) {
+ die('Unable to create AF_INET6 socket [client]');
+ }
+
+ /* Accept that connection */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+
+ fwrite($client, "ABCdef123\n");
+
+ $data = fread($socket, 10);
+ var_dump($data);
+
+ fclose($client);
+ fclose($socket);
+ fclose($server);
+?>
+--EXPECT--
+string(10) "ABCdef123
+"
diff --git a/ext/standard/tests/network/udgloop.phpt b/ext/standard/tests/network/udgloop.phpt
new file mode 100644
index 0000000..a61d082
--- /dev/null
+++ b/ext/standard/tests/network/udgloop.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Streams Based Unix Domain Datagram Loopback test
+--SKIPIF--
+<?php # vim:ft=php:
+ if (array_search("udg",stream_get_transports()) === false)
+ die('SKIP No support for UNIX domain sockets.');
+?>
+--FILE--
+<?php
+ $uniqid = uniqid();
+ if (file_exists("/tmp/$uniqid.sock"))
+ die('Temporary socket /tmp/$uniqid.sock already exists.');
+
+ /* Setup socket server */
+ $server = stream_socket_server("udg:///tmp/$uniqid.sock", $errno, $errstr, STREAM_SERVER_BIND);
+ if (!$server) {
+ die('Unable to create AF_UNIX socket [server]');
+ }
+
+ /* Connect to it */
+ $client = stream_socket_client("udg:///tmp/$uniqid.sock");
+ if (!$client) {
+ die('Unable to create AF_UNIX socket [client]');
+ }
+
+ fwrite($client, "ABCdef123\n");
+
+ $data = fread($server, 10);
+ var_dump($data);
+
+ fclose($client);
+ fclose($server);
+ unlink("/tmp/$uniqid.sock");
+?>
+--EXPECT--
+string(10) "ABCdef123
+"
diff --git a/ext/standard/tests/network/udp4loop.phpt b/ext/standard/tests/network/udp4loop.phpt
new file mode 100644
index 0000000..10d36ed
--- /dev/null
+++ b/ext/standard/tests/network/udp4loop.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Streams Based IPv4 UDP Loopback test
+--FILE--
+<?php
+ /* Setup socket server */
+ $server = stream_socket_server('udp://127.0.0.1:31338', $errno, $errstr, STREAM_SERVER_BIND);
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]');
+ }
+
+ /* Connect to it */
+ $client = stream_socket_client('udp://127.0.0.1:31338');
+ if (!$client) {
+ die('Unable to create AF_INET socket [client]');
+ }
+
+ fwrite($client, "ABCdef123\n");
+
+ $data = fread($server, 10);
+ var_dump($data);
+
+ fclose($client);
+ fclose($server);
+?>
+--EXPECT--
+string(10) "ABCdef123
+"
diff --git a/ext/standard/tests/network/udp6loop.phpt b/ext/standard/tests/network/udp6loop.phpt
new file mode 100644
index 0000000..5fcf7a7
--- /dev/null
+++ b/ext/standard/tests/network/udp6loop.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Streams Based IPv6 UDP Loopback test
+--SKIPIF--
+<?php # vim:ft=php:
+ /* If IPv6 is supported on the platform this will error out with code 111 -
+ * Connection refused. If IPv6 is NOT supported, $errno will be set to
+ * something else (indicating parse/getaddrinfo error)
+ * Note: Might be a good idea to export an IPv6 support indicator
+ * (such as AF_INET6 exported by ext/sockets), however, since we
+ * cannot tell for sure if IPv6 works until we probe it at run time,
+ * this isn't really practical.
+ */
+
+ @stream_socket_client('tcp://[::1]:0', $errno);
+ if ($errno != 111) die('skip IPv6 not supported.');
+?>
+--FILE--
+<?php
+ /* Setup socket server */
+ $server = stream_socket_server('udp://[::1]:31337', $errno, $errstr, STREAM_SERVER_BIND);
+ if (!$server) {
+ die('Unable to create AF_INET6 socket [server]');
+ }
+
+ /* Connect to it */
+ $client = stream_socket_client('udp://[::1]:31337');
+ if (!$client) {
+ die('Unable to create AF_INET6 socket [client]');
+ }
+
+ fwrite($client, "ABCdef123\n");
+
+ $data = fread($server, 10);
+ var_dump($data);
+
+ fclose($client);
+ fclose($server);
+?>
+--EXPECT--
+string(10) "ABCdef123
+"
diff --git a/ext/standard/tests/network/unixloop.phpt b/ext/standard/tests/network/unixloop.phpt
new file mode 100644
index 0000000..abb103b
--- /dev/null
+++ b/ext/standard/tests/network/unixloop.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Streams Based Unix Domain Loopback test
+--SKIPIF--
+<?php # vim:ft=php:
+ if (array_search("unix",stream_get_transports()) === false)
+ die('SKIP No support for UNIX domain sockets.');
+?>
+--FILE--
+<?php
+ $uniqid = uniqid();
+ if (file_exists("/tmp/$uniqid.sock"))
+ die('Temporary socket already exists.');
+
+ /* Setup socket server */
+ $server = stream_socket_server("unix:///tmp/$uniqid.sock");
+ if (!$server) {
+ die('Unable to create AF_UNIX socket [server]');
+ }
+
+ /* Connect to it */
+ $client = stream_socket_client("unix:///tmp/$uniqid.sock");
+ if (!$client) {
+ die('Unable to create AF_UNIX socket [client]');
+ }
+
+ /* Accept that connection */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+
+ fwrite($client, "ABCdef123\n");
+
+ $data = fread($socket, 10);
+ var_dump($data);
+
+ fclose($client);
+ fclose($socket);
+ fclose($server);
+ unlink("/tmp/$uniqid.sock");
+?>
+--EXPECT--
+string(10) "ABCdef123
+"
diff --git a/ext/standard/tests/php_ini_loaded_file.phpt b/ext/standard/tests/php_ini_loaded_file.phpt
new file mode 100644
index 0000000..747e019
--- /dev/null
+++ b/ext/standard/tests/php_ini_loaded_file.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Check the php_ini_loaded_file() function
+--CREDITS--
+Sebastian SchÃŒrmann
+sschuermann@chip.de
+Testfest 2009 Munich
+--INI--
+precision=12
+--FILE--
+<?php
+var_dump(php_ini_loaded_file());
+?>
+--EXPECTF--
+string(%d) "%sphp.ini"
diff --git a/ext/standard/tests/php_logo_guid.phpt b/ext/standard/tests/php_logo_guid.phpt
new file mode 100644
index 0000000..c644b28
--- /dev/null
+++ b/ext/standard/tests/php_logo_guid.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Check the output of the php_logo_guid() function
+--CREDITS--
+Sebastian SchÃŒrmann
+sschuermann@chip.de
+Testfest 2009 Munich
+--FILE--
+<?php
+echo php_logo_guid();
+?>
+--EXPECT--
+PHPE9568F34-D428-11d2-A769-00AA001ACF42
+
diff --git a/ext/standard/tests/php_real_logo_guid.phpt b/ext/standard/tests/php_real_logo_guid.phpt
new file mode 100644
index 0000000..a9fa7d3
--- /dev/null
+++ b/ext/standard/tests/php_real_logo_guid.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Testing the undocumented function php_real_logo_guid()
+--CREDITS--
+Sebastian SchÃŒrmann
+sschuermann@chip.de
+Testfest 2009 Munich
+--FILE--
+<?php
+echo php_real_logo_guid();
+?>
+--EXPECT--
+PHPE9568F34-D428-11d2-A769-00AA001ACF42
diff --git a/ext/standard/tests/serialize/001.phpt b/ext/standard/tests/serialize/001.phpt
new file mode 100644
index 0000000..600c9b7
--- /dev/null
+++ b/ext/standard/tests/serialize/001.phpt
@@ -0,0 +1,122 @@
+--TEST--
+serialize()/unserialize()/var_dump()
+--INI--
+serialize_precision=100
+--FILE--
+<?php
+class t
+{
+ function t()
+ {
+ $this->a = "hallo";
+ }
+}
+
+class s
+{
+ public $a;
+ public $b;
+ public $c;
+
+ function s()
+ {
+ $this->a = "hallo";
+ $this->b = "php";
+ $this->c = "world";
+ $this->d = "!";
+ }
+
+ function __sleep()
+ {
+ echo "__sleep called\n";
+ return array("a","c");
+ }
+
+ function __wakeup()
+ {
+ echo "__wakeup called\n";
+ }
+}
+
+
+echo serialize(NULL)."\n";
+echo serialize((bool) true)."\n";
+echo serialize((bool) false)."\n";
+echo serialize(1)."\n";
+echo serialize(0)."\n";
+echo serialize(-1)."\n";
+echo serialize(2147483647)."\n";
+echo serialize(-2147483647)."\n";
+echo serialize(1.123456789)."\n";
+echo serialize(1.0)."\n";
+echo serialize(0.0)."\n";
+echo serialize(-1.0)."\n";
+echo serialize(-1.123456789)."\n";
+echo serialize("hallo")."\n";
+echo serialize(array(1,1.1,"hallo",NULL,true,array()))."\n";
+
+$t = new t();
+$data = serialize($t);
+echo "$data\n";
+$t = unserialize($data);
+var_dump($t);
+
+$t = new s();
+$data = serialize($t);
+echo "$data\n";
+$t = unserialize($data);
+var_dump($t);
+
+$a = array("a" => "test");
+$a[ "b" ] = &$a[ "a" ];
+var_dump($a);
+$data = serialize($a);
+echo "$data\n";
+$a = unserialize($data);
+var_dump($a);
+?>
+--EXPECTF--
+N;
+b:1;
+b:0;
+i:1;
+i:0;
+i:-1;
+i:2147483647;
+i:-2147483647;
+d:1.123456789000000011213842299184761941432952880859375;
+d:1;
+d:0;
+d:-1;
+d:-1.123456789000000011213842299184761941432952880859375;
+s:5:"hallo";
+a:6:{i:0;i:1;i:1;d:1.100000000000000088817841970012523233890533447265625;i:2;s:5:"hallo";i:3;N;i:4;b:1;i:5;a:0:{}}
+O:1:"t":1:{s:1:"a";s:5:"hallo";}
+object(t)#%d (1) {
+ ["a"]=>
+ string(5) "hallo"
+}
+__sleep called
+O:1:"s":2:{s:1:"a";s:5:"hallo";s:1:"c";s:5:"world";}
+__wakeup called
+object(s)#%d (3) {
+ ["a"]=>
+ string(5) "hallo"
+ ["b"]=>
+ NULL
+ ["c"]=>
+ string(5) "world"
+}
+array(2) {
+ ["a"]=>
+ &string(4) "test"
+ ["b"]=>
+ &string(4) "test"
+}
+a:2:{s:1:"a";s:4:"test";s:1:"b";R:2;}
+array(2) {
+ ["a"]=>
+ &string(4) "test"
+ ["b"]=>
+ &string(4) "test"
+}
diff --git a/ext/standard/tests/serialize/002.phpt b/ext/standard/tests/serialize/002.phpt
new file mode 100644
index 0000000..3085d1c
--- /dev/null
+++ b/ext/standard/tests/serialize/002.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Bug #25378 (unserialize() crashes with invalid data)
+--FILE--
+<?php
+var_dump(unserialize('b:0;'));
+var_dump(unserialize('b:1;'));
+var_dump(unserialize('i:823;'));
+var_dump(unserialize('s:0:"";'));
+var_dump(unserialize('s:3:"foo";'));
+var_dump(unserialize('a:1:{i:0;s:2:"12";}'));
+var_dump(unserialize('a:2:{i:0;a:0:{}i:1;a:0:{}}'));
+var_dump(unserialize('a:3:{i:0;s:3:"foo";i:1;s:3:"bar";i:2;s:3:"baz";}'));
+var_dump(unserialize('O:8:"stdClass":0:{}'));
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(true)
+int(823)
+string(0) ""
+string(3) "foo"
+array(1) {
+ [0]=>
+ string(2) "12"
+}
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ [2]=>
+ string(3) "baz"
+}
+object(stdClass)#%d (0) {
+}
+===DONE===
diff --git a/ext/standard/tests/serialize/003.phpt b/ext/standard/tests/serialize/003.phpt
new file mode 100644
index 0000000..edbcb1f
--- /dev/null
+++ b/ext/standard/tests/serialize/003.phpt
@@ -0,0 +1,25 @@
+--TEST--
+unserialize() floats with E notation (#18654)
+--INI--
+precision=12
+serialize_precision=100
+--FILE--
+<?php
+foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) {
+ echo ($ser = serialize($value))."\n";
+ var_dump(unserialize($ser));
+ echo "\n";
+}
+?>
+--EXPECTREGEX--
+d:100;
+float\(100\)
+
+d:5[0-9]*;
+float\(5\.2E\+25\)
+
+d:8\.52[89][0-9]+E-22;
+float\(8\.529E-22\)
+
+d:8\.[9]*[0-9]*E-9;
+float\(9\.0E-9\)
diff --git a/ext/standard/tests/serialize/004.phpt b/ext/standard/tests/serialize/004.phpt
new file mode 100644
index 0000000..a4a7c68
--- /dev/null
+++ b/ext/standard/tests/serialize/004.phpt
@@ -0,0 +1,33 @@
+--TEST--
+serialize()/unserialize() floats in array.
+--INI--
+precision=12
+serialize_precision=100
+--FILE--
+<?php
+error_reporting (E_ALL);
+$a = array(4);
+$str = serialize($a);
+print('Serialized array: '.$str."\n");
+$b = unserialize($str);
+print('Unserialized array: ');
+var_dump($b);
+print("\n");
+$str = serialize(array(4.5));
+print('Serialized array: '.$str."\n");
+$b = unserialize($str);
+print('Unserialized array: ') ;
+var_dump($b);
+?>
+--EXPECT--
+Serialized array: a:1:{i:0;i:4;}
+Unserialized array: array(1) {
+ [0]=>
+ int(4)
+}
+
+Serialized array: a:1:{i:0;d:4.5;}
+Unserialized array: array(1) {
+ [0]=>
+ float(4.5)
+}
diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt
new file mode 100644
index 0000000..e7b23db
--- /dev/null
+++ b/ext/standard/tests/serialize/005.phpt
@@ -0,0 +1,186 @@
+--TEST--
+serialize()/unserialize() objects
+--SKIPIF--
+<?php if (!interface_exists('Serializable')) die('skip Interface Serialzable not defined'); ?>
+--FILE--
+<?php
+
+// This test verifies that old and new style (un)serializing do not interfere.
+
+function do_autoload($class_name)
+{
+ if ($class_name != 'autoload_not_available')
+ {
+ require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
+ }
+ echo __FUNCTION__ . "($class_name)\n";
+}
+
+function unserializer($class_name)
+{
+ echo __METHOD__ . "($class_name)\n";
+ switch($class_name)
+ {
+ case 'TestNAOld':
+ eval("class TestNAOld extends TestOld {}");
+ break;
+ case 'TestNANew':
+ eval("class TestNANew extends TestNew {}");
+ break;
+ case 'TestNANew2':
+ eval("class TestNANew2 extends TestNew {}");
+ break;
+ default:
+ echo "Try __autoload()\n";
+ if (!function_exists('__autoload'))
+ {
+ eval('function __autoload($class_name) { do_autoload($class_name); }');
+ }
+ __autoload($class_name);
+ break;
+ }
+}
+
+ini_set('unserialize_callback_func', 'unserializer');
+
+class TestOld
+{
+ function serialize()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __wakeup()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __sleep()
+ {
+ echo __METHOD__ . "()\n";
+ return array();
+ }
+}
+
+class TestNew implements Serializable
+{
+ protected static $check = 0;
+
+ function serialize()
+ {
+ echo __METHOD__ . "()\n";
+ switch(++self::$check)
+ {
+ case 1:
+ return NULL;
+ case 2:
+ return "2";
+ }
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __wakeup()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __sleep()
+ {
+ echo __METHOD__ . "()\n";
+ }
+}
+
+echo "===O1===\n";
+var_dump($ser = serialize(new TestOld));
+var_dump(unserialize($ser));
+
+echo "===N1===\n";
+var_dump($ser = serialize(new TestNew));
+var_dump(unserialize($ser));
+
+echo "===N2===\n";
+var_dump($ser = serialize(new TestNew));
+var_dump(unserialize($ser));
+
+echo "===NAOld===\n";
+var_dump(unserialize('O:9:"TestNAOld":0:{}'));
+
+echo "===NANew===\n";
+var_dump(unserialize('O:9:"TestNANew":0:{}'));
+
+echo "===NANew2===\n";
+var_dump(unserialize('C:10:"TestNANew2":0:{}'));
+
+echo "===AutoOld===\n";
+var_dump(unserialize('O:19:"autoload_implements":0:{}'));
+
+// Now we have __autoload(), that will be called before the old style header.
+// If the old style handler also fails to register the class then the object
+// becomes an incomplete class instance.
+
+echo "===AutoNA===\n";
+var_dump(unserialize('O:22:"autoload_not_available":0:{}'));
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===O1===
+TestOld::__sleep()
+string(18) "O:7:"TestOld":0:{}"
+TestOld::__wakeup()
+object(TestOld)#%d (0) {
+}
+===N1===
+TestNew::serialize()
+string(2) "N;"
+NULL
+===N2===
+TestNew::serialize()
+string(19) "C:7:"TestNew":1:{2}"
+TestNew::unserialize()
+object(TestNew)#%d (0) {
+}
+===NAOld===
+unserializer(TestNAOld)
+TestOld::__wakeup()
+object(TestNAOld)#%d (0) {
+}
+===NANew===
+unserializer(TestNANew)
+TestNew::__wakeup()
+object(TestNANew)#%d (0) {
+}
+===NANew2===
+unserializer(TestNANew2)
+TestNew::unserialize()
+object(TestNANew2)#%d (0) {
+}
+===AutoOld===
+unserializer(autoload_implements)
+Try __autoload()
+do_autoload(autoload_interface)
+do_autoload(autoload_implements)
+object(autoload_implements)#%d (0) {
+}
+===AutoNA===
+do_autoload(autoload_not_available)
+unserializer(autoload_not_available)
+Try __autoload()
+do_autoload(autoload_not_available)
+do_autoload(autoload_not_available)
+
+Warning: unserialize(): Function unserializer() hasn't defined the class it was called for in %s005.php on line %d
+object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(22) "autoload_not_available"
+}
+===DONE===
diff --git a/ext/standard/tests/serialize/006.phpt b/ext/standard/tests/serialize/006.phpt
new file mode 100644
index 0000000..fb813bc
--- /dev/null
+++ b/ext/standard/tests/serialize/006.phpt
@@ -0,0 +1,29 @@
+--TEST--
+serialize()/unserialize() with exotic letters
+--FILE--
+<?php
+ $åäöÅÄÖ = array('åäöÅÄÖ' => 'åäöÅÄÖ');
+
+ class ÜberKööliäå
+ {
+ public $åäöÅÄÖüÜber = 'åäöÅÄÖ';
+ }
+
+ $foo = new Überkööliäå();
+
+ var_dump(serialize($foo));
+ var_dump(unserialize(serialize($foo)));
+ var_dump(serialize($åäöÅÄÖ));
+ var_dump(unserialize(serialize($åäöÅÄÖ)));
+?>
+--EXPECT--
+string(55) "O:11:"ÜberKööliäå":1:{s:11:"åäöÅÄÖüÜber";s:6:"åäöÅÄÖ";}"
+object(ÜberKööliäå)#2 (1) {
+ ["åäöÅÄÖüÜber"]=>
+ string(6) "åäöÅÄÖ"
+}
+string(32) "a:1:{s:6:"åäöÅÄÖ";s:6:"åäöÅÄÖ";}"
+array(1) {
+ ["åäöÅÄÖ"]=>
+ string(6) "åäöÅÄÖ"
+}
diff --git a/ext/standard/tests/serialize/autoload_implements.p5c b/ext/standard/tests/serialize/autoload_implements.p5c
new file mode 100755
index 0000000..2c3479c
--- /dev/null
+++ b/ext/standard/tests/serialize/autoload_implements.p5c
@@ -0,0 +1,10 @@
+<?php
+
+class autoload_implements implements autoload_interface {
+ function testFunction()
+ {
+ return true;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/ext/standard/tests/serialize/autoload_interface.p5c b/ext/standard/tests/serialize/autoload_interface.p5c
new file mode 100755
index 0000000..6908155
--- /dev/null
+++ b/ext/standard/tests/serialize/autoload_interface.p5c
@@ -0,0 +1,7 @@
+<?php
+
+interface autoload_interface {
+ function testFunction();
+}
+
+?> \ No newline at end of file
diff --git a/ext/standard/tests/serialize/bug14293.phpt b/ext/standard/tests/serialize/bug14293.phpt
new file mode 100644
index 0000000..3fca7e4
--- /dev/null
+++ b/ext/standard/tests/serialize/bug14293.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #14293 (serialize() and __sleep())
+--FILE--
+<?php
+class t
+{
+ function t()
+ {
+ $this->a = 'hello';
+ }
+
+ function __sleep()
+ {
+ echo "__sleep called\n";
+ return array('a','b');
+ }
+}
+
+$t = new t();
+$data = serialize($t);
+echo "$data\n";
+$t = unserialize($data);
+var_dump($t);
+
+?>
+--EXPECTF--
+__sleep called
+
+Notice: serialize(): "b" returned as member variable from __sleep() but does not exist in %sbug14293.php on line %d
+O:1:"t":2:{s:1:"a";s:5:"hello";s:1:"b";N;}
+object(t)#%d (2) {
+ ["a"]=>
+ string(5) "hello"
+ ["b"]=>
+ NULL
+}
diff --git a/ext/standard/tests/serialize/bug21957.phpt b/ext/standard/tests/serialize/bug21957.phpt
new file mode 100644
index 0000000..29eeb2e
--- /dev/null
+++ b/ext/standard/tests/serialize/bug21957.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Bug #21957 (serialize() mangles objects with __sleep)
+--FILE--
+<?php
+class test
+{
+ public $a, $b;
+
+ function test()
+ {
+ $this->a = 7;
+ $this->b = 2;
+ }
+
+ function __sleep()
+ {
+ $this->b = 0;
+ }
+}
+
+$t['one'] = 'ABC';
+$t['two'] = new test();
+
+var_dump($t);
+
+$s = @serialize($t);
+echo $s . "\n";
+
+var_dump(unserialize($s));
+?>
+--EXPECT--
+array(2) {
+ ["one"]=>
+ string(3) "ABC"
+ ["two"]=>
+ object(test)#1 (2) {
+ ["a"]=>
+ int(7)
+ ["b"]=>
+ int(2)
+ }
+}
+a:2:{s:3:"one";s:3:"ABC";s:3:"two";N;}
+array(2) {
+ ["one"]=>
+ string(3) "ABC"
+ ["two"]=>
+ NULL
+}
diff --git a/ext/standard/tests/serialize/bug23298.phpt b/ext/standard/tests/serialize/bug23298.phpt
new file mode 100644
index 0000000..a5305cf
--- /dev/null
+++ b/ext/standard/tests/serialize/bug23298.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #23298 (serialize() and floats/doubles)
+--INI--
+serialize_precision=100
+--FILE--
+<?php
+ ini_set('precision', 12);
+ $foo = 1.428571428571428647642857142;
+ $bar = unserialize(serialize($foo));
+ var_dump(($foo === $bar));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/serialize/bug24063.phpt b/ext/standard/tests/serialize/bug24063.phpt
new file mode 100644
index 0000000..3cca101
--- /dev/null
+++ b/ext/standard/tests/serialize/bug24063.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #24063 (serialize() missing 0 after the . on scientific notation)
+--INI--
+serialize_precision=100
+precision=12
+--FILE--
+<?php
+$v = 1;
+for ($i = 1; $i < 10; $i++) {
+ $v /= 10;
+ echo "{$v} ".unserialize(serialize($v))."\n";
+}
+?>
+--EXPECT--
+0.1 0.1
+0.01 0.01
+0.001 0.001
+0.0001 0.0001
+1.0E-5 1.0E-5
+1.0E-6 1.0E-6
+1.0E-7 1.0E-7
+1.0E-8 1.0E-8
+1.0E-9 1.0E-9
diff --git a/ext/standard/tests/serialize/bug25378.phpt b/ext/standard/tests/serialize/bug25378.phpt
new file mode 100644
index 0000000..e865b96
--- /dev/null
+++ b/ext/standard/tests/serialize/bug25378.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Bug #25378 (unserialize() crashes with invalid data)
+--FILE--
+<?php
+var_dump(unserialize("s:-1:\"\";"));
+var_dump(unserialize("i:823"));
+var_dump(unserialize("O:8:\"stdClass :0:{}"));
+var_dump(unserialize("O:8:\"stdClass\"+0:{}"));
+var_dump(unserialize("O:1000:\"stdClass\":0:{}"));
+var_dump(unserialize("a:2:{i:0;s:2:\"12\":"));
+var_dump(unserialize("a:2:{i:0;s:2:\"12\";i:1;s:3000:\"123"));
+var_dump(unserialize("a:2:{i:0;s:2:\"12\"+i:1;s:3:\"123\";}"));
+var_dump(unserialize("a:2:{i:0;s:2:\"12\";i:1;s:3:\"123\";"));
+var_dump(unserialize("s:3000:\"123\";"));
+var_dump(unserialize("s:3000:\"123"));
+var_dump(unserialize("s:3:\"123;"));
+var_dump(unserialize("s:0:\"123\";"));
+?>
+===DONE===
+--EXPECTF--
+Notice: unserialize(): Error at offset 0 of 8 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 0 of 5 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 13 of 19 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 14 of 19 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 2 of 22 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 17 of 18 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 24 of 33 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 17 of 33 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 33 of 32 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 2 of 13 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 2 of 11 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 8 of 9 bytes in %sbug25378.php on line %d
+bool(false)
+
+Notice: unserialize(): Error at offset 5 of 10 bytes in %sbug25378.php on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/serialize/bug26762.phpt b/ext/standard/tests/serialize/bug26762.phpt
new file mode 100644
index 0000000..3011bb6
--- /dev/null
+++ b/ext/standard/tests/serialize/bug26762.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #26762 (unserialize() produces lowercase classnames)
+--SKIPIF--
+<?php
+ if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed');
+ if (class_exists('autoload_root')) die('skip Autoload test classes exist already');
+?>
+--FILE--
+<?php
+
+ini_set('unserialize_callback_func','check');
+
+function check($name) {
+ var_dump($name);
+ throw new exception;
+}
+
+try {
+ @unserialize('O:3:"FOO":0:{}');
+}
+catch (Exception $e) {
+ /* ignore */
+}
+
+?>
+--EXPECTF--
+string(3) "FOO"
diff --git a/ext/standard/tests/serialize/bug27469.phpt b/ext/standard/tests/serialize/bug27469.phpt
new file mode 100644
index 0000000..e8d1410
--- /dev/null
+++ b/ext/standard/tests/serialize/bug27469.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #27469 (serialize() objects of incomplete class)
+--FILE--
+<?php
+$str = 'O:9:"TestClass":0:{}';
+$obj = unserialize($str);
+var_dump($obj);
+echo serialize($obj)."\n";
+var_dump($obj);
+echo serialize($obj)."\n";
+var_dump($obj);
+?>
+--EXPECT--
+object(__PHP_Incomplete_Class)#1 (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(9) "TestClass"
+}
+O:9:"TestClass":0:{}
+object(__PHP_Incomplete_Class)#1 (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(9) "TestClass"
+}
+O:9:"TestClass":0:{}
+object(__PHP_Incomplete_Class)#1 (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(9) "TestClass"
+}
diff --git a/ext/standard/tests/serialize/bug28325.phpt b/ext/standard/tests/serialize/bug28325.phpt
new file mode 100644
index 0000000..ee0e60e
--- /dev/null
+++ b/ext/standard/tests/serialize/bug28325.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #28325 (Problem in serialisation of circular references)
+--FILE--
+<?php
+class a {
+ public $b;
+}
+class b {
+ public $c;
+}
+class c {
+ public $d;
+}
+$a = new a();
+$a->b = new b();
+$a->b->c = new c();
+$a->b->c->d = $a;
+var_dump(unserialize(serialize($a)));
+?>
+--EXPECTF--
+object(a)#%d (1) {
+ ["b"]=>
+ object(b)#%d (1) {
+ ["c"]=>
+ object(c)#%d (1) {
+ ["d"]=>
+ *RECURSION*
+ }
+ }
+}
diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt
new file mode 100644
index 0000000..9b40cc5
--- /dev/null
+++ b/ext/standard/tests/serialize/bug30234.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #30234 (__autoload() not invoked for interfaces)
+--SKIPIF--
+<?php
+ if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already');
+?>
+--FILE--
+<?php
+
+function __autoload($class_name)
+{
+ require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
+ echo __FUNCTION__ . '(' . $class_name . ")\n";
+}
+
+var_dump(interface_exists('autoload_interface', false));
+var_dump(class_exists('autoload_implements', false));
+
+$o = unserialize('O:19:"Autoload_Implements":0:{}');
+
+var_dump($o);
+var_dump($o instanceof autoload_interface);
+unset($o);
+
+var_dump(interface_exists('autoload_interface', false));
+var_dump(class_exists('autoload_implements', false));
+
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+__autoload(autoload_interface)
+__autoload(Autoload_Implements)
+object(autoload_implements)#%d (0) {
+}
+bool(true)
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/serialize/bug31402.phpt b/ext/standard/tests/serialize/bug31402.phpt
new file mode 100644
index 0000000..59cc52f
--- /dev/null
+++ b/ext/standard/tests/serialize/bug31402.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Bug #31402 (unserialize() generates references when it should not)
+--INI--
+error_reporting=E_ALL&~E_STRICT&~E_DEPRECATED
+--FILE--
+<?php
+
+class TestX {
+ var $i;
+
+ function __construct($i) {
+ $this->i = $i;
+ }
+}
+
+class TestY {
+ var $A = array();
+ var $B;
+
+ function __construct() {
+ $this->A[1] = new TestX(1);
+ $this->A[2] = & new TestX(2);
+ $this->A[3] = & $this->A[2];
+ $this->B = $this->A[1];
+ }
+}
+
+$before = new TestY();
+$ser = serialize($before);
+$after = unserialize($ser);
+
+var_dump($before, $after);
+
+?>
+===DONE===
+--EXPECTF--
+object(TestY)#%d (2) {
+ ["A"]=>
+ array(3) {
+ [1]=>
+ object(TestX)#%d (1) {
+ ["i"]=>
+ int(1)
+ }
+ [2]=>
+ &object(TestX)#%d (1) {
+ ["i"]=>
+ int(2)
+ }
+ [3]=>
+ &object(TestX)#%d (1) {
+ ["i"]=>
+ int(2)
+ }
+ }
+ ["B"]=>
+ object(TestX)#%d (1) {
+ ["i"]=>
+ int(1)
+ }
+}
+object(TestY)#%d (2) {
+ ["A"]=>
+ array(3) {
+ [1]=>
+ object(TestX)#%d (1) {
+ ["i"]=>
+ int(1)
+ }
+ [2]=>
+ &object(TestX)#%d (1) {
+ ["i"]=>
+ int(2)
+ }
+ [3]=>
+ &object(TestX)#%d (1) {
+ ["i"]=>
+ int(2)
+ }
+ }
+ ["B"]=>
+ object(TestX)#%d (1) {
+ ["i"]=>
+ int(1)
+ }
+}
+===DONE===
diff --git a/ext/standard/tests/serialize/bug31442.phpt b/ext/standard/tests/serialize/bug31442.phpt
new file mode 100644
index 0000000..6d451ba
--- /dev/null
+++ b/ext/standard/tests/serialize/bug31442.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #31442 (unserialize broken on 64-bit systems)
+--INI--
+precision=14
+--FILE--
+<?php
+echo unserialize(serialize(2147483648));
+?>
+--EXPECT--
+2147483648
diff --git a/ext/standard/tests/serialize/bug35895.phpt b/ext/standard/tests/serialize/bug35895.phpt
new file mode 100644
index 0000000..22fce0d
--- /dev/null
+++ b/ext/standard/tests/serialize/bug35895.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #35895 (__sleep and private property)
+--FILE--
+<?php
+class Parents {
+ private $parents;
+ public function __sleep() {
+ return array("parents");
+ }
+}
+
+class Child extends Parents {
+ private $child;
+ public function __sleep() {
+ return array_merge(array("child"), parent::__sleep());
+ }
+}
+
+$obj = new Child();
+serialize($obj);
+
+?>
+--EXPECTF--
+Notice: serialize(): "parents" returned as member variable from __sleep() but does not exist in %sbug35895.php on line %d
diff --git a/ext/standard/tests/serialize/bug36424.phpt b/ext/standard/tests/serialize/bug36424.phpt
new file mode 100644
index 0000000..c62be01
--- /dev/null
+++ b/ext/standard/tests/serialize/bug36424.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Bug #36424 - Serializable interface breaks object references
+--FILE--
+<?php
+
+echo "-TEST\n";
+
+class a implements Serializable {
+ function serialize() {
+ return serialize(get_object_vars($this));
+ }
+ function unserialize($s) {
+ foreach (unserialize($s) as $p=>$v) {
+ $this->$p=$v;
+ }
+ }
+}
+class b extends a {}
+class c extends b {}
+
+$c = new c;
+$c->a = new a;
+$c->a->b = new b;
+$c->a->b->c = $c;
+$c->a->c = $c;
+$c->a->b->a = $c->a;
+$c->a->a = $c->a;
+
+$s = serialize($c);
+printf("%s\n", $s);
+
+$d = unserialize($s);
+
+var_dump(
+ $d === $d->a->b->c,
+ $d->a->a === $d->a,
+ $d->a->b->a === $d->a,
+ $d->a->c === $d
+);
+
+print_r($d);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+%aTEST
+C:1:"c":108:{a:1:{s:1:"a";C:1:"a":81:{a:3:{s:1:"b";C:1:"b":30:{a:2:{s:1:"c";r:1;s:1:"a";r:3;}}s:1:"c";r:1;s:1:"a";r:3;}}}}
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+c Object
+(
+ [a] => a Object
+ (
+ [b] => b Object
+ (
+ [c] => c Object
+ *RECURSION*
+ [a] => a Object
+ *RECURSION*
+ )
+
+ [c] => c Object
+ *RECURSION*
+ [a] => a Object
+ *RECURSION*
+ )
+
+)
+Done
diff --git a/ext/standard/tests/serialize/bug37947.phpt b/ext/standard/tests/serialize/bug37947.phpt
new file mode 100644
index 0000000..07371d1
--- /dev/null
+++ b/ext/standard/tests/serialize/bug37947.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #37947 (zend_ptr_stack reallocation problem)
+--INI--
+error_reporting=0
+--FILE--
+<?php
+class test {
+ function extend_zend_ptr_stack($count,$a,$b,$c,$d,$e) {
+ if ($count>0) $this->extend_zend_ptr_stack($count -
+1,$a,$b,$c,$d,$e);
+ }
+
+ function __wakeup() {
+ $this->extend_zend_ptr_stack(10,'a','b','c','d','e');
+ }
+}
+
+$str='a:2:{i:0;O:4:"test":0:{}junk';
+var_dump(unserialize($str));
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/serialize/bug42919.phpt b/ext/standard/tests/serialize/bug42919.phpt
new file mode 100644
index 0000000..0a3d0b2
--- /dev/null
+++ b/ext/standard/tests/serialize/bug42919.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #42919 (Unserializing of namespaced class object fails)
+--FILE--
+<?php
+namespace Foo;
+class Bar {
+}
+echo serialize(new Bar) . "\n";
+$x = unserialize(serialize(new Bar));
+echo get_class($x) . "\n";
+?>
+--EXPECT--
+O:7:"Foo\Bar":0:{}
+Foo\Bar
diff --git a/ext/standard/tests/serialize/bug43614.phpt b/ext/standard/tests/serialize/bug43614.phpt
new file mode 100644
index 0000000..68568a1
--- /dev/null
+++ b/ext/standard/tests/serialize/bug43614.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #43614 (incorrect processing of numerical string keys of array in arbitrary serialized data)
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+var_dump($a = unserialize('a:2:{s:2:"10";i:1;s:2:"01";i:2;}'));
+var_dump($a['10']);
+var_dump($a[b'01']);
+
+?>
+--EXPECT--
+array(2) {
+ [10]=>
+ int(1)
+ ["01"]=>
+ int(2)
+}
+int(1)
+int(2)
diff --git a/ext/standard/tests/serialize/bug45706.phpt b/ext/standard/tests/serialize/bug45706.phpt
new file mode 100644
index 0000000..218cdcc
--- /dev/null
+++ b/ext/standard/tests/serialize/bug45706.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #45706 Unserialization of classes derived from ArrayIterator fails
+--FILE--
+<?php
+class Foo1 extends ArrayIterator
+{
+}
+class Foo2 {
+}
+$x = array(new Foo1(),new Foo2);
+$s = serialize($x);
+$s = str_replace("Foo", "Bar", $s);
+$y = unserialize($s);
+var_dump($y);
+--EXPECTF--
+Warning: Class __PHP_Incomplete_Class has no unserializer in %sbug45706.php on line %d
+array(2) {
+ [0]=>
+ object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(4) "Bar1"
+ }
+ [1]=>
+ object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(4) "Bar2"
+ }
+}
diff --git a/ext/standard/tests/serialize/bug46882.phpt b/ext/standard/tests/serialize/bug46882.phpt
new file mode 100644
index 0000000..cc64c64
--- /dev/null
+++ b/ext/standard/tests/serialize/bug46882.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #46882 (Serialize / Unserialize misbehaviour under OS with different bit numbers)
+--FILE--
+<?php
+var_dump(unserialize('i:5000000000;') == 5000000000);
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/serialize/bug55798.phpt b/ext/standard/tests/serialize/bug55798.phpt
new file mode 100644
index 0000000..df8443b
--- /dev/null
+++ b/ext/standard/tests/serialize/bug55798.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #55798 (serialize followed by unserialize with numeric object prop. gives integer prop)
+--FILE--
+<?php
+
+$a = new stdClass();
+$a->{0} = 'X';
+$a->{1} = 'Y';
+var_dump(serialize($a));
+var_dump($a->{0});
+$b = unserialize(serialize($a));
+var_dump(serialize($b));
+var_dump($b->{0});
+--EXPECT--
+string(51) "O:8:"stdClass":2:{s:1:"0";s:1:"X";s:1:"1";s:1:"Y";}"
+string(1) "X"
+string(51) "O:8:"stdClass":2:{s:1:"0";s:1:"X";s:1:"1";s:1:"Y";}"
+string(1) "X"
diff --git a/ext/standard/tests/serialize/bug62373.phpt b/ext/standard/tests/serialize/bug62373.phpt
new file mode 100644
index 0000000..666c33e
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62373.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #62373 (serialize() generates wrong reference to the object)
+--FILE--
+<?php
+class A {}
+class B {}
+
+$size_of_ce = (((int)(log(PHP_INT_MAX) / log(2)) + 1 == 32 ? 368: 680) + 15) & ~15;
+$dummy = array();
+$b = new B();
+$period = $size_of_ce << 5;
+for ($i = 0; $i < $period * 3; $i++) {
+ $a = new A();
+ $s = unserialize(serialize(array($b, $a)));
+ if ($s[0] === $s[1]) {
+ echo "OOPS\n";
+ break;
+ }
+ $dummy[] = $a;
+}
+
+echo "OK\n";
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/serialize/bug62836_1.phpt b/ext/standard/tests/serialize/bug62836_1.phpt
new file mode 100644
index 0000000..7291046
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62836_1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #62836 (Seg fault or broken object references on unserialize())
+--FILE--
+<?php
+$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
+function __autoload($name) {
+ unserialize("i:4;");
+ eval("class $name {} ");
+}
+
+print_r(unserialize($serialized_object));
+echo "okey";
+?>
+--EXPECT--
+A Object
+(
+ [b] => B Object
+ (
+ )
+
+ [b1] => B Object
+ (
+ )
+
+ [c] => B Object
+ (
+ )
+
+ [c1] => B Object
+ (
+ )
+
+)
+okey
diff --git a/ext/standard/tests/serialize/bug62836_2.phpt b/ext/standard/tests/serialize/bug62836_2.phpt
new file mode 100644
index 0000000..0634b1d
--- /dev/null
+++ b/ext/standard/tests/serialize/bug62836_2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #62836 (Seg fault or broken object references on unserialize())
+--FILE--
+<?php
+$serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
+
+ini_set('unserialize_callback_func','mycallback');
+
+function mycallback($classname) {
+ unserialize("i:4;");
+ eval ("class $classname {} ");
+}
+
+print_r(unserialize($serialized_object));
+echo "okey";
+?>
+--EXPECT--
+A Object
+(
+ [b] => B Object
+ (
+ )
+
+ [b1] => B Object
+ (
+ )
+
+ [c] => B Object
+ (
+ )
+
+ [c1] => B Object
+ (
+ )
+
+)
+okey
diff --git a/ext/standard/tests/serialize/incomplete_class.phpt b/ext/standard/tests/serialize/incomplete_class.phpt
new file mode 100644
index 0000000..8280485
--- /dev/null
+++ b/ext/standard/tests/serialize/incomplete_class.phpt
@@ -0,0 +1,27 @@
+--TEST--
+(un)serializing __PHP_Incomplete_Class instance
+--FILE--
+<?php
+
+$d = serialize(new __PHP_Incomplete_Class);
+$o = unserialize($d);
+var_dump($o);
+
+$o->test = "a";
+var_dump($o->test);
+var_dump($o->test2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+object(__PHP_Incomplete_Class)#%d (0) {
+}
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/serialize/precision.phpt b/ext/standard/tests/serialize/precision.phpt
new file mode 100644
index 0000000..142b2ce
--- /dev/null
+++ b/ext/standard/tests/serialize/precision.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Default precision is sufficient to serialize all the information in floats
+--SKIPIF--
+<?php
+if (pack('s', 1) != "\x01\x00")
+ die("skip test for little-endian architectures");
+--FILE--
+<?php
+
+$numbers = array(
+ "0000000000000000", //0
+ "2d431cebe2362a3f", //.0002
+ "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01
+ "0000000000001000", //2^-1022. (minimum normal double)
+ "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01
+ "ffffffffffffef7f", //2^1024. (maximum normal double)
+ "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.]
+ "0100000000000000", //minumum subnormal double
+ "0200000000000000", //2nd minumum subnormal double
+ "fffffffffffff000", //maximum subnormal double
+ "fefffffffffff000", //2nd maximum subnormal double
+ "0000000000000f7f", //+inf
+ "0000000000000fff", //-inf
+);
+
+foreach ($numbers as $ns) {
+ $num = unpack("d", pack("H*", $ns)); $num = reset($num);
+ echo "number: ", sprintf("%.17e", $num), "... ";
+ $num2 = unserialize(serialize($num));
+ $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr);
+ if ($repr == $ns)
+ echo "OK\n";
+ else
+ echo "mismatch\n\twas: $ns\n\tbecame: $repr\n";
+}
+--EXPECT--
+number: 0.00000000000000000e+0... OK
+number: 2.00000000000000010e-4... OK
+number: 2.00000000000000037e-4... OK
+number: 2.22507385850720138e-308... OK
+number: 2.22507385850720188e-308... OK
+number: 1.79769313486231571e+308... OK
+number: 1.79769313486231551e+308... OK
+number: 4.94065645841246544e-324... OK
+number: 9.88131291682493088e-324... OK
+number: 3.87340857288933536e-304... OK
+number: 3.87340857288933455e-304... OK
+number: 1.06293653832877718e+304... OK
+number: -1.06293653832877718e+304... OK
diff --git a/ext/standard/tests/serialize/serialization_arrays_001.phpt b/ext/standard/tests/serialize/serialization_arrays_001.phpt
new file mode 100644
index 0000000..51acfc4
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_001.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test serialize() & unserialize() functions: arrays (circular references)
+--INI--
+serialize_precision=100
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n--- Testing Circular reference of an array ---\n";
+
+echo "-- Normal array --\n";
+$arr_circ = array(0, 1, -2, 3.333333, "a", array(), &$arr_circ);
+$serialize_data = serialize($arr_circ);
+var_dump( $serialize_data );
+$arr_circ = unserialize($serialize_data);
+var_dump( $arr_circ );
+
+echo "\n-- Associative array --\n";
+$arr_asso = array("a" => "test");
+$arr_asso[ "b" ] = &$arr_asso[ "a" ];
+var_dump($arr_asso);
+$serialize_data = serialize($arr_asso);
+var_dump($serialize_data);
+$arr_asso = unserialize($serialize_data);
+var_dump($arr_asso);
+
+echo "\nDone";
+?>
+--EXPECTF--
+--- Testing Circular reference of an array ---
+-- Normal array --
+string(238) "a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;s:1:"a";i:5;a:0:{}i:6;a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;s:1:"a";i:5;a:0:{}i:6;R:8;}}"
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-2)
+ [3]=>
+ float(3.333333)
+ [4]=>
+ string(1) "a"
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ &array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-2)
+ [3]=>
+ float(3.333333)
+ [4]=>
+ string(1) "a"
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ *RECURSION*
+ }
+}
+
+-- Associative array --
+array(2) {
+ ["a"]=>
+ &string(4) "test"
+ ["b"]=>
+ &string(4) "test"
+}
+string(37) "a:2:{s:1:"a";s:4:"test";s:1:"b";R:2;}"
+array(2) {
+ ["a"]=>
+ &string(4) "test"
+ ["b"]=>
+ &string(4) "test"
+}
+
+Done
diff --git a/ext/standard/tests/serialize/serialization_arrays_002.phpt b/ext/standard/tests/serialize/serialization_arrays_002.phpt
new file mode 100644
index 0000000..f8cef78
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt
@@ -0,0 +1,544 @@
+--TEST--
+serialization: arrays with references amonst elements
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
+}
+
+echo "\n\n--- No references:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 0 refs 1:\n";
+$a = array();
+$a[0] = &$a[1];
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 0 refs 2:\n";
+$a = array();
+$a[0] = &$a[2];
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1 refs 0:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = &$a[0];
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1 refs 2:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = &$a[2];
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 2 refs 0:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = &$a[0];
+check($a);
+
+echo "\n\n--- 2 refs 1:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = &$a[1];
+check($a);
+
+echo "\n\n--- 0,1 ref 2:\n";
+$a = array();
+$a[0] = &$a[2];
+$a[1] = &$a[2];
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 0,2 ref 1:\n";
+$a = array();
+$a[0] = &$a[1];
+$a[1] = 1;
+$a[2] = &$a[1];
+check($a);
+
+echo "\n\n--- 1,2 ref 0:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = &$a[0];
+$a[2] = &$a[0];
+check($a);
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+--- No references:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 0 refs 1:
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:1;i:1;i:0;R:2;i:2;i:1;}"
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 0 refs 2:
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+}
+string(30) "a:3:{i:2;i:1;i:0;R:2;i:1;i:1;}"
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+}
+array(3) {
+ [2]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+}
+array(3) {
+ [2]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+}
+array(3) {
+ [2]=>
+ &string(10) "b2.changed"
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ string(10) "b1.changed"
+}
+
+
+--- 1 refs 0:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1 refs 2:
+array(3) {
+ [0]=>
+ int(1)
+ [2]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:2;i:1;i:1;R:3;}"
+array(3) {
+ [0]=>
+ int(1)
+ [2]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [2]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [2]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [2]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 2 refs 0:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 2 refs 1:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:3;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 0,1 ref 2:
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+string(30) "a:3:{i:2;i:1;i:0;R:2;i:1;R:2;}"
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+array(3) {
+ [2]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [2]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [2]=>
+ &string(10) "b2.changed"
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 0,2 ref 1:
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:1;i:1;i:0;R:2;i:2;R:2;}"
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [1]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [1]=>
+ &string(10) "b2.changed"
+ [0]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 1,2 ref 0:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_arrays_003.phpt b/ext/standard/tests/serialize/serialization_arrays_003.phpt
new file mode 100644
index 0000000..8d664fc
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_003.phpt
@@ -0,0 +1,294 @@
+--TEST--
+serialization: arrays with references to an external variable
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
+}
+
+echo "\n\n--- 0 refs external:\n";
+$ext = 1;
+$a = array();
+$a[0] = &$ext;
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1 refs external:\n";
+$ext = 1;
+$a = array();
+$a[0] = 1;
+$a[1] = &$ext;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 2 refs external:\n";
+$ext = 1;
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = &$ext;
+check($a);
+
+echo "\n\n--- 1,2 ref external:\n";
+$ext = 1;
+$a = array();
+$a[0] = &$ext;
+$a[1] = &$ext;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1,2,3 ref external:\n";
+$ext = 1;
+$a = array();
+$a[0] = &$ext;
+$a[1] = &$ext;
+$a[2] = &$ext;
+check($a);
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+--- 0 refs external:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1 refs external:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 2 refs external:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2 ref external:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2,3 ref external:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_arrays_004.phpt b/ext/standard/tests/serialize/serialization_arrays_004.phpt
new file mode 100644
index 0000000..55d849c
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt
@@ -0,0 +1,269 @@
+--TEST--
+serialization: arrays with references to the containing array
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
+}
+
+echo "\n\n--- 1 refs container:\n";
+$a = array();
+$a[0] = &$a;
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1,2 ref container:\n";
+$a = array();
+$a[0] = &$a;
+$a[1] = &$a;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1,2,3 ref container:\n";
+$a = array();
+$a[0] = &$a;
+$a[1] = &$a;
+$a[2] = &$a;
+check($a);
+
+echo "Done";
+?>
+--EXPECTF--
+--- 1 refs container:
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;i:1;i:2;i:1;}i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2 ref container:
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+}
+string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;i:1;}i:1;R:2;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2,3 ref container:
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+}
+string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+Done
diff --git a/ext/standard/tests/serialize/serialization_arrays_005.phpt b/ext/standard/tests/serialize/serialization_arrays_005.phpt
new file mode 100644
index 0000000..10e3312
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt
@@ -0,0 +1,521 @@
+--TEST--
+serialization: arrays with references, nested
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+
+ // Change each element and dump result.
+ foreach($b as $k=>$v) {
+ if (is_array($v)){
+ foreach($b[$k] as $sk=>$sv) {
+ $b[$k][$sk] = "b$k.$sk.changed";
+ var_dump($b);
+ }
+ } else {
+ $b[$k] = "b$k.changed";
+ var_dump($b);
+ }
+ }
+}
+
+echo "\n\n--- Nested array references 1 element in containing array:\n";
+$a = array();
+$c = array(1,1,&$a);
+$a[0] = &$c[0];
+$a[1] = 1;
+check($c);
+
+echo "\n\n--- Nested array references 1 element in containing array (slightly different):\n";
+$a = array();
+$c = array(1,&$a,1);
+$a[0] = 1;
+$a[1] = &$c[0];
+check($c);
+
+echo "\n\n--- Nested array references 2 elements in containing array:\n";
+$a = array();
+$c = array(1,1,&$a);
+$a[0] = &$c[0];
+$a[1] = &$c[1];
+check($c);
+
+
+echo "\n\n--- Containing array references 1 element in nested array:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$c = array(1,&$a[0],&$a);
+check($c);
+
+echo "\n\n--- Containing array references 2 elements in nested array:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$c = array(&$a[0],&$a[1],&$a);
+check($c);
+
+echo "\n\n--- Nested array references container:\n";
+$a = array();
+$c = array(1,1,&$a);
+$a[0] = 1;
+$a[1] = &$c;
+check($c);
+
+?>
+--EXPECTF--
+--- Nested array references 1 element in containing array:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;i:1;}}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(12) "b2.1.changed"
+ }
+}
+
+
+--- Nested array references 1 element in containing array (slightly different):
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ }
+ [2]=>
+ int(1)
+}
+string(48) "a:3:{i:0;i:1;i:1;a:2:{i:0;i:1;i:1;R:2;}i:2;i:1;}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &string(10) "b0.changed"
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(12) "b1.0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(12) "b1.1.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(12) "b1.0.changed"
+ [1]=>
+ &string(12) "b1.1.changed"
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(12) "b1.1.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(12) "b1.0.changed"
+ [1]=>
+ &string(12) "b1.1.changed"
+ }
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- Nested array references 2 elements in containing array:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ }
+}
+
+
+--- Containing array references 1 element in nested array:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:3;i:1;i:1;}}"
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(12) "b2.0.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(12) "b2.0.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(12) "b2.1.changed"
+ }
+}
+
+
+--- Containing array references 2 elements in nested array:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ }
+}
+
+
+--- Nested array references container:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+}
+string(74) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;i:1;i:1;a:3:{i:0;i:1;i:1;i:1;i:2;R:4;}}}"
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &array(2) {
+ [0]=>
+ string(12) "b2.0.changed"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &array(2) {
+ [0]=>
+ string(12) "b2.0.changed"
+ [1]=>
+ string(12) "b2.1.changed"
+ }
+}
diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt b/ext/standard/tests/serialize/serialization_error_001.phpt
new file mode 100644
index 0000000..da6f50c
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_error_001.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test serialize() & unserialize() functions: error conditions - wrong number of args.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing serialize()/unserialize() : error conditions ***\n";
+
+// Zero arguments
+var_dump( serialize() );
+var_dump( unserialize() );
+
+//Test serialize with one more than the expected number of arguments
+var_dump( serialize(1,2) );
+var_dump( unserialize(1,2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing serialize()/unserialize() : error conditions ***
+
+Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16
+NULL
+
+Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17
+bool(false)
+
+Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+
+Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21
+bool(false)
+Done
diff --git a/ext/standard/tests/serialize/serialization_miscTypes_001.phpt b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt
new file mode 100644
index 0000000..548a673
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_001.phpt b/ext/standard/tests/serialize/serialization_objects_001.phpt
new file mode 100644
index 0000000..f85b89e
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_001.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_002.phpt b/ext/standard/tests/serialize/serialization_objects_002.phpt
new file mode 100644
index 0000000..fbd9e26
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_002.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_003.phpt b/ext/standard/tests/serialize/serialization_objects_003.phpt
new file mode 100644
index 0000000..2313ffa
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_003.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test serialize() & unserialize() functions: objects (abstract classes)
+--INI--
+serialize_precision=100
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n--- Testing Abstract Class ---\n";
+// abstract class
+abstract class Name
+{
+ public function Name() {
+ $this->a = 10;
+ $this->b = 12.222;
+ $this->c = "string";
+ }
+ abstract protected function getClassName();
+ public function printClassName () {
+ return $this->getClassName();
+ }
+}
+// implement abstract class
+class extendName extends Name
+{
+ var $a, $b, $c;
+
+ protected function getClassName() {
+ return "extendName";
+ }
+}
+
+$obj_extendName = new extendName();
+$serialize_data = serialize($obj_extendName);
+var_dump( $serialize_data );
+$unserialize_data = unserialize($serialize_data);
+var_dump( $unserialize_data );
+
+$serialize_data = serialize($obj_extendName->printClassName());
+var_dump( $serialize_data );
+$unserialize_data = unserialize($serialize_data);
+var_dump( $unserialize_data );
+
+echo "\nDone";
+?>
+--EXPECTF--
+--- Testing Abstract Class ---
+string(119) "O:10:"extendName":3:{s:1:"a";i:10;s:1:"b";d:12.2219999999999995310417943983338773250579833984375;s:1:"c";s:6:"string";}"
+object(extendName)#%d (3) {
+ ["a"]=>
+ int(10)
+ ["b"]=>
+ float(12.222)
+ ["c"]=>
+ string(6) "string"
+}
+string(18) "s:10:"extendName";"
+string(10) "extendName"
+
+Done
diff --git a/ext/standard/tests/serialize/serialization_objects_004.phpt b/ext/standard/tests/serialize/serialization_objects_004.phpt
new file mode 100644
index 0000000..6b826a3
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_004.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test serialize() & unserialize() functions: objects - ensure that COW references of objects are not serialized separately (unlike other types).
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$x = new stdClass;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = 1;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = "a";
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = true;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = null;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = array();
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+echo "Done";
+?>
+--EXPECTF--
+string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}"
+string(22) "a:2:{i:0;i:1;i:1;i:1;}"
+string(30) "a:2:{i:0;s:1:"a";i:1;s:1:"a";}"
+string(22) "a:2:{i:0;b:1;i:1;b:1;}"
+string(18) "a:2:{i:0;N;i:1;N;}"
+string(26) "a:2:{i:0;a:0:{}i:1;a:0:{}}"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
new file mode 100644
index 0000000..35b1593
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Check behaviour of incomplete class
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$serialized = 'O:1:"C":1:{s:1:"p";i:1;}';
+
+$incomplete = unserialize($serialized);
+eval('Class C {}');
+$complete = unserialize($serialized);
+
+
+echo "\n\n---> Various types of access on complete class:\n" ;
+var_dump($complete);
+var_dump(is_object($complete));
+var_dump($complete->p);
+
+$ref1 = "ref1.original";
+$complete->p = &$ref1;
+var_dump($complete->p);
+$ref1 = "ref1.changed";
+var_dump($complete->p);
+$complete->p = "p.changed";
+var_dump($ref1);
+
+var_dump(isset($complete->x));
+$complete->x = "x.new";
+var_dump(isset($complete->x));
+unset($complete->x);
+var_dump($complete->x);
+
+
+echo "\n\n---> Same types of access on incomplete class:\n" ;
+var_dump($incomplete);
+var_dump(is_object($incomplete));
+var_dump($incomplete->p);
+
+$ref2 = "ref1.original";
+$incomplete->p = &$ref2;
+var_dump($incomplete->p);
+$ref2 = "ref1.changed";
+var_dump($incomplete->p);
+$incomplete->p = "p.changed";
+var_dump($ref1);
+
+var_dump(isset($incomplete->x));
+$incomplete->x = "x.new";
+var_dump(isset($incomplete->x));
+unset($incomplete->x);
+var_dump($incomplete->x);
+
+$incomplete->f();
+
+echo "Done";
+?>
+--EXPECTF--
+---> Various types of access on complete class:
+object(C)#%d (1) {
+ ["p"]=>
+ int(1)
+}
+bool(true)
+int(1)
+string(13) "ref1.original"
+string(12) "ref1.changed"
+string(9) "p.changed"
+bool(false)
+bool(true)
+
+Notice: Undefined property: C::$x in %s on line 37
+NULL
+
+
+---> Same types of access on incomplete class:
+object(__PHP_Incomplete_Class)#%d (2) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(1) "C"
+ ["p"]=>
+ int(1)
+}
+bool(false)
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 43
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 46
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 47
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 49
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 50
+string(9) "p.changed"
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 53
+bool(false)
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 54
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 55
+bool(false)
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 56
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57
+NULL
+
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_006.phpt b/ext/standard/tests/serialize/serialization_objects_006.phpt
new file mode 100644
index 0000000..e223f4e
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_006.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Behaviour of incomplete class is preserved even when it was not created by unserialize().
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$a = new __PHP_Incomplete_Class;
+var_dump($a);
+var_dump($a->p);
+
+echo "Done";
+?>
+--EXPECTF--
+object(__PHP_Incomplete_Class)#%d (0) {
+}
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 15
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt
new file mode 100644
index 0000000..9cba9d1
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_007.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Ensure __autoload is called twice if unserialize_callback_func is defined.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function __autoload($name) {
+ echo "in __autoload($name)\n";
+}
+
+ini_set('unserialize_callback_func','check');
+
+function check($name) {
+ echo "in check($name)\n";
+}
+
+$o = unserialize('O:3:"FOO":0:{}');
+
+var_dump($o);
+
+echo "Done";
+?>
+--EXPECTF--
+in __autoload(FOO)
+in check(FOO)
+in __autoload(FOO)
+
+Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23
+object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(3) "FOO"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_008.phpt b/ext/standard/tests/serialize/serialization_objects_008.phpt
new file mode 100644
index 0000000..b963872
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_008.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bad unserialize_callback_func
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+ini_set('unserialize_callback_func','Nonexistent');
+$o = unserialize('O:3:"FOO":0:{}');
+var_dump($o);
+echo "Done";
+?>
+--EXPECTF--
+
+Warning: unserialize(): defined (Nonexistent) but not found in %s on line 14
+object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(3) "FOO"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_009.phpt b/ext/standard/tests/serialize/serialization_objects_009.phpt
new file mode 100644
index 0000000..595692d
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_009.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Custom unserialization of classes with no custom unserializer.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$ser = 'C:1:"C":6:{dasdas}';
+$a = unserialize($ser);
+eval('class C {}');
+$b = unserialize($ser);
+
+var_dump($a, $b);
+
+echo "Done";
+?>
+--EXPECTF--
+Warning: Class __PHP_Incomplete_Class has no unserializer in %sserialization_objects_009.php on line %d
+
+Warning: Class C has no unserializer in %sserialization_objects_009.php on line %d
+object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(1) "C"
+}
+object(C)#%d (0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_010.phpt b/ext/standard/tests/serialize/serialization_objects_010.phpt
new file mode 100644
index 0000000..0fbf072
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_010.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Serialize() must return a string or NULL
+--SKIPIF--
+<?php if (!interface_exists('Serializable')) die('skip Interface Serialzable not defined'); ?>
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+Class C implements Serializable {
+ public function serialize() {
+ return $this;
+ }
+
+ public function unserialize($blah) {
+ }
+}
+
+try {
+ var_dump(serialize(new C));
+} catch (Exception $e) {
+ echo $e->getMessage(). "\n";
+}
+
+echo "Done";
+?>
+--EXPECTF--
+C::serialize() must return a string or NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_011.phpt b/ext/standard/tests/serialize/serialization_objects_011.phpt
new file mode 100644
index 0000000..1dc4839
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_011.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Object serialization / unserialization with inherited and hidden properties.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+Class A {
+ private $APriv = "A.APriv";
+ protected $AProt = "A.AProt";
+ public $APub = "A.APub";
+
+ function audit() {
+ return isset($this->APriv, $this->AProt, $this->APub);
+ }
+}
+
+Class B extends A {
+ private $BPriv = "B.BPriv";
+ protected $BProt = "B.BProt";
+ public $BPub = "B.BPub";
+
+ function audit() {
+ return parent::audit() && isset($this->AProt, $this->APub,
+ $this->BPriv, $this->BProt, $this->BPub);
+ }
+}
+
+Class C extends B {
+ private $APriv = "C.APriv";
+ protected $AProt = "C.AProt";
+ public $APub = "C.APub";
+
+ private $CPriv = "C.CPriv";
+ protected $CProt = "C.BProt";
+ public $CPub = "C.CPub";
+
+ function audit() {
+ return parent::audit() && isset($this->APriv, $this->AProt, $this->APub,
+ $this->BProt, $this->BPub,
+ $this->CPriv, $this->CProt, $this->CPub);
+ }
+}
+
+function prettyPrint($obj) {
+ echo "\n\nBefore serialization:\n";
+ var_dump($obj);
+
+ echo "Serialized form:\n";
+ $ser = serialize($obj);
+ $serPrintable = str_replace("\0", '\0', $ser);
+ var_dump($serPrintable);
+
+ echo "Unserialized:\n";
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+
+ echo "Sanity check: ";
+ var_dump($uobj->audit());
+}
+
+echo "-- Test instance of A --\n";
+prettyPrint(new A);
+echo "\n\n-- Test instance of B --\n";
+prettyPrint(new B);
+echo "\n\n-- Test instance of C --\n";
+prettyPrint(new C);
+
+echo "Done";
+?>
+--EXPECTF--
+-- Test instance of A --
+
+
+Before serialization:
+object(A)#%d (3) {
+ ["APriv":"A":private]=>
+ string(7) "A.APriv"
+ ["AProt":protected]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Serialized form:
+string(98) "O:1:"A":3:{s:8:"\0A\0APriv";s:7:"A.APriv";s:8:"\0*\0AProt";s:7:"A.AProt";s:4:"APub";s:6:"A.APub";}"
+Unserialized:
+object(A)#%d (3) {
+ ["APriv":"A":private]=>
+ string(7) "A.APriv"
+ ["AProt":protected]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Sanity check: bool(true)
+
+
+-- Test instance of B --
+
+
+Before serialization:
+object(B)#%d (6) {
+ ["BPriv":"B":private]=>
+ string(7) "B.BPriv"
+ ["BProt":protected]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv":"A":private]=>
+ string(7) "A.APriv"
+ ["AProt":protected]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Serialized form:
+string(184) "O:1:"B":6:{s:8:"\0B\0BPriv";s:7:"B.BPriv";s:8:"\0*\0BProt";s:7:"B.BProt";s:4:"BPub";s:6:"B.BPub";s:8:"\0A\0APriv";s:7:"A.APriv";s:8:"\0*\0AProt";s:7:"A.AProt";s:4:"APub";s:6:"A.APub";}"
+Unserialized:
+object(B)#%d (6) {
+ ["BPriv":"B":private]=>
+ string(7) "B.BPriv"
+ ["BProt":protected]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv":"A":private]=>
+ string(7) "A.APriv"
+ ["AProt":protected]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Sanity check: bool(true)
+
+
+-- Test instance of C --
+
+
+Before serialization:
+object(C)#%d (10) {
+ ["APriv":"C":private]=>
+ string(7) "C.APriv"
+ ["AProt":protected]=>
+ string(7) "C.AProt"
+ ["APub"]=>
+ string(6) "C.APub"
+ ["CPriv":"C":private]=>
+ string(7) "C.CPriv"
+ ["CProt":protected]=>
+ string(7) "C.BProt"
+ ["CPub"]=>
+ string(6) "C.CPub"
+ ["BPriv":"B":private]=>
+ string(7) "B.BPriv"
+ ["BProt":protected]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv":"A":private]=>
+ string(7) "A.APriv"
+}
+Serialized form:
+string(302) "O:1:"C":10:{s:8:"\0C\0APriv";s:7:"C.APriv";s:8:"\0*\0AProt";s:7:"C.AProt";s:4:"APub";s:6:"C.APub";s:8:"\0C\0CPriv";s:7:"C.CPriv";s:8:"\0*\0CProt";s:7:"C.BProt";s:4:"CPub";s:6:"C.CPub";s:8:"\0B\0BPriv";s:7:"B.BPriv";s:8:"\0*\0BProt";s:7:"B.BProt";s:4:"BPub";s:6:"B.BPub";s:8:"\0A\0APriv";s:7:"A.APriv";}"
+Unserialized:
+object(C)#%d (10) {
+ ["APriv":"C":private]=>
+ string(7) "C.APriv"
+ ["AProt":protected]=>
+ string(7) "C.AProt"
+ ["APub"]=>
+ string(6) "C.APub"
+ ["CPriv":"C":private]=>
+ string(7) "C.CPriv"
+ ["CProt":protected]=>
+ string(7) "C.BProt"
+ ["CPub"]=>
+ string(6) "C.CPub"
+ ["BPriv":"B":private]=>
+ string(7) "B.BPriv"
+ ["BProt":protected]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv":"A":private]=>
+ string(7) "A.APriv"
+}
+Sanity check: bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_012.phpt b/ext/standard/tests/serialize/serialization_objects_012.phpt
new file mode 100644
index 0000000..f994d8e
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_012.phpt
@@ -0,0 +1,244 @@
+--TEST--
+Object serialization / unserialization: real references and COW references
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n\nArray containing same object twice:\n";
+$obj = new stdclass;
+$a[0] = $obj;
+$a[1] = $a[0];
+var_dump($a);
+
+$ser = serialize($a);
+var_dump($ser);
+
+$ua = unserialize($ser);
+var_dump($ua);
+$ua[0]->a = "newProp";
+var_dump($ua);
+$ua[0] = "a0.changed";
+var_dump($ua);
+
+
+echo "\n\nArray containing object and reference to that object:\n";
+$obj = new stdclass;
+$a[0] = $obj;
+$a[1] = &$a[0];
+var_dump($a);
+
+$ser = serialize($a);
+var_dump($ser);
+
+$ua = unserialize($ser);
+var_dump($ua);
+$ua[0]->a = "newProp";
+var_dump($ua);
+$ua[0] = "a0.changed";
+var_dump($ua);
+
+echo "\n\nObject containing same object twice:";
+$obj = new stdclass;
+$contaner = new stdclass;
+$contaner->a = $obj;
+$contaner->b = $contaner->a;
+var_dump($contaner);
+
+$ser = serialize($contaner);
+var_dump($ser);
+
+$ucontainer = unserialize($ser);
+var_dump($ucontainer);
+$ucontainer->a->a = "newProp";
+var_dump($ucontainer);
+$ucontainer->a = "container->a.changed";
+var_dump($ucontainer);
+
+
+echo "\n\nObject containing object and reference to that object:\n";
+$obj = new stdclass;
+$contaner = new stdclass;
+$contaner->a = $obj;
+$contaner->b = &$contaner->a;
+var_dump($contaner);
+
+$ser = serialize($contaner);
+var_dump($ser);
+
+$ucontainer = unserialize($ser);
+var_dump($ucontainer);
+$ucontainer->a->a = "newProp";
+var_dump($ucontainer);
+$ucontainer->b = "container->a.changed";
+var_dump($ucontainer);
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+Array containing same object twice:
+array(2) {
+ [0]=>
+ object(stdClass)#%d (0) {
+ }
+ [1]=>
+ object(stdClass)#%d (0) {
+ }
+}
+string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}"
+array(2) {
+ [0]=>
+ object(stdClass)#%d (0) {
+ }
+ [1]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(2) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ [1]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+array(2) {
+ [0]=>
+ string(10) "a0.changed"
+ [1]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+
+
+Array containing object and reference to that object:
+array(2) {
+ [0]=>
+ &object(stdClass)#%d (0) {
+ }
+ [1]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;R:2;}"
+array(2) {
+ [0]=>
+ &object(stdClass)#%d (0) {
+ }
+ [1]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+array(2) {
+ [0]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ [1]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+array(2) {
+ [0]=>
+ &string(10) "a0.changed"
+ [1]=>
+ &string(10) "a0.changed"
+}
+
+
+Object containing same object twice:object(stdClass)#%d (2) {
+ ["a"]=>
+ object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ object(stdClass)#%d (0) {
+ }
+}
+string(58) "O:8:"stdClass":2:{s:1:"a";O:8:"stdClass":0:{}s:1:"b";r:2;}"
+object(stdClass)#%d (2) {
+ ["a"]=>
+ object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ object(stdClass)#%d (0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ ["b"]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ string(20) "container->a.changed"
+ ["b"]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+
+
+Object containing object and reference to that object:
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+string(58) "O:8:"stdClass":2:{s:1:"a";O:8:"stdClass":0:{}s:1:"b";R:2;}"
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ ["b"]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &string(20) "container->a.changed"
+ ["b"]=>
+ &string(20) "container->a.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_013.phpt b/ext/standard/tests/serialize/serialization_objects_013.phpt
new file mode 100644
index 0000000..01b623c
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_013.phpt
@@ -0,0 +1,494 @@
+--TEST--
+Object serialization / unserialization: references amongst properties
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$obj) {
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
+
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
+}
+
+echo "\n\n--- a refs b:\n";
+$obj = new stdClass;
+$obj->a = &$obj->b;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a refs c:\n";
+$obj = new stdClass;
+$obj->a = &$obj->c;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- b refs a:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$obj->a;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- b refs c:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$obj->c;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- c refs a:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = 1;
+$obj->c = &$obj->a;
+check($obj);
+
+echo "\n\n--- c refs b:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = 1;
+$obj->c = &$obj->b;
+check($obj);
+
+echo "\n\n--- a,b refs c:\n";
+$obj = new stdClass;
+$obj->a = &$obj->c;
+$obj->b = &$obj->c;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,c refs b:\n";
+$obj = new stdClass;
+$obj->a = &$obj->b;
+$obj->b = 1;
+$obj->c = &$obj->b;
+check($obj);
+
+echo "\n\n--- b,c refs a:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$obj->a;
+$obj->c = &$obj->a;
+check($obj);
+
+echo "Done";
+?>
+--EXPECTF--
+
+--- a refs b:
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"b";i:1;s:1:"a";R:2;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a refs c:
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"c";i:1;s:1:"a";R:2;s:1:"b";i:1;}"
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->c.changed"
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+}
+
+
+--- b refs a:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- b refs c:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"c";i:1;s:1:"b";R:3;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["c"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- c refs a:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- c refs b:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";R:3;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- a,b refs c:
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"c";i:1;s:1:"a";R:2;s:1:"b";R:2;}"
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->c.changed"
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- a,c refs b:
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"b";i:1;s:1:"a";R:2;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- b,c refs a:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_014.phpt b/ext/standard/tests/serialize/serialization_objects_014.phpt
new file mode 100644
index 0000000..234f5e0
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_014.phpt
@@ -0,0 +1,295 @@
+--TEST--
+Object serialization / unserialization: references to external values
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$obj) {
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
+
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
+}
+
+echo "\n\n--- a refs external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$ext;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- b refs external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$ext;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- c refs external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = 1;
+$obj->c = &$ext;
+check($obj);
+
+echo "\n\n--- a,b ref external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$ext;
+$obj->b = &$ext;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b,c ref external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$ext;
+$obj->b = &$ext;
+$obj->c = &$ext;
+check($obj);
+
+echo "Done";
+?>
+--EXPECTF--
+
+--- a refs external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- b refs external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- c refs external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b ref external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b,c ref external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_015.phpt b/ext/standard/tests/serialize/serialization_objects_015.phpt
new file mode 100644
index 0000000..2265cab
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_015.phpt
@@ -0,0 +1,336 @@
+--TEST--
+Object serialization / unserialization: properties reference containing object
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+
+function check(&$obj) {
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
+
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
+}
+
+echo "\n\n--- a refs container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$obj;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a eqs container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = $obj;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b ref container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$obj;
+$obj->b = &$obj;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b eq container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = $obj;
+$obj->b = $obj;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b,c ref container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$obj;
+$obj->b = &$obj;
+$obj->c = &$obj;
+check($obj);
+
+echo "\n\n--- a,b,c eq container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = $obj;
+$obj->b = $obj;
+$obj->c = $obj;
+check($obj);
+
+echo "Done";
+?>
+--EXPECTF--
+--- a refs container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a eqs container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b ref container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b eq container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b,c ref container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";R:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- a,b,c eq container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";r:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ *RECURSION*
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+Done
diff --git a/ext/standard/tests/serialize/serialization_precision_001.phpt b/ext/standard/tests/serialize/serialization_precision_001.phpt
new file mode 100644
index 0000000..eb633be
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_precision_001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test serialize_precision (part 1)
+--INI--
+serialize_precision=10
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+var_dump(serialize(0.1));
+?>
+--EXPECTF--
+string(6) "d:0.1;" \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_precision_002.phpt b/ext/standard/tests/serialize/serialization_precision_002.phpt
new file mode 100644
index 0000000..653fabe
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_precision_002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test serialize_precision (part 2)
+--INI--
+serialize_precision=75
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+var_dump(serialize(0.1));
+?>
+--EXPECTF--
+string(60) "d:0.1000000000000000055511151231257827021181583404541015625;" \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_resources_001.phpt b/ext/standard/tests/serialize/serialization_resources_001.phpt
new file mode 100644
index 0000000..dbb7d3d
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_resources_001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test serialize() & unserialize() functions: resources
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n--- Testing Resource ---\n";
+$file_handle = fopen( __FILE__, "r" );
+$serialized_data = serialize( $file_handle );
+fclose($file_handle);
+var_dump($serialized_data);
+var_dump(unserialize($serialized_data));
+
+echo "\nDone";
+?>
+--EXPECTF--
+--- Testing Resource ---
+string(4) "i:%d;"
+int(%d)
+
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/unserializeS.phpt b/ext/standard/tests/serialize/unserializeS.phpt
new file mode 100644
index 0000000..897208b
--- /dev/null
+++ b/ext/standard/tests/serialize/unserializeS.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug MOPB-29 (wrong length calculation for S)
+--INI--
+error_reporting=0
+--FILE--
+<?php
+$str = 'S:'.(100*3).':"'.str_repeat('\61', 100).'"';
+$arr = array(str_repeat('"', 200)."1"=>1,str_repeat('"', 200)."2"=>1);
+
+$data = unserialize($str);
+var_dump($data);
+
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt
new file mode 100644
index 0000000..8ee4363
--- /dev/null
+++ b/ext/standard/tests/streams/bug40459.phpt
@@ -0,0 +1,103 @@
+--TEST--
+bug 40459 - Test whether the constructor of the user-space stream wrapper is called when stream functions are called
+--FILE--
+<?php
+// Test whether the constructor of the user-space stream wrapper is called when stream functions are called
+class testwrapper {
+ private $constructorCalled = false;
+ function __construct() {
+ $this->constructorCalled = true;
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return true;
+ }
+
+ function url_stat($url, $flags)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return array();
+ }
+
+ function unlink($url)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function rename($from, $to)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function mkdir($dir, $mode, $options)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function rmdir($dir, $options)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function dir_opendir($url, $options)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return TRUE;
+ }
+ function stream_metadata()
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return TRUE;
+ }
+}
+
+stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL);
+
+echo 'stream_open: ';
+fopen('test://test', 'r');
+echo "\n";
+
+echo 'url_stat: ';
+stat('test://test');
+echo "\n";
+
+echo 'dir_opendir: ';
+opendir('test://test');
+echo "\n";
+
+echo 'rmdir: ';
+rmdir('test://test');
+echo "\n";
+
+echo 'mkdir: ';
+mkdir('test://test');
+echo "\n";
+
+echo 'rename: ';
+rename('test://test', 'test://test2');
+echo "\n";
+
+echo 'unlink: ';
+unlink('test://test');
+echo "\n";
+
+echo 'touch: ';
+touch('test://test', time());
+echo "\n";
+
+
+
+?>
+==DONE==
+--EXPECT--
+stream_open: yes
+url_stat: yes
+dir_opendir: yes
+rmdir: yes
+mkdir: yes
+rename: yes
+unlink: yes
+touch: yes
+==DONE==
diff --git a/ext/standard/tests/streams/bug44712.phpt b/ext/standard/tests/streams/bug44712.phpt
new file mode 100644
index 0000000..9dfb260
--- /dev/null
+++ b/ext/standard/tests/streams/bug44712.phpt
@@ -0,0 +1,10 @@
+--TEST--
+bug#44712 (stream_context_set_params segfaults on invalid arguments)
+--FILE--
+<?php
+$ctx = stream_context_get_default();
+stream_context_set_params($ctx, array("options" => 1));
+?>
+--EXPECTF--
+Warning: stream_context_set_params(): Invalid stream/context parameter in %sbug44712.php on line %s
+
diff --git a/ext/standard/tests/streams/bug44818.phpt b/ext/standard/tests/streams/bug44818.phpt
new file mode 100644
index 0000000..628f64e
--- /dev/null
+++ b/ext/standard/tests/streams/bug44818.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #44818 (php://memory writeable when opened read only)
+--FILE--
+<?php
+function test($url, $mode) {
+ echo "$url, $mode\n";
+ $fd = fopen($url, $mode);
+ var_dump($fd, fwrite($fd, b"foo"));
+ var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3));
+ fclose($fd);
+}
+test("php://memory","r");
+test("php://memory","r+");
+test("php://temp","r");
+test("php://temp","w");
+?>
+--EXPECTF--
+php://memory, r
+resource(%d) of type (stream)
+int(0)
+int(0)
+string(0) ""
+php://memory, r+
+resource(%d) of type (stream)
+int(3)
+int(0)
+string(3) "foo"
+php://temp, r
+resource(%d) of type (stream)
+int(0)
+int(0)
+string(0) ""
+php://temp, w
+resource(%d) of type (stream)
+int(3)
+int(0)
+string(3) "foo"
diff --git a/ext/standard/tests/streams/bug46024.phpt b/ext/standard/tests/streams/bug46024.phpt
new file mode 100644
index 0000000..fdfd03e
--- /dev/null
+++ b/ext/standard/tests/streams/bug46024.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Bug #46024 stream_select() doesn't return the correct number
+--SKIPIF--
+<?php if (!getenv('TEST_PHP_EXECUTABLE')) die("skip TEST_PHP_EXECUTABLE not defined"); ?>
+--FILE--
+<?php
+$php = realpath(getenv('TEST_PHP_EXECUTABLE'));
+$pipes = array();
+$proc = proc_open(
+ "$php -n -i"
+ ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
+ ,$pipes, dirname(__FILE__), array(), array('binary_pipes' => true)
+);
+var_dump($proc);
+if (!$proc) {
+ exit(1);
+}
+$r = array($pipes[1]);
+$w = array($pipes[0]);
+$e = null;
+$ret = stream_select($r, $w, $e, 1);
+var_dump($ret === (count($r) + count($w)));
+fread($pipes[1], 1);
+
+$r = array($pipes[1]);
+$w = array($pipes[0]);
+$e = null;
+$ret = stream_select($r, $w, $e, 1);
+var_dump($ret === (count($r) + count($w)));
+
+
+foreach($pipes as $pipe) {
+ fclose($pipe);
+}
+proc_terminate($proc);
+if (defined('SIGKILL')) {
+ proc_terminate($proc, SIGKILL);
+} else {
+ proc_terminate($proc);
+}
+proc_close($proc);
+?>
+--EXPECTF--
+resource(%d) of type (process)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt
new file mode 100644
index 0000000..80dbcde
--- /dev/null
+++ b/ext/standard/tests/streams/bug46426.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #46426 (3rd parameter offset of stream_get_contents not works for "0")
+--FILE--
+<?php
+
+$tmp = tmpfile();
+
+fwrite($tmp, b"12345");
+
+echo stream_get_contents($tmp, 2, 1);
+echo "\n";
+echo stream_get_contents($tmp, -1);
+echo "\n";
+echo stream_get_contents($tmp, -1, 0);
+echo "\n";
+echo stream_get_contents($tmp, -1, 2);
+echo "\n";
+echo stream_get_contents($tmp, 0, 0);
+echo "\n";
+echo stream_get_contents($tmp, 1, 0);
+echo "\n";
+echo stream_get_contents($tmp, -1);
+
+@unlink($tmp);
+
+?>
+--EXPECT--
+23
+45
+12345
+345
+
+1
+2345
diff --git a/ext/standard/tests/streams/bug47997.phpt b/ext/standard/tests/streams/bug47997.phpt
new file mode 100644
index 0000000..f13a19d
--- /dev/null
+++ b/ext/standard/tests/streams/bug47997.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #47997 (stream_copy_to_stream returns 1 on empty streams)
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+
+$in = fopen('data://text/plain,', 'rb+');
+$out = fopen('php://memory', 'wb+');
+
+var_dump(stream_copy_to_stream($in, $out));
+
+?>
+--EXPECT--
+int(0)
diff --git a/ext/standard/tests/streams/bug48309.phpt b/ext/standard/tests/streams/bug48309.phpt
new file mode 100644
index 0000000..d347cc3
--- /dev/null
+++ b/ext/standard/tests/streams/bug48309.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #48309 (stream_copy_to_stream() and fpasstru() do not update stream position)
+--FILE--
+<?php
+
+$tmp = tmpfile();
+fwrite($tmp, b'test');
+fseek($tmp, 0, SEEK_SET);
+
+echo "-- stream_copy_to_stream() --\n";
+
+fseek($tmp, 0, SEEK_SET);
+stream_copy_to_stream($tmp, STDOUT, 2);
+
+echo "\n";
+var_dump(stream_get_contents($tmp));
+
+echo "-- fpassthru() --\n";
+
+fseek($tmp, 0, SEEK_SET);
+fpassthru($tmp);
+
+echo "\n";
+var_dump(stream_get_contents($tmp));
+
+?>
+--EXPECTF--
+-- stream_copy_to_stream() --
+te
+string(2) "st"
+-- fpassthru() --
+test
+string(0) ""
diff --git a/ext/standard/tests/streams/bug49936.phpt b/ext/standard/tests/streams/bug49936.phpt
new file mode 100644
index 0000000..d98db1d
--- /dev/null
+++ b/ext/standard/tests/streams/bug49936.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #49936 (crash with ftp stream in php_stream_context_get_option())
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip. Do not run on Windows");
+?>
+--FILE--
+<?php
+
+$dir = 'ftp://your:self@localhost/';
+
+var_dump(@opendir($dir));
+var_dump(@opendir($dir));
+
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/streams/bug49936_win32.phpt b/ext/standard/tests/streams/bug49936_win32.phpt
new file mode 100644
index 0000000..4db4a50
--- /dev/null
+++ b/ext/standard/tests/streams/bug49936_win32.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #49936 (crash with ftp stream in php_stream_context_get_option())
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip. Do run on Windows only");
+?>
+--INI--
+default_socket_timeout=2
+--FILE--
+<?php
+
+$dir = 'ftp://your:self@localhost/';
+
+var_dump(opendir($dir));
+var_dump(opendir($dir));
+
+?>
+--EXPECTF--
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
+
+Warning: opendir(): connect() failed: %s
+ in %s on line %d
+
+Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/streams/bug53427.phpt b/ext/standard/tests/streams/bug53427.phpt
new file mode 100644
index 0000000..9e2e037
--- /dev/null
+++ b/ext/standard/tests/streams/bug53427.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #53427 (stream_select does not preserve keys)
+--FILE--
+<?php
+$read[1] = fopen(__FILE__, "r");
+$read["myindex"] = reset($read);
+$write = NULL;
+$except = NULL;
+
+var_dump($read);
+
+stream_select($read, $write, $except, 0);
+
+var_dump($read);
+--EXPECTF--
+array(2) {
+ [1]=>
+ resource(%d) of type (stream)
+ ["myindex"]=>
+ resource(%d) of type (stream)
+}
+array(2) {
+ [1]=>
+ resource(%d) of type (stream)
+ ["myindex"]=>
+ resource(%d) of type (stream)
+}
diff --git a/ext/standard/tests/streams/bug53903.phpt b/ext/standard/tests/streams/bug53903.phpt
new file mode 100644
index 0000000..3b61635
--- /dev/null
+++ b/ext/standard/tests/streams/bug53903.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #53903 streamwrapper/stream_stat causes problems
+--FILE--
+<?php
+
+class sw {
+
+ public function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+
+ public function stream_stat() {
+ return array(
+ 'atime' => $this->undefined,
+ );
+ }
+
+}
+stream_wrapper_register('sx', 'sw') or die('failed');
+
+fstat(fopen('sx://test', 'r'));
+
+$s[] = 1; // Cannot use a scalar value as an array
+
+print_r($s);
+--EXPECTF--
+Notice: Undefined property: sw::$undefined in %s on line %d
+Array
+(
+ [0] => 1
+)
+
diff --git a/ext/standard/tests/streams/bug54623.phpt b/ext/standard/tests/streams/bug54623.phpt
new file mode 100644
index 0000000..43bcb09
--- /dev/null
+++ b/ext/standard/tests/streams/bug54623.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #54623: Segfault when when writing to a persistent socket after closing a copy of the socket
+--FILE--
+<?php
+$sock = pfsockopen('udp://127.0.0.1', '63844');
+var_dump((int)$sock);
+@fwrite($sock, "1");
+$sock2 = pfsockopen('udp://127.0.0.1', '63844');
+var_dump((int)$sock2);
+@fwrite($sock2, "2");
+fclose($sock2);
+fwrite($sock, "3");
+--EXPECTF--
+int(%d)
+int(%d)
+
+Warning: fwrite(): %d is not a valid stream resource in %s on line %d
diff --git a/ext/standard/tests/streams/bug54946.phpt b/ext/standard/tests/streams/bug54946.phpt
new file mode 100644
index 0000000..b51d593
--- /dev/null
+++ b/ext/standard/tests/streams/bug54946.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug#54946 stream_get_contents infinite loop
+--FILE--
+<?php
+$filename = tempnam(__DIR__, "phpbug");
+$stream = fopen($filename, "w"); // w or a
+$retval = stream_get_contents($stream, 1, 1);
+fclose($stream);
+var_dump($retval);
+unlink($filename);
+
+
+
+$filename = tempnam(__DIR__, "phpbug2");
+
+$stream = fopen($filename, "a");
+$retval = stream_get_contents($stream, 1, 1);
+var_dump($retval);
+fclose($stream);
+unlink($filename);
+
+
+
+$filename = tempnam(__DIR__, "phpbug3");
+
+$stream = fopen($filename, "a");
+fseek($stream, 1);
+$retval = stream_get_contents($stream, 1);
+var_dump($retval);
+fclose($stream);
+unlink($filename);
+?>
+===DONE===
+--EXPECT--
+string(0) ""
+string(0) ""
+string(0) ""
+===DONE===
+
diff --git a/ext/standard/tests/streams/bug60106.phpt b/ext/standard/tests/streams/bug60106.phpt
new file mode 100644
index 0000000..1b36af1
--- /dev/null
+++ b/ext/standard/tests/streams/bug60106.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug#60106 (stream_socket_server silently truncates long unix socket paths)
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip. Do not run on Windows");
+?>
+--FILE--
+<?php
+error_reporting(E_ALL | E_NOTICE);
+$socket_file = "/tmp/" . str_repeat("a", 512);
+function get_truncated_socket_filename($errno, $errmsg, $file, $line) {
+ global $socket_file;
+ print_r ($errmsg);
+ preg_match("#maximum allowed length of (\d+) bytes#", $errmsg, $matches);
+ $socket_file = substr($socket_file, 0, intval($matches[1]) - 1);
+}
+set_error_handler("get_truncated_socket_filename", E_NOTICE);
+stream_socket_server("unix://" . $socket_file);
+unlink($socket_file);
+?>
+--EXPECTF--
+stream_socket_server(): socket path exceeded the maximum allowed length of %d bytes and was truncated
diff --git a/ext/standard/tests/streams/bug60455_01.phpt b/ext/standard/tests/streams/bug60455_01.phpt
new file mode 100644
index 0000000..4669982
--- /dev/null
+++ b/ext/standard/tests/streams/bug60455_01.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60455: stream_get_line and 1-line noeol input
+--FILE--
+<?php
+
+//It's critical the read on the stream returns the input but doesn't set EOF
+//flag the first time. This is why we need to use sockets.
+
+$domain = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? STREAM_PF_INET : STREAM_PF_UNIX);
+$sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)
+ or die("stream_socket_pair");
+fwrite($sockets[0], "a");
+stream_socket_shutdown($sockets[0], STREAM_SHUT_RDWR);
+
+$f = $sockets[1];
+while (!feof($f)) {
+ $line = stream_get_line($f, 99, "\n");
+ var_dump($line);
+}
+--EXPECT--
+string(1) "a"
diff --git a/ext/standard/tests/streams/bug60455_02.phpt b/ext/standard/tests/streams/bug60455_02.phpt
new file mode 100644
index 0000000..0ddf346
--- /dev/null
+++ b/ext/standard/tests/streams/bug60455_02.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #60455: stream_get_line and 1-line followed by eol input
+--FILE--
+<?php
+class TestStream {
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\n";
+
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
+
+}
+
+stream_wrapper_register("test", "TestStream");
+
+$f = fopen("test://", "r");
+while (!feof($f)) {
+ $line = stream_get_line($f, 99, "\n");
+ var_dump($line);
+}
+--EXPECT--
+string(1) "a"
+bool(false)
diff --git a/ext/standard/tests/streams/bug60455_03.phpt b/ext/standard/tests/streams/bug60455_03.phpt
new file mode 100644
index 0000000..2429d31
--- /dev/null
+++ b/ext/standard/tests/streams/bug60455_03.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Bug #60455: stream_get_line and 2 lines, one possibly empty
+--FILE--
+<?php
+class TestStream {
+ private $lines = array();
+ private $s = 0;
+ private $eofth = 3;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ $this->lines[] = "a\n";
+ $this->lines[] = ($path == "test://nonempty2nd" ? "b\n" : "\n");
+ if ($path == "test://eofafter2nd")
+ $this->eofth = 2;
+ return true;
+ }
+ function stream_read($count) {
+ if (key_exists($this->s++, $this->lines))
+ return $this->lines[$this->s - 1];
+
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= $this->eofth;
+ }
+
+}
+
+stream_wrapper_register("test", "TestStream");
+
+$f = fopen("test://nonempty2nd", "r");
+while (!feof($f)) {
+ $line = stream_get_line($f, 99, "\n");
+ var_dump($line);
+}
+$f = fopen("test://", "r");
+while (!feof($f)) {
+ $line = stream_get_line($f, 99, "\n");
+ var_dump($line);
+}
+$f = fopen("test://eofafter2nd", "r");
+while (!feof($f)) {
+ $line = stream_get_line($f, 99, "\n");
+ var_dump($line);
+}
+
+
+--EXPECT--
+string(1) "a"
+string(1) "b"
+bool(false)
+string(1) "a"
+string(0) ""
+bool(false)
+string(1) "a"
+string(0) ""
diff --git a/ext/standard/tests/streams/bug60455_04.phpt b/ext/standard/tests/streams/bug60455_04.phpt
new file mode 100644
index 0000000..3a82298
--- /dev/null
+++ b/ext/standard/tests/streams/bug60455_04.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #60455: stream_get_line and 1-line with maxlen size followed by 0-length
+read with EOL indication
+--FILE--
+<?php
+class TestStream {
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\n";
+
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
+
+}
+
+stream_wrapper_register("test", "TestStream");
+
+$f = fopen("test://", "r");
+while (!feof($f)) {
+ $line = stream_get_line($f, 2, "\n");
+ var_dump($line);
+}
+--EXPECT--
+string(1) "a"
+bool(false)
diff --git a/ext/standard/tests/streams/bug60817.phpt b/ext/standard/tests/streams/bug60817.phpt
new file mode 100644
index 0000000..2d4cf26
--- /dev/null
+++ b/ext/standard/tests/streams/bug60817.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #60817: stream_get_line() reads from stream even when there is already sufficient data buffered
+--FILE--
+<?php
+class TestStream { //data, empty data, empty data + eof
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ echo "Read done\n";
+ if ($this->s++ == 0)
+ return "a\nbb\ncc";
+
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
+
+}
+
+stream_wrapper_register("test", "TestStream");
+
+$f = fopen("test://", "r");
+while (!feof($f)) {
+ $line = stream_get_line($f, 99, "\n");
+ var_dump($line);
+}
+
+--EXPECT--
+Read done
+string(1) "a"
+string(2) "bb"
+Read done
+string(2) "cc"
diff --git a/ext/standard/tests/streams/bug61115-1.phpt b/ext/standard/tests/streams/bug61115-1.phpt
new file mode 100644
index 0000000..99e2f79
--- /dev/null
+++ b/ext/standard/tests/streams/bug61115-1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #61115: Stream related segfault on fatal error in php_stream_context_del_link - variation 1
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
+?>
+--FILE--
+<?php
+
+$fileResourceTemp = fopen('php://temp', 'wr');
+stream_context_get_options($fileResourceTemp);
+ftruncate($fileResourceTemp, PHP_INT_MAX);
+?>
+--EXPECTF--
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/streams/bug61115-2.phpt b/ext/standard/tests/streams/bug61115-2.phpt
new file mode 100644
index 0000000..260b836
--- /dev/null
+++ b/ext/standard/tests/streams/bug61115-2.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #61115: Stream related segfault on fatal error in php_stream_context_del_link - variation 2
+--FILE--
+<?php
+stream_socket_client('abc', $var, $var, 0, STREAM_CLIENT_PERSISTENT);
+
+?>
+==DONE==
+--EXPECT--
+==DONE==
diff --git a/ext/standard/tests/streams/bug61115.phpt b/ext/standard/tests/streams/bug61115.phpt
new file mode 100644
index 0000000..29dc7c1
--- /dev/null
+++ b/ext/standard/tests/streams/bug61115.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #61115: Stream related segfault on fatal error in php_stream_context_del_link.
+--FILE--
+<?php
+
+$arrayLarge = array_fill(0, 113663, '*');
+
+$resourceFileTemp = fopen('php://temp', 'r+');
+stream_context_set_params($resourceFileTemp, array());
+preg_replace('', function() {}, $resourceFileTemp);
+?>
+--EXPECTF--
+Catchable fatal error: Object of class Closure could not be converted to string in %s on line %d
diff --git a/ext/standard/tests/streams/bug61371-win.phpt b/ext/standard/tests/streams/bug61371-win.phpt
new file mode 100644
index 0000000..dc70530
--- /dev/null
+++ b/ext/standard/tests/streams/bug61371-win.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #61371: stream_context_create() causes memory leaks on use streams_socket_create
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+}
+--FILE--
+<?php
+function test($doFclose) {
+$previous = null;
+$current = null;
+for($test=1;$test<=3;$test++) {
+ $current = memory_get_usage(true);
+ if (!is_null($previous)) {
+ var_dump($previous == $current);
+ }
+ $previous = $current;
+ echo 'memory: '.round($current / 1024, 0)."kb\n";
+ for($i=0;$i<=100;$i++) {
+ $context = stream_context_create(array());
+ $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
+ if ($doFclose) fclose($stream);
+ unset($context);
+ unset($stream);
+ unset($errno);
+ unset($errstr);
+ }
+}
+}
+
+test(true);
+test(false);
+?>
+--EXPECTF--
+memory: %dkb
+bool(true)
+memory: %dkb
+bool(true)
+memory: %dkb
+memory: %dkb
+bool(true)
+memory: %dkb
+bool(true)
+memory: %dkb
diff --git a/ext/standard/tests/streams/bug61371.phpt b/ext/standard/tests/streams/bug61371.phpt
new file mode 100644
index 0000000..7c64d1d
--- /dev/null
+++ b/ext/standard/tests/streams/bug61371.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #61371: stream_context_create() causes memory leaks on use streams_socket_create
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die('skip non windows test');
+}
+--FILE--
+<?php
+function test($doFclose) {
+$previous = null;
+$current = null;
+for($test=1;$test<=3;$test++) {
+ $current = memory_get_usage(true);
+ if (!is_null($previous)) {
+ var_dump($previous == $current);
+ }
+ $previous = $current;
+ echo 'memory: '.round($current / 1024, 0)."kb\n";
+ for($i=0;$i<=100;$i++) {
+ $context = stream_context_create(array());
+ $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
+ if ($doFclose) fclose($stream);
+ unset($context);
+ unset($stream);
+ unset($errno);
+ unset($errstr);
+ }
+}
+}
+
+test(true);
+test(false);
+?>
+--EXPECTF--
+memory: %dkb
+bool(true)
+memory: %dkb
+bool(true)
+memory: %dkb
+memory: %dkb
+bool(true)
+memory: %dkb
+bool(true)
+memory: %dkb
diff --git a/ext/standard/tests/streams/bug63240.phpt b/ext/standard/tests/streams/bug63240.phpt
new file mode 100644
index 0000000..7612c43
--- /dev/null
+++ b/ext/standard/tests/streams/bug63240.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #63240: stream_get_line() return contains delimiter string
+--FILE--
+<?php
+$fd = fopen('php://temp', 'r+');
+$delimiter = 'MM';
+$str = str_repeat('.', 8191) . $delimiter . "rest";
+fwrite($fd, $str);
+rewind($fd);
+$line = stream_get_line($fd, 9000, $delimiter);
+var_dump(strlen($line));
+$line = stream_get_line($fd, 9000, $delimiter);
+var_dump($line);
+?>
+--EXPECT--
+int(8191)
+string(4) "rest"
diff --git a/ext/standard/tests/streams/stream_context_get_params_001.phpt b/ext/standard/tests/streams/stream_context_get_params_001.phpt
new file mode 100644
index 0000000..d946184
--- /dev/null
+++ b/ext/standard/tests/streams/stream_context_get_params_001.phpt
@@ -0,0 +1,121 @@
+--TEST--
+stream_context_get_params()
+--FILE--
+<?php
+
+$ctx = stream_context_create();
+var_dump($ctx);
+var_dump(stream_context_get_params($ctx));
+
+var_dump(stream_context_set_option($ctx, "foo","bar","baz"));
+var_dump(stream_context_get_params($ctx));
+
+var_dump(stream_context_set_params($ctx, array("notification" => "stream_notification_callback")));
+var_dump(stream_context_get_params($ctx));
+
+var_dump(stream_context_set_params($ctx, array("notification" => array("stream","notification_callback"))));
+var_dump(stream_context_get_params($ctx));
+
+var_dump(stream_context_get_params($ctx));
+var_dump(stream_context_get_options($ctx));
+var_dump(stream_context_get_params($ctx));
+var_dump(stream_context_get_options($ctx));
+
+?>
+--EXPECTF--
+resource(%d) of type (stream-context)
+array(1) {
+ [%u|b%"options"]=>
+ array(0) {
+ }
+}
+bool(true)
+array(1) {
+ [%u|b%"options"]=>
+ array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+ }
+}
+bool(true)
+array(2) {
+ [%u|b%"notification"]=>
+ %unicode|string%(28) "stream_notification_callback"
+ [%u|b%"options"]=>
+ array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+ }
+}
+bool(true)
+array(2) {
+ [%u|b%"notification"]=>
+ array(2) {
+ [0]=>
+ %unicode|string%(6) "stream"
+ [1]=>
+ %unicode|string%(21) "notification_callback"
+ }
+ [%u|b%"options"]=>
+ array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+ }
+}
+array(2) {
+ [%u|b%"notification"]=>
+ array(2) {
+ [0]=>
+ %unicode|string%(6) "stream"
+ [1]=>
+ %unicode|string%(21) "notification_callback"
+ }
+ [%u|b%"options"]=>
+ array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+ }
+}
+array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+}
+array(2) {
+ [%u|b%"notification"]=>
+ array(2) {
+ [0]=>
+ %unicode|string%(6) "stream"
+ [1]=>
+ %unicode|string%(21) "notification_callback"
+ }
+ [%u|b%"options"]=>
+ array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+ }
+}
+array(1) {
+ [%u|b%"foo"]=>
+ array(1) {
+ [%u|b%"bar"]=>
+ %unicode|string%(3) "baz"
+ }
+}
diff --git a/ext/standard/tests/streams/stream_context_set_option_basic.phpt b/ext/standard/tests/streams/stream_context_set_option_basic.phpt
new file mode 100644
index 0000000..63730ee
--- /dev/null
+++ b/ext/standard/tests/streams/stream_context_set_option_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+stream_context_set_option() function - basic test for stream_context_set_option()
+--CREDITS--
+Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr>
+# Alter Way Contribution Day 2011
+--FILE--
+<?php
+$context = stream_context_create();
+
+// Single option
+var_dump(stream_context_set_option($context, 'http', 'method', 'POST'));
+
+// Array of options
+$options = array(
+ 'http' => array(
+ 'protocol_version' => 1.1,
+ 'user_agent' => 'PHPT Agent',
+ ),
+);
+var_dump(stream_context_set_option($context, $options));
+
+var_dump(stream_context_get_options($context));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+array(1) {
+ ["http"]=>
+ array(3) {
+ ["method"]=>
+ string(4) "POST"
+ ["protocol_version"]=>
+ float(1.1)
+ ["user_agent"]=>
+ string(10) "PHPT Agent"
+ }
+}
diff --git a/ext/standard/tests/streams/stream_context_set_option_error_001.phpt b/ext/standard/tests/streams/stream_context_set_option_error_001.phpt
new file mode 100644
index 0000000..04b37ca
--- /dev/null
+++ b/ext/standard/tests/streams/stream_context_set_option_error_001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+stream_context_set_option() function - error : invalid argument
+--CREDITS--
+Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr>
+# Alter Way Contribution Day 2011
+--FILE--
+<?php
+$context = stream_context_create();
+
+// Single option
+var_dump(stream_context_set_option($context, 'http'));
+
+// Array of options
+var_dump(stream_context_set_option($context, array(), 'foo', 'bar'));
+?>
+--EXPECTF--
+Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d
+bool(false)
+
+Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/streams/stream_context_set_option_error_002.phpt b/ext/standard/tests/streams/stream_context_set_option_error_002.phpt
new file mode 100644
index 0000000..e80fd39
--- /dev/null
+++ b/ext/standard/tests/streams/stream_context_set_option_error_002.phpt
@@ -0,0 +1,18 @@
+--TEST--
+stream_context_set_option() function - error : missing argument
+--CREDITS--
+Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr>
+# Alter Way Contribution Day 2011
+--FILE--
+<?php
+var_dump(stream_context_set_option());
+
+$context = stream_context_create();
+var_dump(stream_context_set_option($context));
+?>
+--EXPECTF--
+Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d
+bool(false)
+
+Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt b/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt
new file mode 100644
index 0000000..7e304b1
--- /dev/null
+++ b/ext/standard/tests/streams/stream_copy_to_stream_socket.phpt
@@ -0,0 +1,30 @@
+--TEST--
+stream_copy_to_stream() with socket as $source
+--SKIPIF--
+<?php
+$sockets = @stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
+if (!$sockets) die("skip stream_socket_pair");
+?>
+--FILE--
+<?php
+
+$sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
+$tmp = tmpfile();
+
+fwrite($sockets[0], b"a");
+stream_socket_shutdown($sockets[0], STREAM_SHUT_WR);
+stream_copy_to_stream($sockets[1], $tmp);
+
+fseek($tmp, 0, SEEK_SET);
+var_dump(stream_get_contents($tmp));
+
+stream_copy_to_stream($sockets[1], $tmp);
+
+fseek($tmp, 0, SEEK_SET);
+var_dump(stream_get_contents($tmp));
+
+
+?>
+--EXPECT--
+string(1) "a"
+string(1) "a"
diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt
new file mode 100644
index 0000000..e8e1c3d
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_contents_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+stream_get_contents() - Testing offset out of range
+--FILE--
+<?php
+
+$tmp = tmpfile();
+
+fwrite($tmp, b"12345");
+
+echo stream_get_contents($tmp, 2, 5), "--\n";
+echo stream_get_contents($tmp, 2), "--\n";
+echo stream_get_contents($tmp, 2, 3), "--\n";
+echo stream_get_contents($tmp, 2, -1), "--\n";
+
+@unlink($tmp);
+
+?>
+--EXPECT--
+--
+--
+45--
+--
diff --git a/ext/standard/tests/streams/stream_get_contents_002.phpt b/ext/standard/tests/streams/stream_get_contents_002.phpt
new file mode 100644
index 0000000..66ff3fb
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_contents_002.phpt
@@ -0,0 +1,18 @@
+--TEST--
+stream_get_contents() - Testing on socket with $maxlength
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip: non windows test");
+?>
+--FILE--
+<?php
+$sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
+
+stream_set_timeout($sockets[1], 6000);
+
+fwrite($sockets[0], b"foo");
+var_dump(stream_get_contents($sockets[1], 3));
+
+?>
+--EXPECT--
+string(3) "foo"
diff --git a/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
new file mode 100644
index 0000000..32756d7
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #60455: stream_get_line and \0 as a delimiter
+--FILE--
+<?php
+class TestStream {
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\0";
+
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
+
+}
+
+stream_wrapper_register("test", "TestStream");
+
+$f = fopen("test://", "r");
+var_dump(stream_get_line($f, 100, "\0"));
+--EXPECT--
+string(1) "a"
diff --git a/ext/standard/tests/streams/stream_get_line_nb.phpt b/ext/standard/tests/streams/stream_get_line_nb.phpt
new file mode 100644
index 0000000..ce98120
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_line_nb.phpt
@@ -0,0 +1,66 @@
+--TEST--
+stream_get_line() on non-blocking stream
+--SKIPIF--
+<?php
+$sockets = @stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
+if (!$sockets) die("skip stream_socket_pair() should work");
+fclose($sockets[0]);
+fclose($sockets[1]);
+?>
+--FILE--
+<?php
+/**
+ * Tests that stream_get_line() behaves as documented on non-blocking streams:
+ * Never return incomplete lines, except on documented conditions:
+ * length bytes have been read, the string specified by ending is found, EOF.
+ */
+
+$sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
+var_dump($sockets);
+
+stream_set_blocking($sockets[1], 0);
+
+$eol = b'<EOL>';
+
+fwrite($sockets[0], b"line start");
+var_dump(stream_get_line($sockets[1], 8192, $eol)); // Does not returns incomplete line (EOL not found)
+var_dump(stream_get_line($sockets[1], 8192, $eol));
+fwrite($sockets[0], b", line end");
+fwrite($sockets[0], b", $eol");
+var_dump(stream_get_line($sockets[1], 8192, $eol)); // Returns full line (EOL found)
+var_dump(stream_get_line($sockets[1], 8192, $eol)); // Nothing to read
+var_dump(stream_get_line($sockets[1], 8192, $eol));
+
+fwrite($sockets[0], b"incomplete line");
+var_dump(stream_get_line($sockets[1], strlen(b"incomplete line"), $eol)); // EOL not found but $length has been read, return incomplete line
+
+fwrite($sockets[0], b"incomplete line");
+var_dump(stream_get_line($sockets[1], 8192, $eol)); // Does not returns incomplete line (EOL not found)
+var_dump(fread($sockets[1], strlen(b"incomplete line"))); // Returns buffer readden by stream_get_line
+
+fwrite($sockets[0], b"end of file");
+var_dump(stream_get_line($sockets[1], 8192, $eol)); // Does not returns incomplete line (EOL not found)
+
+fclose($sockets[0]);
+var_dump(stream_get_line($sockets[1], 8192, $eol)); // Returns incomplete line (End of file)
+
+fclose($sockets[1]);
+
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+}
+bool(false)
+bool(false)
+string(22) "line start, line end, "
+bool(false)
+bool(false)
+string(15) "incomplete line"
+bool(false)
+string(15) "incomplete line"
+bool(false)
+string(11) "end of file"
diff --git a/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt
new file mode 100644
index 0000000..f46c8fd
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+stream_get_meta_data() on directories
+--FILE--
+<?php
+
+$dir = opendir(dirname(__FILE__));
+var_dump(stream_get_meta_data($dir));
+closedir($dir);
+
+$dirObject = dir(dirname(__FILE__));
+var_dump(stream_get_meta_data($dirObject->handle));
+
+?>
+--EXPECT--
+array(8) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(3) "dir"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(8) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(3) "dir"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt
new file mode 100644
index 0000000..4758c75
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+stream_get_meta_data() basic functionality
+--FILE--
+<?php
+
+$fp = fopen(__FILE__, "r");
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+?>
+--EXPECTF--
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%sstream_get_meta_data_file_basic.php"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
new file mode 100644
index 0000000..390694a
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test stream_get_meta_data() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array stream_get_meta_data(resource fp)
+ * Description: Retrieves header/meta data from streams/file pointers
+ * Source code: ext/standard/streamsfuncs.c
+ * Alias to functions: socket_get_status
+ */
+
+echo "*** Testing stream_get_meta_data() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
+var_dump( stream_get_meta_data() );
+
+//Test stream_get_meta_data with one more than the expected number of arguments
+echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
+
+$fp = null;
+$extra_arg = 10;
+var_dump( stream_get_meta_data($fp, $extra_arg) );
+
+echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
+$fp = null;
+var_dump(stream_get_meta_data($fp));
+
+echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
+$fp = fopen(__FILE__, 'r');
+fclose($fp);
+var_dump(stream_get_meta_data($fp));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing stream_get_meta_data() : error conditions ***
+
+-- Testing stream_get_meta_data() function with Zero arguments --
+
+Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %i
+NULL
+
+-- Testing stream_get_meta_data() function with more than expected no. of arguments --
+
+Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %i
+NULL
+
+-- Testing stream_get_meta_data() function with invalid stream resource --
+
+Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %i
+NULL
+
+-- Testing stream_get_meta_data() function with closed stream resource --
+
+Warning: stream_get_meta_data(): %i is not a valid stream resource in %s on line %i
+bool(false)
+Done
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
new file mode 100644
index 0000000..572653e
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
@@ -0,0 +1,510 @@
+--TEST--
+stream_get_meta_data() with differing file access modes
+--FILE--
+<?php
+
+// array of all file access modes
+$filemodes = array('r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+',
+ 'rb', 'rb+', 'wb', 'wb+', 'ab', 'ab+', 'xb', 'xb+',
+ 'rt', 'rt+', 'wt', 'wt+', 'at', 'at+', 'xt', 'xt+');
+
+//create a file
+$filename = __FILE__ . '.tmp';
+$fp = fopen($filename, 'w+');
+fclose($fp);
+
+// open file in each access mode and get meta data
+foreach ($filemodes as $mode) {
+ if (strncmp($mode, 'x', 1) == 0) {
+ // x modes require that file does not exist
+ unlink($filename);
+ }
+ $fp = fopen($filename, $mode);
+ var_dump(stream_get_meta_data($fp));
+ fclose($fp);
+}
+
+unlink($filename);
+
+?>
+--EXPECTF--
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "w"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "a"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "a+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "x"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "x+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "rb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "rb+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "wb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "wb+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "ab"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "ab+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "xb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "xb+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "rt"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "rt+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "wt"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "wt+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "at"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "at+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "xt"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "xt+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
new file mode 100644
index 0000000..d186cb7
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Testing stream_get_meta_data() "unread_bytes" field
+--FILE--
+<?php
+
+$filename = __FILE__ . '.tmp';
+
+$fp = fopen($filename, "w+");
+
+echo "Write some data to the file:\n";
+$i = 0;
+while ($i++ < 20) {
+ fwrite($fp, "a line of data\n");
+}
+
+var_dump(stream_get_meta_data($fp));
+
+//seek to start of file
+rewind($fp);
+
+echo "\n\nRead a line of the file, causing data to be buffered:\n";
+var_dump(fgets($fp));
+
+var_dump(stream_get_meta_data($fp));
+
+echo "\n\nRead 20 bytes from the file:\n";
+fread($fp, 20);
+
+var_dump(stream_get_meta_data($fp));
+
+echo "\n\nRead entire file:\n";
+while(!feof($fp)) {
+ fread($fp, 1);
+}
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+unlink($filename);
+
+?>
+--EXPECTF--
+Write some data to the file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read a line of the file, causing data to be buffered:
+string(15) "a line of data
+"
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(285)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read 20 bytes from the file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(265)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read entire file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt
new file mode 100644
index 0000000..c51d9bd
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt
@@ -0,0 +1,71 @@
+--TEST--
+stream_get_meta_data() with a relative file path
+--FILE--
+<?php
+
+echo "Create a file:\n";
+$filename = __FILE__ . '.tmp';
+$fp = fopen('File://' . $filename, 'w+');
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+echo "\nChange to file's directory and open with a relative path:\n";
+
+$dirname = dirname($filename);
+chdir($dirname);
+$relative_filename = basename($filename);
+
+$fp = fopen($relative_filename, 'r');
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+unlink($filename);
+
+?>
+--EXPECTF--
+Create a file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+Change to file's directory and open with a relative path:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "stream_get_meta_data_file_variation4.php.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
new file mode 100644
index 0000000..386b92f
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
@@ -0,0 +1,77 @@
+--TEST--
+testing stream_get_meta_data() "eof" field for a file stream
+--FILE--
+<?php
+
+$filename = __FILE__ . '.tmp';
+
+$fp = fopen($filename, "w+");
+
+echo "Write some data to the file:\n";
+$i = 0;
+while ($i++ < 20) {
+ fwrite($fp, "a line of data\n");
+}
+
+var_dump(stream_get_meta_data($fp));
+
+//seek to start of file
+rewind($fp);
+
+echo "\n\nRead entire file:\n";
+while(!feof($fp)) {
+ fread($fp, 1);
+}
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+unlink($filename);
+
+?>
+--EXPECTF--
+Write some data to the file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read entire file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt
new file mode 100644
index 0000000..3f4dfbc
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Testing stream_get_meta_data() on a process stream.
+--FILE--
+<?php
+
+$output_file = __FILE__.'.tmp';
+$cmd = "echo here is some output";
+$mode = 'rb';
+$handle = popen($cmd, $mode);
+$data = fread($handle, 100);
+
+var_dump(stream_get_meta_data($handle));
+
+pclose($handle);
+
+echo "Done";
+
+?>
+--EXPECT--
+array(7) {
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "rb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+Done
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt
new file mode 100644
index 0000000..8605611
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+stream_get_meta_data() on a udp socket
+--FILE--
+<?php
+
+$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
+var_dump(stream_get_meta_data($tcp_socket));
+fclose($tcp_socket);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
new file mode 100644
index 0000000..16b38d9
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Testing stream_get_meta_data() "unread_bytes" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+if (!$client) {
+ die("Unable to create socket");
+}
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+echo "Write some data:\n";
+fwrite($socket, "abcdefg\n1234567\nxyzxyz\n");
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead a line from the client, causing data to be buffered:\n";
+fgets($client);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead 3 bytes of data from the client:\n";
+fread($client, 3);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nClose the server side socket and read the remaining data from the client:\n";
+fclose($socket);
+fclose($server);
+while(!feof($client)) {
+ fread($client, 1);
+}
+var_dump(stream_get_meta_data($client));
+
+?>
+--EXPECTF--
+Write some data:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read a line from the client, causing data to be buffered:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(15)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read 3 bytes of data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(12)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Close the server side socket and read the remaining data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
new file mode 100644
index 0000000..d30fec7
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
@@ -0,0 +1,111 @@
+--TEST--
+Testing stream_get_meta_data() "timed_out" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+if (!$client) {
+ die("Unable to create socket");
+}
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nSet a timeout on the client and attempt a read:\n";
+socket_set_timeout($client, 0, 1000);
+fread($client, 1);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nWrite some data from the server:\n";
+fwrite($socket, "12345");
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead some data from the client:\n";
+fread($client, 5);
+var_dump(stream_get_meta_data($client));
+
+fclose($client);
+fclose($socket);
+fclose($server);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Set a timeout on the client and attempt a read:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(true)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Write some data from the server:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(true)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read some data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
new file mode 100644
index 0000000..0b079cc
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Testing stream_get_meta_data() "blocked" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+if (!$client) {
+ die("Unable to create socket");
+}
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nSet blocking to false:\n";
+var_dump(socket_set_blocking($client, 0));
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nSet blocking to true:\n";
+var_dump(socket_set_blocking($client, 1));
+var_dump(stream_get_meta_data($client));
+
+fclose($client);
+fclose($socket);
+fclose($server);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Set blocking to false:
+bool(true)
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(false)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Set blocking to true:
+bool(true)
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
new file mode 100644
index 0000000..f9ef747
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Testing stream_get_meta_data() "eof" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+if (!$client) {
+ die("Unable to create socket");
+}
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+echo "Write some data:\n";
+fwrite($socket, "abcdefg\n1234567\nxyzxyz\n");
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead a line from the client:\n";
+fgets($client);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nClose the server side socket and read the remaining data from the client:\n";
+fclose($socket);
+fclose($server);
+while(!feof($client)) {
+ fread($client, 1);
+}
+var_dump(stream_get_meta_data($client));
+
+fclose($client);
+
+?>
+--EXPECTF--
+Write some data:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(%i)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read a line from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(%i)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Close the server side socket and read the remaining data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(%i)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_is_local.phpt b/ext/standard/tests/streams/stream_is_local.phpt
new file mode 100644
index 0000000..c90eb19
--- /dev/null
+++ b/ext/standard/tests/streams/stream_is_local.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Testing stream_is_local()
+--FILE--
+<?php
+
+$a = 1;
+$b = $a;
+var_dump(stream_is_local($b));
+var_dump($b);
+
+var_dump(stream_is_local(fopen(__FILE__, 'r')));
+
+?>
+--EXPECT--
+bool(true)
+int(1)
+bool(true)
diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt
new file mode 100644
index 0000000..aea5cdd
--- /dev/null
+++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt
@@ -0,0 +1,37 @@
+--TEST--
+stream_resolve_include_path(string path)
+--FILE--
+<?php
+$include_path = __DIR__ . '/test_path';
+$include_path_nested = $include_path . '/nested';
+
+$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file';
+$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file';
+
+mkdir($include_path);
+mkdir($include_path_nested);
+
+file_put_contents($include_path_file, 'include_path');
+file_put_contents($include_path_nested_file, 'include_path');
+
+var_dump(stream_resolve_include_path());
+
+set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
+var_dump(stream_resolve_include_path('file-does-not-exist'));
+
+set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
+var_dump(stream_resolve_include_path('file'));
+set_include_path($include_path_nested . PATH_SEPARATOR . $include_path);
+var_dump(stream_resolve_include_path('file'));
+
+unlink($include_path_nested_file);
+rmdir($include_path_nested);
+unlink($include_path_file);
+rmdir($include_path);
+--EXPECTF--
+Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+string(%d) "%stest_path%sfile"
+string(%d) "%stest_path%snested%sfile"
+
diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt
new file mode 100644
index 0000000..193bc1a
--- /dev/null
+++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt
@@ -0,0 +1,93 @@
+--TEST--
+stream_set_chunk_size basic tests
+--FILE--
+<?php
+class test_wrapper {
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+ function stream_read($count) {
+ echo "read with size: ", $count, "\n";
+ return str_repeat('a', $count);
+ }
+ function stream_write($data) {
+ echo "write with size: ", strlen($data), "\n";
+ return strlen($data);
+ }
+ function stream_set_option($option, $arg1, $arg2) {
+ echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
+ return false;
+ }
+}
+
+var_dump(stream_wrapper_register('test', 'test_wrapper'));
+
+$f = fopen("test://foo","r");
+
+/* when the chunk size is 1, the read buffer is skipped, but the
+ * the writes are made in chunks of size 1 (business as usual)
+ * This should probably be revisited */
+echo "should return previous chunk size (8192)\n";
+var_dump(stream_set_chunk_size($f, 1));
+echo "should be read without buffer (\$count == 10000)\n";
+var_dump(strlen(fread($f, 10000)));
+echo "should elicit 3 writes of size 1 and return 3\n";
+var_dump(fwrite($f, str_repeat('b', 3)));
+
+echo "should return previous chunk size (1)\n";
+var_dump(stream_set_chunk_size($f, 100));
+echo "should elicit one read of size 100 (chunk size)\n";
+var_dump(strlen(fread($f, 250)));
+echo "should elicit one read of size 100 (chunk size)\n";
+var_dump(strlen(fread($f, 50)));
+echo "should elicit no read because there is sufficient cached data\n";
+var_dump(strlen(fread($f, 50)));
+echo "should elicit 2 writes of size 100 and one of size 50\n";
+var_dump(strlen(fwrite($f, str_repeat('b', 250))));
+
+echo "\nerror conditions\n";
+var_dump(stream_set_chunk_size($f, 0));
+var_dump(stream_set_chunk_size($f, -1));
+var_dump(stream_set_chunk_size($f, array()));
+
+--EXPECTF--
+bool(true)
+should return previous chunk size (8192)
+int(8192)
+should be read without buffer ($count == 10000)
+read with size: 10000
+int(10000)
+should elicit 3 writes of size 1 and return 3
+write with size: 1
+write with size: 1
+write with size: 1
+int(3)
+should return previous chunk size (1)
+int(1)
+should elicit one read of size 100 (chunk size)
+read with size: 100
+int(100)
+should elicit one read of size 100 (chunk size)
+read with size: 100
+int(50)
+should elicit no read because there is sufficient cached data
+int(50)
+should elicit 2 writes of size 100 and one of size 50
+write with size: 100
+write with size: 100
+write with size: 50
+int(3)
+
+error conditions
+
+Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given 0 in %s on line %d
+bool(false)
+
+Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d
+bool(false)
+
+Warning: stream_set_chunk_size() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt
new file mode 100644
index 0000000..c1d4d14
--- /dev/null
+++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test stream_set_timeout() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto bool stream_set_timeout(resource stream, int seconds, int microseconds)
+ * Description: Set timeout on stream read to seconds + microseonds
+ * Source code: ext/standard/streamsfuncs.c
+ * Alias to functions: socket_set_timeout
+ */
+
+echo "*** Testing stream_set_timeout() : error conditions ***\n";
+
+//Test stream_set_timeout with one more than the expected number of arguments
+echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n";
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+$seconds = 10;
+$microseconds = 10;
+$extra_arg = 10;
+var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) );
+
+// Testing stream_set_timeout with one less than the expected number of arguments
+echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n";
+
+$seconds = 10;
+var_dump( stream_set_timeout($client) );
+
+
+echo "\n-- Testing stream_set_timeout() function with a closed socket --\n";
+fclose($client);
+var_dump( stream_set_timeout($client, $seconds) );
+
+echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n";
+var_dump( stream_set_timeout($seconds, $seconds) );
+
+echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n";
+$filestream = fopen(__FILE__, "r");
+var_dump( stream_set_timeout($filestream, $seconds) );
+
+fclose($filestream);
+fclose($server);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing stream_set_timeout() : error conditions ***
+
+-- Testing stream_set_timeout() function with more than expected no. of arguments --
+
+Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %i
+NULL
+
+-- Testing stream_set_timeout() function with less than expected no. of arguments --
+
+Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %i
+NULL
+
+-- Testing stream_set_timeout() function with a closed socket --
+
+Warning: stream_set_timeout(): %i is not a valid stream resource in %s on line %i
+bool(false)
+
+-- Testing stream_set_timeout() function with an invalid stream --
+
+Warning: stream_set_timeout() expects parameter 1 to be resource, integer given in %s on line %i
+NULL
+
+-- Testing stream_set_timeout() function with a stream that does not support timeouts --
+bool(false)
+Done
diff --git a/ext/standard/tests/streams/stream_socket_pair.phpt b/ext/standard/tests/streams/stream_socket_pair.phpt
new file mode 100644
index 0000000..203ae98
--- /dev/null
+++ b/ext/standard/tests/streams/stream_socket_pair.phpt
@@ -0,0 +1,19 @@
+--TEST--
+stream_socket_pair()
+--FILE--
+<?php
+$domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX);
+$sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0);
+var_dump($sockets);
+fwrite($sockets[0], b"foo");
+var_dump(fread($sockets[1], strlen(b"foo")));
+fclose($sockets[0]);
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+}
+string(3) "foo"
diff --git a/ext/standard/tests/strings/004.phpt b/ext/standard/tests/strings/004.phpt
new file mode 100644
index 0000000..b9904c6
--- /dev/null
+++ b/ext/standard/tests/strings/004.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Testing randomization of shuffle() and str_shuffle().
+--FILE--
+<?php
+function stats($f, $a) {
+ $times = 90000;
+ print "$f\n";
+ ksort($a);
+ foreach($a as $k => $v)
+ print "$k: $v: " . sprintf('%0.3f', $v / $times) . "\n";
+}
+$a = array();
+$times = 90000;
+for ($i = 0; $i < $times; $i++) {
+ $p = range(1,4);
+ shuffle($p);
+ $s = join('', $p);
+ if (empty($a[$s])) $a[$s] = 0;
+ $a[$s]++;
+}
+
+stats('shuffle', $a);
+$a = array();
+$times = 90000;
+for ($i = 0; $i < $times; $i++) {
+ $p = '1234';
+ $s = str_shuffle($p);
+ if (empty($a[$s])) $a[$s] = 0;
+ $a[$s]++;
+}
+
+stats('str_shuffle', $a);
+?>
+--EXPECTREGEX--
+shuffle
+1234: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1243: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1324: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1342: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1423: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1432: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2134: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2143: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2314: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2341: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2413: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2431: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3124: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3142: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3214: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3241: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3412: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3421: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4123: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4132: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4213: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4231: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4312: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4321: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+str_shuffle
+1234: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1243: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1324: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1342: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1423: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+1432: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2134: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2143: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2314: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2341: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2413: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+2431: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3124: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3142: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3214: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3241: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3412: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+3421: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4123: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4132: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4213: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4231: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4312: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
+4321: 3[0-9][0-9][0-9]: 0.0[3-4][0-9]
diff --git a/ext/standard/tests/strings/005.phpt b/ext/standard/tests/strings/005.phpt
new file mode 100644
index 0000000..a69ff49
--- /dev/null
+++ b/ext/standard/tests/strings/005.phpt
@@ -0,0 +1,24 @@
+--TEST--
+highlight_string(), output buffer and error level
+--INI--
+error_reporting=8192
+--FILE--
+<?php
+
+echo "hello\n";
+
+$string = str_repeat("A", 1024);
+
+var_dump(error_reporting());
+highlight_string($string, true);
+var_dump(ob_get_contents());
+var_dump(error_reporting());
+
+echo "Done\n";
+?>
+--EXPECTF--
+hello
+int(8192)
+bool(false)
+int(8192)
+Done
diff --git a/ext/standard/tests/strings/006.phpt b/ext/standard/tests/strings/006.phpt
new file mode 100644
index 0000000..afb5d24
--- /dev/null
+++ b/ext/standard/tests/strings/006.phpt
@@ -0,0 +1,21 @@
+--TEST--
+highlight_file() and output buffer
+--INI--
+log_errors_max_len=4096
+--FILE--
+<?php
+
+$file = str_repeat("A", 1024);
+
+var_dump(highlight_file($file, true));
+var_dump(ob_get_contents());
+
+?>
+===DONE===
+--EXPECTF--
+Warning: highlight_file(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA): failed to open stream: %s006.php on line %d
+
+Warning: highlight_file(): Failed opening 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' for highlighting in %s006.php on line %d
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/strings/007-win32.phpt b/ext/standard/tests/strings/007-win32.phpt
new file mode 100644
index 0000000..b16c566
--- /dev/null
+++ b/ext/standard/tests/strings/007-win32.phpt
@@ -0,0 +1,20 @@
+--TEST--
+php_strip_whitespace() and output buffer
+--SKIPIF--
+<?php if( substr(PHP_OS, 0, 3) != "WIN") die('skip Windows only test');?>
+--INI--
+log_errors_max_len=4096
+--FILE--
+<?php
+$file = str_repeat("A", PHP_MAXPATHLEN - strlen(__DIR__ . DIRECTORY_SEPARATOR . __FILE__));
+
+var_dump(php_strip_whitespace($file));
+var_dump(ob_get_contents());
+
+?>
+===DONE===
+--EXPECTF--
+Warning: php_strip_whitespace(%s): failed to open stream: No such file or directory in %s on line %d
+string(0) ""
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/strings/007.phpt b/ext/standard/tests/strings/007.phpt
new file mode 100644
index 0000000..804b455
--- /dev/null
+++ b/ext/standard/tests/strings/007.phpt
@@ -0,0 +1,20 @@
+--TEST--
+php_strip_whitespace() and output buffer
+--SKIPIF--
+<?php if( substr(PHP_OS, 0, 3) == "WIN") die('skip Non windows test');?>
+--INI--
+log_errors_max_len=4096
+--FILE--
+<?php
+$file = str_repeat("A", PHP_MAXPATHLEN - strlen(__DIR__ . DIRECTORY_SEPARATOR . __FILE__));
+
+var_dump(php_strip_whitespace($file));
+var_dump(ob_get_contents());
+
+?>
+===DONE===
+--EXPECTF--
+Warning: php_strip_whitespace(%s): failed to open stream: File name too long in %s007.php on line %d
+string(0) ""
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/strings/add-and-stripcslashes.phpt b/ext/standard/tests/strings/add-and-stripcslashes.phpt
new file mode 100644
index 0000000..7c7e36e
--- /dev/null
+++ b/ext/standard/tests/strings/add-and-stripcslashes.phpt
@@ -0,0 +1,26 @@
+--TEST--
+addcslashes() and stripcslashes() function
+--FILE--
+<?php
+echo addcslashes("", "")."\n";
+echo addcslashes("", "burp")."\n";
+echo addcslashes("kaboemkara!", "")."\n";
+echo addcslashes("foobarbaz", 'bar')."\n";
+echo addcslashes('foo[ ]', 'A..z')."\n";
+echo @addcslashes("zoo['.']", 'z..A')."\n";
+echo addcslashes('abcdefghijklmnopqrstuvwxyz', "a\145..\160z")."\n";
+echo "\n\r" == stripcslashes('\n\r'),"\n";
+echo stripcslashes('\065\x64')."\n";
+echo stripcslashes('')."\n";
+?>
+--EXPECT--
+
+
+kaboemkara!
+foo\b\a\r\b\az
+\f\o\o\[ \]
+\zoo['\.']
+\abcd\e\f\g\h\i\j\k\l\m\n\o\pqrstuvwxy\z
+1
+5d
+
diff --git a/ext/standard/tests/strings/add-and-stripslashes.phpt b/ext/standard/tests/strings/add-and-stripslashes.phpt
new file mode 100644
index 0000000..6f01176
--- /dev/null
+++ b/ext/standard/tests/strings/add-and-stripslashes.phpt
@@ -0,0 +1,20 @@
+--TEST--
+addslashes() and stripslashes() functions
+--FILE--
+<?php
+
+$input = '';
+for($i=0; $i<512; $i++) {
+ $input .= chr($i%256);
+}
+
+echo "Normal: ";
+if($input === stripslashes(addslashes($input))) {
+ echo "OK\n";
+} else {
+ echo "FAILED\n";
+}
+
+?>
+--EXPECT--
+Normal: OK
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt
new file mode 100644
index 0000000..c9722c7
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_001.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/addcslashes_002.phpt b/ext/standard/tests/strings/addcslashes_002.phpt
new file mode 100644
index 0000000..eb46803
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_002.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test addcslashes() function (variation 2)
+--INI--
+precision=14
+--FILE--
+<?php
+
+$string = "goodyear12345NULL\0truefalse\a\v\f\b\n\r\t";
+/* charlist "\0..\37" would escape all characters with ASCII code between 0 and 31 */
+echo "\n*** Testing addcslashes() with ASCII code between 0 and 31 ***\n";
+var_dump( addcslashes($string, "\0..\37") );
+
+/* Checking OBJECTS type */
+echo "\n*** Testing addcslashes() with objects ***\n";
+class string1
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+$obj = new string1;
+var_dump( addcslashes($obj, "b") );
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing addcslashes() with ASCII code between 0 and 31 ***
+string(44) "goodyear12345NULL\000truefalse\a\v\f\b\n\r\t"
+
+*** Testing addcslashes() with objects ***
+string(7) "O\bject"
+Done
diff --git a/ext/standard/tests/strings/addcslashes_003.phpt b/ext/standard/tests/strings/addcslashes_003.phpt
new file mode 100644
index 0000000..f1d6581
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_003.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/addcslashes_004.phpt b/ext/standard/tests/strings/addcslashes_004.phpt
new file mode 100644
index 0000000..db2b6f8
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_004.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test addcslashes() function (errors)
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+/* zero argument */
+var_dump( addcslashes() );
+
+/* unexpected arguments */
+var_dump( addcslashes("foo[]") );
+var_dump( addcslashes('foo[]', "o", "foo") );
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: addcslashes() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: addcslashes() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: addcslashes() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/addslashes_basic.phpt b/ext/standard/tests/strings/addslashes_basic.phpt
new file mode 100644
index 0000000..0912d34
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test addslashes() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters (single quotes, double quote,
+ * backslash and nul character) that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing addslashes() with strings containing characters that can be prefixed with backslash
+ * by the function
+*/
+
+echo "*** Testing addslashes() : basic functionality ***\n";
+
+// Initialize all required variables
+$str_array = array( "How's everybody", // string containing single quote
+ 'Are you "JOHN"?', // string with double quotes
+ 'c:\php\addslashes', // string with backslashes
+ "hello\0world" // string with nul character
+ );
+
+// Calling addslashes() with all arguments
+foreach( $str_array as $str ) {
+ var_dump( addslashes($str) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : basic functionality ***
+string(16) "How\'s everybody"
+string(17) "Are you \"JOHN\"?"
+string(19) "c:\\php\\addslashes"
+string(12) "hello\0world"
+Done
diff --git a/ext/standard/tests/strings/addslashes_error.phpt b/ext/standard/tests/strings/addslashes_error.phpt
new file mode 100644
index 0000000..e920dfd
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test addslashes() function : error conditions
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing addslashes() for error conditions
+*/
+
+echo "*** Testing addslashes() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing addslashes() function with Zero arguments --\n";
+var_dump( addslashes() );
+
+// More than expected number of arguments
+echo "\n-- Testing addslashes() function with more than expected no. of arguments --\n";
+$str = '"hello"\"world"';
+$extra_arg = 10;
+
+var_dump( addslashes($str, $extra_arg) );
+var_dump( $str );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : error conditions ***
+
+-- Testing addslashes() function with Zero arguments --
+
+Warning: addslashes() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing addslashes() function with more than expected no. of arguments --
+
+Warning: addslashes() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+string(15) ""hello"\"world""
+Done
diff --git a/ext/standard/tests/strings/addslashes_variation1.phpt b/ext/standard/tests/strings/addslashes_variation1.phpt
new file mode 100644
index 0000000..cc245ae
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_variation1.phpt
@@ -0,0 +1,171 @@
+--TEST--
+Test addslashes() function : usage variations - non-string type argument
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test addslashes() with non-string type argument such as int, float, etc
+*/
+
+echo "*** Testing addslashes() : with non-string type argument ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj'ct";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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,
+
+/*25*/ NULL,
+ null
+);
+
+
+// loop through each element of the array and check the working of addslashes()
+// when $str arugment is supplied with different values
+echo "\n--- Testing addslashes() 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( addslashes($str) );
+
+ $counter ++;
+}
+
+// closing the file
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing addslashes() : 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 addslashes() 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: addslashes() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: addslashes() 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(7) "obj\'ct"
+-- Iteration 24 --
+
+Warning: addslashes() 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/addslashes_variation2.phpt b/ext/standard/tests/strings/addslashes_variation2.phpt
new file mode 100644
index 0000000..49009e8
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_variation2.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test addslashes() function : usage variations - strings with characters to be backslashed
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test addslashes() with various strings containing characters thats can be backslashed
+*/
+
+echo "*** Testing addslashes() : with various strings containing characters to be backslashed ***\n";
+
+// initialising a heredoc string
+$heredoc_string = <<<EOT
+This is line 1 of 'heredoc' string
+This is line 2 of "heredoc" string
+EOT;
+
+$heredoc_null_string =<<<EOT
+EOT;
+
+// initialising the string array
+
+$str_array = array(
+ // string without any characters that can be backslashed
+ 'Hello world',
+
+ // string with single quotes
+ "how're you doing?",
+ "don't disturb u'r neighbours",
+ "don't disturb u'r neighbours''",
+ '',
+ '\'',
+ "'",
+
+ // string with double quotes
+ 'he said, "he will be on leave"',
+ 'he said, ""he will be on leave"',
+ '"""PHP"""',
+ "",
+ "\"",
+ '"',
+ "hello\"",
+
+ // string with backslash characters
+ 'Is your name Ram\Krishna?',
+ '\\0.0.0.0',
+ 'c:\php\testcase\addslashes',
+ '\\',
+
+ // string with nul characters
+ 'hello'.chr(0).'world',
+ chr(0).'hello'.chr(0),
+ chr(0).chr(0).'hello',
+ chr(0),
+
+ // mixed strings
+ "'\\0.0.0.0'",
+ "'\\0.0.0.0'".chr(0),
+ chr(0)."'c:\php\'",
+ '"\\0.0.0.0"',
+ '"c:\php\"'.chr(0)."'",
+ '"hello"'."'world'".chr(0).'//',
+
+ // string with hexadecimal number
+ "0xABCDEF0123456789",
+ "\x00",
+ '!@#$%&*@$%#&/;:,<>',
+ "hello\x00world",
+
+ // heredoc strings
+ $heredoc_string,
+ $heredoc_null_string
+ );
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $str ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( addslashes($str) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : with various strings containing characters to be backslashed ***
+
+-- Iteration 1 --
+string(11) "Hello world"
+
+-- Iteration 2 --
+string(18) "how\'re you doing?"
+
+-- Iteration 3 --
+string(30) "don\'t disturb u\'r neighbours"
+
+-- Iteration 4 --
+string(34) "don\'t disturb u\'r neighbours\'\'"
+
+-- Iteration 5 --
+string(0) ""
+
+-- Iteration 6 --
+string(2) "\'"
+
+-- Iteration 7 --
+string(2) "\'"
+
+-- Iteration 8 --
+string(32) "he said, \"he will be on leave\""
+
+-- Iteration 9 --
+string(34) "he said, \"\"he will be on leave\""
+
+-- Iteration 10 --
+string(15) "\"\"\"PHP\"\"\""
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(2) "\""
+
+-- Iteration 13 --
+string(2) "\""
+
+-- Iteration 14 --
+string(7) "hello\""
+
+-- Iteration 15 --
+string(26) "Is your name Ram\\Krishna?"
+
+-- Iteration 16 --
+string(9) "\\0.0.0.0"
+
+-- Iteration 17 --
+string(29) "c:\\php\\testcase\\addslashes"
+
+-- Iteration 18 --
+string(2) "\\"
+
+-- Iteration 19 --
+string(12) "hello\0world"
+
+-- Iteration 20 --
+string(9) "\0hello\0"
+
+-- Iteration 21 --
+string(9) "\0\0hello"
+
+-- Iteration 22 --
+string(2) "\0"
+
+-- Iteration 23 --
+string(13) "\'\\0.0.0.0\'"
+
+-- Iteration 24 --
+string(15) "\'\\0.0.0.0\'\0"
+
+-- Iteration 25 --
+string(15) "\0\'c:\\php\\\'"
+
+-- Iteration 26 --
+string(13) "\"\\0.0.0.0\""
+
+-- Iteration 27 --
+string(17) "\"c:\\php\\\"\0\'"
+
+-- Iteration 28 --
+string(22) "\"hello\"\'world\'\0//"
+
+-- Iteration 29 --
+string(18) "0xABCDEF0123456789"
+
+-- Iteration 30 --
+string(2) "\0"
+
+-- Iteration 31 --
+string(18) "!@#$%&*@$%#&/;:,<>"
+
+-- Iteration 32 --
+string(12) "hello\0world"
+
+-- Iteration 33 --
+string(73) "This is line 1 of \'heredoc\' string
+This is line 2 of \"heredoc\" string"
+
+-- Iteration 34 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/basename.phpt b/ext/standard/tests/strings/basename.phpt
new file mode 100644
index 0000000..a39a6f9
--- /dev/null
+++ b/ext/standard/tests/strings/basename.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/basename_basic.phpt b/ext/standard/tests/strings/basename_basic.phpt
new file mode 100644
index 0000000..fa0d410
--- /dev/null
+++ b/ext/standard/tests/strings/basename_basic.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/basename_error.phpt b/ext/standard/tests/strings/basename_error.phpt
new file mode 100644
index 0000000..bd7741d
--- /dev/null
+++ b/ext/standard/tests/strings/basename_error.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test basename() function : error conditions
+--FILE--
+<?php
+/* Prototype: string basename ( string $path [, string $suffix] );
+ Description: Given a string containing a path to a file,
+ this function will return the base name of the file.
+ If the filename ends in suffix this will also be cut off.
+*/
+echo "*** Testing error conditions ***\n";
+// zero arguments
+var_dump( basename() );
+
+// more than expected no. of arguments
+var_dump( basename("/var/tmp/bar.gz", ".gz", ".gz") );
+
+// passing invalid type arguments
+$object = new stdclass;
+var_dump( basename( array("string/bar") ) );
+var_dump( basename( array("string/bar"), "bar" ) );
+var_dump( basename( "bar", array("string/bar") ) );
+var_dump( basename( $object, "bar" ) );
+var_dump( basename( $object ) );
+var_dump( basename( $object, $object ) );
+var_dump( basename( "bar", $object ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: basename() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: basename() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 2 to be string, object given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/basename_variation.phpt b/ext/standard/tests/strings/basename_variation.phpt
new file mode 100644
index 0000000..2d74a38
--- /dev/null
+++ b/ext/standard/tests/strings/basename_variation.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test basename() function : usage variations
+--FILE--
+<?php
+/* Prototype: string basename ( string $path [, string $suffix] );
+ Description: Given a string containing a path to a file,
+ this function will return the base name of the file.
+ If the filename ends in suffix this will also be cut off.
+*/
+$file_path_variations = array (
+ /* paths with shortcut home dir char, with suffix variation */
+ array("~/home/user/bar"),
+ array("~/home/user/bar", ""),
+ array("~/home/user/bar", NULL),
+ array("~/home/user/bar", ' '),
+ array("~/home/user/bar.tar", ".tar"),
+ array("~/home/user/bar.tar", "~"),
+ array("~/home/user/bar.tar/", "~"),
+ array("~/home/user/bar.tar/", ""),
+ array("~/home/user/bar.tar", NULL),
+ array("~/home/user/bar.tar", ''),
+ array("~/home/user/bar.tar", " "),
+
+ /* paths with hostname:dir notation, with suffix variation */
+ array("hostname:/home/usr/bar.tar"),
+ array("hostname:/home/user/bar.tar", "home"),
+ array("hostname:/home/user/tbar.gz", "bar.gz"),
+ array("hostname:/home/user/tbar.gz", "/bar.gz"),
+ array("hostname:/home/user/tbar.gz", "/bar.gz/"),
+ array("hostname:/home/user/tbar.gz/", "/bar.gz/"),
+ array("hostname:/home/user/tbar.gz/", "/bar.gz/"),
+ array("hostname:/home/user/My Pics.gz/", "/bar.gz/"),
+ array("hostname:/home/user/My Pics.gz/", "Pics.gz/"),
+ array("hostname:/home/user/My Pics.gz/", "Pics.gz"),
+ array("hostname:/home/user/My Pics.gz/", ".gz"),
+ array("hostname:/home/user/My Pics.gz/"),
+ array("hostname:/home/user/My Pics.gz/", NULL),
+ array("hostname:/home/user/My Pics.gz/", ' '),
+ array("hostname:/home/user/My Pics.gz/", ''),
+ array("hostname:/home/user/My Pics.gz/", "My Pics.gz"),
+
+ /* paths with numeirc strings */
+ array("10.5"),
+ array("10.5", ".5"),
+ array("10.5", "10.5"),
+ array("10"),
+ array("105", "5"),
+ array("/10.5"),
+ array("10.5/"),
+ array("10/10.gz"),
+ array("0"),
+ array('0'),
+
+ /* paths and suffix given as same */
+ array("bar.gz", "bar.gz"),
+ array("/bar.gz", "/bar.gz"),
+ array("/bar.gz/", "/bar.gz/"),
+ array(" ", " "),
+ array(' ', ' '),
+ array(NULL, NULL),
+
+ /* path with spaces */
+ array(" "),
+ array(' '),
+
+ /* empty paths */
+ array(""),
+ array(''),
+ array(NULL)
+);
+
+function check_basename( $path_arrays ) {
+ $loop_counter = 1;
+ foreach ($path_arrays as $path) {
+ echo "\n--Iteration $loop_counter--\n"; $loop_counter++;
+ if( 1 == count($path) ) { // no suffix provided
+ var_dump( basename($path[0]) );
+ } else { // path as well as suffix provided,
+ var_dump( basename($path[0], $path[1]) );
+ }
+ }
+}
+
+echo "*** Testing possible variations in path and suffix ***\n";
+check_basename( $file_path_variations );
+
+echo "Done\n";
+
+--EXPECTF--
+*** Testing possible variations in path and suffix ***
+
+--Iteration 1--
+string(3) "bar"
+
+--Iteration 2--
+string(3) "bar"
+
+--Iteration 3--
+string(3) "bar"
+
+--Iteration 4--
+string(3) "bar"
+
+--Iteration 5--
+string(3) "bar"
+
+--Iteration 6--
+string(7) "bar.tar"
+
+--Iteration 7--
+string(7) "bar.tar"
+
+--Iteration 8--
+string(7) "bar.tar"
+
+--Iteration 9--
+string(7) "bar.tar"
+
+--Iteration 10--
+string(7) "bar.tar"
+
+--Iteration 11--
+string(7) "bar.tar"
+
+--Iteration 12--
+string(7) "bar.tar"
+
+--Iteration 13--
+string(7) "bar.tar"
+
+--Iteration 14--
+string(1) "t"
+
+--Iteration 15--
+string(7) "tbar.gz"
+
+--Iteration 16--
+string(7) "tbar.gz"
+
+--Iteration 17--
+string(7) "tbar.gz"
+
+--Iteration 18--
+string(7) "tbar.gz"
+
+--Iteration 19--
+string(10) "My Pics.gz"
+
+--Iteration 20--
+string(10) "My Pics.gz"
+
+--Iteration 21--
+string(3) "My "
+
+--Iteration 22--
+string(7) "My Pics"
+
+--Iteration 23--
+string(10) "My Pics.gz"
+
+--Iteration 24--
+string(10) "My Pics.gz"
+
+--Iteration 25--
+string(10) "My Pics.gz"
+
+--Iteration 26--
+string(10) "My Pics.gz"
+
+--Iteration 27--
+string(10) "My Pics.gz"
+
+--Iteration 28--
+string(4) "10.5"
+
+--Iteration 29--
+string(2) "10"
+
+--Iteration 30--
+string(4) "10.5"
+
+--Iteration 31--
+string(2) "10"
+
+--Iteration 32--
+string(2) "10"
+
+--Iteration 33--
+string(4) "10.5"
+
+--Iteration 34--
+string(4) "10.5"
+
+--Iteration 35--
+string(5) "10.gz"
+
+--Iteration 36--
+string(1) "0"
+
+--Iteration 37--
+string(1) "0"
+
+--Iteration 38--
+string(6) "bar.gz"
+
+--Iteration 39--
+string(6) "bar.gz"
+
+--Iteration 40--
+string(6) "bar.gz"
+
+--Iteration 41--
+string(1) " "
+
+--Iteration 42--
+string(1) " "
+
+--Iteration 43--
+string(0) ""
+
+--Iteration 44--
+string(1) " "
+
+--Iteration 45--
+string(1) " "
+
+--Iteration 46--
+string(0) ""
+
+--Iteration 47--
+string(0) ""
+
+--Iteration 48--
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/bin2hex.phpt b/ext/standard/tests/strings/bin2hex.phpt
new file mode 100644
index 0000000..42a4f4c
--- /dev/null
+++ b/ext/standard/tests/strings/bin2hex.phpt
@@ -0,0 +1,14 @@
+--TEST--
+bin2hex() function
+--FILE--
+<?php
+$s = '';
+for($i=0; $i<256; $i++) {
+ $s .= chr($i);
+}
+echo bin2hex($s)."\n";
+echo bin2hex("abc")."\n";
+?>
+--EXPECT--
+000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
+616263
diff --git a/ext/standard/tests/strings/bin2hex_basic.phpt b/ext/standard/tests/strings/bin2hex_basic.phpt
new file mode 100644
index 0000000..5d667a7
--- /dev/null
+++ b/ext/standard/tests/strings/bin2hex_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test bin2hex() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string bin2hex ( string $str )
+ * Description: Convert binary data into hexadecimal representation
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing bin2hex() : basic functionality ***\n";
+
+// array with different values for $string
+$strings = array (
+
+ //double quoted strings
+/*1*/ "Here is a simple string",
+ "\t This String contains \t\t some control characters\r\n",
+ "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+
+ //single quoted strings
+/*4*/ 'Here is a simple string',
+ '\t This String contains \t\t some control characters\r\n',
+ '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f',
+);
+
+// loop through with each element of the $strings array to test bin2hex() function
+$count = 1;
+foreach($strings as $string) {
+ echo "-- Iteration $count --\n";
+ var_dump(bin2hex($string));
+ $count ++;
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing bin2hex() : basic functionality ***
+-- Iteration 1 --
+string(46) "4865726520697320612073696d706c6520737472696e67"
+-- Iteration 2 --
+string(102) "09205468697320537472696e6720636f6e7461696e7320090920736f6d6520636f6e74726f6c20636861726163746572730d0a"
+-- Iteration 3 --
+string(36) "9091009394909195969798999a9b9c9d9e9f"
+-- Iteration 4 --
+string(46) "4865726520697320612073696d706c6520737472696e67"
+-- Iteration 5 --
+string(112) "5c74205468697320537472696e6720636f6e7461696e73205c745c7420736f6d6520636f6e74726f6c20636861726163746572735c725c6e"
+-- Iteration 6 --
+string(144) "5c7839305c7839315c7830305c7839335c7839345c7839305c7839315c7839355c7839365c7839375c7839385c7839395c7839615c7839625c7839635c7839645c7839655c783966"
+===DONE===
diff --git a/ext/standard/tests/strings/bin2hex_error.phpt b/ext/standard/tests/strings/bin2hex_error.phpt
new file mode 100644
index 0000000..9d2e131
--- /dev/null
+++ b/ext/standard/tests/strings/bin2hex_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test bin2hex() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string bin2hex ( string $str )
+ * Description: Convert binary data into hexadecimal representation
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing bin2hex() : error conditions ***\n";
+
+echo "\n-- Testing bin2hex() function with no arguments --\n";
+var_dump( bin2hex() );
+
+echo "\n-- Testing bin2hex() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( bin2hex("Hello World", $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing bin2hex() : error conditions ***
+
+-- Testing bin2hex() function with no arguments --
+
+Warning: bin2hex() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing bin2hex() function with more than expected no. of arguments --
+
+Warning: bin2hex() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+===DONE===
diff --git a/ext/standard/tests/strings/bin2hex_variation1.phpt b/ext/standard/tests/strings/bin2hex_variation1.phpt
new file mode 100644
index 0000000..e73ff5d
--- /dev/null
+++ b/ext/standard/tests/strings/bin2hex_variation1.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test bin2hex() function : usage variations - test values for $str argument
+--FILE--
+<?php
+
+/* Prototype : string bin2hex ( string $str )
+ * Description: Convert binary data into hexadecimal representation
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing bin2hex() function: with unexpected inputs for 'str' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 123456,
+
+ // float values
+/*4*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*7*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*10*/true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*14*/NULL,
+ null,
+
+ // objects
+/*16*/new sample(),
+
+ // resource
+/*17*/$file_handle,
+
+ // undefined variable
+/*18*/@$undefined_var,
+
+ // unset variable
+/*19*/@$unset_var
+);
+
+// loop through with each element of the $inputs array to test bin2hex() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump(bin2hex($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing bin2hex() function: with unexpected inputs for 'str' argument ***
+-- Iteration 1 --
+string(2) "30"
+-- Iteration 2 --
+string(2) "31"
+-- Iteration 3 --
+string(12) "313233343536"
+-- Iteration 4 --
+string(8) "31302e35"
+-- Iteration 5 --
+string(10) "2d32302e35"
+-- Iteration 6 --
+string(24) "313031323334353637303030"
+-- Iteration 7 --
+
+Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 10 --
+string(2) "31"
+-- Iteration 11 --
+string(0) ""
+-- Iteration 12 --
+string(2) "31"
+-- Iteration 13 --
+string(0) ""
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(26) "73616d706c65206f626a656374"
+-- Iteration 17 --
+
+Warning: bin2hex() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/bug20108.phpt b/ext/standard/tests/strings/bug20108.phpt
new file mode 100644
index 0000000..6e2219d
--- /dev/null
+++ b/ext/standard/tests/strings/bug20108.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #20108 (Segfault on printf statement)
+--FILE--
+<?php
+ $a = "boo";
+ $z = sprintf("%580.58s\n", $a);
+ var_dump($z);
+?>
+--EXPECT--
+string(581) " boo
+"
diff --git a/ext/standard/tests/strings/bug20169.phpt b/ext/standard/tests/strings/bug20169.phpt
new file mode 100644
index 0000000..c606578
--- /dev/null
+++ b/ext/standard/tests/strings/bug20169.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #20169 (implode() clobbers first argument)
+--FILE--
+<?php
+ @set_time_limit(5);
+ $delimiter = "|";
+
+ echo "delimiter: $delimiter\n";
+ implode($delimiter, array("foo", "bar"));
+ echo "delimiter: $delimiter\n";
+?>
+--EXPECT--
+delimiter: |
+delimiter: |
diff --git a/ext/standard/tests/strings/bug20261.phpt b/ext/standard/tests/strings/bug20261.phpt
new file mode 100644
index 0000000..163e905
--- /dev/null
+++ b/ext/standard/tests/strings/bug20261.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #20261 (str_rot13() changes too much)
+--FILE--
+<?php
+ $first = "boo";
+ $second = $first;
+ $rot = "";
+
+ echo "1: ".$first."\n";
+ echo "2: ".$second."\n";
+ echo "3: ".$rot."\n";
+
+ $rot = str_rot13($second);
+
+ echo "1: ".$first."\n";
+ echo "2: ".$second."\n";
+ echo "3: ".$rot."\n";
+?>
+--EXPECT--
+1: boo
+2: boo
+3:
+1: boo
+2: boo
+3: obb
+
diff --git a/ext/standard/tests/strings/bug20927.phpt b/ext/standard/tests/strings/bug20927.phpt
new file mode 100644
index 0000000..7575f2a
--- /dev/null
+++ b/ext/standard/tests/strings/bug20927.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #20927 (Segfault on wordwrap statement)
+--FILE--
+<?php
+$string = str_repeat("1234567890 X ", 10);
+$break = str_repeat("a-very-long-break-string-to-clobber-the-heap", 8);
+$linelength = 10;
+
+echo "Length of original string: ".strlen($string)."\n";
+echo "Length of break string: ".strlen($break)."\n";
+
+var_dump(wordwrap($string, $linelength, $break, 1));
+?>
+--EXPECT--
+Length of original string: 130
+Length of break string: 352
+string(6799) "1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapX "
diff --git a/ext/standard/tests/strings/bug20934.phpt b/ext/standard/tests/strings/bug20934.phpt
new file mode 100644
index 0000000..0d95081
--- /dev/null
+++ b/ext/standard/tests/strings/bug20934.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #20934 (htmlspecialchars returns latin1 from UTF-8)
+--SKIPIF--
+<?php
+if (!function_exists("utf8_encode") || !function_exists("utf8_decode")) {
+ die("SKIP Neither utf8_encode() nor utf8_decode() are available");
+}
+?>
+--FILE--
+<?php
+$str = utf8_encode("\xe0\xe1");
+var_dump(utf8_decode($str));
+var_dump(utf8_decode(htmlspecialchars($str, ENT_COMPAT, "UTF-8")));
+?>
+--EXPECT--
+string(2) "àá"
+string(2) "àá"
diff --git a/ext/standard/tests/strings/bug21338.phpt b/ext/standard/tests/strings/bug21338.phpt
new file mode 100644
index 0000000..c845765
--- /dev/null
+++ b/ext/standard/tests/strings/bug21338.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #20934 (html_entity_decode() crash when "" is passed)
+--FILE--
+<?php
+ var_dump(html_entity_decode(NULL));
+ var_dump(html_entity_decode(""));
+?>
+--EXPECT--
+string(0) ""
+string(0) ""
diff --git a/ext/standard/tests/strings/bug21453.phpt b/ext/standard/tests/strings/bug21453.phpt
new file mode 100644
index 0000000..40d89dd
--- /dev/null
+++ b/ext/standard/tests/strings/bug21453.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #21453 (handling of non-encoded <)
+--FILE--
+<?php
+$test = "
+<table>
+ <tr><td>first cell before < first cell after</td></tr>
+ <tr><td>second cell before < second cell after</td></tr>
+</table>";
+
+ var_dump(strip_tags($test));
+?>
+--EXPECT--
+string(80) "
+
+ first cell before < first cell after
+ second cell before < second cell after
+"
diff --git a/ext/standard/tests/strings/bug21730.phpt b/ext/standard/tests/strings/bug21730.phpt
new file mode 100644
index 0000000..8d40e20
--- /dev/null
+++ b/ext/standard/tests/strings/bug21730.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #21730 (*scanf "%n" conversion flag gives string instead of integer)
+--FILE--
+<?php
+$foo = "ABC = DEF";
+$fmt = "%s = %s %n";
+$res_a = array();
+
+/* $res_a[2] is supposed to be a integer value that
+ * represents the number of characters consumed so far
+ */
+sscanf($foo, $fmt, $res_a[0], $res_a[1], $res_a[2]);
+
+$res_b = sscanf($foo, $fmt);
+
+var_dump($res_a);
+var_dump($res_b);
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ string(3) "ABC"
+ [1]=>
+ string(3) "DEF"
+ [2]=>
+ int(9)
+}
+array(3) {
+ [0]=>
+ string(3) "ABC"
+ [1]=>
+ string(3) "DEF"
+ [2]=>
+ int(9)
+}
diff --git a/ext/standard/tests/strings/bug21744.phpt b/ext/standard/tests/strings/bug21744.phpt
new file mode 100644
index 0000000..925dac3
--- /dev/null
+++ b/ext/standard/tests/strings/bug21744.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #21744 (strip_tags misses exclamation marks in alt text)
+--FILE--
+<?php
+$test = <<< HERE
+<a href="test?test\\!!!test">test</a>
+<!-- test -->
+HERE;
+
+print strip_tags($test, '');
+print strip_tags($test, '<a>');
+?>
+--EXPECT--
+test
+<a href="test?test\!!!test">test</a>
diff --git a/ext/standard/tests/strings/bug22008.phpt b/ext/standard/tests/strings/bug22008.phpt
new file mode 100644
index 0000000..0965337
--- /dev/null
+++ b/ext/standard/tests/strings/bug22008.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #22008 (strip_tags() eliminates too much)
+--FILE--
+<?php
+$html = <<< HERE
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>test</title>
+</head>
+<body>
+<b>PHP!</b>
+</body>
+</html>
+
+HERE;
+
+echo trim(strip_tags($html, '<b>'))."\n";
+?>
+--EXPECT--
+test
+
+
+<b>PHP!</b>
diff --git a/ext/standard/tests/strings/bug22187.phpt b/ext/standard/tests/strings/bug22187.phpt
new file mode 100644
index 0000000..dccaccc
--- /dev/null
+++ b/ext/standard/tests/strings/bug22187.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #22187 (possible crash in number_format() function)
+--FILE--
+<?php
+ var_dump(number_format(0.0001, 1));
+ var_dump(number_format(0.0001, 0));
+?>
+--EXPECT--
+string(3) "0.0"
+string(1) "0"
diff --git a/ext/standard/tests/strings/bug22207.phpt b/ext/standard/tests/strings/bug22207.phpt
new file mode 100644
index 0000000..32a15d7
--- /dev/null
+++ b/ext/standard/tests/strings/bug22207.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #22207 (missing 0 when using the e notation in *printf functions)
+--FILE--
+<?php
+ printf("%10.5e\n", 1.1);
+ var_dump(sprintf("%10.5e\n", 1.1));
+?>
+--EXPECT--
+1.10000e+0
+string(11) "1.10000e+0
+"
diff --git a/ext/standard/tests/strings/bug22224.phpt b/ext/standard/tests/strings/bug22224.phpt
new file mode 100644
index 0000000..c30f222
--- /dev/null
+++ b/ext/standard/tests/strings/bug22224.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #22224 (implode changes object references in array)
+--INI--
+error_reporting=0
+--FILE--
+<?php
+class foo
+{
+ function __toString()
+ {
+ return "Object";
+ }
+}
+
+
+$a = new foo();
+
+$arr = array(0=>&$a, 1=>&$a);
+var_dump(implode(",",$arr));
+var_dump($arr)
+?>
+--EXPECTF--
+string(13) "Object,Object"
+array(2) {
+ [0]=>
+ &object(foo)#%d (0) {
+ }
+ [1]=>
+ &object(foo)#%d (0) {
+ }
+}
diff --git a/ext/standard/tests/strings/bug22227.phpt b/ext/standard/tests/strings/bug22227.phpt
new file mode 100644
index 0000000..eb980f9
--- /dev/null
+++ b/ext/standard/tests/strings/bug22227.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #22227 (printf() field limiters broke between 4.2.3 and 4.3.0)
+--FILE--
+<?php
+printf("%-3.3s", "abcdef");
+print "\n";
+?>
+--EXPECT--
+abc
diff --git a/ext/standard/tests/strings/bug23650.phpt b/ext/standard/tests/strings/bug23650.phpt
new file mode 100644
index 0000000..01dc888
--- /dev/null
+++ b/ext/standard/tests/strings/bug23650.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #23650 (strip_tags() removes hyphens)
+--FILE--
+<?php
+$str = <<< HERE
+1:<!-- abc - -->
+2:<!doctype -- >
+3:
+4:<abc - def>
+5:abc - def
+6:</abc>
+
+HERE;
+
+echo strip_tags($str);
+echo strip_tags($str, '<abc>');
+?>
+--EXPECT--
+1:
+2:
+3:
+4:
+5:abc - def
+6:
+1:
+2:
+3:
+4:<abc - def>
+5:abc - def
+6:</abc>
+
diff --git a/ext/standard/tests/strings/bug23894.phpt b/ext/standard/tests/strings/bug23894.phpt
new file mode 100644
index 0000000..3455081
--- /dev/null
+++ b/ext/standard/tests/strings/bug23894.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #23894 (sprintf() decimal specifiers problem)
+--FILE--
+<?php
+$a = -12.3456;
+$test = sprintf("%04d", $a);
+var_dump($test, bin2hex($test));
+$test = sprintf("% 13u", $a);
+var_dump($test, bin2hex($test));
+?>
+--EXPECTREGEX--
+string\(4\) \"-012\"
+string\(8\) \"2d303132\"
+(string\(13\) \" 4294967284\"|string\(20\) \"18446744073709551604\")
+(string\(26\) \"20202034323934393637323834\"|string\(40\) \"3138343436373434303733373039353531363034\")
diff --git a/ext/standard/tests/strings/bug24098.phpt b/ext/standard/tests/strings/bug24098.phpt
new file mode 100644
index 0000000..1998d9e
--- /dev/null
+++ b/ext/standard/tests/strings/bug24098.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #24098 (pathinfo() crash)
+--SKIPIF--
+<?php if (DIRECTORY_SEPARATOR == '\\') die("skip directory separator won't match expected output"); ?>
+--FILE--
+<?php
+ var_dump(pathinfo("/dsds.asa"));
+?>
+--EXPECT--
+array(4) {
+ ["dirname"]=>
+ string(1) "/"
+ ["basename"]=>
+ string(8) "dsds.asa"
+ ["extension"]=>
+ string(3) "asa"
+ ["filename"]=>
+ string(4) "dsds"
+}
diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt
new file mode 100644
index 0000000..bed28d9
--- /dev/null
+++ b/ext/standard/tests/strings/bug24208.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #24208 (parse_str() is not working)
+--FILE--
+<?php
+$a = $b = $c = "oops";
+parse_str("a=1&b=2&c=3");
+var_dump($a, $b, $c);
+?>
+--EXPECT--
+string(1) "1"
+string(1) "2"
+string(1) "3"
diff --git a/ext/standard/tests/strings/bug24281.phpt b/ext/standard/tests/strings/bug24281.phpt
new file mode 100644
index 0000000..3c041d6
--- /dev/null
+++ b/ext/standard/tests/strings/bug24281.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #24281 (str_replace count not returned if variable wasn't initialized)
+--SKIPIF--
+<?php
+ if (version_compare(zend_version(), '2.0.0-dev', '<')) die('SKIP PHP5 functionality');
+?>
+--FILE--
+<?php
+$string = "He had had to have had it";
+$newstring = str_replace("had", "foo", $string, $count);
+print "$count changes were made.\n";
+$count = "foo";
+$newstring = str_replace("had", "foo", $string, $count);
+print "$count changes were made.\n";
+?>
+--EXPECT--
+3 changes were made.
+3 changes were made.
diff --git a/ext/standard/tests/strings/bug24312.phpt b/ext/standard/tests/strings/bug24312.phpt
new file mode 100644
index 0000000..5ec444d
--- /dev/null
+++ b/ext/standard/tests/strings/bug24312.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #24208 (base64_decode() not skipping 0xF0 - 0xFF)
+--FILE--
+<?php
+$data = str_repeat("a", 100);
+for ($i = 0xF0; $i < 0xFF + 1; $i++) {
+ $enc = chunk_split(base64_encode($data), 10, chr($i));
+ var_dump(base64_decode($enc));
+}
+?>
+--EXPECT--
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
diff --git a/ext/standard/tests/strings/bug25671.phpt b/ext/standard/tests/strings/bug25671.phpt
new file mode 100644
index 0000000..ac64790
--- /dev/null
+++ b/ext/standard/tests/strings/bug25671.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #25671 (subarrays not copied correctly)
+--FILE--
+<?php
+ $arr = array(
+ "This is string one.",
+ "This is string two.",
+ array(
+ "This is another string.",
+ "This is a last string."),
+ "This is a last string.");
+
+ echo serialize(str_replace("string", "strung", $arr)) . "\n";
+ echo serialize(str_replace("string", "strung", $arr)) . "\n";
+ echo serialize(str_replace(" ", "", $arr)) . "\n";
+ echo serialize(str_replace(" ", "", $arr)) . "\n";
+?>
+--EXPECT--
+a:4:{i:0;s:19:"This is strung one.";i:1;s:19:"This is strung two.";i:2;a:2:{i:0;s:23:"This is another string.";i:1;s:22:"This is a last string.";}i:3;s:22:"This is a last strung.";}
+a:4:{i:0;s:19:"This is strung one.";i:1;s:19:"This is strung two.";i:2;a:2:{i:0;s:23:"This is another string.";i:1;s:22:"This is a last string.";}i:3;s:22:"This is a last strung.";}
+a:4:{i:0;s:16:"Thisisstringone.";i:1;s:16:"Thisisstringtwo.";i:2;a:2:{i:0;s:23:"This is another string.";i:1;s:22:"This is a last string.";}i:3;s:18:"Thisisalaststring.";}
+a:4:{i:0;s:16:"Thisisstringone.";i:1;s:16:"Thisisstringtwo.";i:2;a:2:{i:0;s:23:"This is another string.";i:1;s:22:"This is a last string.";}i:3;s:18:"Thisisalaststring.";}
+
diff --git a/ext/standard/tests/strings/bug25707.phpt b/ext/standard/tests/strings/bug25707.phpt
new file mode 100644
index 0000000..4954fb1
--- /dev/null
+++ b/ext/standard/tests/strings/bug25707.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #25707 (html_entity_decode over-decodes &amp;lt;)
+--FILE--
+<?php
+var_dump(html_entity_decode("&amp;lt;", ENT_COMPAT, 'ISO-8859-1'));
+var_dump(html_entity_decode("&amp;#38;", ENT_COMPAT, 'ISO-8859-1'));
+var_dump(html_entity_decode("&amp;#38;lt;", ENT_COMPAT, 'ISO-8859-1'));
+?>
+--EXPECT--
+string(4) "&lt;"
+string(5) "&#38;"
+string(8) "&#38;lt;"
diff --git a/ext/standard/tests/strings/bug26817.phpt b/ext/standard/tests/strings/bug26817.phpt
new file mode 100644
index 0000000..2283487
--- /dev/null
+++ b/ext/standard/tests/strings/bug26817.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #26817 (http_build_query() did not handle private & protected object properties)
+--FILE--
+<?php
+class test {
+ protected $foo;
+ private $bar;
+ public $test;
+
+ function foo()
+ {
+ $this->bar = 'meuh';
+ $this->foo = 'lala';
+ $this->test = 'test';
+
+ var_dump(http_build_query($this));
+ }
+}
+
+$obj = new test();
+$obj->foo();
+var_dump(http_build_query($obj));
+?>
+--EXPECT--
+string(27) "foo=lala&bar=meuh&test=test"
+string(9) "test=test"
diff --git a/ext/standard/tests/strings/bug26819.phpt b/ext/standard/tests/strings/bug26819.phpt
new file mode 100644
index 0000000..2d639a9
--- /dev/null
+++ b/ext/standard/tests/strings/bug26819.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #26819 (http_build_query() crash on empty output)
+--FILE--
+<?php
+$a = array();
+var_dump(http_build_query($a));
+?>
+--EXPECT--
+string(0) ""
diff --git a/ext/standard/tests/strings/bug26878.phpt b/ext/standard/tests/strings/bug26878.phpt
new file mode 100644
index 0000000..602f710
--- /dev/null
+++ b/ext/standard/tests/strings/bug26878.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #26878 (problem with multiple references to the same variable with different types)
+--FILE--
+<?php
+ printf('Int: %1$d and as string: %1$s', 'some string');
+ echo "\n";
+?>
+--EXPECT--
+Int: 0 and as string: some string
diff --git a/ext/standard/tests/strings/bug26973.phpt b/ext/standard/tests/strings/bug26973.phpt
new file mode 100644
index 0000000..9de3be4
--- /dev/null
+++ b/ext/standard/tests/strings/bug26973.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #26973 (*printf() '+' modifier problem)
+--FILE--
+<?php
+
+printf("%+05d\n", 200);
+printf("%+05d\n", -200);
+printf("%+05f\n", 200);
+printf("%+05f\n", -200);
+printf("%+05u\n", 200);
+printf("%+05u\n", -200);
+echo "---\n";
+printf("%05d\n", 200);
+printf("%05d\n", -200);
+printf("%05f\n", 200);
+printf("%05f\n", -200);
+printf("%05u\n", 200);
+printf("%05u\n", -200);
+
+?>
+--EXPECTREGEX--
+\+0200
+\-0200
+\+200\.000000
+\-200\.000000
+00200
+(4294967096|18446744073709551416)
+---
+00200
+\-0200
+200\.000000
+\-200\.000000
+00200
+(4294967096|18446744073709551416)
diff --git a/ext/standard/tests/strings/bug27276.phpt b/ext/standard/tests/strings/bug27276.phpt
new file mode 100644
index 0000000..f27e1d5
--- /dev/null
+++ b/ext/standard/tests/strings/bug27276.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #27276 (str_replace tries to use obscene amounts of ram)
+--FILE--
+<?php
+ini_set("memory_limit", "12m");
+$replacement = str_repeat("x", 12444);
+$string = str_repeat("x", 9432);
+$key = "{BLURPS}";
+
+str_replace($key, $replacement, $string);
+
+echo "Alive!\n";
+?>
+--EXPECT--
+Alive!
diff --git a/ext/standard/tests/strings/bug27278.phpt b/ext/standard/tests/strings/bug27278.phpt
new file mode 100644
index 0000000..1a94692
--- /dev/null
+++ b/ext/standard/tests/strings/bug27278.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #27278 (*printf() functions treat arguments as if passed by reference)
+--FILE--
+<?php
+
+function foo ($a)
+{
+ $a=sprintf("%02d",$a);
+ var_dump($a);
+}
+
+$x="02";
+var_dump($x);
+foo($x);
+var_dump($x);
+
+?>
+--EXPECT--
+string(2) "02"
+string(2) "02"
+string(2) "02"
diff --git a/ext/standard/tests/strings/bug27295.phpt b/ext/standard/tests/strings/bug27295.phpt
new file mode 100644
index 0000000..d23d270
--- /dev/null
+++ b/ext/standard/tests/strings/bug27295.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #27295 (memory leak inside sscanf())
+--FILE--
+<?php
+$strings = array("foo = bar", "bar = foo");
+foreach( $strings as $string )
+{
+ sscanf( $string, "%s = %[^[]]", $var, $val );
+ echo "$var = $val\n";
+}
+?>
+--EXPECT--
+foo = bar
+bar = foo
diff --git a/ext/standard/tests/strings/bug27457.phpt b/ext/standard/tests/strings/bug27457.phpt
new file mode 100644
index 0000000..6f5ec05
--- /dev/null
+++ b/ext/standard/tests/strings/bug27457.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #27457 (Problem with strtr() and translation array)
+--FILE--
+<?php
+ $test = "Dot in brackets [.]\n";
+ echo $test;
+ $test = strtr($test, array('.' => '0'));
+ echo $test;
+ $test = strtr($test, array('0' => '.'));
+ echo $test;
+ $test = strtr($test, '.', '0');
+ echo $test;
+ $test = strtr($test, '0', '.');
+ echo $test;
+?>
+--EXPECT--
+Dot in brackets [.]
+Dot in brackets [0]
+Dot in brackets [.]
+Dot in brackets [0]
+Dot in brackets [.]
diff --git a/ext/standard/tests/strings/bug27675.phpt b/ext/standard/tests/strings/bug27675.phpt
new file mode 100644
index 0000000..a5d4294
--- /dev/null
+++ b/ext/standard/tests/strings/bug27675.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #27675 (str_ireplace segfaults when shrinking string)
+--FILE--
+<?php
+echo str_ireplace('/*<B>', '<B>', '/*<b> I am a comment</b>*/');
+?>
+--EXPECT--
+<B> I am a comment</b>*/
diff --git a/ext/standard/tests/strings/bug28386.phpt b/ext/standard/tests/strings/bug28386.phpt
new file mode 100644
index 0000000..9c7c158
--- /dev/null
+++ b/ext/standard/tests/strings/bug28386.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #28386 (wordwrap() wraps text 1 character too soon)
+--FILE--
+<?php
+$text = "Some text";
+$string = "$text $text $text $text";
+echo wordwrap($string, 9);
+?>
+--EXPECT--
+Some text
+Some text
+Some text
+Some text
diff --git a/ext/standard/tests/strings/bug28633.phpt b/ext/standard/tests/strings/bug28633.phpt
new file mode 100644
index 0000000..5a1c256
--- /dev/null
+++ b/ext/standard/tests/strings/bug28633.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #28633 (sprintf incorrectly adding padding to floats)
+--FILE--
+<?php
+ echo sprintf("%05.2f", 0.02) . "\n";
+ echo sprintf("%05.2f", 2.02) . "\n";
+?>
+--EXPECT--
+00.02
+02.02
diff --git a/ext/standard/tests/strings/bug29075.phpt b/ext/standard/tests/strings/bug29075.phpt
new file mode 100644
index 0000000..7fe7da6
--- /dev/null
+++ b/ext/standard/tests/strings/bug29075.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #29075 (strnatcmp() incorrectly handles whitespace)
+--FILE--
+<?php
+ var_dump(
+ strnatcmp('foo ', 'foo '),
+ strnatcmp('foo', 'foo'),
+ strnatcmp(' foo', ' foo')
+ );
+?>
+--EXPECT--
+int(0)
+int(0)
+int(0)
diff --git a/ext/standard/tests/strings/bug29119.phpt b/ext/standard/tests/strings/bug29119.phpt
new file mode 100644
index 0000000..8b419b8
--- /dev/null
+++ b/ext/standard/tests/strings/bug29119.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #29119 (html_entity_decode() misbehaves with UTF-8)
+--FILE--
+<?php
+var_dump(bin2hex(html_entity_decode('&ensp;&thinsp;&lsquo;&dagger;&prime;&frasl;&euro;', ENT_QUOTES, 'UTF-8')));
+?>
+--EXPECT--
+string(42) "e28082e28089e28098e280a0e280b2e28184e282ac"
diff --git a/ext/standard/tests/strings/bug29538.phpt b/ext/standard/tests/strings/bug29538.phpt
new file mode 100644
index 0000000..6af25fb
--- /dev/null
+++ b/ext/standard/tests/strings/bug29538.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #29538 (number_format and problem with 0)
+--FILE--
+<?php
+ echo number_format(0.25, 2, '', ''), "\n";
+ echo number_format(1234, 2, '', ',');
+?>
+--EXPECT--
+025
+1,23400
diff --git a/ext/standard/tests/strings/bug33076.phpt b/ext/standard/tests/strings/bug33076.phpt
new file mode 100644
index 0000000..dafb816
--- /dev/null
+++ b/ext/standard/tests/strings/bug33076.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #33076 (str_ireplace() incorrectly counts result string length and may cause segfault)
+--FILE--
+<?php
+
+$value = str_ireplace("t", "bz", "Text");
+
+var_dump($value);
+
+echo "Done\n";
+?>
+--EXPECT--
+string(6) "bzexbz"
+Done
diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt
new file mode 100644
index 0000000..f0c49eb
--- /dev/null
+++ b/ext/standard/tests/strings/bug33605.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #33605 (substr_compare crashes)
+--FILE--
+<?php
+$res = substr_compare("aa", "a", -99999999, 0, 0);
+var_dump($res);
+
+?>
+--EXPECTF--
+Warning: substr_compare(): The length must be greater than zero in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/bug34214.phpt b/ext/standard/tests/strings/bug34214.phpt
new file mode 100644
index 0000000..dc2eb45
--- /dev/null
+++ b/ext/standard/tests/strings/bug34214.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #34214 (base64_decode() does not properly ignore whitespace)
+--FILE--
+<?php
+$txt = 'Zm9vYmFyIG
+ Zvb2Jhcg==';
+echo base64_decode($txt), "\n";
+?>
+--EXPECT--
+foobar foobar
diff --git a/ext/standard/tests/strings/bug35817.phpt b/ext/standard/tests/strings/bug35817.phpt
new file mode 100644
index 0000000..e2a752c
--- /dev/null
+++ b/ext/standard/tests/strings/bug35817.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #35817 (unpack() does not decode odd number of hexadecimal values)
+--FILE--
+<?php
+$a = pack("H3","181");
+$b = unpack("H3", $a);
+var_dump($b);
+
+$a = pack("H2","18");
+$b = unpack("H2", $a);
+var_dump($b);
+
+$a = pack("H","1");
+$b = unpack("H", $a);
+var_dump($b);
+?>
+--EXPECT--
+array(1) {
+ [1]=>
+ string(3) "181"
+}
+array(1) {
+ [1]=>
+ string(2) "18"
+}
+array(1) {
+ [1]=>
+ string(1) "1"
+}
diff --git a/ext/standard/tests/strings/bug36148.phpt b/ext/standard/tests/strings/bug36148.phpt
new file mode 100644
index 0000000..06caac3
--- /dev/null
+++ b/ext/standard/tests/strings/bug36148.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #36148 (unpack("H*hex", $data) is adding an extra character to the end of the string)
+--FILE--
+<?php
+$values = array("a", "aa", "aaa", "aaaa");
+foreach ($values as $value) {
+ $a = pack("H*", $value);
+ $b = unpack("H*", $a);
+ echo $value.": ";
+ var_dump($b);
+}
+?>
+--EXPECT--
+a: array(1) {
+ [1]=>
+ string(2) "a0"
+}
+aa: array(1) {
+ [1]=>
+ string(2) "aa"
+}
+aaa: array(1) {
+ [1]=>
+ string(4) "aaa0"
+}
+aaaa: array(1) {
+ [1]=>
+ string(4) "aaaa"
+}
diff --git a/ext/standard/tests/strings/bug36306.phpt b/ext/standard/tests/strings/bug36306.phpt
new file mode 100644
index 0000000..2d8449a
--- /dev/null
+++ b/ext/standard/tests/strings/bug36306.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #36306 (crc32() 64bit)
+--FILE--
+<?php
+
+/* as an example how to write crc32 tests
+ PHP does not have uint values, you cannot
+ display crc32 like a signed integer.
+ Have to find some small strings to truely reproduce
+ the problem, this example being not a problem
+*/
+echo dechex(crc32("platform independant")) . "\n";
+?>
+--EXPECT--
+ccd9fe66
diff --git a/ext/standard/tests/strings/bug36392.phpt b/ext/standard/tests/strings/bug36392.phpt
new file mode 100644
index 0000000..8e4cd16
--- /dev/null
+++ b/ext/standard/tests/strings/bug36392.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #36392 (wrong number of decimal digits with %e specifier in sprintf)
+--FILE--
+<?php
+ echo sprintf("%e\n", 1.123456789);
+ echo sprintf("%.10e\n", 1.123456789);
+ echo sprintf("%.0e\n", 1.123456789);
+ echo sprintf("%.1e\n", 1.123456789);
+ echo sprintf("%5.1e\n", 1.123456789);
+?>
+--EXPECT--
+1.123457e+0
+1.1234567890e+0
+1e+0
+1.1e+0
+1.1e+0
diff --git a/ext/standard/tests/strings/bug36944.phpt b/ext/standard/tests/strings/bug36944.phpt
new file mode 100644
index 0000000..2a43d06
--- /dev/null
+++ b/ext/standard/tests/strings/bug36944.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #36944 (strncmp & strncasecmp do not return false on negative string length)
+--FILE--
+<?php
+
+var_dump(strncmp("test ", "e", -1));
+var_dump(strncmp("test ", "e", 10));
+var_dump(strncmp("test ", "e", 0));
+
+var_dump(strncasecmp("test ", "E", -1));
+var_dump(strncasecmp("test ", "E", 10));
+var_dump(strncasecmp("test ", "E", 0));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+int(%d)
+int(0)
+
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+int(%d)
+int(0)
+Done
diff --git a/ext/standard/tests/strings/bug37244.phpt b/ext/standard/tests/strings/bug37244.phpt
new file mode 100644
index 0000000..0718c8a
--- /dev/null
+++ b/ext/standard/tests/strings/bug37244.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #37244 (base64_decode violates RFC 3548)
+--FILE--
+<?php
+$strings = array(
+ 'SW1wbGVtZW50YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu',
+ 'SW1wbGVtZW$0YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu',
+ 'SW1wbGVtZW0YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu'
+);
+foreach($strings as $string) {
+ var_dump(base64_decode($string, true));
+}
+?>
+--EXPECT--
+string(93) "Implementations MUST reject the encoding if it contains characters outside the base alphabet."
+bool(false)
+string(92) "Implemem][ۜÈUTÕ™Z™XÝH[˜ÛÙ[™ÈYˆ]Û۝Z[œÈÚ\˜XÝ\œÈÝ]ÚYHH˜\ÙH[X™] "
+
diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt
new file mode 100644
index 0000000..5a9f7f7
--- /dev/null
+++ b/ext/standard/tests/strings/bug37262.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #37262 (var_export() does not escape \0 character)
+--FILE--
+<?php
+$func = create_function('$a', 'return $a;');
+var_export($func);
+?>
+--EXPECTF--
+'' . "\0" . 'lambda_%d'
diff --git a/ext/standard/tests/strings/bug38322.phpt b/ext/standard/tests/strings/bug38322.phpt
new file mode 100644
index 0000000..37f5a93
--- /dev/null
+++ b/ext/standard/tests/strings/bug38322.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #38322 (reading past array in sscanf() leads to segfault/arbitary code execution)
+--FILE--
+<?php
+
+$str = "a b c d e";
+var_dump(sscanf("a ",'%1$s',$str));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(1)
+Done
diff --git a/ext/standard/tests/strings/bug38770.phpt b/ext/standard/tests/strings/bug38770.phpt
new file mode 100644
index 0000000..1821639
--- /dev/null
+++ b/ext/standard/tests/strings/bug38770.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #38770 (unpack() broken with longs on 64 bit machines)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+foreach (array('N','l') as $v) {
+ print_r(unpack($v, pack($v, -30000)));
+}
+
+echo "Done\n";
+?>
+--EXPECT--
+Array
+(
+ [1] => 4294937296
+)
+Array
+(
+ [1] => -30000
+)
+Done
diff --git a/ext/standard/tests/strings/bug39032.phpt b/ext/standard/tests/strings/bug39032.phpt
new file mode 100644
index 0000000..dbd39ec
--- /dev/null
+++ b/ext/standard/tests/strings/bug39032.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #39032 (strcspn() stops on null character)
+--FILE--
+<?php
+
+var_dump(strcspn(chr(0),"x"));
+var_dump(strcspn(chr(0),""));
+var_dump(strcspn(chr(0),"qweqwe"));
+var_dump(strcspn(chr(1),"qweqwe"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(1)
+int(0)
+int(1)
+int(1)
+Done
diff --git a/ext/standard/tests/strings/bug39350.phpt b/ext/standard/tests/strings/bug39350.phpt
new file mode 100644
index 0000000..53d58b7
--- /dev/null
+++ b/ext/standard/tests/strings/bug39350.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #39350 (implode/join() crash on empty input strings)
+--FILE--
+<?php
+
+implode('', array(null));
+implode('', array(false));
+implode('', array(""));
+
+echo "Done\n";
+?>
+--EXPECT--
+Done
diff --git a/ext/standard/tests/strings/bug39621.phpt b/ext/standard/tests/strings/bug39621.phpt
new file mode 100644
index 0000000..1a33147
--- /dev/null
+++ b/ext/standard/tests/strings/bug39621.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bug39873.phpt b/ext/standard/tests/strings/bug39873.phpt
new file mode 100644
index 0000000..e73f3c8
--- /dev/null
+++ b/ext/standard/tests/strings/bug39873.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #39873 (number_format() breaks with locale & decimal points)
+--SKIPIF--
+<?php
+if (!setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1")) {
+ die("skip locale needed for this test is not supported on this platform");
+}
+?>
+--FILE--
+<?php
+ setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1");
+ $num = 0+"1234.56";
+ echo number_format($num,2);
+ echo "\n";
+?>
+--EXPECT--
+1,234.56
diff --git a/ext/standard/tests/strings/bug40432.phpt b/ext/standard/tests/strings/bug40432.phpt
new file mode 100644
index 0000000..6db2e94
--- /dev/null
+++ b/ext/standard/tests/strings/bug40432.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #40432 (strip_tags() fails with greater than in attribute)
+--FILE--
+<?php
+echo strip_tags('<span title="test > all">this</span>') . "\n";
+?>
+--EXPECT--
+this
diff --git a/ext/standard/tests/strings/bug40637.phpt b/ext/standard/tests/strings/bug40637.phpt
new file mode 100644
index 0000000..5669083
--- /dev/null
+++ b/ext/standard/tests/strings/bug40637.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #40637 (strip_tags() does not handle single quotes correctly)
+--FILE--
+<?php
+
+$html = '<span title="Bug \' Trigger">Text</span>';
+var_dump(strip_tags($html));
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(4) "Text"
+Done
diff --git a/ext/standard/tests/strings/bug40704.phpt b/ext/standard/tests/strings/bug40704.phpt
new file mode 100644
index 0000000..82e91b5
--- /dev/null
+++ b/ext/standard/tests/strings/bug40704.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #40704 (strip_tags() does not handle single quotes correctly)
+--FILE--
+<?php
+
+$html = "<div>Bug ' Trigger</div> Missing Text";
+var_dump(strip_tags($html));
+
+echo "Done\n";
+?>
+--EXPECT--
+string(26) "Bug ' Trigger Missing Text"
+Done
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
new file mode 100644
index 0000000..6cfe470
--- /dev/null
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Bug #40754 (Overflow checks inside string functions)
+--FILE--
+<?php
+
+$v = 2147483647;
+
+var_dump(substr("abcde", 1, $v));
+var_dump(substr_replace("abcde", "x", $v, $v));
+
+var_dump(strspn("abcde", "abc", $v, $v));
+var_dump(strcspn("abcde", "abc", $v, $v));
+
+var_dump(substr_count("abcde", "abc", $v, $v));
+var_dump(substr_compare("abcde", "abc", $v, $v));
+
+var_dump(stripos("abcde", "abc", $v));
+var_dump(substr_count("abcde", "abc", $v, 1));
+var_dump(substr_count("abcde", "abc", 1, $v));
+var_dump(strpos("abcde", "abc", $v));
+var_dump(stripos("abcde", "abc", $v));
+var_dump(strrpos("abcde", "abc", $v));
+var_dump(strripos("abcde", "abc", $v));
+var_dump(strncmp("abcde", "abc", $v));
+var_dump(chunk_split("abcde", $v, "abc"));
+var_dump(substr("abcde", $v, $v));
+
+?>
+--EXPECTF--
+%unicode|string%(4) "bcde"
+%unicode|string%(6) "abcdex"
+bool(false)
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
+bool(false)
+
+Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
+bool(false)
+
+Warning: substr_count(): Length value 2147483647 exceeds string length in %s on line %d
+bool(false)
+
+Warning: strpos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in 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: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+int(2)
+string(8) "abcdeabc"
+bool(false)
diff --git a/ext/standard/tests/strings/bug40915.phpt b/ext/standard/tests/strings/bug40915.phpt
new file mode 100644
index 0000000..e3a501a
--- /dev/null
+++ b/ext/standard/tests/strings/bug40915.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bug42107.phpt b/ext/standard/tests/strings/bug42107.phpt
new file mode 100644
index 0000000..d97f891
--- /dev/null
+++ b/ext/standard/tests/strings/bug42107.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #42107 (sscanf() broken when using %2$s type format parameters)
+--FILE--
+<?php
+
+var_dump(sscanf('one two', '%1$s %2$s'));
+var_dump(sscanf('one two', '%2$s %1$s'));
+echo "--\n";
+sscanf('one two', '%1$s %2$s', $foo, $bar);
+var_dump($foo, $bar);
+sscanf('one two', '%2$s %1$s', $foo, $bar);
+var_dump($foo, $bar);
+echo "--\n";
+var_dump(sscanf('one two', '%1$d %2$d'));
+var_dump(sscanf('one two', '%1$d'));
+echo "Done\n";
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(3) "one"
+}
+--
+string(3) "one"
+string(3) "two"
+string(3) "two"
+string(3) "one"
+--
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/strings/bug42208.phpt b/ext/standard/tests/strings/bug42208.phpt
new file mode 100644
index 0000000..72488a9
--- /dev/null
+++ b/ext/standard/tests/strings/bug42208.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #42208 (substr_replace() crashes when the same array is passed more than once)
+--FILE--
+<?php
+$a = array(1, 2);
+$c = $a;
+var_dump(substr_replace($a, 1, 1, $c));
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(2) "11"
+ [1]=>
+ string(2) "21"
+}
diff --git a/ext/standard/tests/strings/bug43927.phpt b/ext/standard/tests/strings/bug43927.phpt
new file mode 100644
index 0000000..b780c4a
--- /dev/null
+++ b/ext/standard/tests/strings/bug43927.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #43927 (koi8r is missing from html_entity_decode())
+--FILE--
+<?php
+var_dump(html_entity_decode("&amp;lt;", ENT_COMPAT, 'koi8-r'));
+var_dump(html_entity_decode("&amp;#38;", ENT_COMPAT, 'koi8-r'));
+var_dump(html_entity_decode("&amp;#38;lt;", ENT_COMPAT, 'koi8-r'));
+?>
+--EXPECT--
+string(4) "&lt;"
+string(5) "&#38;"
+string(8) "&#38;lt;"
diff --git a/ext/standard/tests/strings/bug44242.phpt b/ext/standard/tests/strings/bug44242.phpt
new file mode 100644
index 0000000..00adda2
--- /dev/null
+++ b/ext/standard/tests/strings/bug44242.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #44242 (metaphone('CMXFXM') crashes PHP)
+--FILE--
+<?php
+
+echo metaphone('CMXFXZ'), "\n";
+echo metaphone('CMXFXV'), "\n";
+echo metaphone('CMXFXZXZ'), "\n";
+
+?>
+--EXPECT--
+KMKSFKSS
+KMKSFKSF
+KMKSFKSSKSS
diff --git a/ext/standard/tests/strings/bug44703.phpt b/ext/standard/tests/strings/bug44703.phpt
new file mode 100644
index 0000000..e20b1dd
--- /dev/null
+++ b/ext/standard/tests/strings/bug44703.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Bug #44703 (htmlspecialchars() does not detect bad character set argument)
+--FILE--
+<?php
+
+var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 1));
+var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 12));
+var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 125));
+var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 1252));
+var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 12526));
+
+var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 866));
+var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 8666));
+
+var_dump(htmlspecialchars(b"<>", ENT_COMPAT, NULL));
+
+
+var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 'SJIS'));
+var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 'SjiS'));
+
+var_dump(htmlspecialchars(b"<>", ENT_COMPAT, str_repeat('a', 100)));
+
+?>
+--EXPECTF--
+Warning: htmlspecialchars(): charset `1' not supported, assuming utf-8 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+
+Warning: htmlspecialchars(): charset `12' not supported, assuming utf-8 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+
+Warning: htmlspecialchars(): charset `125' not supported, assuming utf-8 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+
+Warning: htmlspecialchars(): charset `12526' not supported, assuming utf-8 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+string(8) "&lt;&gt;"
+
+Warning: htmlspecialchars(): charset `8666' not supported, assuming utf-8 in %s on line %d
+string(8) "&lt;&gt;"
+string(8) "&lt;&gt;"
+string(8) "&lt;&gt;"
+string(8) "&lt;&gt;"
+
+Warning: htmlspecialchars(): charset `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' not supported, assuming utf-8 in %s on line %d
+string(8) "&lt;&gt;"
diff --git a/ext/standard/tests/strings/bug45166.phpt b/ext/standard/tests/strings/bug45166.phpt
new file mode 100644
index 0000000..60449e0
--- /dev/null
+++ b/ext/standard/tests/strings/bug45166.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #45166 (substr() )
+--FILE--
+<?php
+ echo substr('cd', -3) . "\n";
+?>
+===DONE===
+--EXPECT--
+cd
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/bug45485.phpt b/ext/standard/tests/strings/bug45485.phpt
new file mode 100644
index 0000000..4d24c9a
--- /dev/null
+++ b/ext/standard/tests/strings/bug45485.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #45485 (strip_tags and <?XML tag)
+--FILE--
+<?php
+
+$s =<<< EOD
+This text is shown <?XML:NAMESPACE PREFIX = ST1 /><b>This Text disappears</b>
+EOD;
+
+$s = strip_tags($s);
+echo htmlspecialchars($s),"\n";
+
+$s =<<< EOD
+This text is shown <?xml:NAMESPACE PREFIX = ST1 /><b>This Text disappears</b>
+EOD;
+
+$s = strip_tags($s);
+echo htmlspecialchars($s),"\n";
+
+?>
+--EXPECT--
+This text is shown This Text disappears
+This text is shown This Text disappears
diff --git a/ext/standard/tests/strings/bug46578.phpt b/ext/standard/tests/strings/bug46578.phpt
new file mode 100644
index 0000000..ba9fbbe
--- /dev/null
+++ b/ext/standard/tests/strings/bug46578.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #46578 (strip_tags() does not honor end-of-comment when it encounters a single quote)
+--FILE--
+<?php
+
+var_dump(strip_tags('<!-- testing I\'ve been to mars -->foobar'));
+
+var_dump(strip_tags('<a alt="foobar">foo<!-- foo! --></a>bar'));
+
+var_dump(strip_tags('<a alt="foobar"/>foo<?= foo! /* <!-- "cool" --> */ ?>bar'));
+
+var_dump(strip_tags('< ax'));
+
+var_dump(strip_tags('<! a>'));
+
+var_dump(strip_tags('<? ax'));
+
+?>
+--EXPECTF--
+%string|unicode%(6) "foobar"
+%string|unicode%(6) "foobar"
+%string|unicode%(6) "foobar"
+%string|unicode%(4) "< ax"
+%string|unicode%(0) ""
+%string|unicode%(0) ""
diff --git a/ext/standard/tests/strings/bug47168.phpt b/ext/standard/tests/strings/bug47168.phpt
new file mode 100644
index 0000000..4cca362
--- /dev/null
+++ b/ext/standard/tests/strings/bug47168.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #47168 (printf of floating point variable prints maximum of 40 decimal places)
+--FILE--
+<?php
+
+$dyadic = 0.00000000000045474735088646411895751953125;
+var_dump(printf ("%1.41f\n",unserialize(serialize($dyadic))));
+
+?>
+--EXPECT--
+0.00000000000045474735088646411895751953125
+int(44)
diff --git a/ext/standard/tests/strings/bug47322.phpt b/ext/standard/tests/strings/bug47322.phpt
new file mode 100644
index 0000000..e04b230
--- /dev/null
+++ b/ext/standard/tests/strings/bug47322.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #47322 (sscanf %d does't work)
+--FILE--
+<?php
+
+sscanf(":59:58","%s:%d:%f", $a, $b, $c);
+echo "[$a][$b][$c]\n";
+
+sscanf("15:01:58.2","%d:%f:%f", $a, $b, $c);
+echo "[$a][$b][$c]\n";
+
+sscanf("15.1111::foo","%f:%d:%s", $a, $b, $c);
+echo "[$a][$b][$c]\n";
+
+?>
+--EXPECT--
+[:59:58][][]
+[15][1][58.2]
+[15.1111][1][58.2]
diff --git a/ext/standard/tests/strings/bug47443.phpt b/ext/standard/tests/strings/bug47443.phpt
new file mode 100644
index 0000000..e30acd8
--- /dev/null
+++ b/ext/standard/tests/strings/bug47443.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #47443 (metaphone('scratch') returns wrong result)
+--FILE--
+<?php
+
+var_dump(metaphone("scratch"));
+var_dump(metaphone("scrath"));
+var_dump(metaphone("scratc"));
+
+?>
+--EXPECTF--
+%string|unicode%(4) "SKRX"
+%string|unicode%(4) "SKR0"
+%string|unicode%(5) "SKRTK"
diff --git a/ext/standard/tests/strings/bug47481.phpt b/ext/standard/tests/strings/bug47481.phpt
new file mode 100644
index 0000000..4c59a7c
--- /dev/null
+++ b/ext/standard/tests/strings/bug47481.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Bug #47481 (natcasesort() does not sort extended ASCII characters correctly)
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test natcasesort() with extended ASCII characters
+ */
+
+$array = array ('SÃŒden', 'spielen','Sonne','Wind','Regen','Meer');
+echo "\n-- Before sorting: --\n";
+var_dump($array);
+
+echo "\n-- After Sorting: --\n";
+var_dump(natcasesort($array));
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+-- Before sorting: --
+array(6) {
+ [0]=>
+ %string|unicode%(6) "SÃŒden"
+ [1]=>
+ %string|unicode%(7) "spielen"
+ [2]=>
+ %string|unicode%(5) "Sonne"
+ [3]=>
+ %string|unicode%(4) "Wind"
+ [4]=>
+ %string|unicode%(5) "Regen"
+ [5]=>
+ %string|unicode%(4) "Meer"
+}
+
+-- After Sorting: --
+bool(true)
+array(6) {
+ [5]=>
+ %string|unicode%(4) "Meer"
+ [4]=>
+ %string|unicode%(5) "Regen"
+ [2]=>
+ %string|unicode%(5) "Sonne"
+ [1]=>
+ %string|unicode%(7) "spielen"
+ [0]=>
+ %string|unicode%(6) "SÃŒden"
+ [3]=>
+ %string|unicode%(4) "Wind"
+}
+Done
diff --git a/ext/standard/tests/strings/bug47842.phpt b/ext/standard/tests/strings/bug47842.phpt
new file mode 100644
index 0000000..4ac9da6
--- /dev/null
+++ b/ext/standard/tests/strings/bug47842.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #47842 sscanf() does not support 64-bit values
+--SKIPIF--
+<?php
+if (PHP_INT_MAX < pow(2,31)) die("skip PHP_INT_MAX < 32b\n");
+?>
+--FILE--
+<?php
+echo "-Test\n";
+
+sscanf("2147483647", '%d', $int);
+echo "sscanf 32-bit signed int '2147483647' (2^31)-1 = ",$int,"\n";
+sscanf("4294967295", '%u', $int);
+echo "sscanf 32-bit unsign int '4294967295' (2^32)-1 = ",$int,"\n";
+
+sscanf("9223372036854775807", '%d', $int);
+echo "sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = ",$int,"\n";
+sscanf("18446744073709551615", '%u', $int);
+echo "sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = ",$int,"\n";
+
+printf("printf 64-bit signed int '9223372036854775807' (2^63)-1 = %d\n", 9223372036854775807);
+printf("printf 64-bit signed int '18446744073709551615' (2^64)-1 = %u\n", 18446744073709551615);
+
+echo "Done\n";
+?>
+--EXPECTF--
+%aTest
+sscanf 32-bit signed int '2147483647' (2^31)-1 = 2147483647
+sscanf 32-bit unsign int '4294967295' (2^32)-1 = 4294967295
+sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807
+sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615
+printf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807
+printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0
+Done
diff --git a/ext/standard/tests/strings/bug48709.phpt b/ext/standard/tests/strings/bug48709.phpt
new file mode 100644
index 0000000..999a2c6
--- /dev/null
+++ b/ext/standard/tests/strings/bug48709.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #48709 (metaphone and 'wh')
+--FILE--
+<?php
+
+/* Initial letter exceptions */
+$exceptions = array(
+ 'kn', // Drop first letter
+ 'gn', // ditto
+ 'pn', // ditto
+ 'ae', // ditto
+ 'wr', // ditto
+ 'x', // s
+ 'wh', // w
+ 'wa' // w
+);
+
+foreach ($exceptions as $letter) {
+ printf("%s => %s\n", $letter, metaphone($letter));
+}
+
+?>
+--EXPECT--
+kn => N
+gn => N
+pn => N
+ae => E
+wr => R
+x => S
+wh => W
+wa => W
diff --git a/ext/standard/tests/strings/bug49785.phpt b/ext/standard/tests/strings/bug49785.phpt
new file mode 100644
index 0000000..78a1837
--- /dev/null
+++ b/ext/standard/tests/strings/bug49785.phpt
@@ -0,0 +1,4135 @@
+--TEST--
+Bug #49785 (insufficient input string validation of htmlspecialchars())
+--FILE--
+<?php
+function _bin2hex($val) {
+ return is_string($val) ? bin2hex($val): $val;
+}
+
+echo "UTF-8: basic tests\n";
+var_dump(_bin2hex(htmlentities("\xc1\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xc2\x80", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xc2\x00", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xc2\xc0", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xce\x91", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xce\xb1", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xdf\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\xa0\x80", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\x9f\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\x9f\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\x1f\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\x9f\x3f", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\x1f\x3f", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe2\x99\xa5", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xef\xbf\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xef\xff\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xef\xbf\xff", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf0\x8f\xbf\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf0\x90\x80\x80", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\xbf\xbf\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\x3f\xbf\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\xbf\x3f\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\xbf\xbf\x3f", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\xff\xbf\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\xbf\xff\xbf", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf7\xbf\xbf\xff", ENT_QUOTES, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf8\x88\x80\x80\x80", ENT_QUOTES, "UTF-8")));
+
+echo "--\n";
+echo "UTF-8: with ENT_IGNORE\n";
+var_dump(_bin2hex(htmlentities("\xc0\xa0\xc2\x80", ENT_QUOTES | ENT_IGNORE, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xe0\x80\x80\xe0\xa0\x80", ENT_QUOTES | ENT_IGNORE, "UTF-8")));
+var_dump(_bin2hex(htmlentities("\xf0\x80\x80\x80\xf0\x90\x80\x80", ENT_QUOTES | ENT_IGNORE, "UTF-8")));
+
+echo "--\n";
+echo "UTF-8: alternative (invalid) UTF-8 sequence / surrogate pairs\n";
+var_dump(_bin2hex(htmlspecialchars("\xc0\xa6", ENT_QUOTES, 'UTF-8')));
+var_dump(_bin2hex(htmlspecialchars("\xe0\x80\xa6", ENT_QUOTES, 'UTF-8')));
+var_dump(_bin2hex(htmlspecialchars("\xf0\x80\x80\xa6", ENT_QUOTES, 'UTF-8')));
+var_dump(_bin2hex(htmlspecialchars("\xec\xbf\xbf", ENT_QUOTES, 'UTF-8')));
+var_dump(_bin2hex(htmlspecialchars("\xed\xa0\x80", ENT_QUOTES, 'UTF-8')));
+var_dump(_bin2hex(htmlspecialchars("\xed\xbf\xbf", ENT_QUOTES, 'UTF-8')));
+var_dump(_bin2hex(htmlspecialchars("\xee\x80\x80", ENT_QUOTES, 'UTF-8')));
+
+echo "--\n";
+echo "Shift_JIS: non-lead byte >= 0x80\n";
+var_dump(_bin2hex(htmlspecialchars("\x80", ENT_QUOTES, 'Shift_JIS')));
+foreach (array_map('chr', range(0xa0, 0xdf)) as $c) {
+ var_dump(_bin2hex(htmlspecialchars($c, ENT_QUOTES, 'Shift_JIS')));
+}
+var_dump(_bin2hex(htmlspecialchars("\xfd", ENT_QUOTES, 'Shift_JIS')));
+var_dump(_bin2hex(htmlspecialchars("\xfe", ENT_QUOTES, 'Shift_JIS')));
+var_dump(_bin2hex(htmlspecialchars("\xff", ENT_QUOTES, 'Shift_JIS')));
+
+echo "--\n";
+echo "Shift_JIS: incomplete / invalid multibyte sequences\n";
+foreach (array_map('chr', array_merge(range(0x81, 0x9f), range(0xe0, 0xfc))) as $c) {
+ var_dump(_bin2hex(htmlspecialchars("$c", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x3f", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x40", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x7e", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x7f", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x80", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xfc", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xfd", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xfe", ENT_QUOTES, 'Shift_JIS')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xff", ENT_QUOTES, 'Shift_JIS')));
+}
+
+echo "--\n";
+echo "EUC-JP: non-lead byte >= 0x80\n";
+foreach (array_map('chr', array_merge(range(0x80, 0x8d), range(0x90, 0x9f))) as $c) {
+ var_dump(_bin2hex(htmlspecialchars($c, ENT_QUOTES, 'EUC-JP')));
+}
+var_dump(_bin2hex(htmlspecialchars("\xff", ENT_QUOTES, 'EUC-JP')));
+
+// EUC-JP: control codes that are virtually lead bytes
+var_dump(_bin2hex(htmlspecialchars("\x8e", ENT_QUOTES, 'EUC-JP')));
+var_dump(_bin2hex(htmlspecialchars("\x8f", ENT_QUOTES, 'EUC-JP')));
+var_dump(_bin2hex(htmlspecialchars("\x8e\xa1", ENT_QUOTES, 'EUC-JP')));
+var_dump(_bin2hex(htmlspecialchars("\x8f\xa1", ENT_QUOTES, 'EUC-JP')));
+var_dump(_bin2hex(htmlspecialchars("\x8e\xa1\xa3", ENT_QUOTES, 'EUC-JP')));
+var_dump(_bin2hex(htmlspecialchars("\x8f\xa1\xa3", ENT_QUOTES, 'EUC-JP')));
+
+echo "--\n";
+echo "EUC-JP: incomplete / invalid multibyte sequences\n";
+foreach (array_map('chr', array_merge(range(0xa1, 0xfe))) as $c) {
+ var_dump(_bin2hex(htmlspecialchars("$c", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x26", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x80", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xa0", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xa1", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xfe", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xff", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c\x26", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c\x80", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c\xa0", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c\xa1", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c\xfe", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8e$c\xff", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c\x26", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c\x80", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c\xa0", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c\xa1", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c\xfe", ENT_QUOTES, 'EUC-JP')));
+ var_dump(_bin2hex(htmlspecialchars("\x8f$c\xff", ENT_QUOTES, 'EUC-JP')));
+}
+
+echo "--\n";
+echo "BIG5: non-lead byte >= 0x80\n";
+var_dump(_bin2hex(htmlspecialchars("\x80", ENT_QUOTES, 'BIG5')));
+var_dump(_bin2hex(htmlspecialchars("\xff", ENT_QUOTES, 'BIG5')));
+
+echo "--\n";
+echo "BIG5: incomplete / invalid multibyte sequences\n";
+foreach (array_map('chr', range(0x81, 0xfe)) as $c) {
+ var_dump(_bin2hex(htmlspecialchars("$c", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x3f", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x40", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x7e", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x7f", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\x80", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xa0", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xa1", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xfe", ENT_QUOTES, 'BIG5')));
+ var_dump(_bin2hex(htmlspecialchars("$c\xff", ENT_QUOTES, 'BIG5')));
+}
+?>
+--EXPECT--
+UTF-8: basic tests
+string(0) ""
+string(4) "c280"
+string(0) ""
+string(0) ""
+string(14) "26416c7068613b"
+string(14) "26616c7068613b"
+string(4) "dfbf"
+string(6) "e0a080"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(16) "266865617274733b"
+string(6) "efbfbf"
+string(0) ""
+string(0) ""
+string(0) ""
+string(8) "f0908080"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+--
+UTF-8: with ENT_IGNORE
+string(4) "c280"
+string(6) "e0a080"
+string(8) "f0908080"
+--
+UTF-8: alternative (invalid) UTF-8 sequence / surrogate pairs
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "ecbfbf"
+string(0) ""
+string(0) ""
+string(6) "ee8080"
+--
+Shift_JIS: non-lead byte >= 0x80
+string(0) ""
+string(0) ""
+string(2) "a1"
+string(2) "a2"
+string(2) "a3"
+string(2) "a4"
+string(2) "a5"
+string(2) "a6"
+string(2) "a7"
+string(2) "a8"
+string(2) "a9"
+string(2) "aa"
+string(2) "ab"
+string(2) "ac"
+string(2) "ad"
+string(2) "ae"
+string(2) "af"
+string(2) "b0"
+string(2) "b1"
+string(2) "b2"
+string(2) "b3"
+string(2) "b4"
+string(2) "b5"
+string(2) "b6"
+string(2) "b7"
+string(2) "b8"
+string(2) "b9"
+string(2) "ba"
+string(2) "bb"
+string(2) "bc"
+string(2) "bd"
+string(2) "be"
+string(2) "bf"
+string(2) "c0"
+string(2) "c1"
+string(2) "c2"
+string(2) "c3"
+string(2) "c4"
+string(2) "c5"
+string(2) "c6"
+string(2) "c7"
+string(2) "c8"
+string(2) "c9"
+string(2) "ca"
+string(2) "cb"
+string(2) "cc"
+string(2) "cd"
+string(2) "ce"
+string(2) "cf"
+string(2) "d0"
+string(2) "d1"
+string(2) "d2"
+string(2) "d3"
+string(2) "d4"
+string(2) "d5"
+string(2) "d6"
+string(2) "d7"
+string(2) "d8"
+string(2) "d9"
+string(2) "da"
+string(2) "db"
+string(2) "dc"
+string(2) "dd"
+string(2) "de"
+string(2) "df"
+string(0) ""
+string(0) ""
+string(0) ""
+--
+Shift_JIS: incomplete / invalid multibyte sequences
+string(0) ""
+string(0) ""
+string(4) "8140"
+string(4) "817e"
+string(0) ""
+string(4) "8180"
+string(4) "81fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8240"
+string(4) "827e"
+string(0) ""
+string(4) "8280"
+string(4) "82fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8340"
+string(4) "837e"
+string(0) ""
+string(4) "8380"
+string(4) "83fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8440"
+string(4) "847e"
+string(0) ""
+string(4) "8480"
+string(4) "84fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8540"
+string(4) "857e"
+string(0) ""
+string(4) "8580"
+string(4) "85fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8640"
+string(4) "867e"
+string(0) ""
+string(4) "8680"
+string(4) "86fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8740"
+string(4) "877e"
+string(0) ""
+string(4) "8780"
+string(4) "87fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8840"
+string(4) "887e"
+string(0) ""
+string(4) "8880"
+string(4) "88fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8940"
+string(4) "897e"
+string(0) ""
+string(4) "8980"
+string(4) "89fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8a40"
+string(4) "8a7e"
+string(0) ""
+string(4) "8a80"
+string(4) "8afc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8b40"
+string(4) "8b7e"
+string(0) ""
+string(4) "8b80"
+string(4) "8bfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8c40"
+string(4) "8c7e"
+string(0) ""
+string(4) "8c80"
+string(4) "8cfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8d40"
+string(4) "8d7e"
+string(0) ""
+string(4) "8d80"
+string(4) "8dfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8e40"
+string(4) "8e7e"
+string(0) ""
+string(4) "8e80"
+string(4) "8efc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8f40"
+string(4) "8f7e"
+string(0) ""
+string(4) "8f80"
+string(4) "8ffc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9040"
+string(4) "907e"
+string(0) ""
+string(4) "9080"
+string(4) "90fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9140"
+string(4) "917e"
+string(0) ""
+string(4) "9180"
+string(4) "91fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9240"
+string(4) "927e"
+string(0) ""
+string(4) "9280"
+string(4) "92fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9340"
+string(4) "937e"
+string(0) ""
+string(4) "9380"
+string(4) "93fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9440"
+string(4) "947e"
+string(0) ""
+string(4) "9480"
+string(4) "94fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9540"
+string(4) "957e"
+string(0) ""
+string(4) "9580"
+string(4) "95fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9640"
+string(4) "967e"
+string(0) ""
+string(4) "9680"
+string(4) "96fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9740"
+string(4) "977e"
+string(0) ""
+string(4) "9780"
+string(4) "97fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9840"
+string(4) "987e"
+string(0) ""
+string(4) "9880"
+string(4) "98fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9940"
+string(4) "997e"
+string(0) ""
+string(4) "9980"
+string(4) "99fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9a40"
+string(4) "9a7e"
+string(0) ""
+string(4) "9a80"
+string(4) "9afc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9b40"
+string(4) "9b7e"
+string(0) ""
+string(4) "9b80"
+string(4) "9bfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9c40"
+string(4) "9c7e"
+string(0) ""
+string(4) "9c80"
+string(4) "9cfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9d40"
+string(4) "9d7e"
+string(0) ""
+string(4) "9d80"
+string(4) "9dfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9e40"
+string(4) "9e7e"
+string(0) ""
+string(4) "9e80"
+string(4) "9efc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9f40"
+string(4) "9f7e"
+string(0) ""
+string(4) "9f80"
+string(4) "9ffc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e040"
+string(4) "e07e"
+string(0) ""
+string(4) "e080"
+string(4) "e0fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e140"
+string(4) "e17e"
+string(0) ""
+string(4) "e180"
+string(4) "e1fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e240"
+string(4) "e27e"
+string(0) ""
+string(4) "e280"
+string(4) "e2fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e340"
+string(4) "e37e"
+string(0) ""
+string(4) "e380"
+string(4) "e3fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e440"
+string(4) "e47e"
+string(0) ""
+string(4) "e480"
+string(4) "e4fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e540"
+string(4) "e57e"
+string(0) ""
+string(4) "e580"
+string(4) "e5fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e640"
+string(4) "e67e"
+string(0) ""
+string(4) "e680"
+string(4) "e6fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e740"
+string(4) "e77e"
+string(0) ""
+string(4) "e780"
+string(4) "e7fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e840"
+string(4) "e87e"
+string(0) ""
+string(4) "e880"
+string(4) "e8fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e940"
+string(4) "e97e"
+string(0) ""
+string(4) "e980"
+string(4) "e9fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ea40"
+string(4) "ea7e"
+string(0) ""
+string(4) "ea80"
+string(4) "eafc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eb40"
+string(4) "eb7e"
+string(0) ""
+string(4) "eb80"
+string(4) "ebfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ec40"
+string(4) "ec7e"
+string(0) ""
+string(4) "ec80"
+string(4) "ecfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ed40"
+string(4) "ed7e"
+string(0) ""
+string(4) "ed80"
+string(4) "edfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ee40"
+string(4) "ee7e"
+string(0) ""
+string(4) "ee80"
+string(4) "eefc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ef40"
+string(4) "ef7e"
+string(0) ""
+string(4) "ef80"
+string(4) "effc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f040"
+string(4) "f07e"
+string(0) ""
+string(4) "f080"
+string(4) "f0fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f140"
+string(4) "f17e"
+string(0) ""
+string(4) "f180"
+string(4) "f1fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f240"
+string(4) "f27e"
+string(0) ""
+string(4) "f280"
+string(4) "f2fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f340"
+string(4) "f37e"
+string(0) ""
+string(4) "f380"
+string(4) "f3fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f440"
+string(4) "f47e"
+string(0) ""
+string(4) "f480"
+string(4) "f4fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f540"
+string(4) "f57e"
+string(0) ""
+string(4) "f580"
+string(4) "f5fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f640"
+string(4) "f67e"
+string(0) ""
+string(4) "f680"
+string(4) "f6fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f740"
+string(4) "f77e"
+string(0) ""
+string(4) "f780"
+string(4) "f7fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f840"
+string(4) "f87e"
+string(0) ""
+string(4) "f880"
+string(4) "f8fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f940"
+string(4) "f97e"
+string(0) ""
+string(4) "f980"
+string(4) "f9fc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fa40"
+string(4) "fa7e"
+string(0) ""
+string(4) "fa80"
+string(4) "fafc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fb40"
+string(4) "fb7e"
+string(0) ""
+string(4) "fb80"
+string(4) "fbfc"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fc40"
+string(4) "fc7e"
+string(0) ""
+string(4) "fc80"
+string(4) "fcfc"
+string(0) ""
+string(0) ""
+string(0) ""
+--
+EUC-JP: non-lead byte >= 0x80
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "8a"
+string(2) "8b"
+string(2) "8c"
+string(2) "8d"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(2) "9a"
+string(2) "9b"
+string(2) "9c"
+string(2) "9d"
+string(2) "9e"
+string(2) "9f"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8ea1"
+string(0) ""
+string(0) ""
+string(6) "8fa1a3"
+--
+EUC-JP: incomplete / invalid multibyte sequences
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a1a1"
+string(4) "a1fe"
+string(0) ""
+string(4) "8ea1"
+string(14) "8ea126616d703b"
+string(6) "8ea180"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa1a1"
+string(6) "8fa1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a2a1"
+string(4) "a2fe"
+string(0) ""
+string(4) "8ea2"
+string(14) "8ea226616d703b"
+string(6) "8ea280"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa2a1"
+string(6) "8fa2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a3a1"
+string(4) "a3fe"
+string(0) ""
+string(4) "8ea3"
+string(14) "8ea326616d703b"
+string(6) "8ea380"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa3a1"
+string(6) "8fa3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a4a1"
+string(4) "a4fe"
+string(0) ""
+string(4) "8ea4"
+string(14) "8ea426616d703b"
+string(6) "8ea480"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa4a1"
+string(6) "8fa4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a5a1"
+string(4) "a5fe"
+string(0) ""
+string(4) "8ea5"
+string(14) "8ea526616d703b"
+string(6) "8ea580"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa5a1"
+string(6) "8fa5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a6a1"
+string(4) "a6fe"
+string(0) ""
+string(4) "8ea6"
+string(14) "8ea626616d703b"
+string(6) "8ea680"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa6a1"
+string(6) "8fa6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a7a1"
+string(4) "a7fe"
+string(0) ""
+string(4) "8ea7"
+string(14) "8ea726616d703b"
+string(6) "8ea780"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa7a1"
+string(6) "8fa7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a8a1"
+string(4) "a8fe"
+string(0) ""
+string(4) "8ea8"
+string(14) "8ea826616d703b"
+string(6) "8ea880"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa8a1"
+string(6) "8fa8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a9a1"
+string(4) "a9fe"
+string(0) ""
+string(4) "8ea9"
+string(14) "8ea926616d703b"
+string(6) "8ea980"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fa9a1"
+string(6) "8fa9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aaa1"
+string(4) "aafe"
+string(0) ""
+string(4) "8eaa"
+string(14) "8eaa26616d703b"
+string(6) "8eaa80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8faaa1"
+string(6) "8faafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aba1"
+string(4) "abfe"
+string(0) ""
+string(4) "8eab"
+string(14) "8eab26616d703b"
+string(6) "8eab80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8faba1"
+string(6) "8fabfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aca1"
+string(4) "acfe"
+string(0) ""
+string(4) "8eac"
+string(14) "8eac26616d703b"
+string(6) "8eac80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8faca1"
+string(6) "8facfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ada1"
+string(4) "adfe"
+string(0) ""
+string(4) "8ead"
+string(14) "8ead26616d703b"
+string(6) "8ead80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fada1"
+string(6) "8fadfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aea1"
+string(4) "aefe"
+string(0) ""
+string(4) "8eae"
+string(14) "8eae26616d703b"
+string(6) "8eae80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8faea1"
+string(6) "8faefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "afa1"
+string(4) "affe"
+string(0) ""
+string(4) "8eaf"
+string(14) "8eaf26616d703b"
+string(6) "8eaf80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fafa1"
+string(6) "8faffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b0a1"
+string(4) "b0fe"
+string(0) ""
+string(4) "8eb0"
+string(14) "8eb026616d703b"
+string(6) "8eb080"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb0a1"
+string(6) "8fb0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b1a1"
+string(4) "b1fe"
+string(0) ""
+string(4) "8eb1"
+string(14) "8eb126616d703b"
+string(6) "8eb180"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb1a1"
+string(6) "8fb1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b2a1"
+string(4) "b2fe"
+string(0) ""
+string(4) "8eb2"
+string(14) "8eb226616d703b"
+string(6) "8eb280"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb2a1"
+string(6) "8fb2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b3a1"
+string(4) "b3fe"
+string(0) ""
+string(4) "8eb3"
+string(14) "8eb326616d703b"
+string(6) "8eb380"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb3a1"
+string(6) "8fb3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b4a1"
+string(4) "b4fe"
+string(0) ""
+string(4) "8eb4"
+string(14) "8eb426616d703b"
+string(6) "8eb480"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb4a1"
+string(6) "8fb4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b5a1"
+string(4) "b5fe"
+string(0) ""
+string(4) "8eb5"
+string(14) "8eb526616d703b"
+string(6) "8eb580"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb5a1"
+string(6) "8fb5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b6a1"
+string(4) "b6fe"
+string(0) ""
+string(4) "8eb6"
+string(14) "8eb626616d703b"
+string(6) "8eb680"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb6a1"
+string(6) "8fb6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b7a1"
+string(4) "b7fe"
+string(0) ""
+string(4) "8eb7"
+string(14) "8eb726616d703b"
+string(6) "8eb780"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb7a1"
+string(6) "8fb7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b8a1"
+string(4) "b8fe"
+string(0) ""
+string(4) "8eb8"
+string(14) "8eb826616d703b"
+string(6) "8eb880"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb8a1"
+string(6) "8fb8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b9a1"
+string(4) "b9fe"
+string(0) ""
+string(4) "8eb9"
+string(14) "8eb926616d703b"
+string(6) "8eb980"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fb9a1"
+string(6) "8fb9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "baa1"
+string(4) "bafe"
+string(0) ""
+string(4) "8eba"
+string(14) "8eba26616d703b"
+string(6) "8eba80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fbaa1"
+string(6) "8fbafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bba1"
+string(4) "bbfe"
+string(0) ""
+string(4) "8ebb"
+string(14) "8ebb26616d703b"
+string(6) "8ebb80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fbba1"
+string(6) "8fbbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bca1"
+string(4) "bcfe"
+string(0) ""
+string(4) "8ebc"
+string(14) "8ebc26616d703b"
+string(6) "8ebc80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fbca1"
+string(6) "8fbcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bda1"
+string(4) "bdfe"
+string(0) ""
+string(4) "8ebd"
+string(14) "8ebd26616d703b"
+string(6) "8ebd80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fbda1"
+string(6) "8fbdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bea1"
+string(4) "befe"
+string(0) ""
+string(4) "8ebe"
+string(14) "8ebe26616d703b"
+string(6) "8ebe80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fbea1"
+string(6) "8fbefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bfa1"
+string(4) "bffe"
+string(0) ""
+string(4) "8ebf"
+string(14) "8ebf26616d703b"
+string(6) "8ebf80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fbfa1"
+string(6) "8fbffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c0a1"
+string(4) "c0fe"
+string(0) ""
+string(4) "8ec0"
+string(14) "8ec026616d703b"
+string(6) "8ec080"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc0a1"
+string(6) "8fc0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c1a1"
+string(4) "c1fe"
+string(0) ""
+string(4) "8ec1"
+string(14) "8ec126616d703b"
+string(6) "8ec180"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc1a1"
+string(6) "8fc1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c2a1"
+string(4) "c2fe"
+string(0) ""
+string(4) "8ec2"
+string(14) "8ec226616d703b"
+string(6) "8ec280"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc2a1"
+string(6) "8fc2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c3a1"
+string(4) "c3fe"
+string(0) ""
+string(4) "8ec3"
+string(14) "8ec326616d703b"
+string(6) "8ec380"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc3a1"
+string(6) "8fc3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c4a1"
+string(4) "c4fe"
+string(0) ""
+string(4) "8ec4"
+string(14) "8ec426616d703b"
+string(6) "8ec480"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc4a1"
+string(6) "8fc4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c5a1"
+string(4) "c5fe"
+string(0) ""
+string(4) "8ec5"
+string(14) "8ec526616d703b"
+string(6) "8ec580"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc5a1"
+string(6) "8fc5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c6a1"
+string(4) "c6fe"
+string(0) ""
+string(4) "8ec6"
+string(14) "8ec626616d703b"
+string(6) "8ec680"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc6a1"
+string(6) "8fc6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c7a1"
+string(4) "c7fe"
+string(0) ""
+string(4) "8ec7"
+string(14) "8ec726616d703b"
+string(6) "8ec780"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc7a1"
+string(6) "8fc7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c8a1"
+string(4) "c8fe"
+string(0) ""
+string(4) "8ec8"
+string(14) "8ec826616d703b"
+string(6) "8ec880"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc8a1"
+string(6) "8fc8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c9a1"
+string(4) "c9fe"
+string(0) ""
+string(4) "8ec9"
+string(14) "8ec926616d703b"
+string(6) "8ec980"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fc9a1"
+string(6) "8fc9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "caa1"
+string(4) "cafe"
+string(0) ""
+string(4) "8eca"
+string(14) "8eca26616d703b"
+string(6) "8eca80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fcaa1"
+string(6) "8fcafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cba1"
+string(4) "cbfe"
+string(0) ""
+string(4) "8ecb"
+string(14) "8ecb26616d703b"
+string(6) "8ecb80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fcba1"
+string(6) "8fcbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cca1"
+string(4) "ccfe"
+string(0) ""
+string(4) "8ecc"
+string(14) "8ecc26616d703b"
+string(6) "8ecc80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fcca1"
+string(6) "8fccfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cda1"
+string(4) "cdfe"
+string(0) ""
+string(4) "8ecd"
+string(14) "8ecd26616d703b"
+string(6) "8ecd80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fcda1"
+string(6) "8fcdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cea1"
+string(4) "cefe"
+string(0) ""
+string(4) "8ece"
+string(14) "8ece26616d703b"
+string(6) "8ece80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fcea1"
+string(6) "8fcefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cfa1"
+string(4) "cffe"
+string(0) ""
+string(4) "8ecf"
+string(14) "8ecf26616d703b"
+string(6) "8ecf80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fcfa1"
+string(6) "8fcffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d0a1"
+string(4) "d0fe"
+string(0) ""
+string(4) "8ed0"
+string(14) "8ed026616d703b"
+string(6) "8ed080"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd0a1"
+string(6) "8fd0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d1a1"
+string(4) "d1fe"
+string(0) ""
+string(4) "8ed1"
+string(14) "8ed126616d703b"
+string(6) "8ed180"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd1a1"
+string(6) "8fd1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d2a1"
+string(4) "d2fe"
+string(0) ""
+string(4) "8ed2"
+string(14) "8ed226616d703b"
+string(6) "8ed280"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd2a1"
+string(6) "8fd2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d3a1"
+string(4) "d3fe"
+string(0) ""
+string(4) "8ed3"
+string(14) "8ed326616d703b"
+string(6) "8ed380"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd3a1"
+string(6) "8fd3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d4a1"
+string(4) "d4fe"
+string(0) ""
+string(4) "8ed4"
+string(14) "8ed426616d703b"
+string(6) "8ed480"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd4a1"
+string(6) "8fd4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d5a1"
+string(4) "d5fe"
+string(0) ""
+string(4) "8ed5"
+string(14) "8ed526616d703b"
+string(6) "8ed580"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd5a1"
+string(6) "8fd5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d6a1"
+string(4) "d6fe"
+string(0) ""
+string(4) "8ed6"
+string(14) "8ed626616d703b"
+string(6) "8ed680"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd6a1"
+string(6) "8fd6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d7a1"
+string(4) "d7fe"
+string(0) ""
+string(4) "8ed7"
+string(14) "8ed726616d703b"
+string(6) "8ed780"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd7a1"
+string(6) "8fd7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d8a1"
+string(4) "d8fe"
+string(0) ""
+string(4) "8ed8"
+string(14) "8ed826616d703b"
+string(6) "8ed880"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd8a1"
+string(6) "8fd8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d9a1"
+string(4) "d9fe"
+string(0) ""
+string(4) "8ed9"
+string(14) "8ed926616d703b"
+string(6) "8ed980"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fd9a1"
+string(6) "8fd9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "daa1"
+string(4) "dafe"
+string(0) ""
+string(4) "8eda"
+string(14) "8eda26616d703b"
+string(6) "8eda80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fdaa1"
+string(6) "8fdafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dba1"
+string(4) "dbfe"
+string(0) ""
+string(4) "8edb"
+string(14) "8edb26616d703b"
+string(6) "8edb80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fdba1"
+string(6) "8fdbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dca1"
+string(4) "dcfe"
+string(0) ""
+string(4) "8edc"
+string(14) "8edc26616d703b"
+string(6) "8edc80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fdca1"
+string(6) "8fdcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dda1"
+string(4) "ddfe"
+string(0) ""
+string(4) "8edd"
+string(14) "8edd26616d703b"
+string(6) "8edd80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fdda1"
+string(6) "8fddfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dea1"
+string(4) "defe"
+string(0) ""
+string(4) "8ede"
+string(14) "8ede26616d703b"
+string(6) "8ede80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fdea1"
+string(6) "8fdefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dfa1"
+string(4) "dffe"
+string(0) ""
+string(4) "8edf"
+string(14) "8edf26616d703b"
+string(6) "8edf80"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fdfa1"
+string(6) "8fdffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e0a1"
+string(4) "e0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe0a1"
+string(6) "8fe0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e1a1"
+string(4) "e1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe1a1"
+string(6) "8fe1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e2a1"
+string(4) "e2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe2a1"
+string(6) "8fe2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e3a1"
+string(4) "e3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe3a1"
+string(6) "8fe3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e4a1"
+string(4) "e4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe4a1"
+string(6) "8fe4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e5a1"
+string(4) "e5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe5a1"
+string(6) "8fe5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e6a1"
+string(4) "e6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe6a1"
+string(6) "8fe6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e7a1"
+string(4) "e7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe7a1"
+string(6) "8fe7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e8a1"
+string(4) "e8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe8a1"
+string(6) "8fe8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e9a1"
+string(4) "e9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fe9a1"
+string(6) "8fe9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eaa1"
+string(4) "eafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8feaa1"
+string(6) "8feafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eba1"
+string(4) "ebfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8feba1"
+string(6) "8febfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eca1"
+string(4) "ecfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8feca1"
+string(6) "8fecfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eda1"
+string(4) "edfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8feda1"
+string(6) "8fedfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eea1"
+string(4) "eefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8feea1"
+string(6) "8feefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "efa1"
+string(4) "effe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8fefa1"
+string(6) "8feffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f0a1"
+string(4) "f0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff0a1"
+string(6) "8ff0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f1a1"
+string(4) "f1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff1a1"
+string(6) "8ff1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f2a1"
+string(4) "f2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff2a1"
+string(6) "8ff2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f3a1"
+string(4) "f3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff3a1"
+string(6) "8ff3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f4a1"
+string(4) "f4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff4a1"
+string(6) "8ff4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f5a1"
+string(4) "f5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff5a1"
+string(6) "8ff5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f6a1"
+string(4) "f6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff6a1"
+string(6) "8ff6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f7a1"
+string(4) "f7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff7a1"
+string(6) "8ff7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f8a1"
+string(4) "f8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff8a1"
+string(6) "8ff8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f9a1"
+string(4) "f9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ff9a1"
+string(6) "8ff9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "faa1"
+string(4) "fafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ffaa1"
+string(6) "8ffafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fba1"
+string(4) "fbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ffba1"
+string(6) "8ffbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fca1"
+string(4) "fcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ffca1"
+string(6) "8ffcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fda1"
+string(4) "fdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ffda1"
+string(6) "8ffdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fea1"
+string(4) "fefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(6) "8ffea1"
+string(6) "8ffefe"
+string(0) ""
+--
+BIG5: non-lead byte >= 0x80
+string(2) "80"
+string(2) "ff"
+--
+BIG5: incomplete / invalid multibyte sequences
+string(0) ""
+string(0) ""
+string(4) "8140"
+string(4) "817e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "81a1"
+string(4) "81fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8240"
+string(4) "827e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "82a1"
+string(4) "82fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8340"
+string(4) "837e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "83a1"
+string(4) "83fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8440"
+string(4) "847e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "84a1"
+string(4) "84fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8540"
+string(4) "857e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "85a1"
+string(4) "85fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8640"
+string(4) "867e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "86a1"
+string(4) "86fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8740"
+string(4) "877e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "87a1"
+string(4) "87fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8840"
+string(4) "887e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "88a1"
+string(4) "88fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8940"
+string(4) "897e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "89a1"
+string(4) "89fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8a40"
+string(4) "8a7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8aa1"
+string(4) "8afe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8b40"
+string(4) "8b7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8ba1"
+string(4) "8bfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8c40"
+string(4) "8c7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8ca1"
+string(4) "8cfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8d40"
+string(4) "8d7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8da1"
+string(4) "8dfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8e40"
+string(4) "8e7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8ea1"
+string(4) "8efe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8f40"
+string(4) "8f7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "8fa1"
+string(4) "8ffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9040"
+string(4) "907e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "90a1"
+string(4) "90fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9140"
+string(4) "917e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "91a1"
+string(4) "91fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9240"
+string(4) "927e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "92a1"
+string(4) "92fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9340"
+string(4) "937e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "93a1"
+string(4) "93fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9440"
+string(4) "947e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "94a1"
+string(4) "94fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9540"
+string(4) "957e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "95a1"
+string(4) "95fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9640"
+string(4) "967e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "96a1"
+string(4) "96fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9740"
+string(4) "977e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "97a1"
+string(4) "97fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9840"
+string(4) "987e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "98a1"
+string(4) "98fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9940"
+string(4) "997e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "99a1"
+string(4) "99fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9a40"
+string(4) "9a7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9aa1"
+string(4) "9afe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9b40"
+string(4) "9b7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9ba1"
+string(4) "9bfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9c40"
+string(4) "9c7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9ca1"
+string(4) "9cfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9d40"
+string(4) "9d7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9da1"
+string(4) "9dfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9e40"
+string(4) "9e7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9ea1"
+string(4) "9efe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9f40"
+string(4) "9f7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "9fa1"
+string(4) "9ffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a040"
+string(4) "a07e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a0a1"
+string(4) "a0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a140"
+string(4) "a17e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a1a1"
+string(4) "a1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a240"
+string(4) "a27e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a2a1"
+string(4) "a2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a340"
+string(4) "a37e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a3a1"
+string(4) "a3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a440"
+string(4) "a47e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a4a1"
+string(4) "a4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a540"
+string(4) "a57e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a5a1"
+string(4) "a5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a640"
+string(4) "a67e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a6a1"
+string(4) "a6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a740"
+string(4) "a77e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a7a1"
+string(4) "a7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a840"
+string(4) "a87e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a8a1"
+string(4) "a8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a940"
+string(4) "a97e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "a9a1"
+string(4) "a9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aa40"
+string(4) "aa7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aaa1"
+string(4) "aafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ab40"
+string(4) "ab7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aba1"
+string(4) "abfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ac40"
+string(4) "ac7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aca1"
+string(4) "acfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ad40"
+string(4) "ad7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ada1"
+string(4) "adfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ae40"
+string(4) "ae7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "aea1"
+string(4) "aefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "af40"
+string(4) "af7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "afa1"
+string(4) "affe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b040"
+string(4) "b07e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b0a1"
+string(4) "b0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b140"
+string(4) "b17e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b1a1"
+string(4) "b1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b240"
+string(4) "b27e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b2a1"
+string(4) "b2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b340"
+string(4) "b37e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b3a1"
+string(4) "b3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b440"
+string(4) "b47e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b4a1"
+string(4) "b4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b540"
+string(4) "b57e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b5a1"
+string(4) "b5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b640"
+string(4) "b67e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b6a1"
+string(4) "b6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b740"
+string(4) "b77e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b7a1"
+string(4) "b7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b840"
+string(4) "b87e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b8a1"
+string(4) "b8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b940"
+string(4) "b97e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "b9a1"
+string(4) "b9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ba40"
+string(4) "ba7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "baa1"
+string(4) "bafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bb40"
+string(4) "bb7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bba1"
+string(4) "bbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bc40"
+string(4) "bc7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bca1"
+string(4) "bcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bd40"
+string(4) "bd7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bda1"
+string(4) "bdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "be40"
+string(4) "be7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bea1"
+string(4) "befe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bf40"
+string(4) "bf7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "bfa1"
+string(4) "bffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c040"
+string(4) "c07e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c0a1"
+string(4) "c0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c140"
+string(4) "c17e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c1a1"
+string(4) "c1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c240"
+string(4) "c27e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c2a1"
+string(4) "c2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c340"
+string(4) "c37e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c3a1"
+string(4) "c3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c440"
+string(4) "c47e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c4a1"
+string(4) "c4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c540"
+string(4) "c57e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c5a1"
+string(4) "c5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c640"
+string(4) "c67e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c6a1"
+string(4) "c6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c740"
+string(4) "c77e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c7a1"
+string(4) "c7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c840"
+string(4) "c87e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c8a1"
+string(4) "c8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c940"
+string(4) "c97e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "c9a1"
+string(4) "c9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ca40"
+string(4) "ca7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "caa1"
+string(4) "cafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cb40"
+string(4) "cb7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cba1"
+string(4) "cbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cc40"
+string(4) "cc7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cca1"
+string(4) "ccfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cd40"
+string(4) "cd7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cda1"
+string(4) "cdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ce40"
+string(4) "ce7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cea1"
+string(4) "cefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cf40"
+string(4) "cf7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "cfa1"
+string(4) "cffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d040"
+string(4) "d07e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d0a1"
+string(4) "d0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d140"
+string(4) "d17e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d1a1"
+string(4) "d1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d240"
+string(4) "d27e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d2a1"
+string(4) "d2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d340"
+string(4) "d37e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d3a1"
+string(4) "d3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d440"
+string(4) "d47e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d4a1"
+string(4) "d4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d540"
+string(4) "d57e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d5a1"
+string(4) "d5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d640"
+string(4) "d67e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d6a1"
+string(4) "d6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d740"
+string(4) "d77e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d7a1"
+string(4) "d7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d840"
+string(4) "d87e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d8a1"
+string(4) "d8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d940"
+string(4) "d97e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "d9a1"
+string(4) "d9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "da40"
+string(4) "da7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "daa1"
+string(4) "dafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "db40"
+string(4) "db7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dba1"
+string(4) "dbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dc40"
+string(4) "dc7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dca1"
+string(4) "dcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dd40"
+string(4) "dd7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dda1"
+string(4) "ddfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "de40"
+string(4) "de7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dea1"
+string(4) "defe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "df40"
+string(4) "df7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "dfa1"
+string(4) "dffe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e040"
+string(4) "e07e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e0a1"
+string(4) "e0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e140"
+string(4) "e17e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e1a1"
+string(4) "e1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e240"
+string(4) "e27e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e2a1"
+string(4) "e2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e340"
+string(4) "e37e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e3a1"
+string(4) "e3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e440"
+string(4) "e47e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e4a1"
+string(4) "e4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e540"
+string(4) "e57e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e5a1"
+string(4) "e5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e640"
+string(4) "e67e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e6a1"
+string(4) "e6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e740"
+string(4) "e77e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e7a1"
+string(4) "e7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e840"
+string(4) "e87e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e8a1"
+string(4) "e8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e940"
+string(4) "e97e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "e9a1"
+string(4) "e9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ea40"
+string(4) "ea7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eaa1"
+string(4) "eafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eb40"
+string(4) "eb7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eba1"
+string(4) "ebfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ec40"
+string(4) "ec7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eca1"
+string(4) "ecfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ed40"
+string(4) "ed7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eda1"
+string(4) "edfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ee40"
+string(4) "ee7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "eea1"
+string(4) "eefe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "ef40"
+string(4) "ef7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "efa1"
+string(4) "effe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f040"
+string(4) "f07e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f0a1"
+string(4) "f0fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f140"
+string(4) "f17e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f1a1"
+string(4) "f1fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f240"
+string(4) "f27e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f2a1"
+string(4) "f2fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f340"
+string(4) "f37e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f3a1"
+string(4) "f3fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f440"
+string(4) "f47e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f4a1"
+string(4) "f4fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f540"
+string(4) "f57e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f5a1"
+string(4) "f5fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f640"
+string(4) "f67e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f6a1"
+string(4) "f6fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f740"
+string(4) "f77e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f7a1"
+string(4) "f7fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f840"
+string(4) "f87e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f8a1"
+string(4) "f8fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f940"
+string(4) "f97e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "f9a1"
+string(4) "f9fe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fa40"
+string(4) "fa7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "faa1"
+string(4) "fafe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fb40"
+string(4) "fb7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fba1"
+string(4) "fbfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fc40"
+string(4) "fc7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fca1"
+string(4) "fcfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fd40"
+string(4) "fd7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fda1"
+string(4) "fdfe"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fe40"
+string(4) "fe7e"
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "fea1"
+string(4) "fefe"
+string(0) ""
diff --git a/ext/standard/tests/strings/bug50052.phpt b/ext/standard/tests/strings/bug50052.phpt
new file mode 100644
index 0000000..96d8599
--- /dev/null
+++ b/ext/standard/tests/strings/bug50052.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size)
+--FILE--
+<?php
+$salt = '$1$f+uslYF01$';
+$password = 'test';
+echo $salt . "\n";
+echo crypt($password,$salt) . "\n";
+?>
+--EXPECT--
+$1$f+uslYF01$
+$1$f+uslYF0$orVloNmKSLvOeswusE0bY.
diff --git a/ext/standard/tests/strings/bug50847.phpt b/ext/standard/tests/strings/bug50847.phpt
new file mode 100644
index 0000000..28e83f5
--- /dev/null
+++ b/ext/standard/tests/strings/bug50847.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #50847 (strip_tags() removes all tags greater then 1023 bytes long)
+--FILE--
+<?php
+$var = '<param value="' . str_repeat("a", 2048) . '" />';
+var_dump(strip_tags($var, "<param>"), strip_tags($var));
+?>
+--EXPECT--
+string(2066) "<param value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" />"
+string(0) ""
diff --git a/ext/standard/tests/strings/bug51059.phpt b/ext/standard/tests/strings/bug51059.phpt
new file mode 100644
index 0000000..bdc56f1
--- /dev/null
+++ b/ext/standard/tests/strings/bug51059.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #51059 crypt() segfaults on certain salts
+--FILE--
+<?php
+$res = crypt(b'a', b'_');
+if ($res === b'*0' || $res === b'*1') echo 'OK';
+else echo 'Not OK';
+
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/strings/bug51899.phpt b/ext/standard/tests/strings/bug51899.phpt
new file mode 100644
index 0000000..fb430cf
--- /dev/null
+++ b/ext/standard/tests/strings/bug51899.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #51899 (Parse error in parse_ini_file() function when empy value followed by no newline)
+--FILE--
+<?php
+
+var_dump(parse_ini_string('a='));
+var_dump(parse_ini_string('a= '));
+var_dump(parse_ini_string('a='.PHP_EOL));
+var_dump(parse_ini_string('a=b '));
+var_dump(parse_ini_string(''));
+var_dump(parse_ini_string(NULL));
+var_dump(parse_ini_string("\0"));
+
+?>
+--EXPECT--
+array(1) {
+ ["a"]=>
+ string(0) ""
+}
+array(1) {
+ ["a"]=>
+ string(0) ""
+}
+array(1) {
+ ["a"]=>
+ string(0) ""
+}
+array(1) {
+ ["a"]=>
+ string(2) "b "
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
diff --git a/ext/standard/tests/strings/bug53021.phpt b/ext/standard/tests/strings/bug53021.phpt
new file mode 100644
index 0000000..4a8fbe4
--- /dev/null
+++ b/ext/standard/tests/strings/bug53021.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1)
+--FILE--
+<?php
+var_dump(unpack("H*",html_entity_decode("&#233;", ENT_QUOTES, "ISO-8859-1")));
+echo "double quotes variations:", "\n";
+echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";
+
+echo "\nsingle quotes variations:", "\n";
+echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";
+--EXPECT--
+array(1) {
+ [1]=>
+ string(2) "e9"
+}
+double quotes variations:
+&quot;
+&#34;
+"
+"
+"
+"
+
+single quotes variations:
+&#39;
+'
+&#39;
diff --git a/ext/standard/tests/strings/bug53319.phpt b/ext/standard/tests/strings/bug53319.phpt
new file mode 100644
index 0000000..0bcc06d
--- /dev/null
+++ b/ext/standard/tests/strings/bug53319.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #53319 (Strip_tags() may strip '<br />' incorrectly)
+--FILE--
+<?php
+
+$str = '<br /><br />USD<input type="text"/><br/>CDN<br><input type="text" />';
+var_dump(strip_tags($str, '<input>'));
+var_dump(strip_tags($str, '<br><input>') === $str);
+var_dump(strip_tags($str));
+var_dump(strip_tags('<a/b>', '<a>'));
+
+?>
+--EXPECTF--
+string(47) "USD<input type="text"/>CDN<input type="text" />"
+bool(true)
+string(6) "USDCDN"
+string(0) ""
diff --git a/ext/standard/tests/strings/bug54055.phpt b/ext/standard/tests/strings/bug54055.phpt
new file mode 100644
index 0000000..7124c46
--- /dev/null
+++ b/ext/standard/tests/strings/bug54055.phpt
@@ -0,0 +1,589 @@
+--TEST--
+Bug #54055: PHP crashes when executing strval when precision setting is very high
+--FILE--
+<?php
+for($i = 495; $i <= 1074; $i++) {
+ ini_set('precision', $i);
+ echo "$i: len=", strlen(strval(-1 * pow(2, -1074))), "\n";
+}
+--EXPECT--
+495: len=502
+496: len=503
+497: len=504
+498: len=505
+499: len=506
+500: len=507
+501: len=507
+502: len=507
+503: len=507
+504: len=507
+505: len=507
+506: len=507
+507: len=507
+508: len=507
+509: len=507
+510: len=507
+511: len=507
+512: len=507
+513: len=507
+514: len=507
+515: len=507
+516: len=507
+517: len=507
+518: len=507
+519: len=507
+520: len=507
+521: len=507
+522: len=507
+523: len=507
+524: len=507
+525: len=507
+526: len=507
+527: len=507
+528: len=507
+529: len=507
+530: len=507
+531: len=507
+532: len=507
+533: len=507
+534: len=507
+535: len=507
+536: len=507
+537: len=507
+538: len=507
+539: len=507
+540: len=507
+541: len=507
+542: len=507
+543: len=507
+544: len=507
+545: len=507
+546: len=507
+547: len=507
+548: len=507
+549: len=507
+550: len=507
+551: len=507
+552: len=507
+553: len=507
+554: len=507
+555: len=507
+556: len=507
+557: len=507
+558: len=507
+559: len=507
+560: len=507
+561: len=507
+562: len=507
+563: len=507
+564: len=507
+565: len=507
+566: len=507
+567: len=507
+568: len=507
+569: len=507
+570: len=507
+571: len=507
+572: len=507
+573: len=507
+574: len=507
+575: len=507
+576: len=507
+577: len=507
+578: len=507
+579: len=507
+580: len=507
+581: len=507
+582: len=507
+583: len=507
+584: len=507
+585: len=507
+586: len=507
+587: len=507
+588: len=507
+589: len=507
+590: len=507
+591: len=507
+592: len=507
+593: len=507
+594: len=507
+595: len=507
+596: len=507
+597: len=507
+598: len=507
+599: len=507
+600: len=507
+601: len=507
+602: len=507
+603: len=507
+604: len=507
+605: len=507
+606: len=507
+607: len=507
+608: len=507
+609: len=507
+610: len=507
+611: len=507
+612: len=507
+613: len=507
+614: len=507
+615: len=507
+616: len=507
+617: len=507
+618: len=507
+619: len=507
+620: len=507
+621: len=507
+622: len=507
+623: len=507
+624: len=507
+625: len=507
+626: len=507
+627: len=507
+628: len=507
+629: len=507
+630: len=507
+631: len=507
+632: len=507
+633: len=507
+634: len=507
+635: len=507
+636: len=507
+637: len=507
+638: len=507
+639: len=507
+640: len=507
+641: len=507
+642: len=507
+643: len=507
+644: len=507
+645: len=507
+646: len=507
+647: len=507
+648: len=507
+649: len=507
+650: len=507
+651: len=507
+652: len=507
+653: len=507
+654: len=507
+655: len=507
+656: len=507
+657: len=507
+658: len=507
+659: len=507
+660: len=507
+661: len=507
+662: len=507
+663: len=507
+664: len=507
+665: len=507
+666: len=507
+667: len=507
+668: len=507
+669: len=507
+670: len=507
+671: len=507
+672: len=507
+673: len=507
+674: len=507
+675: len=507
+676: len=507
+677: len=507
+678: len=507
+679: len=507
+680: len=507
+681: len=507
+682: len=507
+683: len=507
+684: len=507
+685: len=507
+686: len=507
+687: len=507
+688: len=507
+689: len=507
+690: len=507
+691: len=507
+692: len=507
+693: len=507
+694: len=507
+695: len=507
+696: len=507
+697: len=507
+698: len=507
+699: len=507
+700: len=507
+701: len=507
+702: len=507
+703: len=507
+704: len=507
+705: len=507
+706: len=507
+707: len=507
+708: len=507
+709: len=507
+710: len=507
+711: len=507
+712: len=507
+713: len=507
+714: len=507
+715: len=507
+716: len=507
+717: len=507
+718: len=507
+719: len=507
+720: len=507
+721: len=507
+722: len=507
+723: len=507
+724: len=507
+725: len=507
+726: len=507
+727: len=507
+728: len=507
+729: len=507
+730: len=507
+731: len=507
+732: len=507
+733: len=507
+734: len=507
+735: len=507
+736: len=507
+737: len=507
+738: len=507
+739: len=507
+740: len=507
+741: len=507
+742: len=507
+743: len=507
+744: len=507
+745: len=507
+746: len=507
+747: len=507
+748: len=507
+749: len=507
+750: len=507
+751: len=507
+752: len=507
+753: len=507
+754: len=507
+755: len=507
+756: len=507
+757: len=507
+758: len=507
+759: len=507
+760: len=507
+761: len=507
+762: len=507
+763: len=507
+764: len=507
+765: len=507
+766: len=507
+767: len=507
+768: len=507
+769: len=507
+770: len=507
+771: len=507
+772: len=507
+773: len=507
+774: len=507
+775: len=507
+776: len=507
+777: len=507
+778: len=507
+779: len=507
+780: len=507
+781: len=507
+782: len=507
+783: len=507
+784: len=507
+785: len=507
+786: len=507
+787: len=507
+788: len=507
+789: len=507
+790: len=507
+791: len=507
+792: len=507
+793: len=507
+794: len=507
+795: len=507
+796: len=507
+797: len=507
+798: len=507
+799: len=507
+800: len=507
+801: len=507
+802: len=507
+803: len=507
+804: len=507
+805: len=507
+806: len=507
+807: len=507
+808: len=507
+809: len=507
+810: len=507
+811: len=507
+812: len=507
+813: len=507
+814: len=507
+815: len=507
+816: len=507
+817: len=507
+818: len=507
+819: len=507
+820: len=507
+821: len=507
+822: len=507
+823: len=507
+824: len=507
+825: len=507
+826: len=507
+827: len=507
+828: len=507
+829: len=507
+830: len=507
+831: len=507
+832: len=507
+833: len=507
+834: len=507
+835: len=507
+836: len=507
+837: len=507
+838: len=507
+839: len=507
+840: len=507
+841: len=507
+842: len=507
+843: len=507
+844: len=507
+845: len=507
+846: len=507
+847: len=507
+848: len=507
+849: len=507
+850: len=507
+851: len=507
+852: len=507
+853: len=507
+854: len=507
+855: len=507
+856: len=507
+857: len=507
+858: len=507
+859: len=507
+860: len=507
+861: len=507
+862: len=507
+863: len=507
+864: len=507
+865: len=507
+866: len=507
+867: len=507
+868: len=507
+869: len=507
+870: len=507
+871: len=507
+872: len=507
+873: len=507
+874: len=507
+875: len=507
+876: len=507
+877: len=507
+878: len=507
+879: len=507
+880: len=507
+881: len=507
+882: len=507
+883: len=507
+884: len=507
+885: len=507
+886: len=507
+887: len=507
+888: len=507
+889: len=507
+890: len=507
+891: len=507
+892: len=507
+893: len=507
+894: len=507
+895: len=507
+896: len=507
+897: len=507
+898: len=507
+899: len=507
+900: len=507
+901: len=507
+902: len=507
+903: len=507
+904: len=507
+905: len=507
+906: len=507
+907: len=507
+908: len=507
+909: len=507
+910: len=507
+911: len=507
+912: len=507
+913: len=507
+914: len=507
+915: len=507
+916: len=507
+917: len=507
+918: len=507
+919: len=507
+920: len=507
+921: len=507
+922: len=507
+923: len=507
+924: len=507
+925: len=507
+926: len=507
+927: len=507
+928: len=507
+929: len=507
+930: len=507
+931: len=507
+932: len=507
+933: len=507
+934: len=507
+935: len=507
+936: len=507
+937: len=507
+938: len=507
+939: len=507
+940: len=507
+941: len=507
+942: len=507
+943: len=507
+944: len=507
+945: len=507
+946: len=507
+947: len=507
+948: len=507
+949: len=507
+950: len=507
+951: len=507
+952: len=507
+953: len=507
+954: len=507
+955: len=507
+956: len=507
+957: len=507
+958: len=507
+959: len=507
+960: len=507
+961: len=507
+962: len=507
+963: len=507
+964: len=507
+965: len=507
+966: len=507
+967: len=507
+968: len=507
+969: len=507
+970: len=507
+971: len=507
+972: len=507
+973: len=507
+974: len=507
+975: len=507
+976: len=507
+977: len=507
+978: len=507
+979: len=507
+980: len=507
+981: len=507
+982: len=507
+983: len=507
+984: len=507
+985: len=507
+986: len=507
+987: len=507
+988: len=507
+989: len=507
+990: len=507
+991: len=507
+992: len=507
+993: len=507
+994: len=507
+995: len=507
+996: len=507
+997: len=507
+998: len=507
+999: len=507
+1000: len=507
+1001: len=507
+1002: len=507
+1003: len=507
+1004: len=507
+1005: len=507
+1006: len=507
+1007: len=507
+1008: len=507
+1009: len=507
+1010: len=507
+1011: len=507
+1012: len=507
+1013: len=507
+1014: len=507
+1015: len=507
+1016: len=507
+1017: len=507
+1018: len=507
+1019: len=507
+1020: len=507
+1021: len=507
+1022: len=507
+1023: len=507
+1024: len=507
+1025: len=507
+1026: len=507
+1027: len=507
+1028: len=507
+1029: len=507
+1030: len=507
+1031: len=507
+1032: len=507
+1033: len=507
+1034: len=507
+1035: len=507
+1036: len=507
+1037: len=507
+1038: len=507
+1039: len=507
+1040: len=507
+1041: len=507
+1042: len=507
+1043: len=507
+1044: len=507
+1045: len=507
+1046: len=507
+1047: len=507
+1048: len=507
+1049: len=507
+1050: len=507
+1051: len=507
+1052: len=507
+1053: len=507
+1054: len=507
+1055: len=507
+1056: len=507
+1057: len=507
+1058: len=507
+1059: len=507
+1060: len=507
+1061: len=507
+1062: len=507
+1063: len=507
+1064: len=507
+1065: len=507
+1066: len=507
+1067: len=507
+1068: len=507
+1069: len=507
+1070: len=507
+1071: len=507
+1072: len=507
+1073: len=507
+1074: len=507
diff --git a/ext/standard/tests/strings/bug54238.phpt b/ext/standard/tests/strings/bug54238.phpt
new file mode 100644
index 0000000..0f60098
--- /dev/null
+++ b/ext/standard/tests/strings/bug54238.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #54238 (use-after-free in substr_replace())
+--INI--
+error_reporting=E_ALL&~E_NOTICE
+--FILE--
+<?php
+$f = array(array('A', 'A'));
+
+$z = substr_replace($f, $f, $f, 1);
+var_dump($z, $f);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(9) "AArrayray"
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "A"
+ }
+}
diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt
new file mode 100644
index 0000000..aead172
--- /dev/null
+++ b/ext/standard/tests/strings/bug54322.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion
+--FILE--
+<?php
+var_dump(
+get_html_translation_table(NAN, 0, "UTF-8") > 0
+);
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/strings/bug54332.phpt b/ext/standard/tests/strings/bug54332.phpt
new file mode 100644
index 0000000..122b387
--- /dev/null
+++ b/ext/standard/tests/strings/bug54332.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #54332 (Crash in zend_mm_check_ptr // Heap corruption)
+--FILE--
+<?php
+echo number_format(1e300, 2006, '', ' ') . "\n";
+?>
+--EXPECT--
+1 000 000 000 000 000 052 504 760 255 204 420 248 704 468 581 108 159 154 915 854 115 511 802 457 988 908 195 786 371 375 080 447 864 043 704 443 832 883 878 176 942 523 235 360 430 575 644 792 184 786 706 982 848 387 200 926 575 803 737 830 233 794 788 090 059 368 953 234 970 799 945 081 119 038 967 640 880 074 652 742 780 142 494 579 258 788 820 056 842 838 115 669 472 196 386 865 459 400 540 16000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
diff --git a/ext/standard/tests/strings/bug54454.phpt b/ext/standard/tests/strings/bug54454.phpt
new file mode 100644
index 0000000..88835c9
--- /dev/null
+++ b/ext/standard/tests/strings/bug54454.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #54454 (substr_compare incorrectly reports equality in some cases)
+--FILE--
+<?php
+var_dump(substr_compare('/', '/asd', 0, 4));
+?>
+--EXPECT--
+int(-3)
diff --git a/ext/standard/tests/strings/bug54721.phpt b/ext/standard/tests/strings/bug54721.phpt
new file mode 100644
index 0000000..3851df1
--- /dev/null
+++ b/ext/standard/tests/strings/bug54721.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #54721 (Different Hashes on Windows, BSD and Linux on wrong Salt size)
+--FILE--
+<?php
+echo crypt("", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+echo crypt("b", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+echo crypt("bu", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+echo crypt("bug", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+echo crypt("pass", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+echo crypt("buged", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+echo crypt("aaaaaaaaaaaaaaaaaaaaaaaaa ", '$1$dW0.is5.$10CH101gGOr1677ZYd517.') . "\n";
+?>
+--EXPECT--
+$1$dW0.is5.$I0iqTYHPzkP4YnRgnXxZW0
+$1$dW0.is5.$KaspRpPQ9U7Xb5Vv5c.WE/
+$1$dW0.is5.$X9G1x/Ep8zYQSrU4/lKUg.
+$1$dW0.is5.$wE5Rz/HxPtDMfqil6kK980
+$1$dW0.is5.$2E4/ZDY1vr73HqLl1bLs9.
+$1$dW0.is5.$lvGhphTQwqgKxWhWwYERr1
+$1$dW0.is5.$XzsWcLSBj2BvhOKH0xdpZ0
diff --git a/ext/standard/tests/strings/bug55674.phpt b/ext/standard/tests/strings/bug55674.phpt
new file mode 100644
index 0000000..72ece64
--- /dev/null
+++ b/ext/standard/tests/strings/bug55674.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #55674 (fgetcsv & str_getcsv skip empty fields in some tab-separated records)
+--FILE--
+<?php
+var_dump(str_getcsv("0\t\t\"2\"\n", "\t"));
+var_dump(str_getcsv("0\t \t'2'\n", "\t", "'"));
+var_dump(str_getcsv(",,,,"));
+var_dump(str_getcsv(" \t \t\t\t ", "\t"));
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "2"
+}
+array(3) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(1) " "
+ [2]=>
+ string(1) "2"
+}
+array(5) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+}
+array(5) {
+ [0]=>
+ string(1) " "
+ [1]=>
+ string(2) " "
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(1) " "
+}
diff --git a/ext/standard/tests/strings/bug55871.phpt b/ext/standard/tests/strings/bug55871.phpt
new file mode 100644
index 0000000..7b743fd
--- /dev/null
+++ b/ext/standard/tests/strings/bug55871.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #55871 (Interruption in substr_replace())
+--FILE--
+<?php
+class test1 {
+ public function __toString() {
+ preg_match('//', '', $GLOBALS['my_var']);
+ return '';
+ }
+}
+
+class test2 {
+ public function __toString() {
+ $GLOBALS['my_var'] += 0x08048000;
+ return '';
+ }
+}
+
+class test3 {
+ public function __toString() {
+ $GLOBALS['my_var'] .= "AAAAAAAA";
+ return '';
+ }
+}
+
+$my_var = str_repeat('A', 40);
+$out = substr_replace(array(&$my_var), array(new test1), 40, 0);
+var_dump($out);
+$my_var = str_repeat('A', 40);
+$out = substr_replace(array(&$my_var), array(new test2), 40, 0);
+var_dump($out);
+$my_var = str_repeat('A', 40);
+$out = substr_replace(array(&$my_var), array(new test3), 40, 0);
+var_dump($out);
+--EXPECTF--
+
+Warning: substr_replace(): Argument was modified while replacing in %s on line %d
+array(0) {
+}
+
+Warning: substr_replace(): Argument was modified while replacing in %s on line %d
+array(0) {
+}
+
+Warning: substr_replace(): Argument was modified while replacing in %s on line %d
+array(0) {
+}
diff --git a/ext/standard/tests/strings/bug60801.phpt b/ext/standard/tests/strings/bug60801.phpt
new file mode 100644
index 0000000..9587bda
--- /dev/null
+++ b/ext/standard/tests/strings/bug60801.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bug60965.phpt b/ext/standard/tests/strings/bug60965.phpt
new file mode 100644
index 0000000..57a3b1c
--- /dev/null
+++ b/ext/standard/tests/strings/bug60965.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #60965: Buffer overflow on htmlspecialchars/entities with $double=false
+--FILE--
+<?php
+echo htmlspecialchars('"""""""""""""""""""""""""""""""""""""""""""""&#x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005;',
+ENT_QUOTES, 'UTF-8', false), "\n";
+echo "Done.\n";
+--EXPECT--
+&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&#x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005;
+Done.
diff --git a/ext/standard/tests/strings/bug61374.phpt b/ext/standard/tests/strings/bug61374.phpt
new file mode 100644
index 0000000..b7fce11
--- /dev/null
+++ b/ext/standard/tests/strings/bug61374.phpt
@@ -0,0 +1,7 @@
+--TEST--
+Bug #61374: html_entity_decode tries to decode code points that don't exist in ISO-8859-1
+--FILE--
+<?php
+echo html_entity_decode('&OElig;', 0, 'ISO-8859-1');
+--EXPECT--
+&OElig;
diff --git a/ext/standard/tests/strings/bug61660.phpt b/ext/standard/tests/strings/bug61660.phpt
new file mode 100644
index 0000000..010ea47
--- /dev/null
+++ b/ext/standard/tests/strings/bug61660.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #61660: bin2hex(hex2bin($data)) != $data
+--FILE--
+<?php
+
+var_dump(hex2bin('123'));
+
+?>
+--EXPECTF--
+Warning: hex2bin(): Hexadecimal input string must have an even length in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/bug61764.phpt b/ext/standard/tests/strings/bug61764.phpt
new file mode 100644
index 0000000..dc44f25
--- /dev/null
+++ b/ext/standard/tests/strings/bug61764.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #61764: 'I' unpacks n as signed if n > 2^31-1 on LP64
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+--FILE--
+<?php
+//expected -30000 mod 2^32 = 4294937296, and not -30000
+//because we can represent 4294937296 with our PHP int type
+print_r(unpack('I', pack('L', -30000)));
+--EXPECT--
+Array
+(
+ [1] => 4294937296
+)
diff --git a/ext/standard/tests/strings/bug62443.phpt b/ext/standard/tests/strings/bug62443.phpt
new file mode 100644
index 0000000..9e0dc38
--- /dev/null
+++ b/ext/standard/tests/strings/bug62443.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #62443 Crypt SHA256/512 Segfaults With Malformed Salt
+--FILE--
+<?php
+crypt("foo", '$5$'.chr(0).'abc');
+crypt("foo", '$6$'.chr(0).'abc');
+echo "OK!";
+--EXPECT--
+OK!
diff --git a/ext/standard/tests/strings/bug62462.phpt b/ext/standard/tests/strings/bug62462.phpt
new file mode 100644
index 0000000..c6eb41a
--- /dev/null
+++ b/ext/standard/tests/strings/bug62462.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Multibyte characters shouldn't be split by soft line break added by quoted_printable_encode - 4 byte character test
+--FILE--
+<?php
+echo quoted_printable_encode(str_repeat("\xc4\x85", 77));
+?>
+
+==DONE==
+--EXPECT--
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
+=C4=85=C4=85=C4=85=C4=85=C4=85
+==DONE==
diff --git a/ext/standard/tests/strings/bug63943.phpt b/ext/standard/tests/strings/bug63943.phpt
new file mode 100644
index 0000000..6018879
--- /dev/null
+++ b/ext/standard/tests/strings/bug63943.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #63943 (Bad warning text from strpos() on empty needle)
+--FILE--
+<?php
+strpos("lllllll", '');
+?>
+--EXPECTF--
+Warning: strpos(): Empty needle in %sbug63943.php on line %d
diff --git a/ext/standard/tests/strings/chop_basic.phpt b/ext/standard/tests/strings/chop_basic.phpt
new file mode 100644
index 0000000..99a03cb
--- /dev/null
+++ b/ext/standard/tests/strings/chop_basic.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_error.phpt b/ext/standard/tests/strings/chop_error.phpt
new file mode 100644
index 0000000..71a1004
--- /dev/null
+++ b/ext/standard/tests/strings/chop_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test chop() function : error conditions
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : error conditions
+*/
+
+echo "*** Testing chop() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing chop() function with Zero arguments --\n";
+var_dump( chop() );
+
+// More than expected number of arguments
+echo "\n-- Testing chop() function with more than expected no. of arguments --\n";
+$str = 'string_val ';
+$charlist = 'string_val';
+$extra_arg = 10;
+
+var_dump( chop($str, $charlist, $extra_arg) );
+var_dump( $str );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : error conditions ***
+
+-- Testing chop() function with Zero arguments --
+
+Warning: chop() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing chop() function with more than expected no. of arguments --
+
+Warning: chop() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+string(11) "string_val "
+Done
diff --git a/ext/standard/tests/strings/chop_variation1.phpt b/ext/standard/tests/strings/chop_variation1.phpt
new file mode 100644
index 0000000..de5ecd8
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation1.phpt
@@ -0,0 +1,214 @@
+--TEST--
+Test chop() function : usage variations - unexpected values for str argument
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : with different unexpected values for $str argument passed to the function
+*/
+
+echo "*** Testing chop() : with unexpected values for str argument ***\n";
+// initialize all required variables
+
+$charlist = " @#$%1234567890";
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return " @#$%Object @#$%";
+ }
+}
+$sample_obj = new sample;
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // object
+ $sample_obj,
+
+ // resource
+ $file_handle
+);
+
+
+// loop through each element of the array and check the working of chop()
+// when $str arugment is supplied with different values
+
+echo "\n--- Testing chop() 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( chop($str) );
+ var_dump( chop($str, $charlist) );
+
+ $counter ++;
+}
+
+// closing the resource
+fclose( $file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing chop() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+string(0) ""
+-- Iteration 2 --
+string(1) "1"
+string(0) ""
+-- Iteration 3 --
+string(5) "12345"
+string(0) ""
+-- Iteration 4 --
+string(5) "-2345"
+string(1) "-"
+-- Iteration 5 --
+string(4) "10.5"
+string(3) "10."
+-- Iteration 6 --
+string(5) "-10.5"
+string(4) "-10."
+-- Iteration 7 --
+string(12) "101234567000"
+string(0) ""
+-- Iteration 8 --
+string(13) "1.07654321E-9"
+string(12) "1.07654321E-"
+-- Iteration 9 --
+string(3) "0.5"
+string(2) "0."
+-- Iteration 10 --
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(1) "1"
+string(0) ""
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+string(0) ""
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+string(0) ""
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+-- Iteration 23 --
+string(0) ""
+string(0) ""
+-- Iteration 24 --
+string(0) ""
+string(0) ""
+-- Iteration 25 --
+string(16) " @#$%Object @#$%"
+string(11) " @#$%Object"
+-- Iteration 26 --
+
+Warning: chop() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/chop_variation2.phpt b/ext/standard/tests/strings/chop_variation2.phpt
new file mode 100644
index 0000000..f0416e7
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation2.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test chop() function : usage variations - unexpected values for charlist argument
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : with different unexpected values for charlist argument passes to the function
+*/
+
+echo "*** Testing chop() : with different unexpected values for charlist argument ***\n";
+// initialize all required variables
+$str = 'hello world12345 ';
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "@# $%12345";
+ }
+}
+
+// defining a resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null values
+ 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 chop()
+// when $charlist arugment is supplied with different values
+
+echo "\n--- Testing chop() by supplying different values for 'charlist' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $charlist = $values [$index];
+
+ var_dump( chop($str, $charlist) );
+
+ $counter ++;
+}
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : with different unexpected values for charlist argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing chop() by supplying different values for 'charlist' argument ---
+-- Iteration 1 --
+string(17) "hello world12345 "
+-- Iteration 2 --
+string(17) "hello world12345 "
+-- Iteration 3 --
+string(17) "hello world12345 "
+-- Iteration 4 --
+string(17) "hello world12345 "
+-- Iteration 5 --
+string(17) "hello world12345 "
+-- Iteration 6 --
+string(17) "hello world12345 "
+-- Iteration 7 --
+string(17) "hello world12345 "
+-- Iteration 8 --
+string(17) "hello world12345 "
+-- Iteration 9 --
+string(17) "hello world12345 "
+-- Iteration 10 --
+
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(17) "hello world12345 "
+-- Iteration 16 --
+string(17) "hello world12345 "
+-- Iteration 17 --
+string(17) "hello world12345 "
+-- Iteration 18 --
+string(17) "hello world12345 "
+-- Iteration 19 --
+string(11) "hello world"
+-- Iteration 20 --
+string(17) "hello world12345 "
+-- Iteration 21 --
+string(17) "hello world12345 "
+-- Iteration 22 --
+string(17) "hello world12345 "
+-- Iteration 23 --
+string(17) "hello world12345 "
+-- Iteration 24 --
+
+Warning: chop() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+-- Iteration 25 --
+string(17) "hello world12345 "
+-- Iteration 26 --
+string(17) "hello world12345 "
+Done
diff --git a/ext/standard/tests/strings/chop_variation3.phpt b/ext/standard/tests/strings/chop_variation3.phpt
new file mode 100644
index 0000000..9509fb8
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_variation4.phpt b/ext/standard/tests/strings/chop_variation4.phpt
new file mode 100644
index 0000000..cd269df
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_variation5.phpt b/ext/standard/tests/strings/chop_variation5.phpt
new file mode 100644
index 0000000..8f283e3
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation5.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test chop() function : usage variations - miscellaneous arguments
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : with miscellaneous arguments
+*/
+
+echo "*** Testing chop() : with miscellaneous arguments ***\n";
+
+ var_dump ( chop("chop test \t\0 ") ); /* without second Argument */
+ var_dump ( chop("chop test " , "") ); /* no characters in second Argument */
+ var_dump ( chop("chop test ", NULL) ); /* with NULL as second Argument */
+ var_dump ( chop("chop test ", true) ); /* with boolean value as second Argument */
+ var_dump ( chop("chop test ", " ") ); /* with single space as second Argument */
+ var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
+ var_dump ( chop("chop testABCXYZ", "A..Z") ); /* with characters range as second Argument */
+ var_dump ( chop("chop test0123456789", "0..9") ); /* with numbers range as second Argument */
+ var_dump ( chop("chop test$#@", "#@$") ); /* with some special characters as second Argument */
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : with miscellaneous arguments ***
+string(9) "chop test"
+string(12) "chop test "
+string(17) "chop test "
+string(17) "chop test "
+string(9) "chop test"
+string(10) "chop test "
+string(9) "chop test"
+string(9) "chop test"
+string(9) "chop test"
+Done
diff --git a/ext/standard/tests/strings/chr_basic.phpt b/ext/standard/tests/strings/chr_basic.phpt
new file mode 100644
index 0000000..378b402
--- /dev/null
+++ b/ext/standard/tests/strings/chr_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test chr() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string chr ( int $ascii )
+ * Description: Return a specific character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing chr() : basic functionality ***\n";
+
+echo chr(72). chr(101) . chr(108) . chr(108). chr(111); // Hello
+echo chr(10); // "\n"
+echo "World";
+echo "\n";
+?>
+===DONE===
+--EXPECTF--
+*** Testing chr() : basic functionality ***
+Hello
+World
+===DONE===
diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt
new file mode 100644
index 0000000..d5fb974
--- /dev/null
+++ b/ext/standard/tests/strings/chr_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test chr() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string chr ( int $ascii )
+ * Description: Return a specific character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing chr() : error conditions ***\n";
+
+echo "\n-- Testing chr() function with no arguments --\n";
+var_dump( chr() );
+
+echo "\n-- Testing chr() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( chr(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing chr() : error conditions ***
+
+-- Testing chr() function with no arguments --
+
+Warning: Wrong parameter count for chr() in %s on line %d
+NULL
+
+-- Testing chr() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for chr() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt
new file mode 100644
index 0000000..b5015a0
--- /dev/null
+++ b/ext/standard/tests/strings/chr_ord.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chr_variation1.phpt b/ext/standard/tests/strings/chr_variation1.phpt
new file mode 100644
index 0000000..03adc49
--- /dev/null
+++ b/ext/standard/tests/strings/chr_variation1.phpt
@@ -0,0 +1,123 @@
+--TEST--
+Test chr() function : usage variations - test values for $ascii argument
+--FILE--
+<?php
+
+/* Prototype : string chr ( int $ascii )
+ * Description: Return a specific character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing chr() function: with unexpected inputs for 'ascii' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+
+ // float values
+/*5*/ 10.5,
+ -20.5,
+ 1.1234e6,
+
+ // array values
+/*8*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*15*/ NULL,
+ null,
+
+ // objects
+/*17*/ new sample(),
+
+ // resource
+/*18*/ $file_handle,
+
+ // undefined variable
+/*19*/ @$undefined_var,
+
+ // unset variable
+/*20*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test chr() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( bin2hex(chr($input)) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing chr() function: with unexpected inputs for 'ascii' argument ***
+-- Iteration 1 --
+string(2) "00"
+-- Iteration 2 --
+string(2) "01"
+-- Iteration 3 --
+string(2) "ff"
+-- Iteration 4 --
+string(2) "00"
+-- Iteration 5 --
+string(2) "0a"
+-- Iteration 6 --
+string(2) "ec"
+-- Iteration 7 --
+string(2) "48"
+-- Iteration 8 --
+string(2) "00"
+-- Iteration 9 --
+string(2) "00"
+-- Iteration 10 --
+string(2) "00"
+-- Iteration 11 --
+string(2) "01"
+-- Iteration 12 --
+string(2) "00"
+-- Iteration 13 --
+string(2) "01"
+-- Iteration 14 --
+string(2) "00"
+-- Iteration 15 --
+string(2) "00"
+-- Iteration 16 --
+string(2) "00"
+-- Iteration 17 --
+string(2) "00"
+-- Iteration 18 --
+string(2) "00"
+-- Iteration 19 --
+string(2) "00"
+-- Iteration 20 --
+string(2) "00"
+===DONE===
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
new file mode 100644
index 0000000..648388f
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split.phpt
@@ -0,0 +1,34 @@
+--TEST--
+chunk_split() function
+--FILE--
+<?php
+echo chunk_split('abc', 1, '-')."\n";
+echo chunk_split('foooooooooooooooo', 5)."\n";
+echo chunk_split(str_repeat('X', 2*76))."\n";
+echo chunk_split("test", 10, "|end") . "\n";
+
+$a=str_repeat("B", 65535);
+$b=1;
+$c=str_repeat("B", 65535);
+var_dump(chunk_split($a,$b,$c));
+
+$a=str_repeat("B", 65537);
+$b=1;
+$c=str_repeat("B", 65537);
+var_dump(chunk_split($a,$b,$c));
+
+
+?>
+--EXPECT--
+a-b-c-
+foooo
+ooooo
+ooooo
+oo
+
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+test|end
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/strings/chunk_split_basic.phpt b/ext/standard/tests/strings/chunk_split_basic.phpt
new file mode 100644
index 0000000..14ad782
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_basic.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test chunk_split() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+*/
+
+/*
+* Testing chunk_split() for basic functionality by passing all possible
+* arguments as well as with default arguments chunklen and ending
+*/
+
+echo "*** Testing chunk_split() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = 'Testing';
+$chunklen = 2;
+$ending = '##';
+
+// Calling chunk_split() with all possible arguments
+echo "-- Testing chunk_split() with all possible arguments --\n";
+var_dump( chunk_split($str, $chunklen, $ending) );
+
+
+// Calling chunk_split() with default ending string
+echo "-- Testing chunk_split() with default ending string --\n";
+var_dump( chunk_split($str, $chunklen) );
+
+
+//Calling chunk_split() with default chunklen and ending string
+echo "-- Testing chunk_split() with default chunklen and ending string --\n";
+var_dump( chunk_split($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : basic functionality ***
+-- Testing chunk_split() with all possible arguments --
+string(15) "Te##st##in##g##"
+-- Testing chunk_split() with default ending string --
+string(15) "Te
+st
+in
+g
+"
+-- Testing chunk_split() with default chunklen and ending string --
+string(9) "Testing
+"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_error.phpt b/ext/standard/tests/strings/chunk_split_error.phpt
new file mode 100644
index 0000000..9313b65
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test chunk_split() function : error conditions
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing error conditions of chunk_split() with zero arguments
+* and for more than expected number of argments
+*/
+
+echo "*** Testing chunk_split() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing chunk_split() function with Zero arguments --";
+var_dump( chunk_split() );
+
+// With one more than the expected number of arguments
+$str = 'Testing chunk_split';
+$chunklen = 5;
+$ending = '***';
+$extra_arg = 10;
+echo "-- Testing chunk_split() function with more than expected no. of arguments --";
+var_dump( chunk_split($str, $chunklen, $ending, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : error conditions ***
+-- Testing chunk_split() function with Zero arguments --
+Warning: chunk_split() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing chunk_split() function with more than expected no. of arguments --
+Warning: chunk_split() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation1.phpt b/ext/standard/tests/strings/chunk_split_variation1.phpt
new file mode 100644
index 0000000..5f41c86
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation1.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test chunk_split() function : usage variations - with unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line %d%d
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : with unexpected values for 'str' argument ***\n";
+
+// Initialising variables
+$chunklen = 2;
+$ending = ' ';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'str'
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $fp
+);
+
+// loop through each element of the array for 'str'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( chunk_split($values[$count], $chunklen, $ending) );
+};
+
+echo "Done";
+
+// close the resource
+fclose($fp);
+
+?>
+--EXPECTF--
+*** Testing chunk_split() : with unexpected values for 'str' argument ***
+-- Iteration 1 --
+string(2) "0 "
+-- Iteration 2 --
+string(2) "1 "
+-- Iteration 3 --
+string(8) "12 34 5 "
+-- Iteration 4 --
+string(8) "-2 34 5 "
+-- Iteration 5 --
+string(6) "10 .5 "
+-- Iteration 6 --
+string(8) "-1 0. 5 "
+-- Iteration 7 --
+string(18) "10 12 34 56 70 00 "
+-- Iteration 8 --
+string(20) "1. 07 65 43 21 E- 9 "
+-- Iteration 9 --
+string(5) "0. 5 "
+-- Iteration 10 --
+
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
+-- Iteration 11 --
+
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
+-- Iteration 12 --
+
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
+-- Iteration 13 --
+
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
+-- Iteration 14 --
+
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
+-- Iteration 15 --
+string(1) " "
+-- Iteration 16 --
+string(1) " "
+-- Iteration 17 --
+string(2) "1 "
+-- Iteration 18 --
+string(1) " "
+-- Iteration 19 --
+string(2) "1 "
+-- Iteration 20 --
+string(1) " "
+-- Iteration 21 --
+string(1) " "
+-- Iteration 22 --
+string(1) " "
+-- Iteration 23 --
+string(9) "st ri ng "
+-- Iteration 24 --
+string(9) "st ri ng "
+-- Iteration 25 --
+string(9) "ob je ct "
+-- Iteration 26 --
+string(1) " "
+-- Iteration 27 --
+string(1) " "
+-- Iteration 28 --
+
+Warning: chunk_split() expects parameter 1 to be string, resource given in %s on line 87
+NULL
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation10.phpt b/ext/standard/tests/strings/chunk_split_variation10.phpt
new file mode 100644
index 0000000..36b9fe8
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation10.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test chunk_split() function : usage variations - different single quoted strings for 'ending' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different single quoted strings for 'ending' arguments to chunk_split()
+* 'chunklen' is set to 9.2 for this testcase
+*/
+
+echo "*** Testing chunk_split() : different single quoted strings as 'ending' ***\n";
+
+
+//Initializing variables
+$str = "This is to test chunk_split() with various 'single quoted' ending string.";
+$chunklen = 9.2;
+
+//different values for 'ending' argument
+$values = array (
+ '', //empty
+ ' ', //space
+ 'a', //Single char
+ 'ENDING', //String
+ '@#$%^', //Special chars
+
+
+ '\t',
+ '\n',
+ '\r',
+ '\r\n',
+
+ '\0', //Null char
+ '123', //Numeric
+ '(MSG)', //With ( and )
+ ') ending string (', //sentence as ending string
+ ') numbers 1234 (', //string with numbers
+ ') speci@! ch@r$ (' //string with special chars
+);
+
+
+//loop through each element of values for 'ending'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chunk_split($str, $chunklen, $values[$count]) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different single quoted strings as 'ending' ***
+-- Iteration 0 --
+string(73) "This is to test chunk_split() with various 'single quoted' ending string."
+-- Iteration 1 --
+string(82) "This is t o test ch unk_split () with v arious 's ingle quo ted' endi ng string . "
+-- Iteration 2 --
+string(82) "This is tao test chaunk_splita() with vaarious 'saingle quoated' endiang stringa.a"
+-- Iteration 3 --
+string(127) "This is tENDINGo test chENDINGunk_splitENDING() with vENDINGarious 'sENDINGingle quoENDINGted' endiENDINGng stringENDING.ENDING"
+-- Iteration 4 --
+string(118) "This is t@#$%^o test ch@#$%^unk_split@#$%^() with v@#$%^arious 's@#$%^ingle quo@#$%^ted' endi@#$%^ng string@#$%^.@#$%^"
+-- Iteration 5 --
+string(91) "This is t\to test ch\tunk_split\t() with v\tarious 's\tingle quo\tted' endi\tng string\t.\t"
+-- Iteration 6 --
+string(91) "This is t\no test ch\nunk_split\n() with v\narious 's\ningle quo\nted' endi\nng string\n.\n"
+-- Iteration 7 --
+string(91) "This is t\ro test ch\runk_split\r() with v\rarious 's\ringle quo\rted' endi\rng string\r.\r"
+-- Iteration 8 --
+string(109) "This is t\r\no test ch\r\nunk_split\r\n() with v\r\narious 's\r\ningle quo\r\nted' endi\r\nng string\r\n.\r\n"
+-- Iteration 9 --
+string(91) "This is t\0o test ch\0unk_split\0() with v\0arious 's\0ingle quo\0ted' endi\0ng string\0.\0"
+-- Iteration 10 --
+string(100) "This is t123o test ch123unk_split123() with v123arious 's123ingle quo123ted' endi123ng string123.123"
+-- Iteration 11 --
+string(118) "This is t(MSG)o test ch(MSG)unk_split(MSG)() with v(MSG)arious 's(MSG)ingle quo(MSG)ted' endi(MSG)ng string(MSG).(MSG)"
+-- Iteration 12 --
+string(226) "This is t) ending string (o test ch) ending string (unk_split) ending string (() with v) ending string (arious 's) ending string (ingle quo) ending string (ted' endi) ending string (ng string) ending string (.) ending string ("
+-- Iteration 13 --
+string(217) "This is t) numbers 1234 (o test ch) numbers 1234 (unk_split) numbers 1234 (() with v) numbers 1234 (arious 's) numbers 1234 (ingle quo) numbers 1234 (ted' endi) numbers 1234 (ng string) numbers 1234 (.) numbers 1234 ("
+-- Iteration 14 --
+string(226) "This is t) speci@! ch@r$ (o test ch) speci@! ch@r$ (unk_split) speci@! ch@r$ (() with v) speci@! ch@r$ (arious 's) speci@! ch@r$ (ingle quo) speci@! ch@r$ (ted' endi) speci@! ch@r$ (ng string) speci@! ch@r$ (.) speci@! ch@r$ ("
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation11.phpt b/ext/standard/tests/strings/chunk_split_variation11.phpt
new file mode 100644
index 0000000..418e607
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation11.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test chunk_split() function : usage variations - different strings for 'ending' with heredoc 'str'
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different strings for 'ending' and heredoc string as 'str' to chunk_split()
+* 'chunklen' is set to 6E0 for this testcase
+*/
+
+echo "*** Testing chunk_split() : different values for 'ending' with heredoc 'str'***\n";
+
+// Initializing required variables
+// heredoc string for 'str' argument
+$heredoc_str = <<<EOT
+This is heredoc string with \t and \n.It also contains
+sPeci@! ch@r$ :) & numbers 222.This is \k wrong escape char.
+EOT;
+
+$chunklen = 6E+0;
+
+//different values for 'ending'
+$values = array (
+ "", //empty
+ " ", //space
+ "a", //single char
+ "ENDING", //regular string
+ "\r\n", //White space char
+ "123", //Numeric
+ ")speci@! ch@r$(", //String with special chars
+);
+
+//loop through each values for 'ending'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split($heredoc_str, $chunklen, $values[$count]) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different values for 'ending' with heredoc 'str'***
+-- Iteration 1 --
+string(113) "This is heredoc string with and
+.It also contains
+sPeci@! ch@r$ :) & numbers 222.This is \k wrong escape char."
+-- Iteration 2 --
+string(132) "This i s here doc st ring w ith and
+. It als o cont ains
+s Peci@! ch@r$ :) & number s 222. This i s \k w rong e scape char. "
+-- Iteration 3 --
+string(132) "This ias hereadoc staring waith aand
+.aIt alsao contaains
+saPeci@!a ch@r$a :) & anumberas 222.aThis ias \k warong eascape achar.a"
+-- Iteration 4 --
+string(227) "This iENDINGs hereENDINGdoc stENDINGring wENDINGith ENDINGand
+.ENDINGIt alsENDINGo contENDINGains
+sENDINGPeci@!ENDING ch@r$ENDING :) & ENDINGnumberENDINGs 222.ENDINGThis iENDINGs \k wENDINGrong eENDINGscape ENDINGchar.ENDING"
+-- Iteration 5 --
+string(151) "This i
+s here
+doc st
+ring w
+ith
+and
+.
+It als
+o cont
+ains
+s
+Peci@!
+ ch@r$
+ :) &
+number
+s 222.
+This i
+s \k w
+rong e
+scape
+char.
+"
+-- Iteration 6 --
+string(170) "This i123s here123doc st123ring w123ith 123and
+.123It als123o cont123ains
+s123Peci@!123 ch@r$123 :) & 123number123s 222.123This i123s \k w123rong e123scape 123char.123"
+-- Iteration 7 --
+string(398) "This i)speci@! ch@r$(s here)speci@! ch@r$(doc st)speci@! ch@r$(ring w)speci@! ch@r$(ith )speci@! ch@r$(and
+.)speci@! ch@r$(It als)speci@! ch@r$(o cont)speci@! ch@r$(ains
+s)speci@! ch@r$(Peci@!)speci@! ch@r$( ch@r$)speci@! ch@r$( :) & )speci@! ch@r$(number)speci@! ch@r$(s 222.)speci@! ch@r$(This i)speci@! ch@r$(s \k w)speci@! ch@r$(rong e)speci@! ch@r$(scape )speci@! ch@r$(char.)speci@! ch@r$("
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation12.phpt b/ext/standard/tests/strings/chunk_split_variation12.phpt
new file mode 100644
index 0000000..e902875
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation12.phpt
@@ -0,0 +1,145 @@
+--TEST--
+Test chunk_split() function : usage variations - different heredoc strings for 'ending' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different heredoc strings as 'ending' argument to chunk_split()
+* 'chunklen' argument is set to 10
+*/
+
+echo "*** Testing chunk_split() : different heredoc strings for 'ending' argument ***\n";
+
+// Initializing required variables
+$chunklen = 10;
+$str = "This is str to check with heredoc ending.This\tcontains,\nspeci@! ch@r$ __with wrong \k escape char 222.";
+
+// Null heredoc string
+$heredoc_null = <<<EOT1
+EOT1;
+
+// heredoc string with single character
+$heredoc_char = <<<EOT2
+a
+EOT2;
+
+// simple heredoc string
+$heredoc_str = <<<EOT3
+This is simple heredoc string
+EOT3;
+
+// heredoc with special characters
+$heredoc_spchar = <<<EOT4
+This checks with $, %, &, chars
+EOT4;
+
+// blank heredoc string
+$heredoc_blank = <<<EOT5
+
+EOT5;
+
+// heredoc with different white space characters
+$heredoc_escchar = <<<EOT6
+This checks\t and \nwhite space chars
+EOT6;
+
+// heredoc with multiline
+$heredoc_multiline= <<<EOT7
+This is to check chunk_split
+function with multiline
+heredoc
+EOT7;
+
+// heredoc with quotes and slashes
+$heredoc_quote_slash = <<<EOT8
+"To check " in heredoc".I'm sure it'll \work!
+EOT8;
+
+// different heredoc strings for 'ending'
+$heredoc_arr = array(
+ $heredoc_null,
+ $heredoc_blank,
+ $heredoc_char,
+ $heredoc_str,
+ $heredoc_multiline,
+ $heredoc_spchar,
+ $heredoc_escchar,
+ $heredoc_quote_slash
+);
+
+
+// loop through each element of the heredoc_arr for str
+$count = 0;
+foreach($heredoc_arr as $value) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split( $str, $chunklen, $value) );
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different heredoc strings for 'ending' argument ***
+-- Iteration 1 --
+string(102) "This is str to check with heredoc ending.This contains,
+speci@! ch@r$ __with wrong \k escape char 222."
+-- Iteration 2 --
+string(102) "This is str to check with heredoc ending.This contains,
+speci@! ch@r$ __with wrong \k escape char 222."
+-- Iteration 3 --
+string(113) "This is star to checka with hereadoc endinga.This contaains,
+specai@! ch@r$ a__with wroang \k escaape char 22a2.a"
+-- Iteration 4 --
+string(421) "This is stThis is simple heredoc stringr to checkThis is simple heredoc string with hereThis is simple heredoc stringdoc endingThis is simple heredoc string.This contThis is simple heredoc stringains,
+specThis is simple heredoc stringi@! ch@r$ This is simple heredoc string__with wroThis is simple heredoc stringng \k escaThis is simple heredoc stringpe char 22This is simple heredoc string2.This is simple heredoc string"
+-- Iteration 5 --
+string(762) "This is stThis is to check chunk_split
+function with multiline
+heredocr to checkThis is to check chunk_split
+function with multiline
+heredoc with hereThis is to check chunk_split
+function with multiline
+heredocdoc endingThis is to check chunk_split
+function with multiline
+heredoc.This contThis is to check chunk_split
+function with multiline
+heredocains,
+specThis is to check chunk_split
+function with multiline
+heredoci@! ch@r$ This is to check chunk_split
+function with multiline
+heredoc__with wroThis is to check chunk_split
+function with multiline
+heredocng \k escaThis is to check chunk_split
+function with multiline
+heredocpe char 22This is to check chunk_split
+function with multiline
+heredoc2.This is to check chunk_split
+function with multiline
+heredoc"
+-- Iteration 6 --
+string(443) "This is stThis checks with $, %, &, charsr to checkThis checks with $, %, &, chars with hereThis checks with $, %, &, charsdoc endingThis checks with $, %, &, chars.This contThis checks with $, %, &, charsains,
+specThis checks with $, %, &, charsi@! ch@r$ This checks with $, %, &, chars__with wroThis checks with $, %, &, charsng \k escaThis checks with $, %, &, charspe char 22This checks with $, %, &, chars2.This checks with $, %, &, chars"
+-- Iteration 7 --
+string(487) "This is stThis checks and
+white space charsr to checkThis checks and
+white space chars with hereThis checks and
+white space charsdoc endingThis checks and
+white space chars.This contThis checks and
+white space charsains,
+specThis checks and
+white space charsi@! ch@r$ This checks and
+white space chars__with wroThis checks and
+white space charsng \k escaThis checks and
+white space charspe char 22This checks and
+white space chars2.This checks and
+white space chars"
+-- Iteration 8 --
+string(597) "This is st"To check " in heredoc".I'm sure it'll \work!r to check"To check " in heredoc".I'm sure it'll \work! with here"To check " in heredoc".I'm sure it'll \work!doc ending"To check " in heredoc".I'm sure it'll \work!.This cont"To check " in heredoc".I'm sure it'll \work!ains,
+spec"To check " in heredoc".I'm sure it'll \work!i@! ch@r$ "To check " in heredoc".I'm sure it'll \work!__with wro"To check " in heredoc".I'm sure it'll \work!ng \k esca"To check " in heredoc".I'm sure it'll \work!pe char 22"To check " in heredoc".I'm sure it'll \work!2."To check " in heredoc".I'm sure it'll \work!"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation13.phpt b/ext/standard/tests/strings/chunk_split_variation13.phpt
new file mode 100644
index 0000000..3cbcbe4
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation13.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test chunk_split() function : usage variations - default 'chunklen' with long string as 'str'argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+*/
+
+/*
+* passing long string as 'str' and testing default value of chunklen which is 76
+*/
+
+echo "*** Testing chunk_split() : default 'chunklen' with long string 'str' ***\n";
+
+//Initializing variables
+$values = array (
+ "123456789012345678901234567890123456789012345678901234567890123456789012345678901",
+ "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
+);
+
+//loop through each element of values for 'str' and default value of 'chunklen'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chunk_split($values[$count]) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : default 'chunklen' with long string 'str' ***
+-- Iteration 0 --
+string(85) "1234567890123456789012345678901234567890123456789012345678901234567890123456
+78901
+"
+-- Iteration 1 --
+string(217) "1234567890123456789012345678901234567890123456789012345678901234567890123456
+7890123456789012345678901234567890123456789012345678901234567890123456789012
+34567890123456789012345678901234567890123456789012345678901
+"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt
new file mode 100644
index 0000000..d49ec3b
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation2.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796)
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : with unexpected values for 'chunklen' argument ***\n";
+
+// Initialise function arguments
+$str = 'This is chuklen variation';
+$ending = '*';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get resource variable
+$fp = fopen(__FILE__, 'r');
+
+//Class to get object variable
+class MyClass
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ (float) PHP_INT_MAX + 1,
+ (float) -PHP_INT_MAX - 1,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+ $fp
+);
+
+// loop through each element of the values for 'chunklen'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( chunk_split($str, $values[$count], $ending) );
+}
+
+//closing resource
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing chunk_split() : with unexpected values for 'chunklen' argument ***
+-- Iteration 1 --
+string(28) "This is ch*uklen vari*ation*"
+-- Iteration 2 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: chunk_split() expects parameter 2 to be long, array given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 7 --
+
+Warning: chunk_split() expects parameter 2 to be long, array given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 8 --
+
+Warning: chunk_split() expects parameter 2 to be long, array given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 9 --
+
+Warning: chunk_split() expects parameter 2 to be long, array given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 10 --
+
+Warning: chunk_split() expects parameter 2 to be long, array given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 11 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 13 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 14 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 15 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 16 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: chunk_split() expects parameter 2 to be long, string given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 18 --
+
+Warning: chunk_split() expects parameter 2 to be long, string given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 19 --
+
+Warning: chunk_split() expects parameter 2 to be long, string given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 20 --
+
+Warning: chunk_split() expects parameter 2 to be long, string given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 21 --
+
+Warning: chunk_split() expects parameter 2 to be long, object given in %schunk_split_variation2.php on line %d
+NULL
+-- Iteration 22 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: chunk_split() expects parameter 2 to be long, resource given in %schunk_split_variation2.php on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt
new file mode 100644
index 0000000..758bec0
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation3.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected values for 'ending' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : unexpected values for 'ending' ***\n";
+
+// Initializing variables
+$str = 'This is simple string.';
+$chunklen = 4.9;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//resource variable
+$fp = fopen(__FILE__,'r');
+
+//Class to get object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//different values for 'ending'
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.123456e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $fp
+);
+
+// loop through each element of values for 'ending'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( chunk_split($str, $chunklen, $values[$count]) );
+}
+
+echo "Done";
+
+//closing resource
+fclose($fp);
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected values for 'ending' ***
+-- Iteration 1 --
+string(28) "This0 is 0simp0le s0trin0g.0"
+-- Iteration 2 --
+string(28) "This1 is 1simp1le s1trin1g.1"
+-- Iteration 3 --
+string(52) "This12345 is 12345simp12345le s12345trin12345g.12345"
+-- Iteration 4 --
+string(52) "This-2345 is -2345simp-2345le s-2345trin-2345g.-2345"
+-- Iteration 5 --
+string(46) "This10.5 is 10.5simp10.5le s10.5trin10.5g.10.5"
+-- Iteration 6 --
+string(52) "This-10.5 is -10.5simp-10.5le s-10.5trin-10.5g.-10.5"
+-- Iteration 7 --
+string(94) "This101234560000 is 101234560000simp101234560000le s101234560000trin101234560000g.101234560000"
+-- Iteration 8 --
+string(100) "This1.07654321E-9 is 1.07654321E-9simp1.07654321E-9le s1.07654321E-9trin1.07654321E-9g.1.07654321E-9"
+-- Iteration 9 --
+string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5"
+-- Iteration 10 --
+
+Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(22) "This is simple string."
+-- Iteration 16 --
+string(22) "This is simple string."
+-- Iteration 17 --
+string(28) "This1 is 1simp1le s1trin1g.1"
+-- Iteration 18 --
+string(22) "This is simple string."
+-- Iteration 19 --
+string(28) "This1 is 1simp1le s1trin1g.1"
+-- Iteration 20 --
+string(22) "This is simple string."
+-- Iteration 21 --
+string(22) "This is simple string."
+-- Iteration 22 --
+string(22) "This is simple string."
+-- Iteration 23 --
+string(58) "Thisobject is objectsimpobjectle sobjecttrinobjectg.object"
+-- Iteration 24 --
+string(22) "This is simple string."
+-- Iteration 25 --
+string(22) "This is simple string."
+-- Iteration 26 --
+
+Warning: chunk_split() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/chunk_split_variation4.phpt b/ext/standard/tests/strings/chunk_split_variation4.phpt
new file mode 100644
index 0000000..cfa6269
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation4.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test chunk_split() function : usage variations - different heredoc strings as 'str' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Passing different heredoc strings as 'str' argument to the chunk_split()
+* with 'chunklen' 4 and default value of 'ending' that is "\r\n"
+*/
+
+echo "*** Testing chunk_split() : heredoc strings as 'str' argument ***\n";
+
+// Initializing required variables
+$chunklen = 4;
+
+// Null heredoc string
+$heredoc_null = <<<EOT1
+EOT1;
+
+// heredoc string with single character
+$heredoc_char = <<<EOT2
+a
+EOT2;
+
+// simple heredoc string
+$heredoc_str = <<<EOT3
+This is simple heredoc string
+EOT3;
+
+// heredoc with special characters
+$heredoc_spchar = <<<EOT4
+This checks heredoc with $, %, &, chars
+EOT4;
+
+// blank heredoc string
+$heredoc_blank = <<<EOT5
+
+EOT5;
+
+// heredoc with different white space characters
+$heredoc_escchar = <<<EOT6
+This checks\t chunk_split()\nEscape\rchars
+EOT6;
+
+// heredoc with multiline
+$heredoc_multiline= <<<EOT7
+This is to check chunk_split
+function with multiline
+heredoc
+EOT7;
+
+// heredoc with quotes and slashes
+$heredoc_quote_slash = <<<EOT8
+"To check " in heredoc"
+I'm sure it'll work also with \
+which is single slash
+EOT8;
+
+//different heredoc strings for 'str'
+$heredoc_arr = array(
+ $heredoc_null,
+ $heredoc_blank,
+ $heredoc_char,
+ $heredoc_str,
+ $heredoc_multiline,
+ $heredoc_spchar,
+ $heredoc_escchar,
+ $heredoc_quote_slash
+);
+
+
+// loop through each element of the heredoc_arr for 'str'
+$count = 0;
+foreach($heredoc_arr as $str) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split( $str, $chunklen) );
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : heredoc strings as 'str' argument ***
+-- Iteration 1 --
+string(2) "
+"
+-- Iteration 2 --
+string(2) "
+"
+-- Iteration 3 --
+string(3) "a
+"
+-- Iteration 4 --
+string(45) "This
+ is
+simp
+le h
+ered
+oc s
+trin
+g
+"
+-- Iteration 5 --
+string(90) "This
+ is
+to c
+heck
+ chu
+nk_s
+plit
+
+fun
+ctio
+n wi
+th m
+ulti
+line
+
+her
+edoc
+"
+-- Iteration 6 --
+string(59) "This
+ che
+cks
+here
+doc
+with
+ $,
+%, &
+, ch
+ars
+"
+-- Iteration 7 --
+string(59) "This
+ che
+cks
+ chu
+nk_s
+plit
+()
+E
+scap
+e ch
+ars
+"
+-- Iteration 8 --
+string(117) ""To
+chec
+k "
+in h
+ered
+oc"
+
+I'm
+sure
+ it'
+ll w
+ork
+also
+ wit
+h \
+
+whic
+h is
+ sin
+gle
+slas
+h
+"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt
new file mode 100644
index 0000000..580f8f0
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split_variation6.phpt b/ext/standard/tests/strings/chunk_split_variation6.phpt
new file mode 100644
index 0000000..705bb31
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation6.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test chunk_split() function : usage variations - single quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different single quoted strings as 'str' argument to the function
+* 'chunklen' is set to 7 and 'ending' is '):('
+*/
+
+echo "*** Testing chunk_split() : with different single quoted 'str' ***\n";
+
+//Initializing variables
+$chunklen = 7;
+$ending = "):(";
+
+//different single quoted string for 'str'
+$values = array(
+ '', //empty
+ ' ', //space
+ 'This is simple string', //regular string
+ 'It\'s string with quotes',
+ 'This contains @ # $ % ^ & chars', //special characters
+ 'This string\tcontains\rwhite space\nchars', //with white space chars
+ 'This is string with 1234 numbers',
+ 'This is string with \0 and ".chr(0)."null chars', //for binary safe
+ 'This is string with multiple space char',
+ 'This is to check string with ()',
+ ' Testing with multiple spaces ',
+ 'Testing invalid \k and \m escape char',
+ 'This is to check with \\n and \\t'
+);
+
+
+//Loop through each element of values for 'str'
+for($count = 0;$count < count($values);$count++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chunk_split($values[$count], $chunklen, $ending) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : with different single quoted 'str' ***
+-- Iteration 0 --
+string(3) "):("
+-- Iteration 1 --
+string(4) " ):("
+-- Iteration 2 --
+string(30) "This is):( simple):( string):("
+-- Iteration 3 --
+string(35) "It's st):(ring wi):(th quot):(es):("
+-- Iteration 4 --
+string(46) "This co):(ntains ):(@ # $ %):( ^ & ch):(ars):("
+-- Iteration 5 --
+string(59) "This st):(ring\tc):(ontains):(\rwhite):( space\):(nchars):("
+-- Iteration 6 --
+string(47) "This is):( string):( with 1):(234 num):(bers):("
+-- Iteration 7 --
+string(68) "This is):( string):( with \):(0 and "):(.chr(0)):(."null ):(chars):("
+-- Iteration 8 --
+string(74) "This is):( string):( with ):( multi):(ple ):( sp):(ace cha):(r):("
+-- Iteration 9 --
+string(46) "This is):( to che):(ck stri):(ng with):( ()):("
+-- Iteration 10 --
+string(59) " Te):(sting w):(ith ):(multipl):(e space):(s ):("
+-- Iteration 11 --
+string(55) "Testing):( invali):(d \k an):(d \m es):(cape ch):(ar):("
+-- Iteration 12 --
+string(46) "This is):( to che):(ck with):( \n and):( \t):("
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/chunk_split_variation7.phpt b/ext/standard/tests/strings/chunk_split_variation7.phpt
new file mode 100644
index 0000000..a27ff3c
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation7.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt
new file mode 100644
index 0000000..cfb440e
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation8.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test chunk_split() function : usage variations - different integer values for 'chunklen' with heredoc string as 'str'(Bug#42796)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+*/
+
+/*
+* passing different integer values for 'chunklen' and heredoc string for 'str' to chunk_split()
+*/
+
+echo "*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***\n";
+
+
+// Initializing required variables
+//heredoc string as str
+$heredoc_str = <<<EOT
+This's heredoc string with \t and \n white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split()
+EOT;
+
+$ending = ':::';
+
+// different values for 'chunklen'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ PHP_INT_MAX, // max positive integer number
+ PHP_INT_MAX * 3, // integer overflow
+ -PHP_INT_MAX - 1, // min negative integer
+
+);
+
+
+// loop through each element of values for 'chunklen'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
+-- Iteration 1 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: :::
+::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.:::
+:::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t:::
+:::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::"
+-- Iteration 3 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+string(129) "This's heredoc string with and
+ white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split():::"
+-- Iteration 5 --
+string(141) "This's heredoc string with::: and
+ white space char.:::
+It has _speci@l ch@r$ 222:::2 !!!Now \k as escape char::: to test
+chunk_split():::"
+-- Iteration 6 --
+string(129) "This's heredoc string with and
+ white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split():::"
+-- Iteration 7 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation9.phpt b/ext/standard/tests/strings/chunk_split_variation9.phpt
new file mode 100644
index 0000000..5601bbc
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt
new file mode 100644
index 0000000..0b4db25
--- /dev/null
+++ b/ext/standard/tests/strings/convert_cyr_string.phpt
@@ -0,0 +1,50 @@
+--TEST--
+basic convert_cyr_string() tests
+--FILE--
+<?php
+
+var_dump(convert_cyr_string());
+var_dump(convert_cyr_string(""));
+var_dump(convert_cyr_string("", ""));
+var_dump(convert_cyr_string("", "", ""));
+var_dump(convert_cyr_string(array(), array(), array()));
+
+var_dump(convert_cyr_string((binary)"[[[[[[", "q", "m"));
+var_dump(convert_cyr_string((binary)"[[[[[[", "k", "w"));
+var_dump(convert_cyr_string((binary)"[[[[[[", "m", "a"));
+var_dump(convert_cyr_string((binary)"[[[[[[", "d", "i"));
+var_dump(convert_cyr_string((binary)"[[[[[[", "w", "k"));
+var_dump(convert_cyr_string((binary)"[[[[[[", "i", "q"));
+var_dump(convert_cyr_string((binary)"", "d", "i"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d
+NULL
+
+Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d
+NULL
+
+Warning: convert_cyr_string(): Unknown source charset: in %s on line %d
+
+Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d
+string(0) ""
+
+Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+string(6) "[[[[[["
+
+Warning: convert_cyr_string(): Unknown destination charset: q in %s on line %d
+string(6) "[[[[[["
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/convert_cyr_string_basic.phpt b/ext/standard/tests/strings/convert_cyr_string_basic.phpt
new file mode 100644
index 0000000..e29ad33
--- /dev/null
+++ b/ext/standard/tests/strings/convert_cyr_string_basic.phpt
@@ -0,0 +1,165 @@
+--TEST--
+Test convert_cyr_string() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
+ * Description: Convert from one Cyrillic character set to another
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing convert_cyr_string() : basic functionality ***\n";
+
+$str = "Convert from one Cyrillic character set to another.";
+
+echo "\n-- First try some simple English text --\n";
+var_dump(bin2hex(convert_cyr_string($str, 'w', 'k')));
+var_dump(bin2hex(convert_cyr_string($str, 'w', 'i')));
+
+
+echo "\n-- Now try some of characters in 128-255 range --\n";
+
+for ($i = 128; $i < 256; $i++) {
+ $str = chr($i);
+ echo "$i: " . bin2hex(convert_cyr_string($str, 'w', 'k')) . "\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_cyr_string() : basic functionality ***
+
+-- First try some simple English text --
+string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e"
+string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e"
+
+-- Now try some of characters in 128-255 range --
+128: 2e
+129: 2e
+130: 2e
+131: 2e
+132: 2e
+133: 2e
+134: 2e
+135: 2e
+136: 2e
+137: 2e
+138: 2e
+139: 2e
+140: 2e
+141: 2e
+142: 2e
+143: 2e
+144: 2e
+145: 2e
+146: 2e
+147: 2e
+148: 2e
+149: 2e
+150: 2e
+151: 2e
+152: 2e
+153: 2e
+154: 2e
+155: 2e
+156: 2e
+157: 2e
+158: 2e
+159: 2e
+160: 9a
+161: ae
+162: be
+163: 2e
+164: 9f
+165: bd
+166: 2e
+167: 2e
+168: b3
+169: bf
+170: b4
+171: 9d
+172: 2e
+173: 2e
+174: 9c
+175: b7
+176: 2e
+177: 2e
+178: b6
+179: a6
+180: ad
+181: 2e
+182: 2e
+183: 9e
+184: a3
+185: 98
+186: a4
+187: 9b
+188: 2e
+189: 2e
+190: 2e
+191: a7
+192: e1
+193: e2
+194: f7
+195: e7
+196: e4
+197: e5
+198: f6
+199: fa
+200: e9
+201: ea
+202: eb
+203: ec
+204: ed
+205: ee
+206: ef
+207: f0
+208: f2
+209: f3
+210: f4
+211: f5
+212: e6
+213: e8
+214: e3
+215: fe
+216: fb
+217: fd
+218: ff
+219: f9
+220: f8
+221: fc
+222: e0
+223: f1
+224: c1
+225: c2
+226: d7
+227: c7
+228: c4
+229: c5
+230: d6
+231: da
+232: c9
+233: ca
+234: cb
+235: cc
+236: cd
+237: ce
+238: cf
+239: d0
+240: d2
+241: d3
+242: d4
+243: d5
+244: c6
+245: c8
+246: c3
+247: de
+248: db
+249: dd
+250: df
+251: d9
+252: d8
+253: dc
+254: c0
+255: d1
+===DONE===
diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt
new file mode 100644
index 0000000..844f2d7
--- /dev/null
+++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test convert_cyr_string() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
+ * Description: Convert from one Cyrillic character set to another
+ * Source code: ext/standard/string.c
+*/
+
+$str = "hello";
+$from = "k";
+$to = "d";
+$extra_arg = 10;
+
+echo "*** Testing convert_cyr_string() : error conditions ***\n";
+
+echo "\n-- Testing convert_cyr_string() function with no arguments --\n";
+var_dump( convert_cyr_string() );
+
+echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n";
+var_dump( convert_cyr_string($str, $from) );
+
+echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n";
+var_dump( convert_cyr_string($str, $from, $to, $extra_arg) );
+
+echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n";
+var_dump(bin2hex( convert_cyr_string($str, "?", $to) ));
+
+echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n";
+var_dump(bin2hex( convert_cyr_string($str, $from, "?")) );
+
+echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n";
+var_dump(bin2hex( convert_cyr_string($str, ">", "?")) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_cyr_string() : error conditions ***
+
+-- Testing convert_cyr_string() function with no arguments --
+
+Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing convert_cyr_string() function with no 'to' character set --
+
+Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d
+NULL
+
+-- Testing convert_cyr_string() function with more than expected no. of arguments --
+
+Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing convert_cyr_string() function with invalid 'from' character set --
+
+Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d
+string(10) "68656c6c6f"
+
+-- Testing convert_cyr_string() function with invalid 'to' character set --
+
+Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
+string(10) "68656c6c6f"
+
+-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --
+
+Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d
+
+Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
+string(10) "68656c6c6f"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/convert_cyr_string_variation1.phpt b/ext/standard/tests/strings/convert_cyr_string_variation1.phpt
new file mode 100644
index 0000000..9986ac2
--- /dev/null
+++ b/ext/standard/tests/strings/convert_cyr_string_variation1.phpt
@@ -0,0 +1,139 @@
+--TEST--
+Test convert_cyr_string() function : usage variations - test values for $str argument
+--FILE--
+<?php
+
+/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
+ * Description: Convert from one Cyrillic character set to another
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $str
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test convert_cyr_string() function
+$count = 1;
+$from = "w";
+$to = "k";
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( convert_cyr_string($input, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_cyr_string() 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(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(12) "101234567000"
+-- Iteration 10 --
+
+Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: convert_cyr_string() 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: convert_cyr_string() 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/convert_uudecode_basic.phpt b/ext/standard/tests/strings/convert_uudecode_basic.phpt
new file mode 100644
index 0000000..6e334a9
--- /dev/null
+++ b/ext/standard/tests/strings/convert_uudecode_basic.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test convert_uudecode() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string convert_uudecode ( string $data )
+ * Description: Decode a uuencoded string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uudecode() : basic functionality ***\n";
+
+// array with different values for $string
+$strings = array (
+
+ //double quoted strings
+ "123",
+ "abc",
+ "1a2b3c",
+ "Here is a simple string to test convert_uuencode/decode",
+ "\t This String contains \t\t some control characters\r\n",
+ "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+
+ //single quoted strings
+ '123',
+ 'abc',
+ '1a2b3c',
+ '\t This String contains \t\t some control characters\r\n',
+
+);
+
+// loop through with each element of the $strings array to test convert_uudecode() function
+$count = 1;
+foreach($strings as $string) {
+
+ $encode = convert_uuencode($string);
+ $decode = convert_uudecode($encode);
+
+ if ($decode != $string) {
+ var_dump($encode, $decode, $string);
+ exit("TEST FAILED on iteration $count\n");
+ }
+
+ $count ++;
+}
+
+echo "TEST PASSED\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uudecode() : basic functionality ***
+TEST PASSED
+===DONE===
diff --git a/ext/standard/tests/strings/convert_uudecode_error.phpt b/ext/standard/tests/strings/convert_uudecode_error.phpt
new file mode 100644
index 0000000..77d3a88
--- /dev/null
+++ b/ext/standard/tests/strings/convert_uudecode_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test convert_uudecode() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string convert_uudecode ( string $data )
+ * Description: Decode a uuencoded string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uudecode() : error conditions ***\n";
+
+echo "\n-- Testing convert_uudecode() function with no arguments --\n";
+var_dump( convert_uudecode() );
+
+echo "\n-- Testing convert_uudecode() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( convert_uudecode(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uudecode() : error conditions ***
+
+-- Testing convert_uudecode() function with no arguments --
+
+Warning: convert_uudecode() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing convert_uudecode() function with more than expected no. of arguments --
+
+Warning: convert_uudecode() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+===DONE===
diff --git a/ext/standard/tests/strings/convert_uudecode_variation1.phpt b/ext/standard/tests/strings/convert_uudecode_variation1.phpt
new file mode 100644
index 0000000..049fd7f
--- /dev/null
+++ b/ext/standard/tests/strings/convert_uudecode_variation1.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test convert_uudecode() function : usage variations - test values for $data argument
+--FILE--
+<?php
+
+/* Prototype : string convert_uudecode ( string $data )
+ * Description: Decode a uuencoded string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $data
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $data array to test convert_uudecode() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( convert_uudecode($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***
+-- Iteration 1 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: convert_uudecode() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/strings/convert_uuencode_basic.phpt b/ext/standard/tests/strings/convert_uuencode_basic.phpt
new file mode 100644
index 0000000..df8ee36
--- /dev/null
+++ b/ext/standard/tests/strings/convert_uuencode_basic.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test convert_uuencode() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string convert_uuencode ( string $data )
+ * Description: Uuencode a string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uuencode() : basic functionality ***\n";
+
+// array with different values for $string
+$strings = array (
+
+ //double quoted strings
+ b"123",
+ b"abc",
+ b"1a2b3c",
+ b"Here is a simple string to test convert_uuencode/decode",
+ b"\t This String contains \t\t some control characters\r\n",
+ b"\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+
+ //single quoted strings
+ b'123',
+ b'abc',
+ b'1a2b3c',
+ b'\t This String contains \t\t some control characters\r\n',
+
+);
+
+// loop through with each element of the $strings array to test convert_uuencode() function
+$count = 1;
+foreach($strings as $string) {
+ echo "-- Iteration $count --\n";
+ var_dump( convert_uuencode($string) );
+ $count ++;
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uuencode() : basic functionality ***
+-- Iteration 1 --
+string(8) "#,3(S
+`
+"
+-- Iteration 2 --
+string(8) "#86)C
+`
+"
+-- Iteration 3 --
+string(12) "&,6$R8C-C
+`
+"
+-- Iteration 4 --
+string(82) "M2&5R92!I<R!A('-I;7!L92!S=')I;F<@=&\@=&5S="!C;VYV97)T7W5U96YC
+*;V1E+V1E8V]D90``
+`
+"
+-- Iteration 5 --
+string(74) "M"2!4:&ES(%-T<FEN9R!C;VYT86EN<R`)"2!S;VUE(&-O;G1R;VP@8VAA<F%C
+&=&5R<PT*
+`
+"
+-- Iteration 6 --
+string(28) "2D)$`DY20D966EYB9FIN<G9Z?
+`
+"
+-- Iteration 7 --
+string(8) "#,3(S
+`
+"
+-- Iteration 8 --
+string(8) "#86)C
+`
+"
+-- Iteration 9 --
+string(12) "&,6$R8C-C
+`
+"
+-- Iteration 10 --
+string(82) "M7'0@5&AI<R!3=')I;F<@8V]N=&%I;G,@7'1<="!S;VUE(&-O;G1R;VP@8VAA
++<F%C=&5R<UQR7&X`
+`
+"
+===DONE===
diff --git a/ext/standard/tests/strings/convert_uuencode_error.phpt b/ext/standard/tests/strings/convert_uuencode_error.phpt
new file mode 100644
index 0000000..a995e18
--- /dev/null
+++ b/ext/standard/tests/strings/convert_uuencode_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test convert_uuencode() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string convert_uuencode ( string $data )
+ * Description: Uuencode a string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uuencode() : error conditions ***\n";
+
+echo "\n-- Testing chconvert_uuencoder() function with no arguments --\n";
+var_dump( convert_uuencode() );
+
+echo "\n-- Testing convert_uuencode() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( convert_uuencode(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uuencode() : error conditions ***
+
+-- Testing chconvert_uuencoder() function with no arguments --
+
+Warning: convert_uuencode() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing convert_uuencode() function with more than expected no. of arguments --
+
+Warning: convert_uuencode() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+===DONE===
diff --git a/ext/standard/tests/strings/convert_uuencode_variation1.phpt b/ext/standard/tests/strings/convert_uuencode_variation1.phpt
new file mode 100644
index 0000000..12ca281
--- /dev/null
+++ b/ext/standard/tests/strings/convert_uuencode_variation1.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test convert_uuencode() function : usage variations - test values for $data argument
+--FILE--
+<?php
+
+/* Prototype : string convert_uuencode ( string $data )
+ * Description: Uuencode a string
+ * Source code: ext/standard/uuencode.c
+*/
+
+echo "*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $data
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $data array to test convert_uuencode() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( bin2hex(convert_uuencode($input)) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***
+-- Iteration 1 --
+string(16) "212c6060600a600a"
+-- Iteration 2 --
+string(16) "212c3060600a600a"
+-- Iteration 3 --
+string(16) "232c4334550a600a"
+-- Iteration 4 --
+string(16) "232c4334560a600a"
+-- Iteration 5 --
+string(40) "2a2c4324542d5330582c5338542d5060600a600a"
+-- Iteration 6 --
+string(40) "2b2b3328512d233c542e232c562d2340600a600a"
+-- Iteration 7 --
+string(24) "242c33604e2d3060600a600a"
+-- Iteration 8 --
+string(24) "252b3328502b4334600a600a"
+-- Iteration 9 --
+string(40) "2c2c3360512c432c542d3338572c2360500a600a"
+-- Iteration 10 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+-- Iteration 11 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+-- Iteration 12 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+-- Iteration 13 --
+string(16) "212c3060600a600a"
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(16) "212c3060600a600a"
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(0) ""
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(48) "2d3c56254d3c26514528265d423a4635433d6060600a600a"
+-- Iteration 20 --
+
+Warning: convert_uuencode() expects parameter 1 to be string, resource given in %s on line %d
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/strings/count_chars.phpt b/ext/standard/tests/strings/count_chars.phpt
new file mode 100644
index 0000000..fe21b65
--- /dev/null
+++ b/ext/standard/tests/strings/count_chars.phpt
@@ -0,0 +1,18 @@
+--TEST--
+count_chars() function
+--FILE--
+<?php
+$s = "het leven is net erwtensoep - je kunt er geen touw aan vastknopen";
+for($i=0; $i<3; $i++) {
+ echo implode(count_chars($s, $i))."\n";
+}
+echo $a = count_chars($s, 3), "\n";
+echo (int) strlen(count_chars($s, 4)) == 256-strlen($a),"\n";
+
+?>
+--EXPECT--
+000000000000000000000000000000001200000000000010000000000000000000000000000000000000000000000000003000120111121083202362220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+121312111121832236222
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ -aeghijklnoprstuvw
+1
diff --git a/ext/standard/tests/strings/count_chars_basic.phpt b/ext/standard/tests/strings/count_chars_basic.phpt
new file mode 100644
index 0000000..f28fa63
--- /dev/null
+++ b/ext/standard/tests/strings/count_chars_basic.phpt
@@ -0,0 +1,1574 @@
+--TEST--
+Test count_chars() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing count_chars() : basic functionality ***\n";
+
+$string = "Return information about characters used in a string";
+
+var_dump(count_chars($string));
+var_dump(count_chars($string, 0));
+var_dump(count_chars($string, 1));
+var_dump(count_chars($string, 2));
+var_dump(count_chars($string, 3));
+var_dump(bin2hex(count_chars($string, 4)));
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() : basic functionality ***
+array(256) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(0)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+ [9]=>
+ int(0)
+ [10]=>
+ int(0)
+ [11]=>
+ int(0)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [32]=>
+ int(7)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [82]=>
+ int(1)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [97]=>
+ int(5)
+ [98]=>
+ int(1)
+ [99]=>
+ int(2)
+ [100]=>
+ int(1)
+ [101]=>
+ int(3)
+ [102]=>
+ int(1)
+ [103]=>
+ int(1)
+ [104]=>
+ int(1)
+ [105]=>
+ int(4)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [109]=>
+ int(1)
+ [110]=>
+ int(5)
+ [111]=>
+ int(3)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [114]=>
+ int(5)
+ [115]=>
+ int(3)
+ [116]=>
+ int(5)
+ [117]=>
+ int(3)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(0)
+}
+array(256) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(0)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+ [9]=>
+ int(0)
+ [10]=>
+ int(0)
+ [11]=>
+ int(0)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [32]=>
+ int(7)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [82]=>
+ int(1)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [97]=>
+ int(5)
+ [98]=>
+ int(1)
+ [99]=>
+ int(2)
+ [100]=>
+ int(1)
+ [101]=>
+ int(3)
+ [102]=>
+ int(1)
+ [103]=>
+ int(1)
+ [104]=>
+ int(1)
+ [105]=>
+ int(4)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [109]=>
+ int(1)
+ [110]=>
+ int(5)
+ [111]=>
+ int(3)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [114]=>
+ int(5)
+ [115]=>
+ int(3)
+ [116]=>
+ int(5)
+ [117]=>
+ int(3)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(0)
+}
+array(18) {
+ [32]=>
+ int(7)
+ [82]=>
+ int(1)
+ [97]=>
+ int(5)
+ [98]=>
+ int(1)
+ [99]=>
+ int(2)
+ [100]=>
+ int(1)
+ [101]=>
+ int(3)
+ [102]=>
+ int(1)
+ [103]=>
+ int(1)
+ [104]=>
+ int(1)
+ [105]=>
+ int(4)
+ [109]=>
+ int(1)
+ [110]=>
+ int(5)
+ [111]=>
+ int(3)
+ [114]=>
+ int(5)
+ [115]=>
+ int(3)
+ [116]=>
+ int(5)
+ [117]=>
+ int(3)
+}
+array(238) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(0)
+ [7]=>
+ int(0)
+ [8]=>
+ int(0)
+ [9]=>
+ int(0)
+ [10]=>
+ int(0)
+ [11]=>
+ int(0)
+ [12]=>
+ int(0)
+ [13]=>
+ int(0)
+ [14]=>
+ int(0)
+ [15]=>
+ int(0)
+ [16]=>
+ int(0)
+ [17]=>
+ int(0)
+ [18]=>
+ int(0)
+ [19]=>
+ int(0)
+ [20]=>
+ int(0)
+ [21]=>
+ int(0)
+ [22]=>
+ int(0)
+ [23]=>
+ int(0)
+ [24]=>
+ int(0)
+ [25]=>
+ int(0)
+ [26]=>
+ int(0)
+ [27]=>
+ int(0)
+ [28]=>
+ int(0)
+ [29]=>
+ int(0)
+ [30]=>
+ int(0)
+ [31]=>
+ int(0)
+ [33]=>
+ int(0)
+ [34]=>
+ int(0)
+ [35]=>
+ int(0)
+ [36]=>
+ int(0)
+ [37]=>
+ int(0)
+ [38]=>
+ int(0)
+ [39]=>
+ int(0)
+ [40]=>
+ int(0)
+ [41]=>
+ int(0)
+ [42]=>
+ int(0)
+ [43]=>
+ int(0)
+ [44]=>
+ int(0)
+ [45]=>
+ int(0)
+ [46]=>
+ int(0)
+ [47]=>
+ int(0)
+ [48]=>
+ int(0)
+ [49]=>
+ int(0)
+ [50]=>
+ int(0)
+ [51]=>
+ int(0)
+ [52]=>
+ int(0)
+ [53]=>
+ int(0)
+ [54]=>
+ int(0)
+ [55]=>
+ int(0)
+ [56]=>
+ int(0)
+ [57]=>
+ int(0)
+ [58]=>
+ int(0)
+ [59]=>
+ int(0)
+ [60]=>
+ int(0)
+ [61]=>
+ int(0)
+ [62]=>
+ int(0)
+ [63]=>
+ int(0)
+ [64]=>
+ int(0)
+ [65]=>
+ int(0)
+ [66]=>
+ int(0)
+ [67]=>
+ int(0)
+ [68]=>
+ int(0)
+ [69]=>
+ int(0)
+ [70]=>
+ int(0)
+ [71]=>
+ int(0)
+ [72]=>
+ int(0)
+ [73]=>
+ int(0)
+ [74]=>
+ int(0)
+ [75]=>
+ int(0)
+ [76]=>
+ int(0)
+ [77]=>
+ int(0)
+ [78]=>
+ int(0)
+ [79]=>
+ int(0)
+ [80]=>
+ int(0)
+ [81]=>
+ int(0)
+ [83]=>
+ int(0)
+ [84]=>
+ int(0)
+ [85]=>
+ int(0)
+ [86]=>
+ int(0)
+ [87]=>
+ int(0)
+ [88]=>
+ int(0)
+ [89]=>
+ int(0)
+ [90]=>
+ int(0)
+ [91]=>
+ int(0)
+ [92]=>
+ int(0)
+ [93]=>
+ int(0)
+ [94]=>
+ int(0)
+ [95]=>
+ int(0)
+ [96]=>
+ int(0)
+ [106]=>
+ int(0)
+ [107]=>
+ int(0)
+ [108]=>
+ int(0)
+ [112]=>
+ int(0)
+ [113]=>
+ int(0)
+ [118]=>
+ int(0)
+ [119]=>
+ int(0)
+ [120]=>
+ int(0)
+ [121]=>
+ int(0)
+ [122]=>
+ int(0)
+ [123]=>
+ int(0)
+ [124]=>
+ int(0)
+ [125]=>
+ int(0)
+ [126]=>
+ int(0)
+ [127]=>
+ int(0)
+ [128]=>
+ int(0)
+ [129]=>
+ int(0)
+ [130]=>
+ int(0)
+ [131]=>
+ int(0)
+ [132]=>
+ int(0)
+ [133]=>
+ int(0)
+ [134]=>
+ int(0)
+ [135]=>
+ int(0)
+ [136]=>
+ int(0)
+ [137]=>
+ int(0)
+ [138]=>
+ int(0)
+ [139]=>
+ int(0)
+ [140]=>
+ int(0)
+ [141]=>
+ int(0)
+ [142]=>
+ int(0)
+ [143]=>
+ int(0)
+ [144]=>
+ int(0)
+ [145]=>
+ int(0)
+ [146]=>
+ int(0)
+ [147]=>
+ int(0)
+ [148]=>
+ int(0)
+ [149]=>
+ int(0)
+ [150]=>
+ int(0)
+ [151]=>
+ int(0)
+ [152]=>
+ int(0)
+ [153]=>
+ int(0)
+ [154]=>
+ int(0)
+ [155]=>
+ int(0)
+ [156]=>
+ int(0)
+ [157]=>
+ int(0)
+ [158]=>
+ int(0)
+ [159]=>
+ int(0)
+ [160]=>
+ int(0)
+ [161]=>
+ int(0)
+ [162]=>
+ int(0)
+ [163]=>
+ int(0)
+ [164]=>
+ int(0)
+ [165]=>
+ int(0)
+ [166]=>
+ int(0)
+ [167]=>
+ int(0)
+ [168]=>
+ int(0)
+ [169]=>
+ int(0)
+ [170]=>
+ int(0)
+ [171]=>
+ int(0)
+ [172]=>
+ int(0)
+ [173]=>
+ int(0)
+ [174]=>
+ int(0)
+ [175]=>
+ int(0)
+ [176]=>
+ int(0)
+ [177]=>
+ int(0)
+ [178]=>
+ int(0)
+ [179]=>
+ int(0)
+ [180]=>
+ int(0)
+ [181]=>
+ int(0)
+ [182]=>
+ int(0)
+ [183]=>
+ int(0)
+ [184]=>
+ int(0)
+ [185]=>
+ int(0)
+ [186]=>
+ int(0)
+ [187]=>
+ int(0)
+ [188]=>
+ int(0)
+ [189]=>
+ int(0)
+ [190]=>
+ int(0)
+ [191]=>
+ int(0)
+ [192]=>
+ int(0)
+ [193]=>
+ int(0)
+ [194]=>
+ int(0)
+ [195]=>
+ int(0)
+ [196]=>
+ int(0)
+ [197]=>
+ int(0)
+ [198]=>
+ int(0)
+ [199]=>
+ int(0)
+ [200]=>
+ int(0)
+ [201]=>
+ int(0)
+ [202]=>
+ int(0)
+ [203]=>
+ int(0)
+ [204]=>
+ int(0)
+ [205]=>
+ int(0)
+ [206]=>
+ int(0)
+ [207]=>
+ int(0)
+ [208]=>
+ int(0)
+ [209]=>
+ int(0)
+ [210]=>
+ int(0)
+ [211]=>
+ int(0)
+ [212]=>
+ int(0)
+ [213]=>
+ int(0)
+ [214]=>
+ int(0)
+ [215]=>
+ int(0)
+ [216]=>
+ int(0)
+ [217]=>
+ int(0)
+ [218]=>
+ int(0)
+ [219]=>
+ int(0)
+ [220]=>
+ int(0)
+ [221]=>
+ int(0)
+ [222]=>
+ int(0)
+ [223]=>
+ int(0)
+ [224]=>
+ int(0)
+ [225]=>
+ int(0)
+ [226]=>
+ int(0)
+ [227]=>
+ int(0)
+ [228]=>
+ int(0)
+ [229]=>
+ int(0)
+ [230]=>
+ int(0)
+ [231]=>
+ int(0)
+ [232]=>
+ int(0)
+ [233]=>
+ int(0)
+ [234]=>
+ int(0)
+ [235]=>
+ int(0)
+ [236]=>
+ int(0)
+ [237]=>
+ int(0)
+ [238]=>
+ int(0)
+ [239]=>
+ int(0)
+ [240]=>
+ int(0)
+ [241]=>
+ int(0)
+ [242]=>
+ int(0)
+ [243]=>
+ int(0)
+ [244]=>
+ int(0)
+ [245]=>
+ int(0)
+ [246]=>
+ int(0)
+ [247]=>
+ int(0)
+ [248]=>
+ int(0)
+ [249]=>
+ int(0)
+ [250]=>
+ int(0)
+ [251]=>
+ int(0)
+ [252]=>
+ int(0)
+ [253]=>
+ int(0)
+ [254]=>
+ int(0)
+ [255]=>
+ int(0)
+}
+string(18) " Rabcdefghimnorstu"
+string(476) "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f5051535455565758595a5b5c5d5e5f606a6b6c7071767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
+===DONE===
diff --git a/ext/standard/tests/strings/count_chars_error.phpt b/ext/standard/tests/strings/count_chars_error.phpt
new file mode 100644
index 0000000..45c1163
--- /dev/null
+++ b/ext/standard/tests/strings/count_chars_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test count_chars() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing count_chars() : error conditions ***\n";
+
+echo "\n-- Testing count_chars() function with no arguments --\n";
+var_dump( count_chars() );
+
+echo "\n-- Testing count_chars() function with more than expected no. of arguments --\n";
+$string = "Hello World\n";
+$mode = 1;
+$extra_arg = 10;
+var_dump( count_chars($string, $mode, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() : error conditions ***
+
+-- Testing count_chars() function with no arguments --
+
+Warning: count_chars() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing count_chars() function with more than expected no. of arguments --
+
+Warning: count_chars() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/count_chars_variation1.phpt b/ext/standard/tests/strings/count_chars_variation1.phpt
new file mode 100644
index 0000000..18e23f9
--- /dev/null
+++ b/ext/standard/tests/strings/count_chars_variation1.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test count_chars() function : usage variations - test values for $string argument
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing count_chars() function: with unexpected inputs for 'string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/* 1 */ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/* 7 */ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/* 10 */ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/* 13 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/* 17 */ NULL,
+ null,
+
+ // objects
+/* 19 */ new sample(),
+
+ // resource
+/* 20 */ $file_handle,
+
+ // undefined variable
+/* 21 */ @$undefined_var,
+
+ // unset variable
+/* 22 */ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test count_chars() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // only list characters with a frequency > 0
+ var_dump(count_chars($input, 1));
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() function: with unexpected inputs for 'string' argument ***
+-- Iteration 1 --
+array(1) {
+ [48]=>
+ int(1)
+}
+-- Iteration 2 --
+array(1) {
+ [49]=>
+ int(1)
+}
+-- Iteration 3 --
+array(2) {
+ [50]=>
+ int(1)
+ [53]=>
+ int(2)
+}
+-- Iteration 4 --
+array(3) {
+ [50]=>
+ int(1)
+ [53]=>
+ int(1)
+ [54]=>
+ int(1)
+}
+-- Iteration 5 --
+array(7) {
+ [49]=>
+ int(1)
+ [50]=>
+ int(1)
+ [51]=>
+ int(1)
+ [52]=>
+ int(3)
+ [54]=>
+ int(1)
+ [55]=>
+ int(2)
+ [56]=>
+ int(1)
+}
+-- Iteration 6 --
+array(8) {
+ [45]=>
+ int(1)
+ [49]=>
+ int(1)
+ [50]=>
+ int(1)
+ [51]=>
+ int(1)
+ [52]=>
+ int(3)
+ [54]=>
+ int(1)
+ [55]=>
+ int(1)
+ [56]=>
+ int(2)
+}
+-- Iteration 7 --
+array(4) {
+ [46]=>
+ int(1)
+ [48]=>
+ int(1)
+ [49]=>
+ int(1)
+ [53]=>
+ int(1)
+}
+-- Iteration 8 --
+array(5) {
+ [45]=>
+ int(1)
+ [46]=>
+ int(1)
+ [48]=>
+ int(1)
+ [50]=>
+ int(1)
+ [53]=>
+ int(1)
+}
+-- Iteration 9 --
+array(8) {
+ [48]=>
+ int(4)
+ [49]=>
+ int(2)
+ [50]=>
+ int(1)
+ [51]=>
+ int(1)
+ [52]=>
+ int(1)
+ [53]=>
+ int(1)
+ [54]=>
+ int(1)
+ [55]=>
+ int(1)
+}
+-- Iteration 10 --
+
+Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+array(1) {
+ [49]=>
+ int(1)
+}
+-- Iteration 14 --
+array(0) {
+}
+-- Iteration 15 --
+array(1) {
+ [49]=>
+ int(1)
+}
+-- Iteration 16 --
+array(0) {
+}
+-- Iteration 17 --
+array(0) {
+}
+-- Iteration 18 --
+array(0) {
+}
+-- Iteration 19 --
+array(12) {
+ [32]=>
+ int(1)
+ [97]=>
+ int(1)
+ [98]=>
+ int(1)
+ [99]=>
+ int(1)
+ [101]=>
+ int(2)
+ [106]=>
+ int(1)
+ [108]=>
+ int(1)
+ [109]=>
+ int(1)
+ [111]=>
+ int(1)
+ [112]=>
+ int(1)
+ [115]=>
+ int(1)
+ [116]=>
+ int(1)
+}
+-- Iteration 20 --
+
+Warning: count_chars() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+array(0) {
+}
+-- Iteration 22 --
+array(0) {
+}
+===DONE===
diff --git a/ext/standard/tests/strings/count_chars_variation2.phpt b/ext/standard/tests/strings/count_chars_variation2.phpt
new file mode 100644
index 0000000..7a17cb9
--- /dev/null
+++ b/ext/standard/tests/strings/count_chars_variation2.phpt
@@ -0,0 +1,162 @@
+--TEST--
+Test count_chars() function : usage variations - test values for $mode argument
+--FILE--
+<?php
+
+/* Prototype : mixed count_chars ( string $string [, int $mode ] )
+ * Description: Return information about characters used in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+}
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/* 1 */ 0,
+ 1,
+ 255,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/* 6 */ 0.0,
+ 1.3,
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/* 11 */ array(),
+ array(1, 2, 3, 4, 5, 6, 7, 8, 9),
+
+ // boolean values
+/* 14 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/* 18 */ NULL,
+ null,
+
+ // string values
+/* 20 */ "ABCD",
+ 'abcd',
+ "1ABC",
+ "5ABC",
+
+ // objects
+/* 24 */ new sample(),
+
+ // undefined variable
+/* 25 */ @$undefined_var,
+
+ // unset variable
+/* 26 */ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test count_chars() function
+// with unexepcted values for the 'mode' argument
+$count = 1;
+$string = "Return information about characters used in a string";
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // only list characters with a frequency > 0
+ var_dump(is_array(count_chars($string, $input)));
+ $count ++;
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: count_chars() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: count_chars() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+
+Warning: count_chars() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: count_chars() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+bool(true)
+-- Iteration 22 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Warning: count_chars(): Unknown mode in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: count_chars() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/strings/crc32.phpt b/ext/standard/tests/strings/crc32.phpt
new file mode 100644
index 0000000..e1b338f
--- /dev/null
+++ b/ext/standard/tests/strings/crc32.phpt
@@ -0,0 +1,14 @@
+--TEST--
+crc32() function
+--FILE--
+<?php
+$input = array("foo", "bar", "baz", "grldsajkopallkjasd");
+foreach($input AS $i) {
+ printf("%u\n", crc32($i));
+}
+?>
+--EXPECT--
+2356372769
+1996459178
+2015626392
+824412087
diff --git a/ext/standard/tests/strings/crc32_basic.phpt b/ext/standard/tests/strings/crc32_basic.phpt
new file mode 100644
index 0000000..52a3f89
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test crc32() function : basic functionality
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : basic functionality
+*/
+
+echo "*** Testing crc32() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = 'string_val1234';
+
+// Calling crc32() with all possible arguments
+
+// checking for the return type of the function
+var_dump( is_int(crc32($str)) );
+
+// Printing the returned value from the function
+printf("%u\n", crc32($str) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : basic functionality ***
+bool(true)
+256895812
+Done
diff --git a/ext/standard/tests/strings/crc32_error.phpt b/ext/standard/tests/strings/crc32_error.phpt
new file mode 100644
index 0000000..4537820
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_error.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test crc32() function : error conditions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : error conditions
+*/
+
+echo "*** Testing crc32() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing crc32() function with Zero arguments --\n";
+var_dump( crc32() );
+
+//Test crc32 with one more than the expected number of arguments
+echo "\n-- Testing crc32() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( crc32($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : error conditions ***
+
+-- Testing crc32() function with Zero arguments --
+
+Warning: crc32() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing crc32() function with more than expected no. of arguments --
+
+Warning: crc32() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/crc32_variation1.phpt b/ext/standard/tests/strings/crc32_variation1.phpt
new file mode 100644
index 0000000..cfd4779
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation1.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test crc32() function : usage variations - unexpected values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with unexpected values for str argument
+*/
+
+echo "*** Testing crc32() : with unexpected values for str argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for str
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($value) );
+ $count++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration 1 --
+int(-186917087)
+
+-- Iteration 2 --
+int(-2082672713)
+
+-- Iteration 3 --
+int(-873121252)
+
+-- Iteration 4 --
+int(1860518047)
+
+-- Iteration 5 --
+int(269248583)
+
+-- Iteration 6 --
+int(-834950157)
+
+-- Iteration 7 --
+int(-965354630)
+
+-- Iteration 8 --
+int(1376932222)
+
+-- Iteration 9 --
+int(-2036403827)
+
+-- Iteration 10 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(-2082672713)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(-2082672713)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(-1465013268)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+
+Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/crc32_variation2.phpt b/ext/standard/tests/strings/crc32_variation2.phpt
new file mode 100644
index 0000000..6d57a94
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation2.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test crc32() function : usage variations - single quoted strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing crc32() : with different strings in single quotes passed to the function
+*/
+
+echo "*** Testing crc32() : with different strings in single quotes ***\n";
+
+// defining an array of strings
+$string_array = array(
+ '',
+ ' ',
+ 'hello world',
+ 'HELLO WORLD',
+ ' helloworld ',
+
+ '(hello world)',
+ 'hello(world)',
+ 'helloworld()',
+ 'hello()(world',
+
+ '"hello" world',
+ 'hello "world"',
+ 'hello""world',
+
+ 'hello\tworld',
+ 'hellowor\\tld',
+ '\thello world\t',
+ 'hello\nworld',
+ 'hellowor\\nld',
+ '\nhello world\n',
+ '\n\thelloworld',
+ 'hel\tlo\n world',
+
+ '!@#$%&',
+ '#hello@world.com',
+ '$hello$world',
+
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+ eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+ gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+ 111111111111111111111122222222222222222222222222222222222222222222
+ 333333333333333333333333333333333334444444444444444444444444444444
+ 555555555555555555555555555555555555555555556666666666666666666666
+ 777777777777777777777777777777777777777777777777777777777777777777
+ /t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
+ /n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n'
+);
+
+// looping to check the behaviour of the function for each string in the array
+
+$count = 1;
+foreach($string_array as $str) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($str) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different strings in single quotes ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(135755572)
+
+-- Iteration 11 --
+int(27384015)
+
+-- Iteration 12 --
+int(-497244052)
+
+-- Iteration 13 --
+int(-2065897232)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-856440615)
+
+-- Iteration 16 --
+int(647088397)
+
+-- Iteration 17 --
+int(523630053)
+
+-- Iteration 18 --
+int(-2062229676)
+
+-- Iteration 19 --
+int(1169918910)
+
+-- Iteration 20 --
+int(-618551732)
+
+-- Iteration 21 --
+int(-1828940657)
+
+-- Iteration 22 --
+int(-1654468652)
+
+-- Iteration 23 --
+int(-1648442217)
+
+-- Iteration 24 --
+int(1431761713)
+Done
diff --git a/ext/standard/tests/strings/crc32_variation3.phpt b/ext/standard/tests/strings/crc32_variation3.phpt
new file mode 100644
index 0000000..639254a
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation3.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test crc32() function : usage variations - double quoted strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with different strings in double quotes passed to the function
+*/
+
+echo "*** Testing crc32() : with different strings in double quotes ***\n";
+
+// defining an array of strings
+$string_array = array(
+ "",
+ " ",
+ "hello world",
+ "HELLO WORLD",
+ " helloworld ",
+
+ "(hello world)",
+ "hello(world)",
+ "helloworld()",
+ "hello()(world",
+
+ "'hello' world",
+ "hello 'world'",
+ "hello''world",
+
+ "hello\tworld",
+ "hellowor\\tld",
+ "\thello world\t",
+ "helloworld",
+ "hellowor\\ld",
+ "hello\nworld",
+ "hellowor\\nld",
+ "\nhello world\n",
+ "\n\thelloworld",
+ "hel\tlo\n world",
+
+ "!@#$%&",
+ "#hello@world.com",
+ "$hello$world",
+
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+ eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+ gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+ 111111111111111111111122222222222222222222222222222222222222222222
+ 333333333333333333333333333333333334444444444444444444444444444444
+ 555555555555555555555555555555555555555555556666666666666666666666
+ 777777777777777777777777777777777777777777777777777777777777777777
+ /t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
+ /n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n"
+);
+
+// looping to check the behaviour of the function for each string in the array
+
+$count = 1;
+foreach($string_array as $str) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($str) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different strings in double quotes ***
+
+Notice: Undefined variable: hello in %s on line %d
+
+Notice: Undefined variable: world in %s on line %d
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(1191242624)
+
+-- Iteration 11 --
+int(603128807)
+
+-- Iteration 12 --
+int(-525789576)
+
+-- Iteration 13 --
+int(770262395)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-986324846)
+
+-- Iteration 16 --
+int(-102031187)
+
+-- Iteration 17 --
+int(-588181215)
+
+-- Iteration 18 --
+int(-1417857067)
+
+-- Iteration 19 --
+int(523630053)
+
+-- Iteration 20 --
+int(-503915034)
+
+-- Iteration 21 --
+int(-254912432)
+
+-- Iteration 22 --
+int(-1581578467)
+
+-- Iteration 23 --
+int(-1828940657)
+
+-- Iteration 24 --
+int(-1654468652)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+int(1431761713)
+Done
diff --git a/ext/standard/tests/strings/crc32_variation4.phpt b/ext/standard/tests/strings/crc32_variation4.phpt
new file mode 100644
index 0000000..35c3b0a
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation4.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Test crc32() function : usage variations - heredoc strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with different heredoc strings passed to the str argument
+*/
+
+echo "*** Testing crc32() : with different heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_long_string = <<<EOT
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+111111111111111111111122222222222222222222222222222222222222222222
+333333333333333333333333333333333334444444444444444444444444444444
+555555555555555555555555555555555555555555556666666666666666666666
+777777777777777777777777777777777777777777777777777777777777777777
+/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
+/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal,
+ $heredoc_with_long_string
+ );
+
+// loop to test the function with each heredoc string in the array
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($str) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different heredoc strings ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1541608299)
+
+-- Iteration 3 --
+int(1588851550)
+
+-- Iteration 4 --
+int(-1726108239)
+
+-- Iteration 5 --
+int(-1847303891)
+
+-- Iteration 6 --
+int(-1260053120)
+
+-- Iteration 7 --
+int(-1718044186)
+
+-- Iteration 8 --
+int(1646793751)
+Done
diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt
new file mode 100644
index 0000000..ce178f6
--- /dev/null
+++ b/ext/standard/tests/strings/crypt.phpt
@@ -0,0 +1,43 @@
+--TEST--
+crypt() function
+--SKIPIF--
+<?php
+if (!function_exists('crypt')) {
+ die("SKIP crypt() is not available");
+}
+?>
+--FILE--
+<?php
+
+$str = 'rasmuslerdorf';
+$salt1 = 'rl';
+$res_1 = 'rl.3StKT.4T8M';
+$salt2 = '_J9..rasm';
+$res_2 = '_J9..rasmBYk8r9AiWNc';
+$salt3 = '$1$rasmusle$';
+$res_3 = '$1$rasmusle$rISCgZzpwk3UhDidwXvin0';
+$salt4 = '$2a$07$rasmuslerd............';
+$res_4 = '$2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra';
+
+echo (CRYPT_STD_DES) ? ((crypt($str, $salt1) === $res_1) ? 'STD' : 'STD - ERROR') : 'STD', "\n";
+echo (CRYPT_EXT_DES) ? ((crypt($str, $salt2) === $res_2) ? 'EXT' : 'EXT - ERROR') : 'EXT', "\n";
+echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR') : 'MD5', "\n";
+echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
+
+var_dump(crypt($str));
+var_dump(crypt());
+var_dump(crypt("", "", ""));
+
+?>
+--EXPECTF--
+STD
+EXT
+MD5
+BLO
+string(%d) "%s"
+
+Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/strings/crypt_blowfish.phpt b/ext/standard/tests/strings/crypt_blowfish.phpt
new file mode 100644
index 0000000..20a6a27
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_blowfish.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Official blowfish tests (http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/glibc/crypt_blowfish/wrapper.c)
+--SKIPIF--
+<?php
+if (!function_exists('crypt') || !defined("CRYPT_BLOWFISH")) {
+ die("SKIP crypt()-blowfish is not available");
+}
+?>
+--FILE--
+<?php
+
+$tests =array(
+ array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', 'U*U'),
+ array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK', 'U*U*'),
+ array('$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', 'U*U*U'),
+ array('$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored'),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xa3"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.ZC1JEJ8Z4gPfpe1JOr/oyPXTWl9EFd.', "\xff\xa334\xff\xff\xff\xa3345"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
+ array('$2x$05$6bNw2HLQYeqHYyBfLMsv/OiwqTymGIGzFsA4hOTWebfehXHNprcAS', "\xd1\x91"),
+ array('$2x$05$6bNw2HLQYeqHYyBfLMsv/O9LIGgn8OMzuDoHfof8AQimSGfcSWxnS', "\xd0\xc1\xd2\xcf\xcc\xd8"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"),
+ array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''),
+
+);
+$i=0;
+foreach($tests as $test) {
+ if(crypt($test[1], $test[0]) == $test[0]) {
+ echo "$i. OK\n";
+ } else {
+ echo "$i. Not OK: $test[0] ".crypt($test[1], $test[0])."\n";
+ }
+ $i++;
+}
+
+?>
+--EXPECT--
+0. OK
+1. OK
+2. OK
+3. OK
+4. OK
+5. OK
+6. OK
+7. OK
+8. OK
+9. OK
+10. OK
+11. OK
+12. OK
+13. OK
+14. OK
+15. OK
+16. OK
+17. OK
+18. OK
+19. OK
+20. OK
+21. OK
+22. OK
+23. OK
+24. OK
+25. OK
diff --git a/ext/standard/tests/strings/crypt_blowfish_variation1.phpt b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
new file mode 100644
index 0000000..1592cfe
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test Blowfish crypt() with invalid rounds
+--SKIPIF--
+<?php
+if (!function_exists('crypt') || !defined("CRYPT_BLOWFISH")) {
+ die("SKIP crypt()-blowfish is not available");
+}
+?>
+--FILE--
+<?php
+
+$salts = array(b'32' => b'$2a$32$CCCCCCCCCCCCCCCCCCCCCC$',
+ b'33' => b'$2a$33$CCCCCCCCCCCCCCCCCCCCCC$',
+ b'34' => b'$2a$34$CCCCCCCCCCCCCCCCCCCCCC$',
+ b'35' => b'$2a$35$CCCCCCCCCCCCCCCCCCCCCC$',
+ b'36' => b'$2a$36$CCCCCCCCCCCCCCCCCCCCCC$',
+ b'37' => b'$2a$37$CCCCCCCCCCCCCCCCCCCCCC$',
+ b'38' => b'$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',);
+
+foreach($salts as $i=>$salt) {
+ $crypt = crypt(b'U*U', $salt);
+ if ($crypt === b'*0' || $crypt === b'*1') {
+ echo "$i. OK\n";
+ } else {
+ echo "$i. Not OK\n";
+ }
+}
+
+?>
+--EXPECT--
+32. OK
+33. OK
+34. OK
+35. OK
+36. OK
+37. OK
+38. OK
diff --git a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
new file mode 100644
index 0000000..21bedc1
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test Blowfish crypt() falls back to DES when rounds are not specified,
+or Blowfish is not available.
+--FILE--
+<?php
+$crypt = crypt(b'U*U', b'$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW');
+if ($crypt===b'$2SHYF.wPGyfE') {
+ echo "OK\n";
+} else {
+ echo "Not OK\n";
+}
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/strings/crypt_chars.phpt b/ext/standard/tests/strings/crypt_chars.phpt
new file mode 100644
index 0000000..09cd868
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_chars.phpt
@@ -0,0 +1,19 @@
+--TEST--
+crypt() function - characters > 0x80
+--SKIPIF--
+<?php
+if (!function_exists('crypt')) {
+ die("SKIP crypt() is not available");
+}
+?>
+--FILE--
+<?php
+var_dump(crypt("À1234abcd", "99"));
+var_dump(crypt("À9234abcd", "99"));
+var_dump(crypt("À1234abcd", "_01234567"));
+var_dump(crypt("À9234abcd", "_01234567"));
+--EXPECT--
+string(13) "99PxawtsTfX56"
+string(13) "99jcVcGxUZOWk"
+string(20) "_01234567IBjxKliXXRQ"
+string(20) "_012345678OSGpGQRVHA"
diff --git a/ext/standard/tests/strings/crypt_sha256.phpt b/ext/standard/tests/strings/crypt_sha256.phpt
new file mode 100644
index 0000000..86c7245
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_sha256.phpt
@@ -0,0 +1,64 @@
+--TEST--
+crypt() SHA-256
+--SKIPIF--
+<?php
+if (!function_exists('crypt') || !defined("CRYPT_SHA256")) {
+ die("SKIP crypt()-sha256 is not available");
+}
+?>
+--FILE--
+<?php
+
+$tests = array(
+ 1 => array(
+ b'$5$saltstring',
+ b'Hello world!',
+ b'$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5'
+ ),
+ 2 => array(
+ b'$5$rounds=10000$saltstringsaltstring',
+ b'Hello world!',
+ b'$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
+ ),
+ 3 => array(
+ b'$5$rounds=10000$saltstringsaltstring',
+ b'Hello world!',
+ b'$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
+ ),
+ 4 => array(
+ b'$5$rounds=5000$toolongsaltstring',
+ b'This is just a test',
+ b'$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5'
+ ),
+ 5 => array(
+ b'$5$rounds=1400$anotherlongsaltstring',
+ b'a very much longer text to encrypt. This one even stretches over morethan one line.',
+ b'$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1'
+ ),
+ 6 => array(
+ b'$5$rounds=77777$short',
+ b'we have a short salt string but not a short password',
+ b'$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/'
+ ),
+ 7 => array(
+ b'$5$rounds=123456$asaltof16chars..',
+ b'a short string',
+ b'$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
+ ),
+ 8 => array(
+ b'$5$rounds=10$roundstoolow',
+ b'the minimum number is still observed',
+ b'$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC'
+ )
+);
+
+foreach ($tests as $iter => $t) {
+ $res = crypt($t[1], $t[0]);
+ if ($res != $t[2]) echo "Iteration $iter failed.
+Expected: <$t[2]>
+Got <$res>\n";
+}
+echo "Passes.";?>
+--EXPECTF--
+Passes.
+
diff --git a/ext/standard/tests/strings/crypt_sha512.phpt b/ext/standard/tests/strings/crypt_sha512.phpt
new file mode 100644
index 0000000..d6f9df6
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_sha512.phpt
@@ -0,0 +1,65 @@
+--TEST--
+crypt() SHA-512
+--SKIPIF--
+<?php
+if (!function_exists('crypt') || !defined("CRYPT_SHA512")) {
+ die("SKIP crypt()-sha512 is not available");
+}
+?>
+--FILE--
+<?php
+
+$tests = array(
+ 1 => array(
+ b'$6$saltstring',
+ b'Hello world!',
+ b'$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1'
+ ),
+ 2 => array(
+ b'$6$rounds=10000$saltstringsaltstring',
+ b'Hello world!',
+ b'$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.'
+ ),
+ 3 => array(
+ b'$6$rounds=5000$toolongsaltstring',
+ b'This is just a test',
+ b'$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0'
+ ),
+ 4 => array(
+ b'$6$rounds=1400$anotherlongsaltstring',
+ b'a very much longer text to encrypt. This one even stretches over morethan one line.',
+ b'$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1'
+ ),
+ 5 => array(
+ b'$6$rounds=77777$short',
+ b'we have a short salt string but not a short password',
+ b'$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0'
+ ),
+ 6 => array(
+ b'$6$rounds=123456$asaltof16chars..',
+ b'a short string',
+ b'$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1'
+ ),
+ 7 => array(
+ b'$6$rounds=10$roundstoolow',
+ b'the minimum number is still observed',
+ b'$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.'
+ ),
+ 8 => array(
+ b'$6$$bar$',
+ b'foo',
+ b'$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.'
+ ),
+);
+
+foreach ($tests as $iter => $t) {
+ $res = crypt($t[1], $t[0]);
+ if ($res != $t[2]) echo "Iteration $iter failed.
+Expected: <$t[2]>
+Got <$res>\n";
+}
+echo "Passes.";
+?>
+--EXPECTF--
+Passes.
+
diff --git a/ext/standard/tests/strings/crypt_variation1.phpt b/ext/standard/tests/strings/crypt_variation1.phpt
new file mode 100644
index 0000000..6e0d3fe
--- /dev/null
+++ b/ext/standard/tests/strings/crypt_variation1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+crypt() function - long salt
+--SKIPIF--
+<?php
+if (!function_exists('crypt')) {
+ die("SKIP crypt() is not available");
+}
+?>
+--FILE--
+<?php
+
+$b = str_repeat("A", 124);
+echo crypt("A", "$5$" . $b)."\n";
+$b = str_repeat("A", 125);
+echo crypt("A", "$5$" . $b)."\n";
+$b = str_repeat("A", 4096);
+echo crypt("A", "$5$" . $b)."\n";
+
+?>
+--EXPECTF--
+$5$AAAAAAAAAAAAAAAA$frotiiztWZiwcncxnY5tWG9Ida2WOZEximjLXCleQu6
+$5$AAAAAAAAAAAAAAAA$frotiiztWZiwcncxnY5tWG9Ida2WOZEximjLXCleQu6
+$5$AAAAAAAAAAAAAAAA$frotiiztWZiwcncxnY5tWG9Ida2WOZEximjLXCleQu6
diff --git a/ext/standard/tests/strings/dirname_basic.phpt b/ext/standard/tests/strings/dirname_basic.phpt
new file mode 100644
index 0000000..2b5e4d4
--- /dev/null
+++ b/ext/standard/tests/strings/dirname_basic.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test dirname() function : basic funtionality
+--FILE--
+<?php
+/* Prototype: string dirname ( string $path );
+ Description: Returns directory name component of path.
+*/
+$file_paths = array (
+ /* simple paths */
+ "bar",
+ "/foo/bar",
+ "foo/bar",
+ "/bar",
+ "bar/",
+ "/bar/",
+ "/foo/bar/",
+ "foo/bar/",
+ "/bar/",
+
+ /* path with only files and trailing slashes*/
+ "/foo/bar.gz",
+ "foo/bar.gz",
+ "bar.gz",
+ "bar.gz/",
+ "/bar.gz",
+ "/bar.gz/",
+ "/foo/bar.gz/",
+ "foo/bar.gz/",
+ "/bar.gz/",
+
+ /* path with file extension and trailing slashes */
+ "/.gz",
+ ".gz",
+ "/foo/.gz",
+ ".gz/",
+ "/foo/.gz/",
+ "foo/.gz/",
+
+ /* paths with binary value to check if the function is binary safe*/
+ "foo".chr(0)."bar",
+ "/foo".chr(0)."bar/",
+ "/foo".chr(0)."bar",
+ "foo".chr(0)."bar/",
+ "/foo".chr(0)."bar/t.gz"
+);
+
+function check_dirname( $paths ) {
+ $loop_counter = 0;
+ $noOfPaths = count($paths);
+ for( ; $loop_counter < $noOfPaths; $loop_counter++ ) {
+ echo "\n--Iteration ";
+ echo $loop_counter + 1;
+ echo " --\n";
+ var_dump( dirname($paths[$loop_counter]) );
+ }
+}
+
+echo "*** Testing basic operations ***\n";
+check_dirname( $file_paths );
+
+echo "Done\n";
+?>
+
+--EXPECTREGEX--
+\*\*\* Testing basic operations \*\*\*
+
+--Iteration 1 --
+string\(1\) "."
+
+--Iteration 2 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 3 --
+string\(3\) "foo"
+
+--Iteration 4 --
+string\(1\) "(\\|\/)"
+
+--Iteration 5 --
+string\(1\) "."
+
+--Iteration 6 --
+string\(1\) "(\\|\/)"
+
+--Iteration 7 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 8 --
+string\(3\) "foo"
+
+--Iteration 9 --
+string\(1\) "(\\|\/)"
+
+--Iteration 10 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 11 --
+string\(3\) "foo"
+
+--Iteration 12 --
+string\(1\) "."
+
+--Iteration 13 --
+string\(1\) "."
+
+--Iteration 14 --
+string\(1\) "(\\|\/)"
+
+--Iteration 15 --
+string\(1\) "(\\|\/)"
+
+--Iteration 16 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 17 --
+string\(3\) "foo"
+
+--Iteration 18 --
+string\(1\) "(\\|\/)"
+
+--Iteration 19 --
+string\(1\) "(\\|\/)"
+
+--Iteration 20 --
+string\(1\) "."
+
+--Iteration 21 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 22 --
+string\(1\) "."
+
+--Iteration 23 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 24 --
+string\(3\) "foo"
+
+--Iteration 25 --
+string\(1\) "."
+
+--Iteration 26 --
+string\(1\) "(\\|\/)"
+
+--Iteration 27 --
+string\(1\) "(\\|\/)"
+
+--Iteration 28 --
+string\(1\) "."
+
+--Iteration 29 --
+string\(8\) "(\\|\/)foo\x00bar"
+Done
diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt
new file mode 100644
index 0000000..bf63102
--- /dev/null
+++ b/ext/standard/tests/strings/dirname_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test dirname() function : error conditions
+--FILE--
+<?php
+/* Prototype: string dirname ( string $path );
+ Description: Returns directory name component of path.
+*/
+echo "*** Testing error conditions ***\n";
+// zero arguments
+var_dump( dirname() );
+
+// more than expected no. of arguments
+var_dump( dirname("/var/tmp/bar.gz", ".gz") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: dirname() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: dirname() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/dirname_variation.phpt b/ext/standard/tests/strings/dirname_variation.phpt
new file mode 100644
index 0000000..da66f0f
--- /dev/null
+++ b/ext/standard/tests/strings/dirname_variation.phpt
@@ -0,0 +1,143 @@
+--TEST--
+Test dirname() function : usage variations
+--FILE--
+<?php
+/* Prototype: string dirname ( string $path );
+ Description: Returns directory name component of path.
+*/
+class temp
+{
+ function __toString() {
+ return "Object";
+ }
+}
+
+$file_path_variations = array (
+ /* home dir shortcut char */
+ "~/home/user/bar",
+ "~/home/user/bar/",
+ "~/home/user/bar.tar",
+ "~/home/user/bar.tar/",
+
+ /* with hotname:dir notation */
+ "hostname:/home/user/bar.tar",
+ "hostname:/home/user/tbar.gz/",
+ "hostname:/home/user/My Pics.gz",
+ "hostname:/home/user/My Pics.gz/",
+ "hostname:/home/user/My Pics/",
+ "hostname:/home/user/My Pics",
+
+ /* path containing numeric string */
+ "10.5",
+ "/10.5",
+ "/10.5/",
+ "10.5/",
+ "10/10.gz",
+ '0',
+ "0",
+
+ /* object */
+ new temp,
+
+ /* path as spaces */
+ " ",
+ ' ',
+
+ /* empty path */
+ "",
+ '',
+ NULL,
+ null
+);
+
+function check_dirname( $paths ) {
+ $loop_counter = 0;
+ $noOfPaths = count($paths);
+ for( ; $loop_counter < $noOfPaths; $loop_counter++ ) {
+ echo "\n--Iteration ";
+ echo $loop_counter +1;
+ echo " --\n";
+ var_dump( dirname($paths[$loop_counter]) );
+ }
+}
+
+echo "*** Testing possible variations in path ***\n";
+check_dirname( $file_path_variations );
+
+echo "Done\n";
+?>
+--EXPECTREGEX--
+\*\*\* Testing possible variations in path \*\*\*
+
+--Iteration 1 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 2 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 3 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 4 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 5 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 6 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 7 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 8 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 9 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 10 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 11 --
+string\(1\) "."
+
+--Iteration 12 --
+string\(1\) "(\\|\/)"
+
+--Iteration 13 --
+string\(1\) "(\\|\/)"
+
+--Iteration 14 --
+string\(1\) "."
+
+--Iteration 15 --
+string\(2\) "10"
+
+--Iteration 16 --
+string\(1\) "."
+
+--Iteration 17 --
+string\(1\) "."
+
+--Iteration 18 --
+string\(1\) "."
+
+--Iteration 19 --
+string\(1\) "."
+
+--Iteration 20 --
+string\(1\) "."
+
+--Iteration 21 --
+string\(0\) ""
+
+--Iteration 22 --
+string\(0\) ""
+
+--Iteration 23 --
+string\(0\) ""
+
+--Iteration 24 --
+string\(0\) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
new file mode 100644
index 0000000..1047fb7
--- /dev/null
+++ b/ext/standard/tests/strings/explode.phpt
@@ -0,0 +1,164 @@
+--TEST--
+explode() function
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+/* From http://bugs.php.net/19865 */
+echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE);
+echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
+echo "\n";
+var_dump(@explode("", ""));
+var_dump(@explode("", NULL));
+var_dump(@explode(NULL, ""));
+var_dump(@explode("a", ""));
+var_dump(@explode("a", "a"));
+var_dump(@explode("a", NULL));
+var_dump(@explode(NULL, a));
+var_dump(@explode("abc", "acb"));
+var_dump(@explode("somestring", "otherstring"));
+var_dump(@explode("somestring", "otherstring", -1));
+var_dump(@explode("a", "aaaaaa"));
+var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10)));
+var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10)));
+//////////////////////////////////////
+var_dump(explode(":","a lazy dog:jumps:over:",-1));
+var_dump(explode(":","a lazy dog:jumps:over", -1));
+var_dump(explode(":","a lazy dog:jumps:over", -2));
+var_dump(explode(":","a lazy dog:jumps:over:",-4));
+var_dump(explode(":","a lazy dog:jumps:over:",-40000000000000));
+var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-1));
+var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2));
+?>
+--EXPECTF--
+array (
+ 0 => 'a',
+ 1 => 'b' . "\0" . 'd',
+ 2 => 'f',
+ 3 => '1',
+ 4 => 'd',
+)d6bee42a771449205344c0938ad4f035
+bool(false)
+bool(false)
+bool(false)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+bool(false)
+array(1) {
+ [0]=>
+ string(3) "acb"
+}
+array(1) {
+ [0]=>
+ string(11) "otherstring"
+}
+array(0) {
+}
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(60) "-=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=-"
+}
+array(21) {
+ [0]=>
+ string(1) "-"
+ [1]=>
+ string(2) "48"
+ [2]=>
+ string(2) "--"
+ [3]=>
+ string(2) "48"
+ [4]=>
+ string(2) "--"
+ [5]=>
+ string(2) "48"
+ [6]=>
+ string(2) "--"
+ [7]=>
+ string(2) "48"
+ [8]=>
+ string(2) "--"
+ [9]=>
+ string(2) "48"
+ [10]=>
+ string(2) "--"
+ [11]=>
+ string(2) "48"
+ [12]=>
+ string(2) "--"
+ [13]=>
+ string(2) "48"
+ [14]=>
+ string(2) "--"
+ [15]=>
+ string(2) "48"
+ [16]=>
+ string(2) "--"
+ [17]=>
+ string(2) "48"
+ [18]=>
+ string(2) "--"
+ [19]=>
+ string(2) "48"
+ [20]=>
+ string(1) "-"
+}
+array(3) {
+ [0]=>
+ string(10) "a lazy dog"
+ [1]=>
+ string(5) "jumps"
+ [2]=>
+ string(4) "over"
+}
+array(2) {
+ [0]=>
+ string(10) "a lazy dog"
+ [1]=>
+ string(5) "jumps"
+}
+array(1) {
+ [0]=>
+ string(10) "a lazy dog"
+}
+array(0) {
+}
+array(0) {
+}
+array(2) {
+ [0]=>
+ string(10) "a lazy dog"
+ [1]=>
+ string(11) "jumps::over"
+}
+array(1) {
+ [0]=>
+ string(10) "a lazy dog"
+}
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
new file mode 100644
index 0000000..669b662
--- /dev/null
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -0,0 +1,509 @@
+--TEST--
+Test explode() function
+--INI--
+error_reporting=2047
+precision=14
+--FILE--
+<?php
+/* Prototype: array explode ( string $delimiter, string $string [, int $limit] );
+ Description: Returns an array of strings, each of which is a substring of string
+ formed by splitting it on boundaries formed by the string delimiter.
+ If limit is set, the returned array will contain a maximum of limit
+ elements with the last element containing the rest of string.
+*/
+
+echo "*** Testing explode() for basic operations ***\n";
+$delimiters = array (
+ "", // len=0
+ NULL,
+ "abcd", // string
+ 0, // zero
+ "0",
+ TRUE, // boolean value
+ FALSE,
+ -1, // negative integer
+ -11.23, // double
+ 4, // positive integer
+ "%",
+);
+$string = "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND";
+/* loop prints an array of strings, each of which is a substring of $string
+ formed by splitting it on boundaries formed by the string $delimiter.
+ */
+$counter = 1;
+foreach($delimiters as $delimiter) {
+ echo "-- Iteration $counter --\n";
+ var_dump( explode($delimiter, $string, -1) );
+ var_dump( explode($delimiter, $string, 0) );
+ var_dump( explode($delimiter, $string, 1) );
+ var_dump( explode($delimiter, $string, 2) );
+ $counter++;
+}
+
+echo "\n*** Testing explode() with miscelleneous input arguments ***\n";
+
+echo "\n-- Passing positive values of Limit to explode() --\n";
+/* LIMIT=2 */
+var_dump( explode("::", "mon::tues::wed::thurs::fri::sat::sun", 2) );
+
+/* checking for LIMIT =0,1 */
+echo "\n-- Passing limit values 0 and 1 to explode() --\n";
+var_dump( explode(":", "Name:Phone:Address:City:State", 0) );
+var_dump( explode(":", "Name:Phone:Address:City:State", 1) );
+
+/* to check the maximum limit of string that can be given with limit<=0,
+ default size is 50 but increases dynamically */
+echo "\n*** Testing explode() for maximum limit of string with Limit = -1 ***\n";
+var_dump( explode(":", "1:2:3:4:5:6:7:7:5:6:7:3:4:5:2:8:9:0:5:5:5:5:5:5:5:5:5:5:5:5:55:5:5:5%:%:%:%:5:5:5:%:%:5:5:5:5:5%:%:%:55:1:1", -1) );
+
+echo "\n*** Testing explode() with string variations as input argument ***\n";
+/* String with escape characters */
+echo "\n-- Testing string with escape characters --\n";
+var_dump( explode("\t\n", "1234\t\n5678\n\t9100") );
+var_dump( explode("\r", "1234\rabcd\r5678\rrstu") );
+
+/* String with embedded NULL */
+echo "\n-- Testing string with embedded NULL --\n";
+var_dump( explode("\x00", "abcd\x0n1234\x0005678\x0000efgh\xijkl") );
+var_dump( explode("\0", "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\000yz") );
+
+/* Checking OBJECTS type */
+echo "\n*** Testing explode() with objects ***\n";
+class string1 {
+ public function __toString() {
+ return "Object";
+ }
+}
+$obj = new string1;
+var_dump( explode("b", $obj) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for arguments <2 and >3 */
+var_dump( explode(":", "array1:array2:array3", -1, -33) );
+var_dump( explode(":") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing explode() for basic operations ***
+-- Iteration 1 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(10) "1234NULL23"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(10) "1234NULL23"
+ [1]=>
+ string(43) "00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 4 --
+array(5) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 5 --
+array(5) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 6 --
+array(5) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(28) "234NULL23abcd00000TRUEFALSE-"
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(12) ".234444true-"
+ [4]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 7 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+ [1]=>
+ string(12) "1.234444true"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+ [1]=>
+ string(27) "1.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+ [1]=>
+ string(23) "4444true-11.24%PHP%ZEND"
+}
+-- Iteration 10 --
+array(6) {
+ [0]=>
+ string(3) "123"
+ [1]=>
+ string(30) "NULL23abcd00000TRUEFALSE-11.23"
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(9) "true-11.2"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(3) "123"
+ [1]=>
+ string(53) "NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24"
+ [1]=>
+ string(3) "PHP"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24"
+ [1]=>
+ string(8) "PHP%ZEND"
+}
+
+*** Testing explode() with miscelleneous input arguments ***
+
+-- Passing positive values of Limit to explode() --
+array(2) {
+ [0]=>
+ string(3) "mon"
+ [1]=>
+ string(31) "tues::wed::thurs::fri::sat::sun"
+}
+
+-- Passing limit values 0 and 1 to explode() --
+array(1) {
+ [0]=>
+ string(29) "Name:Phone:Address:City:State"
+}
+array(1) {
+ [0]=>
+ string(29) "Name:Phone:Address:City:State"
+}
+
+*** Testing explode() for maximum limit of string with Limit = -1 ***
+array(51) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+ [5]=>
+ string(1) "6"
+ [6]=>
+ string(1) "7"
+ [7]=>
+ string(1) "7"
+ [8]=>
+ string(1) "5"
+ [9]=>
+ string(1) "6"
+ [10]=>
+ string(1) "7"
+ [11]=>
+ string(1) "3"
+ [12]=>
+ string(1) "4"
+ [13]=>
+ string(1) "5"
+ [14]=>
+ string(1) "2"
+ [15]=>
+ string(1) "8"
+ [16]=>
+ string(1) "9"
+ [17]=>
+ string(1) "0"
+ [18]=>
+ string(1) "5"
+ [19]=>
+ string(1) "5"
+ [20]=>
+ string(1) "5"
+ [21]=>
+ string(1) "5"
+ [22]=>
+ string(1) "5"
+ [23]=>
+ string(1) "5"
+ [24]=>
+ string(1) "5"
+ [25]=>
+ string(1) "5"
+ [26]=>
+ string(1) "5"
+ [27]=>
+ string(1) "5"
+ [28]=>
+ string(1) "5"
+ [29]=>
+ string(1) "5"
+ [30]=>
+ string(2) "55"
+ [31]=>
+ string(1) "5"
+ [32]=>
+ string(1) "5"
+ [33]=>
+ string(2) "5%"
+ [34]=>
+ string(1) "%"
+ [35]=>
+ string(1) "%"
+ [36]=>
+ string(1) "%"
+ [37]=>
+ string(1) "5"
+ [38]=>
+ string(1) "5"
+ [39]=>
+ string(1) "5"
+ [40]=>
+ string(1) "%"
+ [41]=>
+ string(1) "%"
+ [42]=>
+ string(1) "5"
+ [43]=>
+ string(1) "5"
+ [44]=>
+ string(1) "5"
+ [45]=>
+ string(1) "5"
+ [46]=>
+ string(2) "5%"
+ [47]=>
+ string(1) "%"
+ [48]=>
+ string(1) "%"
+ [49]=>
+ string(2) "55"
+ [50]=>
+ string(1) "1"
+}
+
+*** Testing explode() with string variations as input argument ***
+
+-- Testing string with escape characters --
+array(2) {
+ [0]=>
+ string(4) "1234"
+ [1]=>
+ string(10) "5678
+ 9100"
+}
+array(4) {
+ [0]=>
+ string(4) "1234"
+ [1]=>
+ string(4) "abcd"
+ [2]=>
+ string(4) "5678"
+ [3]=>
+ string(4) "rstu"
+}
+
+-- Testing string with embedded NULL --
+array(4) {
+ [0]=>
+ string(4) "abcd"
+ [1]=>
+ string(5) "n1234"
+ [2]=>
+ string(5) "05678"
+ [3]=>
+ string(12) "00efgh\xijkl"
+}
+array(7) {
+ [0]=>
+ string(4) "abcd"
+ [1]=>
+ string(4) "efgh"
+ [2]=>
+ string(4) "ijkl"
+ [3]=>
+ string(4) "mnop"
+ [4]=>
+ string(5) "0qrst"
+ [5]=>
+ string(4) "uvwx"
+ [6]=>
+ string(2) "yz"
+}
+
+*** Testing explode() with objects ***
+array(2) {
+ [0]=>
+ string(1) "O"
+ [1]=>
+ string(4) "ject"
+}
+
+*** Testing error conditions ***
+
+Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+Warning: explode() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/explode_bug.phpt b/ext/standard/tests/strings/explode_bug.phpt
new file mode 100644
index 0000000..9766f0b
--- /dev/null
+++ b/ext/standard/tests/strings/explode_bug.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Explode/memnstr bug
+--INI--
+error_reporting=2047
+memory_limit=256M
+--FILE--
+<?php
+$res = explode(str_repeat("A",145999999),1);
+var_dump($res);
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(1) "1"
+}
diff --git a/ext/standard/tests/strings/explode_error.phpt b/ext/standard/tests/strings/explode_error.phpt
new file mode 100644
index 0000000..f7342e7
--- /dev/null
+++ b/ext/standard/tests/strings/explode_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test explode() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() : error conditions ***\n";
+
+echo "\n-- Testing explode() function with no arguments --\n";
+var_dump( explode() );
+
+echo "\n-- Testing explode() function with more than expected no. of arguments --\n";
+$delimeter = " ";
+$string = "piece1 piece2 piece3 piece4 piece5 piece6";
+$limit = 5;
+$extra_arg = 10;
+var_dump( explode($delimeter, $string, $limit, $extra_arg) );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing explode() : error conditions ***
+
+-- Testing explode() function with no arguments --
+
+Warning: explode() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing explode() function with more than expected no. of arguments --
+
+Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt
new file mode 100644
index 0000000..9c9ce11
--- /dev/null
+++ b/ext/standard/tests/strings/explode_variation1.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test explode() function : usage variations - test values for $delimiter argument
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $delimeter
+$delimeters = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $delimeters array to test explode() function
+$count = 1;
+$string = "piece1 piece2 piece3 piece4 piece5 piece6";
+$limit = 5;
+foreach($delimeters as $delimeter) {
+ echo "-- Iteration $count --\n";
+ var_dump( explode($delimeter, $string, $limit) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ string(5) "piece"
+ [1]=>
+ string(35) " piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 10 --
+
+Warning: explode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: explode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: explode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ string(5) "piece"
+ [1]=>
+ string(35) " piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 14 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(5) "piece"
+ [1]=>
+ string(35) " piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 16 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 19 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 20 --
+
+Warning: explode() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: explode(): Empty delimiter in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt
new file mode 100644
index 0000000..9e1f72c
--- /dev/null
+++ b/ext/standard/tests/strings/explode_variation2.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test explode() function : usage variations - test values for $string argument
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: with unexpected inputs for 'string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $string
+$strings = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $strings array to test explode() function
+$count = 1;
+$delimeter = " ";
+$limit = 5;
+foreach($strings as $string) {
+ echo "-- Iteration $count --\n";
+ var_dump( explode($delimeter, $string, $limit) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing explode() function: with unexpected inputs for 'string' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(3) "255"
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(3) "256"
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(5) "-20.5"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(12) "101234567000"
+}
+-- Iteration 10 --
+
+Warning: explode() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: explode() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: explode() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 16 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 19 --
+array(2) {
+ [0]=>
+ string(6) "sample"
+ [1]=>
+ string(6) "object"
+}
+-- Iteration 20 --
+
+Warning: explode() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 22 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+===DONE===
diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt
new file mode 100644
index 0000000..54d5222
--- /dev/null
+++ b/ext/standard/tests/strings/explode_variation3.phpt
@@ -0,0 +1,238 @@
+--TEST--
+Test explode() function : usage variations - test values for $limit argument
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: with unexpected inputs for 'limit' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $delimeter
+$limits = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $limits array to test explode() function
+$count = 1;
+$delimeter = " ";
+$string = "piece1 piece2 piece3 piece4 piece5 piece6";
+foreach($limits as $limit) {
+ echo "-- Iteration $count --\n";
+ var_dump( explode($delimeter, $string, $limit) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===Done===
+--EXPECTF--
+*** Testing explode() function: with unexpected inputs for 'limit' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 3 --
+array(6) {
+ [0]=>
+ string(6) "piece1"
+ [1]=>
+ string(6) "piece2"
+ [2]=>
+ string(6) "piece3"
+ [3]=>
+ string(6) "piece4"
+ [4]=>
+ string(6) "piece5"
+ [5]=>
+ string(6) "piece6"
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ string(6) "piece1"
+ [1]=>
+ string(6) "piece2"
+ [2]=>
+ string(6) "piece3"
+ [3]=>
+ string(6) "piece4"
+ [4]=>
+ string(6) "piece5"
+ [5]=>
+ string(6) "piece6"
+}
+-- Iteration 5 --
+array(6) {
+ [0]=>
+ string(6) "piece1"
+ [1]=>
+ string(6) "piece2"
+ [2]=>
+ string(6) "piece3"
+ [3]=>
+ string(6) "piece4"
+ [4]=>
+ string(6) "piece5"
+ [5]=>
+ string(6) "piece6"
+}
+-- Iteration 6 --
+array(0) {
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(6) "piece1"
+ [1]=>
+ string(6) "piece2"
+ [2]=>
+ string(6) "piece3"
+ [3]=>
+ string(6) "piece4"
+ [4]=>
+ string(6) "piece5"
+ [5]=>
+ string(6) "piece6"
+}
+-- Iteration 8 --
+array(0) {
+}
+-- Iteration 9 --
+array(6) {
+ [0]=>
+ string(6) "piece1"
+ [1]=>
+ string(6) "piece2"
+ [2]=>
+ string(6) "piece3"
+ [3]=>
+ string(6) "piece4"
+ [4]=>
+ string(6) "piece5"
+ [5]=>
+ string(6) "piece6"
+}
+-- Iteration 10 --
+
+Warning: explode() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: explode() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: explode() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 16 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 19 --
+
+Warning: explode() expects parameter 3 to be long, object given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: explode() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+-- Iteration 22 --
+array(1) {
+ [0]=>
+ string(41) "piece1 piece2 piece3 piece4 piece5 piece6"
+}
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/explode_variation4.phpt b/ext/standard/tests/strings/explode_variation4.phpt
new file mode 100644
index 0000000..080531c
--- /dev/null
+++ b/ext/standard/tests/strings/explode_variation4.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test explode() function : usage variations - match longer string
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: match longer string ***\n";
+
+$pizza = "piece1 piece2 piece3 piece4 piece5 piece6 p";
+$pieces = explode(" p", $pizza);
+var_dump($pieces);
+?>
+===DONE===
+--EXPECT--
+*** Testing explode() function: match longer string ***
+array(7) {
+ [0]=>
+ string(6) "piece1"
+ [1]=>
+ string(5) "iece2"
+ [2]=>
+ string(5) "iece3"
+ [3]=>
+ string(5) "iece4"
+ [4]=>
+ string(5) "iece5"
+ [5]=>
+ string(5) "iece6"
+ [6]=>
+ string(0) ""
+}
+===DONE===
diff --git a/ext/standard/tests/strings/explode_variation5.phpt b/ext/standard/tests/strings/explode_variation5.phpt
new file mode 100644
index 0000000..754e552
--- /dev/null
+++ b/ext/standard/tests/strings/explode_variation5.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test explode() function : usage variations - positive and negative limits
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: positive and negative limits ***\n";
+$str = 'one||two||three||four';
+
+echo "\n-- positive limit --\n";
+var_dump(explode('||', $str, 2));
+
+echo "\n-- negative limit (since PHP 5.1) --\n";
+var_dump(explode('||', $str, -1));
+
+echo "\n-- negative limit (since PHP 5.1) with null string -- \n";
+var_dump(explode('||', "", -1));
+?>
+===DONE===
+--EXPECT--
+*** Testing explode() function: positive and negative limits ***
+
+-- positive limit --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(16) "two||three||four"
+}
+
+-- negative limit (since PHP 5.1) --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(5) "three"
+}
+
+-- negative limit (since PHP 5.1) with null string --
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/explode_variation6.phpt b/ext/standard/tests/strings/explode_variation6.phpt
new file mode 100644
index 0000000..d1b34e3
--- /dev/null
+++ b/ext/standard/tests/strings/explode_variation6.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test explode() function : usage variations - misc tests
+--FILE--
+<?php
+
+/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
+ * Description: Split a string by string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing explode() function: misc tests ***\n";
+
+$str = "one\x00two\x00three\x00four";
+
+echo "\n-- positive limit with null separator --\n";
+$e = test_explode("\x00", $str, 2);
+
+echo "\n-- negative limit (since PHP 5.1) with null separator --\n";
+$e = test_explode("\x00", $str, -2);
+
+echo "\n-- unknown string --\n";
+$e = test_explode("fred", $str,1);
+
+echo "\n-- limit = 0 --\n";
+$e = test_explode("\x00", $str, 0);
+
+echo "\n-- limit = -1 --\n";
+$e = test_explode("\x00", $str, -1);
+
+echo "\n-- large limit = -100 --\n";
+$e = test_explode("\x00", $str, 100);
+
+function test_explode($delim, $string, $limit)
+{
+ $e = explode($delim, $string, $limit);
+ foreach ( $e as $v)
+ {
+ var_dump(bin2hex($v));
+ }
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing explode() function: misc tests ***
+
+-- positive limit with null separator --
+string(6) "6f6e65"
+string(28) "74776f00746872656500666f7572"
+
+-- negative limit (since PHP 5.1) with null separator --
+string(6) "6f6e65"
+string(6) "74776f"
+
+-- unknown string --
+string(36) "6f6e650074776f00746872656500666f7572"
+
+-- limit = 0 --
+string(36) "6f6e650074776f00746872656500666f7572"
+
+-- limit = -1 --
+string(6) "6f6e65"
+string(6) "74776f"
+string(10) "7468726565"
+
+-- large limit = -100 --
+string(6) "6f6e65"
+string(6) "74776f"
+string(10) "7468726565"
+string(8) "666f7572"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt
new file mode 100644
index 0000000..ccc3740
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test fprintf() function (errors)
+--FILE--
+<?php
+
+/* Testing Error Conditions */
+echo "*** Testing Error Conditions ***\n";
+
+/* zero argument */
+var_dump( fprintf() );
+
+/* scalar argument */
+var_dump( fprintf(3) );
+
+/* NULL argument */
+var_dump( fprintf(NULL) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
+NULL
+
+Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
+NULL
+
+Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_001.phpt b/ext/standard/tests/strings/fprintf_variation_001.phpt
new file mode 100644
index 0000000..f08d5cb
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_001.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test fprintf() function (variation - 1)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$float_variation = array( "%f","%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07.2f", "%'#7.2f" );
+$float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54 );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+/* float type variations */
+fprintf($fp, "\n*** Testing fprintf() with floats ***\n");
+
+foreach( $float_variation as $float_var ) {
+ fprintf( $fp, "\n-- Iteration %d --\n",$counter);
+ foreach( $float_numbers as $float_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, $float_var, $float_num );
+ }
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with floats ***
+
+-- Iteration 1 --
+
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+-- Iteration 2 --
+
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+-- Iteration 3 --
+
++0.000000
++1.000000
+-1.000000
++0.320000
+-0.320000
++3.400000
++2.540000
+-2.540000
+-- Iteration 4 --
+
+ 0.00
+ 1.00
+ -1.00
+ 0.32
+ -0.32
+ 3.40
+ 2.54
+ -2.54
+-- Iteration 5 --
+
+0.00
+1.00
+-1.00
+0.32
+-0.32
+3.40
+2.54
+-2.54
+-- Iteration 6 --
+
+0000.00
+0001.00
+-001.00
+0000.32
+-000.32
+0003.40
+0002.54
+-002.54
+-- Iteration 7 --
+
+0.00000
+1.00000
+-1.0000
+0.32000
+-0.3200
+3.40000
+2.54000
+-2.5400
+-- Iteration 8 --
+
+###0.00
+###1.00
+##-1.00
+###0.32
+##-0.32
+###3.40
+###2.54
+##-2.54
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_002.phpt b/ext/standard/tests/strings/fprintf_variation_002.phpt
new file mode 100644
index 0000000..fb3ab6c
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_002.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test fprintf() function (variation - 2)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+/* integer type variations */
+fprintf($fp, "\n*** Testing fprintf() with integers ***\n");
+foreach( $int_variation as $int_var ) {
+ fprintf( $fp, "\n-- Iteration %d --\n",$counter);
+ foreach( $int_numbers as $int_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, $int_var, $int_num );
+ }
+ $counter++;
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with integers ***
+
+-- Iteration 1 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 2 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 3 --
+
++0
++1
+-1
++2
+-2
++23333333
+-23333333
++1234
+-- Iteration 4 --
+
+ 0
+ 1
+ -1
+ 2
+ -2
+23333333
+-23333333
+ 1234
+-- Iteration 5 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 6 --
+
+0000000
+0000001
+-000001
+0000002
+-000002
+23333333
+-23333333
+0001234
+-- Iteration 7 --
+
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+-- Iteration 8 --
+
+######0
+######1
+#####-1
+######2
+#####-2
+23333333
+-23333333
+###1234
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_003.phpt b/ext/standard/tests/strings/fprintf_variation_003.phpt
new file mode 100644
index 0000000..c312c49
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_003.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 3)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* binary type variations */
+fprintf($fp, "\n*** Testing fprintf() with binary ***\n");
+foreach( $int_numbers as $bin_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%b", $bin_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with binary ***
+
+0
+1
+11111111111111111111111111111111
+10
+11111111111111111111111111111110
+1011001000000100111010101
+11111110100110111111011000101011
+10011010010
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt
new file mode 100644
index 0000000..448f528
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 3)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* binary type variations */
+fprintf($fp, "\n*** Testing fprintf() with binary ***\n");
+foreach( $int_numbers as $bin_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%b", $bin_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with binary ***
+
+0
+1
+1111111111111111111111111111111111111111111111111111111111111111
+10
+1111111111111111111111111111111111111111111111111111111111111110
+1011001000000100111010101
+1111111111111111111111111111111111111110100110111111011000101011
+10011010010
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_004.phpt b/ext/standard/tests/strings/fprintf_variation_004.phpt
new file mode 100644
index 0000000..5502b6d
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_004.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/fprintf_variation_005.phpt b/ext/standard/tests/strings/fprintf_variation_005.phpt
new file mode 100644
index 0000000..75636ac
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_005.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test fprintf() function (variation - 5)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* %e type variations */
+fprintf($fp, "\n*** Testing fprintf() for scientific type ***\n");
+foreach( $int_numbers as $num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%e", $num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for scientific type ***
+
+0.000000e+0
+1.000000e+0
+-1.000000e+0
+2.700000e+0
+-2.700000e+0
+2.333333e+7
+-2.333333e+7
+1.234000e+3
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_006.phpt b/ext/standard/tests/strings/fprintf_variation_006.phpt
new file mode 100644
index 0000000..d7a3278
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_006.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 6)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* unsigned int type variation */
+fprintf($fp, "\n*** Testing fprintf() for unsigned integers ***\n");
+foreach( $int_numbers as $unsig_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%u", $unsig_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for unsigned integers ***
+
+0
+1
+4294967295
+2
+4294967294
+23333333
+4271633963
+1234
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt
new file mode 100644
index 0000000..d68683e
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 6)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* unsigned int type variation */
+fprintf($fp, "\n*** Testing fprintf() for unsigned integers ***\n");
+foreach( $int_numbers as $unsig_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%u", $unsig_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for unsigned integers ***
+
+0
+1
+18446744073709551615
+2
+18446744073709551614
+23333333
+18446744073686218283
+1234
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_007.phpt b/ext/standard/tests/strings/fprintf_variation_007.phpt
new file mode 100644
index 0000000..cb09084
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_007.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 7)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* octal type variations */
+fprintf($fp, "\n*** Testing fprintf() for octals ***\n");
+foreach( $int_numbers as $octal_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%o", $octal_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for octals ***
+
+0
+1
+37777777777
+2
+37777777776
+131004725
+37646773053
+2322
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt
new file mode 100644
index 0000000..c8481e9
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 7)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* octal type variations */
+fprintf($fp, "\n*** Testing fprintf() for octals ***\n");
+foreach( $int_numbers as $octal_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%o", $octal_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for octals ***
+
+0
+1
+1777777777777777777777
+2
+1777777777777777777776
+131004725
+1777777777777646773053
+2322
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_008.phpt b/ext/standard/tests/strings/fprintf_variation_008.phpt
new file mode 100644
index 0000000..f91e7a1
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_008.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test fprintf() function (variation - 8)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* hexadecimal type variations */
+fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
+foreach( $int_numbers as $hexa_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%x", $hexa_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for hexadecimals ***
+
+0
+1
+ffffffff
+2
+fffffffe
+16409d5
+fe9bf62b
+4d2
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt
new file mode 100644
index 0000000..f619510
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test fprintf() function (variation - 8)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+/* hexadecimal type variations */
+fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
+foreach( $int_numbers as $hexa_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%x", $hexa_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for hexadecimals ***
+
+0
+1
+ffffffffffffffff
+2
+fffffffffffffffe
+16409d5
+fffffffffe9bf62b
+4d2
+Done
diff --git a/ext/standard/tests/strings/fprintf_variation_009.phpt b/ext/standard/tests/strings/fprintf_variation_009.phpt
new file mode 100644
index 0000000..40f36bb
--- /dev/null
+++ b/ext/standard/tests/strings/fprintf_variation_009.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test fprintf() function (variation - 9)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+ die('skip File dump.txt could not be created');
+}
+?>
+--FILE--
+<?php
+
+$string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" );
+$strings = array( NULL, "abc", 'aaa' );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+/* string type variations */
+fprintf($fp, "\n*** Testing fprintf() for string types ***\n");
+foreach( $string_variation as $string_var ) {
+ fprintf( $fp, "\n-- Iteration %d --\n",$counter);
+ foreach( $strings as $str ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, $string_var, $str );
+ }
+ $counter++;
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for string types ***
+
+-- Iteration 1 --
+
+
+ abc
+ aaa
+-- Iteration 2 --
+
+
+abc
+aaa
+-- Iteration 3 --
+
+00000
+00abc
+00aaa
+-- Iteration 4 --
+
+#####
+##abc
+##aaa
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
new file mode 100644
index 0000000..87857d9
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
@@ -0,0 +1,549 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - with default args
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+echo "-- with table = HTML_ENTITIES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort($tt);
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort($tt);
+var_dump( $tt );
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_ENTITIES --
+array(252) {
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Α"]=>
+ string(7) "&Alpha;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Β"]=>
+ string(6) "&Beta;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["Χ"]=>
+ string(5) "&Chi;"
+ ["‡"]=>
+ string(8) "&Dagger;"
+ ["Δ"]=>
+ string(7) "&Delta;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["Ε"]=>
+ string(9) "&Epsilon;"
+ ["Η"]=>
+ string(5) "&Eta;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Γ"]=>
+ string(7) "&Gamma;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Ι"]=>
+ string(6) "&Iota;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Κ"]=>
+ string(7) "&Kappa;"
+ ["Λ"]=>
+ string(8) "&Lambda;"
+ ["Μ"]=>
+ string(4) "&Mu;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ν"]=>
+ string(4) "&Nu;"
+ ["Œ"]=>
+ string(7) "&OElig;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ω"]=>
+ string(7) "&Omega;"
+ ["Ο"]=>
+ string(9) "&Omicron;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["Ί"]=>
+ string(5) "&Phi;"
+ ["Π"]=>
+ string(4) "&Pi;"
+ ["″"]=>
+ string(7) "&Prime;"
+ ["Κ"]=>
+ string(5) "&Psi;"
+ ["Ρ"]=>
+ string(5) "&Rho;"
+ ["Å "]=>
+ string(8) "&Scaron;"
+ ["Σ"]=>
+ string(7) "&Sigma;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["΀"]=>
+ string(5) "&Tau;"
+ ["Θ"]=>
+ string(7) "&Theta;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Î¥"]=>
+ string(9) "&Upsilon;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ξ"]=>
+ string(4) "&Xi;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Åž"]=>
+ string(6) "&Yuml;"
+ ["Ζ"]=>
+ string(6) "&Zeta;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ÂŽ"]=>
+ string(7) "&acute;"
+ ["Ê"]=>
+ string(7) "&aelig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["ℵ"]=>
+ string(9) "&alefsym;"
+ ["α"]=>
+ string(7) "&alpha;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["∧"]=>
+ string(5) "&and;"
+ ["∠"]=>
+ string(5) "&ang;"
+ ["Ã¥"]=>
+ string(7) "&aring;"
+ ["≈"]=>
+ string(7) "&asymp;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["À"]=>
+ string(6) "&auml;"
+ ["„"]=>
+ string(7) "&bdquo;"
+ ["β"]=>
+ string(6) "&beta;"
+ ["Š"]=>
+ string(8) "&brvbar;"
+ ["•"]=>
+ string(6) "&bull;"
+ ["∩"]=>
+ string(5) "&cap;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["ž"]=>
+ string(7) "&cedil;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["χ"]=>
+ string(5) "&chi;"
+ ["ˆ"]=>
+ string(6) "&circ;"
+ ["♣"]=>
+ string(7) "&clubs;"
+ ["≅"]=>
+ string(6) "&cong;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["↵"]=>
+ string(7) "&crarr;"
+ ["∪"]=>
+ string(5) "&cup;"
+ ["€"]=>
+ string(8) "&curren;"
+ ["⇓"]=>
+ string(6) "&dArr;"
+ ["†"]=>
+ string(8) "&dagger;"
+ ["↓"]=>
+ string(6) "&darr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["ÎŽ"]=>
+ string(7) "&delta;"
+ ["♩"]=>
+ string(7) "&diams;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["Ú"]=>
+ string(8) "&egrave;"
+ ["∅"]=>
+ string(7) "&empty;"
+ [" "]=>
+ string(6) "&emsp;"
+ [" "]=>
+ string(6) "&ensp;"
+ ["ε"]=>
+ string(9) "&epsilon;"
+ ["≡"]=>
+ string(7) "&equiv;"
+ ["η"]=>
+ string(5) "&eta;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["€"]=>
+ string(6) "&euro;"
+ ["∃"]=>
+ string(7) "&exist;"
+ ["ƒ"]=>
+ string(6) "&fnof;"
+ ["∀"]=>
+ string(8) "&forall;"
+ ["œ"]=>
+ string(8) "&frac12;"
+ ["Œ"]=>
+ string(8) "&frac14;"
+ ["Ÿ"]=>
+ string(8) "&frac34;"
+ ["⁄"]=>
+ string(7) "&frasl;"
+ ["γ"]=>
+ string(7) "&gamma;"
+ ["≥"]=>
+ string(4) "&ge;"
+ [">"]=>
+ string(4) "&gt;"
+ ["⇔"]=>
+ string(6) "&hArr;"
+ ["↔"]=>
+ string(6) "&harr;"
+ ["♥"]=>
+ string(8) "&hearts;"
+ ["
"]=>
+ string(8) "&hellip;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["ℑ"]=>
+ string(7) "&image;"
+ ["∞"]=>
+ string(7) "&infin;"
+ ["∫"]=>
+ string(5) "&int;"
+ ["ι"]=>
+ string(6) "&iota;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["∈"]=>
+ string(6) "&isin;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["κ"]=>
+ string(7) "&kappa;"
+ ["⇐"]=>
+ string(6) "&lArr;"
+ ["λ"]=>
+ string(8) "&lambda;"
+ ["〈"]=>
+ string(6) "&lang;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["←"]=>
+ string(6) "&larr;"
+ ["⌈"]=>
+ string(7) "&lceil;"
+ ["“"]=>
+ string(7) "&ldquo;"
+ ["≀"]=>
+ string(4) "&le;"
+ ["⌊"]=>
+ string(8) "&lfloor;"
+ ["∗"]=>
+ string(8) "&lowast;"
+ ["◊"]=>
+ string(5) "&loz;"
+ ["‎"]=>
+ string(5) "&lrm;"
+ ["‹"]=>
+ string(8) "&lsaquo;"
+ ["‘"]=>
+ string(7) "&lsquo;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["—"]=>
+ string(7) "&mdash;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["−"]=>
+ string(7) "&minus;"
+ ["Ό"]=>
+ string(4) "&mu;"
+ ["∇"]=>
+ string(7) "&nabla;"
+ [" "]=>
+ string(6) "&nbsp;"
+ ["–"]=>
+ string(7) "&ndash;"
+ ["≠"]=>
+ string(4) "&ne;"
+ ["∋"]=>
+ string(4) "&ni;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["∉"]=>
+ string(7) "&notin;"
+ ["⊄"]=>
+ string(6) "&nsub;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["Μ"]=>
+ string(4) "&nu;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ÃŽ"]=>
+ string(7) "&ocirc;"
+ ["œ"]=>
+ string(7) "&oelig;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["‟"]=>
+ string(7) "&oline;"
+ ["ω"]=>
+ string(7) "&omega;"
+ ["ο"]=>
+ string(9) "&omicron;"
+ ["⊕"]=>
+ string(7) "&oplus;"
+ ["√"]=>
+ string(4) "&or;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["Þ"]=>
+ string(8) "&oslash;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["⊗"]=>
+ string(8) "&otimes;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["∂"]=>
+ string(6) "&part;"
+ ["‰"]=>
+ string(8) "&permil;"
+ ["⊥"]=>
+ string(6) "&perp;"
+ ["φ"]=>
+ string(5) "&phi;"
+ ["π"]=>
+ string(4) "&pi;"
+ ["ϖ"]=>
+ string(5) "&piv;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["′"]=>
+ string(7) "&prime;"
+ ["∏"]=>
+ string(6) "&prod;"
+ ["∝"]=>
+ string(6) "&prop;"
+ ["ψ"]=>
+ string(5) "&psi;"
+ ["""]=>
+ string(6) "&quot;"
+ ["⇒"]=>
+ string(6) "&rArr;"
+ ["√"]=>
+ string(7) "&radic;"
+ ["〉"]=>
+ string(6) "&rang;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["→"]=>
+ string(6) "&rarr;"
+ ["⌉"]=>
+ string(7) "&rceil;"
+ ["”"]=>
+ string(7) "&rdquo;"
+ ["ℜ"]=>
+ string(6) "&real;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["⌋"]=>
+ string(8) "&rfloor;"
+ ["ρ"]=>
+ string(5) "&rho;"
+ ["‏"]=>
+ string(5) "&rlm;"
+ ["›"]=>
+ string(8) "&rsaquo;"
+ ["’"]=>
+ string(7) "&rsquo;"
+ ["‚"]=>
+ string(7) "&sbquo;"
+ ["Å¡"]=>
+ string(8) "&scaron;"
+ ["⋅"]=>
+ string(6) "&sdot;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["σ"]=>
+ string(7) "&sigma;"
+ ["ς"]=>
+ string(8) "&sigmaf;"
+ ["∌"]=>
+ string(5) "&sim;"
+ ["♠"]=>
+ string(8) "&spades;"
+ ["⊂"]=>
+ string(5) "&sub;"
+ ["⊆"]=>
+ string(6) "&sube;"
+ ["∑"]=>
+ string(5) "&sum;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["⊃"]=>
+ string(5) "&sup;"
+ ["⊇"]=>
+ string(6) "&supe;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["τ"]=>
+ string(5) "&tau;"
+ ["∎"]=>
+ string(8) "&there4;"
+ ["Ξ"]=>
+ string(7) "&theta;"
+ ["ϑ"]=>
+ string(10) "&thetasym;"
+ [" "]=>
+ string(8) "&thinsp;"
+ ["ß"]=>
+ string(7) "&thorn;"
+ ["˜"]=>
+ string(7) "&tilde;"
+ ["×"]=>
+ string(7) "&times;"
+ ["™"]=>
+ string(7) "&trade;"
+ ["⇑"]=>
+ string(6) "&uArr;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["↑"]=>
+ string(6) "&uarr;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["š"]=>
+ string(5) "&uml;"
+ ["ϒ"]=>
+ string(7) "&upsih;"
+ ["υ"]=>
+ string(9) "&upsilon;"
+ ["Ì"]=>
+ string(6) "&uuml;"
+ ["℘"]=>
+ string(8) "&weierp;"
+ ["Ο"]=>
+ string(4) "&xi;"
+ ["Ü"]=>
+ string(8) "&yacute;"
+ ["Â¥"]=>
+ string(5) "&yen;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["ζ"]=>
+ string(6) "&zeta;"
+ ["‍"]=>
+ string(5) "&zwj;"
+ ["‌"]=>
+ string(6) "&zwnj;"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic10.phpt b/ext/standard/tests/strings/get_html_translation_table_basic10.phpt
new file mode 100644
index 0000000..a5a3568
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic10.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test get_html_translation_table() function: htmlentities/HTML 4/ISO-8859-1 (bug #64011)
+--FILE--
+<?php
+
+function so($a,$b) { return ord($a) - ord($b); }
+
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT, "ISO-8859-1");
+uksort( $tt, 'so' );
+var_dump( count($tt) );
+print_r( $tt );
+echo "Done\n";
+
+?>
+--EXPECT--
+int(100)
+Array
+(
+ ["] => &quot;
+ [&] => &amp;
+ [<] => &lt;
+ [>] => &gt;
+ [ ] => &nbsp;
+ [¡] => &iexcl;
+ [¢] => &cent;
+ [£] => &pound;
+ [€] => &curren;
+ [¥] => &yen;
+ [Š] => &brvbar;
+ [§] => &sect;
+ [š] => &uml;
+ [©] => &copy;
+ [ª] => &ordf;
+ [«] => &laquo;
+ [¬] => &not;
+ [­] => &shy;
+ [®] => &reg;
+ [¯] => &macr;
+ [°] => &deg;
+ [±] => &plusmn;
+ [²] => &sup2;
+ [³] => &sup3;
+ [Ž] => &acute;
+ [µ] => &micro;
+ [¶] => &para;
+ [·] => &middot;
+ [ž] => &cedil;
+ [¹] => &sup1;
+ [º] => &ordm;
+ [»] => &raquo;
+ [Œ] => &frac14;
+ [œ] => &frac12;
+ [Ÿ] => &frac34;
+ [¿] => &iquest;
+ [À] => &Agrave;
+ [Á] => &Aacute;
+ [Â] => &Acirc;
+ [Ã] => &Atilde;
+ [Ä] => &Auml;
+ [Å] => &Aring;
+ [Æ] => &AElig;
+ [Ç] => &Ccedil;
+ [È] => &Egrave;
+ [É] => &Eacute;
+ [Ê] => &Ecirc;
+ [Ë] => &Euml;
+ [Ì] => &Igrave;
+ [Í] => &Iacute;
+ [Î] => &Icirc;
+ [Ï] => &Iuml;
+ [Ð] => &ETH;
+ [Ñ] => &Ntilde;
+ [Ò] => &Ograve;
+ [Ó] => &Oacute;
+ [Ô] => &Ocirc;
+ [Õ] => &Otilde;
+ [Ö] => &Ouml;
+ [×] => &times;
+ [Ø] => &Oslash;
+ [Ù] => &Ugrave;
+ [Ú] => &Uacute;
+ [Û] => &Ucirc;
+ [Ü] => &Uuml;
+ [Ý] => &Yacute;
+ [Þ] => &THORN;
+ [ß] => &szlig;
+ [à] => &agrave;
+ [á] => &aacute;
+ [â] => &acirc;
+ [ã] => &atilde;
+ [ä] => &auml;
+ [å] => &aring;
+ [æ] => &aelig;
+ [ç] => &ccedil;
+ [è] => &egrave;
+ [é] => &eacute;
+ [ê] => &ecirc;
+ [ë] => &euml;
+ [ì] => &igrave;
+ [í] => &iacute;
+ [î] => &icirc;
+ [ï] => &iuml;
+ [ð] => &eth;
+ [ñ] => &ntilde;
+ [ò] => &ograve;
+ [ó] => &oacute;
+ [ô] => &ocirc;
+ [õ] => &otilde;
+ [ö] => &ouml;
+ [÷] => &divide;
+ [ø] => &oslash;
+ [ù] => &ugrave;
+ [ú] => &uacute;
+ [û] => &ucirc;
+ [ü] => &uuml;
+ [ý] => &yacute;
+ [þ] => &thorn;
+ [ÿ] => &yuml;
+)
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic2.phpt b/ext/standard/tests/strings/get_html_translation_table_basic2.phpt
new file mode 100644
index 0000000..1ab2ffa
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic2.phpt
@@ -0,0 +1,1565 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_ENTITIES & diff quote_style
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// Calling get_html_translation_table() with all arguments
+// $table as HTML_ENTITIES and different quote style
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$quote_style = ENT_COMPAT;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --\n";
+$quote_style = ENT_QUOTES;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --\n";
+$quote_style = ENT_NOQUOTES;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --
+array(252) {
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Α"]=>
+ string(7) "&Alpha;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Β"]=>
+ string(6) "&Beta;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["Χ"]=>
+ string(5) "&Chi;"
+ ["‡"]=>
+ string(8) "&Dagger;"
+ ["Δ"]=>
+ string(7) "&Delta;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["Ε"]=>
+ string(9) "&Epsilon;"
+ ["Η"]=>
+ string(5) "&Eta;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Γ"]=>
+ string(7) "&Gamma;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Ι"]=>
+ string(6) "&Iota;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Κ"]=>
+ string(7) "&Kappa;"
+ ["Λ"]=>
+ string(8) "&Lambda;"
+ ["Μ"]=>
+ string(4) "&Mu;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ν"]=>
+ string(4) "&Nu;"
+ ["Œ"]=>
+ string(7) "&OElig;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ω"]=>
+ string(7) "&Omega;"
+ ["Ο"]=>
+ string(9) "&Omicron;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["Ί"]=>
+ string(5) "&Phi;"
+ ["Π"]=>
+ string(4) "&Pi;"
+ ["″"]=>
+ string(7) "&Prime;"
+ ["Κ"]=>
+ string(5) "&Psi;"
+ ["Ρ"]=>
+ string(5) "&Rho;"
+ ["Å "]=>
+ string(8) "&Scaron;"
+ ["Σ"]=>
+ string(7) "&Sigma;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["΀"]=>
+ string(5) "&Tau;"
+ ["Θ"]=>
+ string(7) "&Theta;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Î¥"]=>
+ string(9) "&Upsilon;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ξ"]=>
+ string(4) "&Xi;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Åž"]=>
+ string(6) "&Yuml;"
+ ["Ζ"]=>
+ string(6) "&Zeta;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ÂŽ"]=>
+ string(7) "&acute;"
+ ["Ê"]=>
+ string(7) "&aelig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["ℵ"]=>
+ string(9) "&alefsym;"
+ ["α"]=>
+ string(7) "&alpha;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["∧"]=>
+ string(5) "&and;"
+ ["∠"]=>
+ string(5) "&ang;"
+ ["Ã¥"]=>
+ string(7) "&aring;"
+ ["≈"]=>
+ string(7) "&asymp;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["À"]=>
+ string(6) "&auml;"
+ ["„"]=>
+ string(7) "&bdquo;"
+ ["β"]=>
+ string(6) "&beta;"
+ ["Š"]=>
+ string(8) "&brvbar;"
+ ["•"]=>
+ string(6) "&bull;"
+ ["∩"]=>
+ string(5) "&cap;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["ž"]=>
+ string(7) "&cedil;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["χ"]=>
+ string(5) "&chi;"
+ ["ˆ"]=>
+ string(6) "&circ;"
+ ["♣"]=>
+ string(7) "&clubs;"
+ ["≅"]=>
+ string(6) "&cong;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["↵"]=>
+ string(7) "&crarr;"
+ ["∪"]=>
+ string(5) "&cup;"
+ ["€"]=>
+ string(8) "&curren;"
+ ["⇓"]=>
+ string(6) "&dArr;"
+ ["†"]=>
+ string(8) "&dagger;"
+ ["↓"]=>
+ string(6) "&darr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["ÎŽ"]=>
+ string(7) "&delta;"
+ ["♩"]=>
+ string(7) "&diams;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["Ú"]=>
+ string(8) "&egrave;"
+ ["∅"]=>
+ string(7) "&empty;"
+ [" "]=>
+ string(6) "&emsp;"
+ [" "]=>
+ string(6) "&ensp;"
+ ["ε"]=>
+ string(9) "&epsilon;"
+ ["≡"]=>
+ string(7) "&equiv;"
+ ["η"]=>
+ string(5) "&eta;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["€"]=>
+ string(6) "&euro;"
+ ["∃"]=>
+ string(7) "&exist;"
+ ["ƒ"]=>
+ string(6) "&fnof;"
+ ["∀"]=>
+ string(8) "&forall;"
+ ["œ"]=>
+ string(8) "&frac12;"
+ ["Œ"]=>
+ string(8) "&frac14;"
+ ["Ÿ"]=>
+ string(8) "&frac34;"
+ ["⁄"]=>
+ string(7) "&frasl;"
+ ["γ"]=>
+ string(7) "&gamma;"
+ ["≥"]=>
+ string(4) "&ge;"
+ [">"]=>
+ string(4) "&gt;"
+ ["⇔"]=>
+ string(6) "&hArr;"
+ ["↔"]=>
+ string(6) "&harr;"
+ ["♥"]=>
+ string(8) "&hearts;"
+ ["
"]=>
+ string(8) "&hellip;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["ℑ"]=>
+ string(7) "&image;"
+ ["∞"]=>
+ string(7) "&infin;"
+ ["∫"]=>
+ string(5) "&int;"
+ ["ι"]=>
+ string(6) "&iota;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["∈"]=>
+ string(6) "&isin;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["κ"]=>
+ string(7) "&kappa;"
+ ["⇐"]=>
+ string(6) "&lArr;"
+ ["λ"]=>
+ string(8) "&lambda;"
+ ["〈"]=>
+ string(6) "&lang;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["←"]=>
+ string(6) "&larr;"
+ ["⌈"]=>
+ string(7) "&lceil;"
+ ["“"]=>
+ string(7) "&ldquo;"
+ ["≀"]=>
+ string(4) "&le;"
+ ["⌊"]=>
+ string(8) "&lfloor;"
+ ["∗"]=>
+ string(8) "&lowast;"
+ ["◊"]=>
+ string(5) "&loz;"
+ ["‎"]=>
+ string(5) "&lrm;"
+ ["‹"]=>
+ string(8) "&lsaquo;"
+ ["‘"]=>
+ string(7) "&lsquo;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["—"]=>
+ string(7) "&mdash;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["−"]=>
+ string(7) "&minus;"
+ ["Ό"]=>
+ string(4) "&mu;"
+ ["∇"]=>
+ string(7) "&nabla;"
+ [" "]=>
+ string(6) "&nbsp;"
+ ["–"]=>
+ string(7) "&ndash;"
+ ["≠"]=>
+ string(4) "&ne;"
+ ["∋"]=>
+ string(4) "&ni;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["∉"]=>
+ string(7) "&notin;"
+ ["⊄"]=>
+ string(6) "&nsub;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["Μ"]=>
+ string(4) "&nu;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ÃŽ"]=>
+ string(7) "&ocirc;"
+ ["œ"]=>
+ string(7) "&oelig;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["‟"]=>
+ string(7) "&oline;"
+ ["ω"]=>
+ string(7) "&omega;"
+ ["ο"]=>
+ string(9) "&omicron;"
+ ["⊕"]=>
+ string(7) "&oplus;"
+ ["√"]=>
+ string(4) "&or;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["Þ"]=>
+ string(8) "&oslash;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["⊗"]=>
+ string(8) "&otimes;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["∂"]=>
+ string(6) "&part;"
+ ["‰"]=>
+ string(8) "&permil;"
+ ["⊥"]=>
+ string(6) "&perp;"
+ ["φ"]=>
+ string(5) "&phi;"
+ ["π"]=>
+ string(4) "&pi;"
+ ["ϖ"]=>
+ string(5) "&piv;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["′"]=>
+ string(7) "&prime;"
+ ["∏"]=>
+ string(6) "&prod;"
+ ["∝"]=>
+ string(6) "&prop;"
+ ["ψ"]=>
+ string(5) "&psi;"
+ ["""]=>
+ string(6) "&quot;"
+ ["⇒"]=>
+ string(6) "&rArr;"
+ ["√"]=>
+ string(7) "&radic;"
+ ["〉"]=>
+ string(6) "&rang;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["→"]=>
+ string(6) "&rarr;"
+ ["⌉"]=>
+ string(7) "&rceil;"
+ ["”"]=>
+ string(7) "&rdquo;"
+ ["ℜ"]=>
+ string(6) "&real;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["⌋"]=>
+ string(8) "&rfloor;"
+ ["ρ"]=>
+ string(5) "&rho;"
+ ["‏"]=>
+ string(5) "&rlm;"
+ ["›"]=>
+ string(8) "&rsaquo;"
+ ["’"]=>
+ string(7) "&rsquo;"
+ ["‚"]=>
+ string(7) "&sbquo;"
+ ["Å¡"]=>
+ string(8) "&scaron;"
+ ["⋅"]=>
+ string(6) "&sdot;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["σ"]=>
+ string(7) "&sigma;"
+ ["ς"]=>
+ string(8) "&sigmaf;"
+ ["∌"]=>
+ string(5) "&sim;"
+ ["♠"]=>
+ string(8) "&spades;"
+ ["⊂"]=>
+ string(5) "&sub;"
+ ["⊆"]=>
+ string(6) "&sube;"
+ ["∑"]=>
+ string(5) "&sum;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["⊃"]=>
+ string(5) "&sup;"
+ ["⊇"]=>
+ string(6) "&supe;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["τ"]=>
+ string(5) "&tau;"
+ ["∎"]=>
+ string(8) "&there4;"
+ ["Ξ"]=>
+ string(7) "&theta;"
+ ["ϑ"]=>
+ string(10) "&thetasym;"
+ [" "]=>
+ string(8) "&thinsp;"
+ ["ß"]=>
+ string(7) "&thorn;"
+ ["˜"]=>
+ string(7) "&tilde;"
+ ["×"]=>
+ string(7) "&times;"
+ ["™"]=>
+ string(7) "&trade;"
+ ["⇑"]=>
+ string(6) "&uArr;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["↑"]=>
+ string(6) "&uarr;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["š"]=>
+ string(5) "&uml;"
+ ["ϒ"]=>
+ string(7) "&upsih;"
+ ["υ"]=>
+ string(9) "&upsilon;"
+ ["Ì"]=>
+ string(6) "&uuml;"
+ ["℘"]=>
+ string(8) "&weierp;"
+ ["Ο"]=>
+ string(4) "&xi;"
+ ["Ü"]=>
+ string(8) "&yacute;"
+ ["Â¥"]=>
+ string(5) "&yen;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["ζ"]=>
+ string(6) "&zeta;"
+ ["‍"]=>
+ string(5) "&zwj;"
+ ["‌"]=>
+ string(6) "&zwnj;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --
+array(253) {
+ ["'"]=>
+ string(6) "&#039;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Α"]=>
+ string(7) "&Alpha;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Β"]=>
+ string(6) "&Beta;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["Χ"]=>
+ string(5) "&Chi;"
+ ["‡"]=>
+ string(8) "&Dagger;"
+ ["Δ"]=>
+ string(7) "&Delta;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["Ε"]=>
+ string(9) "&Epsilon;"
+ ["Η"]=>
+ string(5) "&Eta;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Γ"]=>
+ string(7) "&Gamma;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Ι"]=>
+ string(6) "&Iota;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Κ"]=>
+ string(7) "&Kappa;"
+ ["Λ"]=>
+ string(8) "&Lambda;"
+ ["Μ"]=>
+ string(4) "&Mu;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ν"]=>
+ string(4) "&Nu;"
+ ["Œ"]=>
+ string(7) "&OElig;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ω"]=>
+ string(7) "&Omega;"
+ ["Ο"]=>
+ string(9) "&Omicron;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["Ί"]=>
+ string(5) "&Phi;"
+ ["Π"]=>
+ string(4) "&Pi;"
+ ["″"]=>
+ string(7) "&Prime;"
+ ["Κ"]=>
+ string(5) "&Psi;"
+ ["Ρ"]=>
+ string(5) "&Rho;"
+ ["Å "]=>
+ string(8) "&Scaron;"
+ ["Σ"]=>
+ string(7) "&Sigma;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["΀"]=>
+ string(5) "&Tau;"
+ ["Θ"]=>
+ string(7) "&Theta;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Î¥"]=>
+ string(9) "&Upsilon;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ξ"]=>
+ string(4) "&Xi;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Åž"]=>
+ string(6) "&Yuml;"
+ ["Ζ"]=>
+ string(6) "&Zeta;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ÂŽ"]=>
+ string(7) "&acute;"
+ ["Ê"]=>
+ string(7) "&aelig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["ℵ"]=>
+ string(9) "&alefsym;"
+ ["α"]=>
+ string(7) "&alpha;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["∧"]=>
+ string(5) "&and;"
+ ["∠"]=>
+ string(5) "&ang;"
+ ["Ã¥"]=>
+ string(7) "&aring;"
+ ["≈"]=>
+ string(7) "&asymp;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["À"]=>
+ string(6) "&auml;"
+ ["„"]=>
+ string(7) "&bdquo;"
+ ["β"]=>
+ string(6) "&beta;"
+ ["Š"]=>
+ string(8) "&brvbar;"
+ ["•"]=>
+ string(6) "&bull;"
+ ["∩"]=>
+ string(5) "&cap;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["ž"]=>
+ string(7) "&cedil;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["χ"]=>
+ string(5) "&chi;"
+ ["ˆ"]=>
+ string(6) "&circ;"
+ ["♣"]=>
+ string(7) "&clubs;"
+ ["≅"]=>
+ string(6) "&cong;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["↵"]=>
+ string(7) "&crarr;"
+ ["∪"]=>
+ string(5) "&cup;"
+ ["€"]=>
+ string(8) "&curren;"
+ ["⇓"]=>
+ string(6) "&dArr;"
+ ["†"]=>
+ string(8) "&dagger;"
+ ["↓"]=>
+ string(6) "&darr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["ÎŽ"]=>
+ string(7) "&delta;"
+ ["♩"]=>
+ string(7) "&diams;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["Ú"]=>
+ string(8) "&egrave;"
+ ["∅"]=>
+ string(7) "&empty;"
+ [" "]=>
+ string(6) "&emsp;"
+ [" "]=>
+ string(6) "&ensp;"
+ ["ε"]=>
+ string(9) "&epsilon;"
+ ["≡"]=>
+ string(7) "&equiv;"
+ ["η"]=>
+ string(5) "&eta;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["€"]=>
+ string(6) "&euro;"
+ ["∃"]=>
+ string(7) "&exist;"
+ ["ƒ"]=>
+ string(6) "&fnof;"
+ ["∀"]=>
+ string(8) "&forall;"
+ ["œ"]=>
+ string(8) "&frac12;"
+ ["Œ"]=>
+ string(8) "&frac14;"
+ ["Ÿ"]=>
+ string(8) "&frac34;"
+ ["⁄"]=>
+ string(7) "&frasl;"
+ ["γ"]=>
+ string(7) "&gamma;"
+ ["≥"]=>
+ string(4) "&ge;"
+ [">"]=>
+ string(4) "&gt;"
+ ["⇔"]=>
+ string(6) "&hArr;"
+ ["↔"]=>
+ string(6) "&harr;"
+ ["♥"]=>
+ string(8) "&hearts;"
+ ["
"]=>
+ string(8) "&hellip;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["ℑ"]=>
+ string(7) "&image;"
+ ["∞"]=>
+ string(7) "&infin;"
+ ["∫"]=>
+ string(5) "&int;"
+ ["ι"]=>
+ string(6) "&iota;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["∈"]=>
+ string(6) "&isin;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["κ"]=>
+ string(7) "&kappa;"
+ ["⇐"]=>
+ string(6) "&lArr;"
+ ["λ"]=>
+ string(8) "&lambda;"
+ ["〈"]=>
+ string(6) "&lang;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["←"]=>
+ string(6) "&larr;"
+ ["⌈"]=>
+ string(7) "&lceil;"
+ ["“"]=>
+ string(7) "&ldquo;"
+ ["≀"]=>
+ string(4) "&le;"
+ ["⌊"]=>
+ string(8) "&lfloor;"
+ ["∗"]=>
+ string(8) "&lowast;"
+ ["◊"]=>
+ string(5) "&loz;"
+ ["‎"]=>
+ string(5) "&lrm;"
+ ["‹"]=>
+ string(8) "&lsaquo;"
+ ["‘"]=>
+ string(7) "&lsquo;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["—"]=>
+ string(7) "&mdash;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["−"]=>
+ string(7) "&minus;"
+ ["Ό"]=>
+ string(4) "&mu;"
+ ["∇"]=>
+ string(7) "&nabla;"
+ [" "]=>
+ string(6) "&nbsp;"
+ ["–"]=>
+ string(7) "&ndash;"
+ ["≠"]=>
+ string(4) "&ne;"
+ ["∋"]=>
+ string(4) "&ni;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["∉"]=>
+ string(7) "&notin;"
+ ["⊄"]=>
+ string(6) "&nsub;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["Μ"]=>
+ string(4) "&nu;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ÃŽ"]=>
+ string(7) "&ocirc;"
+ ["œ"]=>
+ string(7) "&oelig;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["‟"]=>
+ string(7) "&oline;"
+ ["ω"]=>
+ string(7) "&omega;"
+ ["ο"]=>
+ string(9) "&omicron;"
+ ["⊕"]=>
+ string(7) "&oplus;"
+ ["√"]=>
+ string(4) "&or;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["Þ"]=>
+ string(8) "&oslash;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["⊗"]=>
+ string(8) "&otimes;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["∂"]=>
+ string(6) "&part;"
+ ["‰"]=>
+ string(8) "&permil;"
+ ["⊥"]=>
+ string(6) "&perp;"
+ ["φ"]=>
+ string(5) "&phi;"
+ ["π"]=>
+ string(4) "&pi;"
+ ["ϖ"]=>
+ string(5) "&piv;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["′"]=>
+ string(7) "&prime;"
+ ["∏"]=>
+ string(6) "&prod;"
+ ["∝"]=>
+ string(6) "&prop;"
+ ["ψ"]=>
+ string(5) "&psi;"
+ ["""]=>
+ string(6) "&quot;"
+ ["⇒"]=>
+ string(6) "&rArr;"
+ ["√"]=>
+ string(7) "&radic;"
+ ["〉"]=>
+ string(6) "&rang;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["→"]=>
+ string(6) "&rarr;"
+ ["⌉"]=>
+ string(7) "&rceil;"
+ ["”"]=>
+ string(7) "&rdquo;"
+ ["ℜ"]=>
+ string(6) "&real;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["⌋"]=>
+ string(8) "&rfloor;"
+ ["ρ"]=>
+ string(5) "&rho;"
+ ["‏"]=>
+ string(5) "&rlm;"
+ ["›"]=>
+ string(8) "&rsaquo;"
+ ["’"]=>
+ string(7) "&rsquo;"
+ ["‚"]=>
+ string(7) "&sbquo;"
+ ["Å¡"]=>
+ string(8) "&scaron;"
+ ["⋅"]=>
+ string(6) "&sdot;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["σ"]=>
+ string(7) "&sigma;"
+ ["ς"]=>
+ string(8) "&sigmaf;"
+ ["∌"]=>
+ string(5) "&sim;"
+ ["♠"]=>
+ string(8) "&spades;"
+ ["⊂"]=>
+ string(5) "&sub;"
+ ["⊆"]=>
+ string(6) "&sube;"
+ ["∑"]=>
+ string(5) "&sum;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["⊃"]=>
+ string(5) "&sup;"
+ ["⊇"]=>
+ string(6) "&supe;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["τ"]=>
+ string(5) "&tau;"
+ ["∎"]=>
+ string(8) "&there4;"
+ ["Ξ"]=>
+ string(7) "&theta;"
+ ["ϑ"]=>
+ string(10) "&thetasym;"
+ [" "]=>
+ string(8) "&thinsp;"
+ ["ß"]=>
+ string(7) "&thorn;"
+ ["˜"]=>
+ string(7) "&tilde;"
+ ["×"]=>
+ string(7) "&times;"
+ ["™"]=>
+ string(7) "&trade;"
+ ["⇑"]=>
+ string(6) "&uArr;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["↑"]=>
+ string(6) "&uarr;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["š"]=>
+ string(5) "&uml;"
+ ["ϒ"]=>
+ string(7) "&upsih;"
+ ["υ"]=>
+ string(9) "&upsilon;"
+ ["Ì"]=>
+ string(6) "&uuml;"
+ ["℘"]=>
+ string(8) "&weierp;"
+ ["Ο"]=>
+ string(4) "&xi;"
+ ["Ü"]=>
+ string(8) "&yacute;"
+ ["Â¥"]=>
+ string(5) "&yen;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["ζ"]=>
+ string(6) "&zeta;"
+ ["‍"]=>
+ string(5) "&zwj;"
+ ["‌"]=>
+ string(6) "&zwnj;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --
+array(251) {
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Α"]=>
+ string(7) "&Alpha;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Β"]=>
+ string(6) "&Beta;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["Χ"]=>
+ string(5) "&Chi;"
+ ["‡"]=>
+ string(8) "&Dagger;"
+ ["Δ"]=>
+ string(7) "&Delta;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["Ε"]=>
+ string(9) "&Epsilon;"
+ ["Η"]=>
+ string(5) "&Eta;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Γ"]=>
+ string(7) "&Gamma;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Ι"]=>
+ string(6) "&Iota;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Κ"]=>
+ string(7) "&Kappa;"
+ ["Λ"]=>
+ string(8) "&Lambda;"
+ ["Μ"]=>
+ string(4) "&Mu;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ν"]=>
+ string(4) "&Nu;"
+ ["Œ"]=>
+ string(7) "&OElig;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ω"]=>
+ string(7) "&Omega;"
+ ["Ο"]=>
+ string(9) "&Omicron;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["Ί"]=>
+ string(5) "&Phi;"
+ ["Π"]=>
+ string(4) "&Pi;"
+ ["″"]=>
+ string(7) "&Prime;"
+ ["Κ"]=>
+ string(5) "&Psi;"
+ ["Ρ"]=>
+ string(5) "&Rho;"
+ ["Å "]=>
+ string(8) "&Scaron;"
+ ["Σ"]=>
+ string(7) "&Sigma;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["΀"]=>
+ string(5) "&Tau;"
+ ["Θ"]=>
+ string(7) "&Theta;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Î¥"]=>
+ string(9) "&Upsilon;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ξ"]=>
+ string(4) "&Xi;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Åž"]=>
+ string(6) "&Yuml;"
+ ["Ζ"]=>
+ string(6) "&Zeta;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ÂŽ"]=>
+ string(7) "&acute;"
+ ["Ê"]=>
+ string(7) "&aelig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["ℵ"]=>
+ string(9) "&alefsym;"
+ ["α"]=>
+ string(7) "&alpha;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["∧"]=>
+ string(5) "&and;"
+ ["∠"]=>
+ string(5) "&ang;"
+ ["Ã¥"]=>
+ string(7) "&aring;"
+ ["≈"]=>
+ string(7) "&asymp;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["À"]=>
+ string(6) "&auml;"
+ ["„"]=>
+ string(7) "&bdquo;"
+ ["β"]=>
+ string(6) "&beta;"
+ ["Š"]=>
+ string(8) "&brvbar;"
+ ["•"]=>
+ string(6) "&bull;"
+ ["∩"]=>
+ string(5) "&cap;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["ž"]=>
+ string(7) "&cedil;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["χ"]=>
+ string(5) "&chi;"
+ ["ˆ"]=>
+ string(6) "&circ;"
+ ["♣"]=>
+ string(7) "&clubs;"
+ ["≅"]=>
+ string(6) "&cong;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["↵"]=>
+ string(7) "&crarr;"
+ ["∪"]=>
+ string(5) "&cup;"
+ ["€"]=>
+ string(8) "&curren;"
+ ["⇓"]=>
+ string(6) "&dArr;"
+ ["†"]=>
+ string(8) "&dagger;"
+ ["↓"]=>
+ string(6) "&darr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["ÎŽ"]=>
+ string(7) "&delta;"
+ ["♩"]=>
+ string(7) "&diams;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["Ú"]=>
+ string(8) "&egrave;"
+ ["∅"]=>
+ string(7) "&empty;"
+ [" "]=>
+ string(6) "&emsp;"
+ [" "]=>
+ string(6) "&ensp;"
+ ["ε"]=>
+ string(9) "&epsilon;"
+ ["≡"]=>
+ string(7) "&equiv;"
+ ["η"]=>
+ string(5) "&eta;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["€"]=>
+ string(6) "&euro;"
+ ["∃"]=>
+ string(7) "&exist;"
+ ["ƒ"]=>
+ string(6) "&fnof;"
+ ["∀"]=>
+ string(8) "&forall;"
+ ["œ"]=>
+ string(8) "&frac12;"
+ ["Œ"]=>
+ string(8) "&frac14;"
+ ["Ÿ"]=>
+ string(8) "&frac34;"
+ ["⁄"]=>
+ string(7) "&frasl;"
+ ["γ"]=>
+ string(7) "&gamma;"
+ ["≥"]=>
+ string(4) "&ge;"
+ [">"]=>
+ string(4) "&gt;"
+ ["⇔"]=>
+ string(6) "&hArr;"
+ ["↔"]=>
+ string(6) "&harr;"
+ ["♥"]=>
+ string(8) "&hearts;"
+ ["
"]=>
+ string(8) "&hellip;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["ℑ"]=>
+ string(7) "&image;"
+ ["∞"]=>
+ string(7) "&infin;"
+ ["∫"]=>
+ string(5) "&int;"
+ ["ι"]=>
+ string(6) "&iota;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["∈"]=>
+ string(6) "&isin;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["κ"]=>
+ string(7) "&kappa;"
+ ["⇐"]=>
+ string(6) "&lArr;"
+ ["λ"]=>
+ string(8) "&lambda;"
+ ["〈"]=>
+ string(6) "&lang;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["←"]=>
+ string(6) "&larr;"
+ ["⌈"]=>
+ string(7) "&lceil;"
+ ["“"]=>
+ string(7) "&ldquo;"
+ ["≀"]=>
+ string(4) "&le;"
+ ["⌊"]=>
+ string(8) "&lfloor;"
+ ["∗"]=>
+ string(8) "&lowast;"
+ ["◊"]=>
+ string(5) "&loz;"
+ ["‎"]=>
+ string(5) "&lrm;"
+ ["‹"]=>
+ string(8) "&lsaquo;"
+ ["‘"]=>
+ string(7) "&lsquo;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["—"]=>
+ string(7) "&mdash;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["−"]=>
+ string(7) "&minus;"
+ ["Ό"]=>
+ string(4) "&mu;"
+ ["∇"]=>
+ string(7) "&nabla;"
+ [" "]=>
+ string(6) "&nbsp;"
+ ["–"]=>
+ string(7) "&ndash;"
+ ["≠"]=>
+ string(4) "&ne;"
+ ["∋"]=>
+ string(4) "&ni;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["∉"]=>
+ string(7) "&notin;"
+ ["⊄"]=>
+ string(6) "&nsub;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["Μ"]=>
+ string(4) "&nu;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ÃŽ"]=>
+ string(7) "&ocirc;"
+ ["œ"]=>
+ string(7) "&oelig;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["‟"]=>
+ string(7) "&oline;"
+ ["ω"]=>
+ string(7) "&omega;"
+ ["ο"]=>
+ string(9) "&omicron;"
+ ["⊕"]=>
+ string(7) "&oplus;"
+ ["√"]=>
+ string(4) "&or;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["Þ"]=>
+ string(8) "&oslash;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["⊗"]=>
+ string(8) "&otimes;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["∂"]=>
+ string(6) "&part;"
+ ["‰"]=>
+ string(8) "&permil;"
+ ["⊥"]=>
+ string(6) "&perp;"
+ ["φ"]=>
+ string(5) "&phi;"
+ ["π"]=>
+ string(4) "&pi;"
+ ["ϖ"]=>
+ string(5) "&piv;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["′"]=>
+ string(7) "&prime;"
+ ["∏"]=>
+ string(6) "&prod;"
+ ["∝"]=>
+ string(6) "&prop;"
+ ["ψ"]=>
+ string(5) "&psi;"
+ ["⇒"]=>
+ string(6) "&rArr;"
+ ["√"]=>
+ string(7) "&radic;"
+ ["〉"]=>
+ string(6) "&rang;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["→"]=>
+ string(6) "&rarr;"
+ ["⌉"]=>
+ string(7) "&rceil;"
+ ["”"]=>
+ string(7) "&rdquo;"
+ ["ℜ"]=>
+ string(6) "&real;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["⌋"]=>
+ string(8) "&rfloor;"
+ ["ρ"]=>
+ string(5) "&rho;"
+ ["‏"]=>
+ string(5) "&rlm;"
+ ["›"]=>
+ string(8) "&rsaquo;"
+ ["’"]=>
+ string(7) "&rsquo;"
+ ["‚"]=>
+ string(7) "&sbquo;"
+ ["Å¡"]=>
+ string(8) "&scaron;"
+ ["⋅"]=>
+ string(6) "&sdot;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["σ"]=>
+ string(7) "&sigma;"
+ ["ς"]=>
+ string(8) "&sigmaf;"
+ ["∌"]=>
+ string(5) "&sim;"
+ ["♠"]=>
+ string(8) "&spades;"
+ ["⊂"]=>
+ string(5) "&sub;"
+ ["⊆"]=>
+ string(6) "&sube;"
+ ["∑"]=>
+ string(5) "&sum;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["⊃"]=>
+ string(5) "&sup;"
+ ["⊇"]=>
+ string(6) "&supe;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["τ"]=>
+ string(5) "&tau;"
+ ["∎"]=>
+ string(8) "&there4;"
+ ["Ξ"]=>
+ string(7) "&theta;"
+ ["ϑ"]=>
+ string(10) "&thetasym;"
+ [" "]=>
+ string(8) "&thinsp;"
+ ["ß"]=>
+ string(7) "&thorn;"
+ ["˜"]=>
+ string(7) "&tilde;"
+ ["×"]=>
+ string(7) "&times;"
+ ["™"]=>
+ string(7) "&trade;"
+ ["⇑"]=>
+ string(6) "&uArr;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["↑"]=>
+ string(6) "&uarr;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["š"]=>
+ string(5) "&uml;"
+ ["ϒ"]=>
+ string(7) "&upsih;"
+ ["υ"]=>
+ string(9) "&upsilon;"
+ ["Ì"]=>
+ string(6) "&uuml;"
+ ["℘"]=>
+ string(8) "&weierp;"
+ ["Ο"]=>
+ string(4) "&xi;"
+ ["Ü"]=>
+ string(8) "&yacute;"
+ ["Â¥"]=>
+ string(5) "&yen;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["ζ"]=>
+ string(6) "&zeta;"
+ ["‍"]=>
+ string(5) "&zwj;"
+ ["‌"]=>
+ string(6) "&zwnj;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic3.phpt b/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
new file mode 100644
index 0000000..4e1cddd
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// $table as HTML_SEPCIALCHARS and different quote style
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$quote_style = ENT_COMPAT;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n";
+$quote_style = ENT_QUOTES;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n";
+$quote_style = ENT_NOQUOTES;
+$tt = get_html_translation_table($table, $quote_style, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --
+array(5) {
+ ["'"]=>
+ string(6) "&#039;"
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic4.phpt b/ext/standard/tests/strings/get_html_translation_table_basic4.phpt
new file mode 100644
index 0000000..1a908ef
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic4.phpt
@@ -0,0 +1,293 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - charset WINDOWS-1252
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+
+echo "*** Testing get_html_translation_table() : basic functionality/Windows-1252 ***\n";
+
+echo "-- with table = HTML_ENTITIES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT, "WINDOWS-1252");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "WINDOWS-1252");
+asort( $tt );
+var_dump( $tt );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality/Windows-1252 ***
+-- with table = HTML_ENTITIES --
+array(125) {
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["‡"]=>
+ string(8) "&Dagger;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Œ"]=>
+ string(7) "&OElig;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["Š"]=>
+ string(8) "&Scaron;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Ÿ"]=>
+ string(6) "&Yuml;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["Ž"]=>
+ string(7) "&acute;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["„"]=>
+ string(7) "&bdquo;"
+ ["Š"]=>
+ string(8) "&brvbar;"
+ ["•"]=>
+ string(6) "&bull;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["ž"]=>
+ string(7) "&cedil;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["ˆ"]=>
+ string(6) "&circ;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["€"]=>
+ string(8) "&curren;"
+ ["†"]=>
+ string(8) "&dagger;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["€"]=>
+ string(6) "&euro;"
+ ["ƒ"]=>
+ string(6) "&fnof;"
+ ["œ"]=>
+ string(8) "&frac12;"
+ ["Œ"]=>
+ string(8) "&frac14;"
+ ["Ÿ"]=>
+ string(8) "&frac34;"
+ [">"]=>
+ string(4) "&gt;"
+ ["…"]=>
+ string(8) "&hellip;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["“"]=>
+ string(7) "&ldquo;"
+ ["‹"]=>
+ string(8) "&lsaquo;"
+ ["‘"]=>
+ string(7) "&lsquo;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["—"]=>
+ string(7) "&mdash;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["·"]=>
+ string(8) "&middot;"
+ [" "]=>
+ string(6) "&nbsp;"
+ ["–"]=>
+ string(7) "&ndash;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["œ"]=>
+ string(7) "&oelig;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["‰"]=>
+ string(8) "&permil;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["""]=>
+ string(6) "&quot;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["”"]=>
+ string(7) "&rdquo;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["›"]=>
+ string(8) "&rsaquo;"
+ ["’"]=>
+ string(7) "&rsquo;"
+ ["‚"]=>
+ string(7) "&sbquo;"
+ ["š"]=>
+ string(8) "&scaron;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["˜"]=>
+ string(7) "&tilde;"
+ ["×"]=>
+ string(7) "&times;"
+ ["™"]=>
+ string(7) "&trade;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["š"]=>
+ string(5) "&uml;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic5.phpt b/ext/standard/tests/strings/get_html_translation_table_basic5.phpt
new file mode 100644
index 0000000..600ad43
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic5.phpt
@@ -0,0 +1,1598 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - HTML 5
+--FILE--
+<?php
+echo "*** Testing get_html_translation_table() : basic functionality/HTML 5 ***\n";
+
+echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT | ENT_HTML5, "UTF-8");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "UTF-8");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "UTF-8");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality/HTML 5 ***
+-- with table = HTML_ENTITIES, ENT_COMPAT --
+int(1509)
+Array
+(
+ [Æ] => &AElig;
+ [Á] => &Aacute;
+ [Ă] => &Abreve;
+ [Â] => &Acirc;
+ [А] => &Acy;
+ [𝔄] => &Afr;
+ [À] => &Agrave;
+ [Α] => &Alpha;
+ [Ā] => &Amacr;
+ [⩓] => &And;
+ [Ą] => &Aogon;
+ [𝔞] => &Aopf;
+ [Å] => &Aring;
+ [𝒜] => &Ascr;
+ [Ã] => &Atilde;
+ [Ä] => &Auml;
+ [â«§] => &Barv;
+ [Б] => &Bcy;
+ [∵] => &Because;
+ [Β] => &Beta;
+ [𝔅] => &Bfr;
+ [𝔹] => &Bopf;
+ [˘] => &Breve;
+ [ℬ] => &Bscr;
+ [Ч] => &CHcy;
+ [Ć] => &Cacute;
+ [⋒] => &Cap;
+ [ⅅ] => &CapitalDifferentialD;
+ [Č] => &Ccaron;
+ [Ç] => &Ccedil;
+ [Ĉ] => &Ccirc;
+ [∰] => &Cconint;
+ [Ċ] => &Cdot;
+ [ž] => &Cedilla;
+ [·] => &CenterDot;
+ [ℭ] => &Cfr;
+ [Χ] => &Chi;
+ [⊙] => &CircleDot;
+ [⊕] => &CirclePlus;
+ [⊗] => &CircleTimes;
+ [∷] => &Colon;
+ [⩎] => &Colone;
+ [≡] => &Congruent;
+ [∮] => &ContourIntegral;
+ [∐] => &Coproduct;
+ [⚯] => &Cross;
+ [𝒞] => &Cscr;
+ [⋓] => &Cup;
+ [≍] => &CupCap;
+ [‑] => &DDotrahd;
+ [Ђ] => &DJcy;
+ [Ѕ] => &DScy;
+ [Џ] => &DZcy;
+ [‡] => &Dagger;
+ [↡] => &Darr;
+ [â«€] => &Dashv;
+ [Ď] => &Dcaron;
+ [Д] => &Dcy;
+ [Δ] => &Delta;
+ [𝔇] => &Dfr;
+ [ÂŽ] => &DiacriticalAcute;
+ [˝] => &DiacriticalDoubleAcute;
+ [˜] => &DiacriticalTilde;
+ [ⅆ] => &DifferentialD;
+ [𝔻] => &Dopf;
+ [⃜] => &DotDot;
+ [∯] => &DoubleContourIntegral;
+ [š] => &DoubleDot;
+ [⇐] => &DoubleLeftArrow;
+ [⟹] => &DoubleLongRightArrow;
+ [⊹] => &DoubleRightTee;
+ [⇑] => &DoubleUpArrow;
+ [–] => &DownArrowBar;
+ [⇵] => &DownArrowUpArrow;
+ [̑] => &DownBreve;
+ [⥐] => &DownLeftRightVector;
+ [⥞] => &DownLeftTeeVector;
+ [⥖] => &DownLeftVectorBar;
+ [⥟] => &DownRightTeeVector;
+ [⥗] => &DownRightVectorBar;
+ [⊀] => &DownTee;
+ [↧] => &DownTeeArrow;
+ [⇓] => &Downarrow;
+ [𝒟] => &Dscr;
+ [Đ] => &Dstrok;
+ [Ŋ] => &ENG;
+ [Ð] => &ETH;
+ [É] => &Eacute;
+ [Ě] => &Ecaron;
+ [Ê] => &Ecirc;
+ [Э] => &Ecy;
+ [Ė] => &Edot;
+ [𝔈] => &Efr;
+ [È] => &Egrave;
+ [Ē] => &Emacr;
+ [◻] => &EmptySmallSquare;
+ [▫] => &EmptyVerySmallSquare;
+ [Ę] => &Eogon;
+ [𝔌] => &Eopf;
+ [Ε] => &Epsilon;
+ [⩵] => &Equal;
+ [⩳] => &Esim;
+ [Η] => &Eta;
+ [Ë] => &Euml;
+ [∃] => &Exists;
+ [Ѐ] => &Fcy;
+ [𝔉] => &Ffr;
+ [◌] => &FilledSmallSquare;
+ [𝔜] => &Fopf;
+ [ℱ] => &Fouriertrf;
+ [Ѓ] => &GJcy;
+ [Γ] => &Gamma;
+ [Ϝ] => &Gammad;
+ [Ğ] => &Gbreve;
+ [Ä¢] => &Gcedil;
+ [Ĝ] => &Gcirc;
+ [Г] => &Gcy;
+ [Ä ] => &Gdot;
+ [𝔊] => &Gfr;
+ [⋙] => &Gg;
+ [𝔟] => &Gopf;
+ [⪢] => &GreaterGreater;
+ [≳] => &GreaterTilde;
+ [𝒢] => &Gscr;
+ [Ъ] => &HARDcy;
+ [ˇ] => &Hacek;
+ [^] => &Hat;
+ [Ä€] => &Hcirc;
+ [ℌ] => &Hfr;
+ [ℋ] => &HilbertSpace;
+ [ℍ] => &Hopf;
+ [─] => &HorizontalLine;
+ [ÄŠ] => &Hstrok;
+ [≏] => &HumpEqual;
+ [Е] => &IEcy;
+ [IJ] => &IJlig;
+ [Ё] => &IOcy;
+ [Í] => &Iacute;
+ [Î] => &Icirc;
+ [И] => &Icy;
+ [İ] => &Idot;
+ [ℑ] => &Ifr;
+ [Ì] => &Igrave;
+ [Ī] => &Imacr;
+ [ⅈ] => &ImaginaryI;
+ [⇒] => &Implies;
+ [∬] => &Int;
+ [∫] => &Integral;
+ [⁢] => &InvisibleTimes;
+ [Ä®] => &Iogon;
+ [𝕀] => &Iopf;
+ [Ι] => &Iota;
+ [Äš] => &Itilde;
+ [І] => &Iukcy;
+ [Ï] => &Iuml;
+ [ÄŽ] => &Jcirc;
+ [Й] => &Jcy;
+ [𝔍] => &Jfr;
+ [𝕁] => &Jopf;
+ [𝒥] => &Jscr;
+ [Ј] => &Jsercy;
+ [Є] => &Jukcy;
+ [Ð¥] => &KHcy;
+ [Ќ] => &KJcy;
+ [Κ] => &Kappa;
+ [Ķ] => &Kcedil;
+ [К] => &Kcy;
+ [𝔎] => &Kfr;
+ [𝕂] => &Kopf;
+ [𝒊] => &Kscr;
+ [Љ] => &LJcy;
+ [Ĺ] => &Lacute;
+ [Λ] => &Lambda;
+ [⟪] => &Lang;
+ [↞] => &Larr;
+ [Ĝ] => &Lcaron;
+ [Ä»] => &Lcedil;
+ [Л] => &Lcy;
+ [⇀] => &LeftArrowBar;
+ [⟩] => &LeftDoubleBracket;
+ [⥡] => &LeftDownTeeVector;
+ [⥙] => &LeftDownVectorBar;
+ [⌊] => &LeftFloor;
+ [⥎] => &LeftRightVector;
+ [ↀ] => &LeftTeeArrow;
+ [⥚] => &LeftTeeVector;
+ [⧏] => &LeftTriangleBar;
+ [⊮] => &LeftTriangleEqual;
+ [⥑] => &LeftUpDownVector;
+ [⥠] => &LeftUpTeeVector;
+ [⥘] => &LeftUpVectorBar;
+ [⥒] => &LeftVectorBar;
+ [⪡] => &LessLess;
+ [≲] => &LessTilde;
+ [𝔏] => &Lfr;
+ [⋘] => &Ll;
+ [Ä¿] => &Lmidot;
+ [⟷] => &LongLeftRightArrow;
+ [⟶] => &LongRightArrow;
+ [𝕃] => &Lopf;
+ [↘] => &LowerRightArrow;
+ [↰] => &Lsh;
+ [Ł] => &Lstrok;
+ [ ] => &Map;
+ [М] => &Mcy;
+ [ ] => &MediumSpace;
+ [ℳ] => &Mellintrf;
+ [𝔐] => &Mfr;
+ [∓] => &MinusPlus;
+ [𝕄] => &Mopf;
+ [Μ] => &Mu;
+ [Њ] => &NJcy;
+ [Ń] => &Nacute;
+ [Ň] => &Ncaron;
+ [Ņ] => &Ncedil;
+ [Н] => &Ncy;
+ [
+] => &NewLine;
+ [𝔑] => &Nfr;
+ [⁠] => &NoBreak;
+ [⫬] => &Not;
+ [≢] => &NotCongruent;
+ [≭] => &NotCupCap;
+ [≠] => &NotEqual;
+ [≧̞] => &NotGreaterFullEqual
+ [≫̞] => &NotGreaterGreater
+ [≹] => &NotGreaterLess;
+ [⧏̞] => &NotLeftTriangleBar
+ [≮] => &NotLess;
+ [≰] => &NotLessEqual;
+ [⪢̞] => &NotNestedGreaterGreater
+ [⪡̞] => &NotNestedLessLess
+ [⪯̞] => &NotPrecedesEqual
+ [⋠] => &NotPrecedesSlantEqual;
+ [⧐̞] => &NotRightTriangleBar
+ [⋭] => &NotRightTriangleEqual;
+ [⊏̞] => &NotSquareSubset
+ [⋢] => &NotSquareSubsetEqual;
+ [⊐̞] => &NotSquareSuperset
+ [⋣] => &NotSquareSupersetEqual;
+ [⊈] => &NotSubsetEqual;
+ [⊁] => &NotSucceeds;
+ [⪰̞] => &NotSucceedsEqual
+ [⋡] => &NotSucceedsSlantEqual;
+ [≿̞] => &NotSucceedsTilde
+ [⊉] => &NotSupersetEqual;
+ [≁] => &NotTilde;
+ [𝒩] => &Nscr;
+ [Ñ] => &Ntilde;
+ [Ν] => &Nu;
+ [Œ] => &OElig;
+ [Ó] => &Oacute;
+ [Ô] => &Ocirc;
+ [О] => &Ocy;
+ [Ő] => &Odblac;
+ [𝔒] => &Ofr;
+ [Ò] => &Ograve;
+ [Ō] => &Omacr;
+ [Ω] => &Omega;
+ [Ο] => &Omicron;
+ [𝕆] => &Oopf;
+ [“] => &OpenCurlyDoubleQuote;
+ [‘] => &OpenCurlyQuote;
+ [⩔] => &Or;
+ [𝒪] => &Oscr;
+ [Ø] => &Oslash;
+ [Õ] => &Otilde;
+ [âš·] => &Otimes;
+ [Ö] => &Ouml;
+ [⏞] => &OverBrace;
+ [⎮] => &OverBracket;
+ [⏜] => &OverParenthesis;
+ [П] => &Pcy;
+ [𝔓] => &Pfr;
+ [Ί] => &Phi;
+ [Π] => &Pi;
+ [⪻] => &Pr;
+ [≌] => &PrecedesSlantEqual;
+ [″] => &Prime;
+ [𝒫] => &Pscr;
+ [Κ] => &Psi;
+ [𝔔] => &Qfr;
+ [𝒬] => &Qscr;
+ [Ŕ] => &Racute;
+ [⟫] => &Rang;
+ [‖] => &Rarrtl;
+ [Ř] => &Rcaron;
+ [Ŗ] => &Rcedil;
+ [Р] => &Rcy;
+ [∋] => &ReverseElement;
+ [⥯] => &ReverseUpEquilibrium;
+ [ℜ] => &Rfr;
+ [Ρ] => &Rho;
+ [⟩] => &RightAngleBracket;
+ [⇥] => &RightArrowBar;
+ [⌉] => &RightCeiling;
+ [⟧] => &RightDoubleBracket;
+ [⥝] => &RightDownTeeVector;
+ [⇂] => &RightDownVector;
+ [⥕] => &RightDownVectorBar;
+ [⌋] => &RightFloor;
+ [⥛] => &RightTeeVector;
+ [⧐] => &RightTriangleBar;
+ [⊵] => &RightTriangleEqual;
+ [⥏] => &RightUpDownVector;
+ [⥜] => &RightUpTeeVector;
+ [↟] => &RightUpVector;
+ [⥔] => &RightUpVectorBar;
+ [⥓] => &RightVectorBar;
+ [ℝ] => &Ropf;
+ [⥰] => &RoundImplies;
+ [â§Ž] => &RuleDelayed;
+ [Щ] => &SHCHcy;
+ [К] => &SHcy;
+ [Ь] => &SOFTcy;
+ [Ś] => &Sacute;
+ [⪌] => &Sc;
+ [Å ] => &Scaron;
+ [Ş] => &Scedil;
+ [Ŝ] => &Scirc;
+ [С] => &Scy;
+ [𝔖] => &Sfr;
+ [Σ] => &Sigma;
+ [𝕊] => &Sopf;
+ [√] => &Sqrt;
+ [□] => &Square;
+ [⊑] => &SquareSubsetEqual;
+ [⊒] => &SquareSupersetEqual;
+ [𝒮] => &Sscr;
+ [⋆] => &Star;
+ [⋐] => &Sub;
+ [⊆] => &SubsetEqual;
+ [⪰] => &SucceedsEqual;
+ [≿] => &SucceedsTilde;
+ [⋑] => &Supset;
+ [Þ] => &THORN;
+ [Ћ] => &TSHcy;
+ [Њ] => &TScy;
+ [ ] => &Tab;
+ [΀] => &Tau;
+ [Å€] => &Tcaron;
+ [Å¢] => &Tcedil;
+ [Т] => &Tcy;
+ [𝔗] => &Tfr;
+ [Θ] => &Theta;
+ [  ] => &ThickSpace
+ [ ] => &ThinSpace;
+ [≅] => &TildeFullEqual;
+ [𝕋] => &Topf;
+ [⃛] => &TripleDot;
+ [𝒯] => &Tscr;
+ [ÅŠ] => &Tstrok;
+ [Ú] => &Uacute;
+ [↟] => &Uarr;
+ [⥉] => &Uarrocir;
+ [Ў] => &Ubrcy;
+ [Ŭ] => &Ubreve;
+ [Û] => &Ucirc;
+ [У] => &Ucy;
+ [Ű] => &Udblac;
+ [𝔘] => &Ufr;
+ [Ù] => &Ugrave;
+ [Ū] => &Umacr;
+ [⏟] => &UnderBrace;
+ [⏝] => &UnderParenthesis;
+ [⊎] => &UnionPlus;
+ [Ų] => &Uogon;
+ [𝕌] => &Uopf;
+ [‒] => &UpArrowBar;
+ [↕] => &UpDownArrow;
+ [↥] => &UpTeeArrow;
+ [⇕] => &Updownarrow;
+ [↗] => &UpperRightArrow;
+ [Î¥] => &Upsilon;
+ [Å®] => &Uring;
+ [𝒰] => &Uscr;
+ [Åš] => &Utilde;
+ [Ü] => &Uuml;
+ [⊫] => &VDash;
+ [â««] => &Vbar;
+ [В] => &Vcy;
+ [⊩] => &Vdash;
+ [⫊] => &Vdashl;
+ [‖] => &Verbar;
+ [❘] => &VerticalSeparator;
+ [𝔙] => &Vfr;
+ [𝕍] => &Vopf;
+ [𝒱] => &Vscr;
+ [⊪] => &Vvdash;
+ [ÅŽ] => &Wcirc;
+ [𝔚] => &Wfr;
+ [𝕎] => &Wopf;
+ [𝒲] => &Wscr;
+ [𝔛] => &Xfr;
+ [Ξ] => &Xi;
+ [𝕏] => &Xopf;
+ [𝒳] => &Xscr;
+ [Я] => &YAcy;
+ [Ї] => &YIcy;
+ [Ю] => &YUcy;
+ [Ý] => &Yacute;
+ [Ŷ] => &Ycirc;
+ [Ы] => &Ycy;
+ [𝔜] => &Yfr;
+ [𝕐] => &Yopf;
+ [𝒎] => &Yscr;
+ [Åž] => &Yuml;
+ [Ж] => &ZHcy;
+ [Ź] => &Zacute;
+ [Ŝ] => &Zcaron;
+ [З] => &Zcy;
+ [Å»] => &Zdot;
+ [​] => &ZeroWidthSpace;
+ [Ζ] => &Zeta;
+ [ℹ] => &Zfr;
+ [â„€] => &Zopf;
+ [𝒵] => &Zscr;
+ [á] => &aacute;
+ [ă] => &abreve;
+ [∟] => &ac;
+ [∟̳] => &acE
+ [∿] => &acd;
+ [â] => &acirc;
+ [а] => &acy;
+ [Ê] => &aelig;
+ [⁡] => &af;
+ [𝔞] => &afr;
+ [à] => &agrave;
+ [ℵ] => &aleph;
+ [α] => &alpha;
+ [ā] => &amacr;
+ [âš¿] => &amalg;
+ [&] => &amp;
+ [∧] => &and;
+ [⩕] => &andand;
+ [⩜] => &andd;
+ [⩘] => &andslope;
+ [⩚] => &andv;
+ [⊀] => &ange;
+ [∠] => &angle;
+ [∡] => &angmsd;
+ [⊚] => &angmsdaa;
+ [⊩] => &angmsdab;
+ [⊪] => &angmsdac;
+ [⊫] => &angmsdad;
+ [⊬] => &angmsdae;
+ [⊭] => &angmsdaf;
+ [⊮] => &angmsdag;
+ [⊯] => &angmsdah;
+ [∟] => &angrt;
+ [⊟] => &angrtvb;
+ [⊝] => &angrtvbd;
+ [∢] => &angsph;
+ [⍌] => &angzarr;
+ [ą] => &aogon;
+ [𝕒] => &aopf;
+ [â©°] => &apE;
+ [⩯] => &apacir;
+ [≊] => &ape;
+ [≋] => &apid;
+ [≈] => &approx;
+ [Ã¥] => &aring;
+ [𝒶] => &ascr;
+ [*] => &ast;
+ [ã] => &atilde;
+ [À] => &auml;
+ [∳] => &awconint;
+ [⹑] => &awint;
+ [â«­] => &bNot;
+ [϶] => &backepsilon;
+ [‵] => &backprime;
+ [⋍] => &backsimeq;
+ [⊜] => &barvee;
+ [⌅] => &barwed;
+ [⎵] => &bbrk;
+ [⎶] => &bbrktbrk;
+ [≌] => &bcong;
+ [б] => &bcy;
+ [„] => &bdquo;
+ [⊰] => &bemptyv;
+ [β] => &beta;
+ [ℶ] => &beth;
+ [≬] => &between;
+ [𝔟] => &bfr;
+ [⋂] => &bigcap;
+ [◯] => &bigcirc;
+ [⋃] => &bigcup;
+ [⚁] => &bigoplus;
+ [⹂] => &bigotimes;
+ [⹆] => &bigsqcup;
+ [▜] => &bigtriangledown;
+ [△] => &bigtriangleup;
+ [⹄] => &biguplus;
+ [‍] => &bkarow;
+ [▮] => &blacktriangle;
+ [â–Ÿ] => &blacktriangledown;
+ [◂] => &blacktriangleleft;
+ [▾] => &blacktriangleright;
+ [␣] => &blank;
+ [▒] => &blk12;
+ [░] => &blk14;
+ [▓] => &blk34;
+ [█] => &block;
+ [=⃥] => &bne
+ [≡⃥] => &bnequiv
+ [⌐] => &bnot;
+ [𝕓] => &bopf;
+ [⋈] => &bowtie;
+ [╗] => &boxDL;
+ [╔] => &boxDR;
+ [╖] => &boxDl;
+ [╓] => &boxDr;
+ [═] => &boxH;
+ [╩] => &boxHD;
+ [╩] => &boxHU;
+ [â•€] => &boxHd;
+ [╧] => &boxHu;
+ [╝] => &boxUL;
+ [╚] => &boxUR;
+ [╜] => &boxUl;
+ [╙] => &boxUr;
+ [║] => &boxV;
+ [╬] => &boxVH;
+ [╣] => &boxVL;
+ [╠] => &boxVR;
+ [╫] => &boxVh;
+ [╢] => &boxVl;
+ [╟] => &boxVr;
+ [⧉] => &boxbox;
+ [╕] => &boxdL;
+ [╒] => &boxdR;
+ [┐] => &boxdl;
+ [┌] => &boxdr;
+ [╥] => &boxhD;
+ [╹] => &boxhU;
+ [┬] => &boxhd;
+ [┮] => &boxhu;
+ [⊟] => &boxminus;
+ [⊞] => &boxplus;
+ [╛] => &boxuL;
+ [╘] => &boxuR;
+ [┘] => &boxul;
+ [└] => &boxur;
+ [│] => &boxv;
+ [╪] => &boxvH;
+ [╡] => &boxvL;
+ [╞] => &boxvR;
+ [┌] => &boxvh;
+ [─] => &boxvl;
+ [├] => &boxvr;
+ [Š] => &brvbar;
+ [𝒷] => &bscr;
+ [⁏] => &bsemi;
+ [∜] => &bsim;
+ [\] => &bsol;
+ [⧅] => &bsolb;
+ [⟈] => &bsolhsub;
+ [•] => &bull;
+ [≎] => &bump;
+ [⪮] => &bumpE;
+ [ć] => &cacute;
+ [∩] => &cap;
+ [⩄] => &capand;
+ [⩉] => &capbrcup;
+ [⩋] => &capcap;
+ [⩇] => &capcup;
+ [⩀] => &capdot;
+ [∩] => &caps
+ [⁁] => &caret;
+ [⩍] => &ccaps;
+ [č] => &ccaron;
+ [ç] => &ccedil;
+ [ĉ] => &ccirc;
+ [⩌] => &ccups;
+ [⩐] => &ccupssm;
+ [ċ] => &cdot;
+ [⊲] => &cemptyv;
+ [¢] => &cent;
+ [𝔠] => &cfr;
+ [ч] => &chcy;
+ [✓] => &check;
+ [χ] => &chi;
+ [○] => &cir;
+ [⧃] => &cirE;
+ [ˆ] => &circ;
+ [≗] => &circeq;
+ [⚐] => &cirfnint;
+ [⫯] => &cirmid;
+ [⧂] => &cirscir;
+ [♣] => &clubs;
+ [:] => &colon;
+ [≔] => &coloneq;
+ [,] => &comma;
+ [@] => &commat;
+ [∁] => &comp;
+ [∘] => &compfn;
+ [ℂ] => &complexes;
+ [â©­] => &congdot;
+ [𝕔] => &copf;
+ [©] => &copy;
+ [℗] => &copysr;
+ [↵] => &crarr;
+ [✗] => &cross;
+ [𝒞] => &cscr;
+ [⫏] => &csub;
+ [⫑] => &csube;
+ [⫐] => &csup;
+ [⫒] => &csupe;
+ [⋯] => &ctdot;
+ [„] => &cudarrl;
+ [‵] => &cudarrr;
+ [⋟] => &cuesc;
+ [“] => &cularrp;
+ [∪] => &cup;
+ [⩈] => &cupbrcap;
+ [⩆] => &cupcap;
+ [⩊] => &cupcup;
+ [⊍] => &cupdot;
+ [⩅] => &cupor;
+ [∪] => &cups
+ [↷] => &curarr;
+ [‌] => &curarrm;
+ [⋞] => &curlyeqprec;
+ [⋎] => &curlyvee;
+ [⋏] => &curlywedge;
+ [€] => &curren;
+ [↶] => &curvearrowleft;
+ [∲] => &cwconint;
+ [∱] => &cwint;
+ [⌭] => &cylcty;
+ [⥥] => &dHar;
+ [†] => &dagger;
+ [ℾ] => &daleth;
+ [↓] => &darr;
+ [⊣] => &dashv;
+ [‏] => &dbkarow;
+ [ď] => &dcaron;
+ [ÐŽ] => &dcy;
+ [â©·] => &ddotseq;
+ [°] => &deg;
+ [ÎŽ] => &delta;
+ [⊱] => &demptyv;
+ [⥿] => &dfisht;
+ [𝔡] => &dfr;
+ [⇃] => &dharl;
+ [⋄] => &diamond;
+ [♩] => &diamondsuit;
+ [⋲] => &disin;
+ [÷] => &divide;
+ [⋇] => &divonx;
+ [ђ] => &djcy;
+ [⌍] => &dlcrop;
+ [$] => &dollar;
+ [𝕕] => &dopf;
+ [˙] => &dot;
+ [≑] => &doteqdot;
+ [⌆] => &doublebarwedge;
+ [⇊] => &downdownarrows;
+ [‐] => &drbkarow;
+ [⌟] => &drcorn;
+ [⌌] => &drcrop;
+ [𝒹] => &dscr;
+ [ѕ] => &dscy;
+ [â§¶] => &dsol;
+ [đ] => &dstrok;
+ [⋱] => &dtdot;
+ [⊊] => &dwangle;
+ [џ] => &dzcy;
+ [⟿] => &dzigrarr;
+ [é] => &eacute;
+ [â©®] => &easter;
+ [ě] => &ecaron;
+ [≖] => &ecir;
+ [ê] => &ecirc;
+ [э] => &ecy;
+ [ė] => &edot;
+ [𝔢] => &efr;
+ [⪚] => &eg;
+ [Ú] => &egrave;
+ [⪖] => &egs;
+ [⪘] => &egsdot;
+ [⪙] => &el;
+ [⏧] => &elinters;
+ [ℓ] => &ell;
+ [⪕] => &els;
+ [⪗] => &elsdot;
+ [ē] => &emacr;
+ [∅] => &empty;
+ [ ] => &emsp13;
+ [ ] => &emsp14;
+ [ ] => &emsp;
+ [ŋ] => &eng;
+ [ ] => &ensp;
+ [ę] => &eogon;
+ [𝕖] => &eopf;
+ [⋕] => &epar;
+ [â§£] => &eparsl;
+ [⩱] => &eplus;
+ [ε] => &epsi;
+ [≕] => &eqcolon;
+ [=] => &equals;
+ [≟] => &equest;
+ [⩞] => &equivDD;
+ [â§¥] => &eqvparsl;
+ [⥱] => &erarr;
+ [ℯ] => &escr;
+ [≐] => &esdot;
+ [≂] => &esim;
+ [η] => &eta;
+ [ð] => &eth;
+ [ë] => &euml;
+ [€] => &euro;
+ [!] => &excl;
+ [ℰ] => &expectation;
+ [ⅇ] => &exponentiale;
+ [≒] => &fallingdotseq;
+ [ф] => &fcy;
+ [♀] => &female;
+ [ffi] => &ffilig;
+ [ff] => &fflig;
+ [ffl] => &ffllig;
+ [𝔣] => &ffr;
+ [fi] => &filig;
+ [fj] => &fjlig
+ [♭] => &flat;
+ [fl] => &fllig;
+ [▱] => &fltns;
+ [ƒ] => &fnof;
+ [𝕗] => &fopf;
+ [∀] => &forall;
+ [⫙] => &forkv;
+ [⚍] => &fpartint;
+ [⅓] => &frac13;
+ [Œ] => &frac14;
+ [⅕] => &frac15;
+ [⅙] => &frac16;
+ [⅛] => &frac18;
+ [⅔] => &frac23;
+ [⅖] => &frac25;
+ [Ÿ] => &frac34;
+ [⅗] => &frac35;
+ [⅜] => &frac38;
+ [⅘] => &frac45;
+ [⅚] => &frac56;
+ [⅝] => &frac58;
+ [⅞] => &frac78;
+ [⁄] => &frasl;
+ [⌢] => &frown;
+ [𝒻] => &fscr;
+ [⪌] => &gEl;
+ [ǵ] => &gacute;
+ [γ] => &gamma;
+ [ϝ] => &gammad;
+ [⪆] => &gap;
+ [ğ] => &gbreve;
+ [ĝ] => &gcirc;
+ [г] => &gcy;
+ [Ä¡] => &gdot;
+ [≥] => &ge;
+ [≧] => &geqq;
+ [⩟] => &ges;
+ [⪩] => &gescc;
+ [⪀] => &gesdot;
+ [⪂] => &gesdoto;
+ [⪄] => &gesdotol;
+ [⋛] => &gesl
+ [⪔] => &gesles;
+ [𝔀] => &gfr;
+ [≫] => &gg;
+ [ℷ] => &gimel;
+ [ѓ] => &gjcy;
+ [≷] => &gl;
+ [⪒] => &glE;
+ [⪥] => &gla;
+ [⪀] => &glj;
+ [⪊] => &gnap;
+ [⪈] => &gne;
+ [≩] => &gneqq;
+ [⋧] => &gnsim;
+ [𝕘] => &gopf;
+ [`] => &grave;
+ [ℊ] => &gscr;
+ [⪎] => &gsime;
+ [⪐] => &gsiml;
+ [>] => &gt;
+ [⪧] => &gtcc;
+ [⩺] => &gtcir;
+ [⩕] => &gtlPar;
+ [⩌] => &gtquest;
+ [⥞] => &gtrarr;
+ [⋗] => &gtrdot;
+ [⋛] => &gtreqless;
+ [≩] => &gvertneqq
+ [⇔] => &hArr;
+ [ ] => &hairsp;
+ [œ] => &half;
+ [ъ] => &hardcy;
+ [↔] => &harr;
+ [⥈] => &harrcir;
+ [↭] => &harrw;
+ [Ä¥] => &hcirc;
+ [♥] => &hearts;
+ [
] => &hellip;
+ [⊹] => &hercon;
+ [𝔥] => &hfr;
+ [⇿] => &hoarr;
+ [∻] => &homtht;
+ [𝕙] => &hopf;
+ [―] => &horbar;
+ [𝒜] => &hscr;
+ [ħ] => &hstrok;
+ [⁃] => &hybull;
+ [‐] => &hyphen;
+ [í] => &iacute;
+ [⁣] => &ic;
+ [î] => &icirc;
+ [О] => &icy;
+ [е] => &iecy;
+ [¡] => &iexcl;
+ [𝔊] => &ifr;
+ [ì] => &igrave;
+ [⹌] => &iiiint;
+ [⧜] => &iinfin;
+ [℩] => &iiota;
+ [ij] => &ijlig;
+ [Ä«] => &imacr;
+ [ℐ] => &imagline;
+ [⊷] => &imof;
+ [Ƶ] => &imped;
+ [℅] => &incare;
+ [∞] => &infin;
+ [⧝] => &infintie;
+ [ı] => &inodot;
+ [⊺] => &intcal;
+ [⹗] => &intlarhk;
+ [ё] => &iocy;
+ [į] => &iogon;
+ [𝕚] => &iopf;
+ [ι] => &iota;
+ [⚌] => &iprod;
+ [¿] => &iquest;
+ [𝒟] => &iscr;
+ [⋹] => &isinE;
+ [⋵] => &isindot;
+ [⋮] => &isins;
+ [⋳] => &isinsv;
+ [∈] => &isinv;
+ [Ä©] => &itilde;
+ [і] => &iukcy;
+ [ï] => &iuml;
+ [ĵ] => &jcirc;
+ [й] => &jcy;
+ [𝔧] => &jfr;
+ [È·] => &jmath;
+ [𝕛] => &jopf;
+ [𝒿] => &jscr;
+ [ј] => &jsercy;
+ [є] => &jukcy;
+ [κ] => &kappa;
+ [Ä·] => &kcedil;
+ [к] => &kcy;
+ [𝔚] => &kfr;
+ [Äž] => &kgreen;
+ [х] => &khcy;
+ [ќ] => &kjcy;
+ [𝕜] => &kopf;
+ [𝓀] => &kscr;
+ [⇚] => &lAarr;
+ [‛] => &lAtail;
+ [‎] => &lBarr;
+ [≩] => &lE;
+ [⥢] => &lHar;
+ [ĺ] => &lacute;
+ [⊎] => &laemptyv;
+ [ℒ] => &lagran;
+ [λ] => &lambda;
+ [⩑] => &langd;
+ [⟹] => &langle;
+ [⪅] => &lap;
+ [«] => &laquo;
+ [←] => &larr;
+ [‟] => &larrbfs;
+ [”] => &larrfs;
+ [↩] => &larrhk;
+ [↫] => &larrlp;
+ [‹] => &larrpl;
+ [⥳] => &larrsim;
+ [↢] => &larrtl;
+ [⪫] => &lat;
+ [’] => &latail;
+ [⪭] => &late;
+ [⪭] => &lates
+ [‌] => &lbarr;
+ [❲] => &lbbrk;
+ [{] => &lbrace;
+ [[] => &lbrack;
+ [⩋] => &lbrke;
+ [⊏] => &lbrksld;
+ [⊍] => &lbrkslu;
+ [ÄŸ] => &lcaron;
+ [Č] => &lcedil;
+ [⌈] => &lceil;
+ [л] => &lcy;
+ [‶] => &ldca;
+ [⥧] => &ldrdhar;
+ [⥋] => &ldrushar;
+ [↲] => &ldsh;
+ [↜] => &leftharpoondown;
+ [↌] => &leftharpoonup;
+ [⇋] => &leftrightharpoons;
+ [≀] => &leq;
+ [⩜] => &les;
+ [⪚] => &lescc;
+ [â©¿] => &lesdot;
+ [⪁] => &lesdoto;
+ [⪃] => &lesdotor;
+ [⋚] => &lesg
+ [⪓] => &lesges;
+ [⋖] => &lessdot;
+ [⋚] => &lesseqgtr;
+ [⪋] => &lesseqqgtr;
+ [≶] => &lessgtr;
+ [⥌] => &lfisht;
+ [𝔩] => &lfr;
+ [⪑] => &lgE;
+ [⥪] => &lharul;
+ [▄] => &lhblk;
+ [љ] => &ljcy;
+ [≪] => &ll;
+ [⇇] => &llarr;
+ [⌞] => &llcorner;
+ [⥫] => &llhard;
+ [◺] => &lltri;
+ [ŀ] => &lmidot;
+ [⎰] => &lmoust;
+ [⪉] => &lnap;
+ [⪇] => &lne;
+ [≹] => &lneqq;
+ [⋩] => &lnsim;
+ [⟬] => &loang;
+ [⇜] => &loarr;
+ [⟵] => &longleftarrow;
+ [↬] => &looparrowright;
+ [⩅] => &lopar;
+ [𝕝] => &lopf;
+ [âš­] => &loplus;
+ [⚎] => &lotimes;
+ [∗] => &lowast;
+ [_] => &lowbar;
+ [◊] => &lozenge;
+ [â§«] => &lozf;
+ [(] => &lpar;
+ [⩓] => &lparlt;
+ [⇆] => &lrarr;
+ [⥭] => &lrhard;
+ [‎] => &lrm;
+ [⊿] => &lrtri;
+ [‹] => &lsaquo;
+ [𝓁] => &lscr;
+ [⪍] => &lsime;
+ [⪏] => &lsimg;
+ [ł] => &lstrok;
+ [<] => &lt;
+ [⪊] => &ltcc;
+ [⩹] => &ltcir;
+ [⋋] => &lthree;
+ [⋉] => &ltimes;
+ [⥶] => &ltlarr;
+ [â©»] => &ltquest;
+ [⩖] => &ltrPar;
+ [◃] => &ltri;
+ [⥊] => &lurdshar;
+ [⥊] => &luruhar;
+ [≚] => &lvertneqq
+ [∺] => &mDDot;
+ [¯] => &macr;
+ [♂] => &male;
+ [✠] => &maltese;
+ [↩] => &map;
+ [▮] => &marker;
+ [âš©] => &mcomma;
+ [Ќ] => &mcy;
+ [—] => &mdash;
+ [𝔪] => &mfr;
+ [℧] => &mho;
+ [µ] => &micro;
+ [∣] => &mid;
+ [â«°] => &midcir;
+ [−] => &minus;
+ [∞] => &minusd;
+ [⚪] => &minusdu;
+ [⫛] => &mlcp;
+ [⊧] => &models;
+ [𝕞] => &mopf;
+ [𝓂] => &mscr;
+ [Ό] => &mu;
+ [⊾] => &mumap;
+ [⋙̞] => &nGg
+ [≫⃒] => &nGt
+ [⇍] => &nLeftarrow;
+ [⋘̞] => &nLl
+ [≪⃒] => &nLt
+ [≪̞] => &nLtv
+ [⊯] => &nVDash;
+ [⊮] => &nVdash;
+ [∇] => &nabla;
+ [ń] => &nacute;
+ [∠⃒] => &nang
+ [â©°Ìž] => &napE
+ [≋̞] => &napid
+ [ʼn] => &napos;
+ [≉] => &napprox;
+ [♮] => &natur;
+ [ℕ] => &naturals;
+ [ ] => &nbsp;
+ [≎̞] => &nbump
+ [≏̞] => &nbumpe
+ [⩃] => &ncap;
+ [ň] => &ncaron;
+ [ņ] => &ncedil;
+ [≇] => &ncong;
+ [â©­Ìž] => &ncongdot
+ [⩂] => &ncup;
+ [М] => &ncy;
+ [–] => &ndash;
+ [⇗] => &neArr;
+ [ ] => &nearhk;
+ [≐̞] => &nedot
+ [≂̞] => &nesim
+ [∄] => &nexist;
+ [𝔫] => &nfr;
+ [≱] => &ngeq;
+ [⩟̞] => &nges
+ [≵] => &ngsim;
+ [≯] => &ngtr;
+ [⇎] => &nhArr;
+ [⫲] => &nhpar;
+ [⋌] => &nis;
+ [⋺] => &nisd;
+ [њ] => &njcy;
+ [≊̞] => &nlE
+ [‥] => &nldr;
+ [↚] => &nleftarrow;
+ [↮] => &nleftrightarrow;
+ [⩜̞] => &nles
+ [≮] => &nlsim;
+ [⋪] => &nltri;
+ [⋬] => &nltrie;
+ [𝕟] => &nopf;
+ [¬] => &not;
+ [∉] => &notin;
+ [⋹̞] => &notinE
+ [⋵̞] => &notindot
+ [⋷] => &notinvb;
+ [⋶] => &notinvc;
+ [∌] => &notniva;
+ [⋟] => &notnivb;
+ [⋜] => &notnivc;
+ [∊] => &nparallel;
+ [∂̞] => &npart
+ [⹔] => &npolint;
+ [⊀] => &npr;
+ [⇏] => &nrArr;
+ [↛] => &nrarr;
+ [″̞] => &nrarrc
+ [↝̞] => &nrarrw
+ [𝓃] => &nscr;
+ [∀] => &nshortmid;
+ [≄] => &nsime;
+ [⊄] => &nsub;
+ [â«…Ìž] => &nsubE
+ [⊅] => &nsup;
+ [⊃⃒] => &nsupset
+ [⫆̞] => &nsupseteqq
+ [ñ] => &ntilde;
+ [≾] => &ntlg;
+ [⋫] => &ntriangleright;
+ [Μ] => &nu;
+ [#] => &num;
+ [№] => &numero;
+ [ ] => &numsp;
+ [⊭] => &nvDash;
+ [ ] => &nvHarr;
+ [≍⃒] => &nvap
+ [⊬] => &nvdash;
+ [≥⃒] => &nvge
+ [>⃒] => &nvgt
+ [⧞] => &nvinfin;
+ [ ] => &nvlArr;
+ [≀⃒] => &nvle
+ [<⃒] => &nvlt
+ [⊮⃒] => &nvltrie
+ [ ] => &nvrArr;
+ [⊵⃒] => &nvrtrie
+ [∌⃒] => &nvsim
+ [⇖] => &nwArr;
+ [‣] => &nwarhk;
+ [↖] => &nwarrow;
+ [‧] => &nwnear;
+ [Ⓢ] => &oS;
+ [ó] => &oacute;
+ [⊛] => &oast;
+ [⊚] => &ocir;
+ [ÃŽ] => &ocirc;
+ [П] => &ocy;
+ [⊝] => &odash;
+ [ő] => &odblac;
+ [âšž] => &odiv;
+ [⊌] => &odsold;
+ [œ] => &oelig;
+ [⊿] => &ofcir;
+ [𝔬] => &ofr;
+ [˛] => &ogon;
+ [ò] => &ograve;
+ [⧁] => &ogt;
+ [⊵] => &ohbar;
+ [↺] => &olarr;
+ [⊟] => &olcir;
+ [⊻] => &olcross;
+ [‟] => &oline;
+ [⧀] => &olt;
+ [ō] => &omacr;
+ [ω] => &omega;
+ [ο] => &omicron;
+ [⊶] => &omid;
+ [⊖] => &ominus;
+ [𝕠] => &oopf;
+ [⊷] => &opar;
+ [⊹] => &operp;
+ [√] => &or;
+ [↻] => &orarr;
+ [⩝] => &ord;
+ [℮] => &orderof;
+ [ª] => &ordf;
+ [º] => &ordm;
+ [⊶] => &origof;
+ [⩖] => &oror;
+ [⩗] => &orslope;
+ [⩛] => &orv;
+ [Þ] => &oslash;
+ [⊘] => &osol;
+ [õ] => &otilde;
+ [âš¶] => &otimesas;
+ [ö] => &ouml;
+ [⌜] => &ovbar;
+ [¶] => &para;
+ [⫳] => &parsim;
+ [∂] => &part;
+ [п] => &pcy;
+ [%] => &percnt;
+ [.] => &period;
+ [‰] => &permil;
+ [⊥] => &perp;
+ [‱] => &pertenk;
+ [𝔭] => &pfr;
+ [φ] => &phi;
+ [☎] => &phone;
+ [π] => &pi;
+ [⋔] => &pitchfork;
+ [ϖ] => &piv;
+ [ℏ] => &planck;
+ [ℎ] => &planckh;
+ [+] => &plus;
+ [⚣] => &plusacir;
+ [⚢] => &pluscir;
+ [∔] => &plusdo;
+ [⚥] => &plusdu;
+ [⩲] => &pluse;
+ [±] => &plusmn;
+ [⚊] => &plussim;
+ [âš§] => &plustwo;
+ [⹕] => &pointint;
+ [𝕡] => &popf;
+ [£] => &pound;
+ [⪳] => &prE;
+ [≺] => &prec;
+ [⪷] => &precapprox;
+ [⪯] => &preceq;
+ [⪹] => &precnapprox;
+ [⪵] => &precneqq;
+ [⋹] => &precnsim;
+ [≟] => &precsim;
+ [′] => &prime;
+ [ℙ] => &primes;
+ [∏] => &prod;
+ [⌮] => &profalar;
+ [⌒] => &profline;
+ [⌓] => &profsurf;
+ [∝] => &prop;
+ [⊰] => &prurel;
+ [𝓅] => &pscr;
+ [ψ] => &psi;
+ [ ] => &puncsp;
+ [𝔮] => &qfr;
+ [𝕢] => &qopf;
+ [⁗] => &qprime;
+ [𝓆] => &qscr;
+ [⹖] => &quatint;
+ [?] => &quest;
+ ["] => &quot;
+ [⇛] => &rAarr;
+ [“] => &rAtail;
+ [⥀] => &rHar;
+ [∜̱] => &race
+ [ŕ] => &racute;
+ [⊳] => &raemptyv;
+ [⩒] => &rangd;
+ [⊥] => &range;
+ [»] => &raquo;
+ [⥵] => &rarrap;
+ [†] => &rarrbfs;
+ [″] => &rarrc;
+ [„] => &rarrfs;
+ [↪] => &rarrhk;
+ [⥅] => &rarrpl;
+ [⥎] => &rarrsim;
+ [↣] => &rarrtl;
+ [↝] => &rarrw;
+ [‚] => &ratail;
+ [∶] => &ratio;
+ [ℚ] => &rationals;
+ [❳] => &rbbrk;
+ [⩌] => &rbrke;
+ [⊎] => &rbrksld;
+ [⊐] => &rbrkslu;
+ [ř] => &rcaron;
+ [ŗ] => &rcedil;
+ [}] => &rcub;
+ [р] => &rcy;
+ [‷] => &rdca;
+ [⥩] => &rdldhar;
+ [”] => &rdquo;
+ [↳] => &rdsh;
+ [ℛ] => &realine;
+ [▭] => &rect;
+ [®] => &reg;
+ [⥜] => &rfisht;
+ [𝔯] => &rfr;
+ [⇁] => &rhard;
+ [⇀] => &rharu;
+ [⥬] => &rharul;
+ [ρ] => &rho;
+ [ϱ] => &rhov;
+ [⇄] => &rightleftarrows;
+ [⇌] => &rightleftharpoons;
+ [˚] => &ring;
+ [≓] => &risingdotseq;
+ [‏] => &rlm;
+ [⎱] => &rmoust;
+ [â«®] => &rnmid;
+ [⟭] => &roang;
+ [⇟] => &roarr;
+ [⩆] => &ropar;
+ [𝕣] => &ropf;
+ [âš®] => &roplus;
+ [âšµ] => &rotimes;
+ [)] => &rpar;
+ [⩔] => &rpargt;
+ [⹒] => &rppolint;
+ [⇉] => &rrarr;
+ [›] => &rsaquo;
+ [𝓇] => &rscr;
+ [↱] => &rsh;
+ []] => &rsqb;
+ [’] => &rsquo;
+ [⋌] => &rthree;
+ [⋊] => &rtimes;
+ [▹] => &rtri;
+ [⧎] => &rtriltri;
+ [⥚] => &ruluhar;
+ [℞] => &rx;
+ [ś] => &sacute;
+ [‚] => &sbquo;
+ [⪎] => &scE;
+ [Å¡] => &scaron;
+ [ş] => &scedil;
+ [ŝ] => &scirc;
+ [⪶] => &scnE;
+ [⋩] => &scnsim;
+ [⹓] => &scpolint;
+ [с] => &scy;
+ [⋅] => &sdot;
+ [⊡] => &sdotb;
+ [⩊] => &sdote;
+ [⇘] => &seArr;
+ [‥] => &searhk;
+ [§] => &sect;
+ [;] => &semi;
+ [
] => &seswar;
+ [✶] => &sext;
+ [𝔰] => &sfr;
+ [♯] => &sharp;
+ [щ] => &shchcy;
+ [ш] => &shcy;
+ [∥] => &shortparallel;
+ [­] => &shy;
+ [σ] => &sigma;
+ [ς] => &sigmav;
+ [∌] => &sim;
+ [⩪] => &simdot;
+ [≃] => &simeq;
+ [⪞] => &simg;
+ [⪠] => &simgE;
+ [⪝] => &siml;
+ [⪟] => &simlE;
+ [≆] => &simne;
+ [⚀] => &simplus;
+ [⥲] => &simrarr;
+ [âš³] => &smashp;
+ [â§€] => &smeparsl;
+ [⌣] => &smile;
+ [⪪] => &smt;
+ [⪬] => &smte;
+ [⪬] => &smtes
+ [ь] => &softcy;
+ [/] => &sol;
+ [⧄] => &solb;
+ [⌿] => &solbar;
+ [𝕀] => &sopf;
+ [♠] => &spadesuit;
+ [⊓] => &sqcap;
+ [⊓] => &sqcaps
+ [⊔] => &sqcup;
+ [⊔] => &sqcups
+ [⊏] => &sqsub;
+ [⊐] => &sqsupset;
+ [▪] => &squarf;
+ [→] => &srarr;
+ [𝓈] => &sscr;
+ [∖] => &ssetmn;
+ [☆] => &star;
+ [★] => &starf;
+ [ϵ] => &straightepsilon;
+ [ϕ] => &straightphi;
+ [⊂] => &sub;
+ [⫅] => &subE;
+ [⪜] => &subdot;
+ [⫃] => &subedot;
+ [⫁] => &submult;
+ [⪿] => &subplus;
+ [⥹] => &subrarr;
+ [⊊] => &subsetneq;
+ [⫋] => &subsetneqq;
+ [⫇] => &subsim;
+ [⫕] => &subsub;
+ [⫓] => &subsup;
+ [≻] => &succ;
+ [⪞] => &succapprox;
+ [≜] => &succcurlyeq;
+ [⪺] => &succnapprox;
+ [∑] => &sum;
+ [♪] => &sung;
+ [¹] => &sup1;
+ [²] => &sup2;
+ [³] => &sup3;
+ [⊃] => &sup;
+ [⪟] => &supdot;
+ [⫘] => &supdsub;
+ [⊇] => &supe;
+ [⫄] => &supedot;
+ [⟉] => &suphsol;
+ [⫗] => &suphsub;
+ [⥻] => &suplarr;
+ [⫂] => &supmult;
+ [⫌] => &supnE;
+ [⫀] => &supplus;
+ [⫆] => &supseteqq;
+ [⊋] => &supsetneq;
+ [⫈] => &supsim;
+ [⫔] => &supsub;
+ [⫖] => &supsup;
+ [⇙] => &swArr;
+ [ ] => &swarhk;
+ [↙] => &swarr;
+ [‪] => &swnwar;
+ [ß] => &szlig;
+ [⌖] => &target;
+ [τ] => &tau;
+ [Å¥] => &tcaron;
+ [Å£] => &tcedil;
+ [т] => &tcy;
+ [⌕] => &telrec;
+ [𝔱] => &tfr;
+ [∎] => &there4;
+ [Ξ] => &theta;
+ [ϑ] => &thetasym;
+ [ß] => &thorn;
+ [×] => &times;
+ [⊠] => &timesb;
+ [âš±] => &timesbar;
+ [âš°] => &timesd;
+ [∭] => &tint;
+ [‚] => &toea;
+ [⌶] => &topbot;
+ [⫱] => &topcir;
+ [𝕥] => &topf;
+ [⫚] => &topfork;
+ [‮] => &tprime;
+ [™] => &trade;
+ [▵] => &triangle;
+ [▿] => &triangledown;
+ [≜] => &triangleq;
+ [◬] => &tridot;
+ [⚺] => &triminus;
+ [âš¹] => &triplus;
+ [⧍] => &trisb;
+ [âš»] => &tritime;
+ [⏢] => &trpezium;
+ [𝓉] => &tscr;
+ [ц] => &tscy;
+ [ћ] => &tshcy;
+ [ŧ] => &tstrok;
+ [↠] => &twoheadrightarrow;
+ [⥣] => &uHar;
+ [ú] => &uacute;
+ [↑] => &uarr;
+ [ў] => &ubrcy;
+ [Å­] => &ubreve;
+ [û] => &ucirc;
+ [у] => &ucy;
+ [⇅] => &udarr;
+ [ű] => &udblac;
+ [⥮] => &udhar;
+ [⥟] => &ufisht;
+ [𝔲] => &ufr;
+ [ù] => &ugrave;
+ [↿] => &uharl;
+ [▀] => &uhblk;
+ [⌜] => &ulcorner;
+ [⌏] => &ulcrop;
+ [◾] => &ultri;
+ [Å«] => &umacr;
+ [ų] => &uogon;
+ [𝕊] => &uopf;
+ [υ] => &upsi;
+ [ϒ] => &upsih;
+ [⇈] => &upuparrows;
+ [⌝] => &urcorner;
+ [⌎] => &urcrop;
+ [ů] => &uring;
+ [◹] => &urtri;
+ [𝓊] => &uscr;
+ [⋰] => &utdot;
+ [Å©] => &utilde;
+ [Ì] => &uuml;
+ [⊧] => &uwangle;
+ [⫚] => &vBar;
+ [â«©] => &vBarv;
+ [⩜] => &vangrt;
+ [ϰ] => &varkappa;
+ [⫌] => &varsupsetneqq
+ [⫝̸] => &varsupsetneqq
+ [⊲] => &vartriangleleft;
+ [в] => &vcy;
+ [⊢] => &vdash;
+ [⊻] => &veebar;
+ [≚] => &veeeq;
+ [⋮] => &vellip;
+ [|] => &vert;
+ [𝔳] => &vfr;
+ [⊂⃒] => &vnsub
+ [𝕧] => &vopf;
+ [⊳] => &vrtri;
+ [𝓋] => &vscr;
+ [⫋] => &vsubnE
+ [⊊] => &vsubne
+ [⊋] => &vsupne
+ [⩚] => &vzigzag;
+ [ŵ] => &wcirc;
+ [⩟] => &wedbar;
+ [≙] => &wedgeq;
+ [𝔎] => &wfr;
+ [𝕚] => &wopf;
+ [℘] => &wp;
+ [≀] => &wr;
+ [𝓌] => &wscr;
+ [𝔵] => &xfr;
+ [⟺] => &xhArr;
+ [Ο] => &xi;
+ [⟾] => &xlArr;
+ [⟌] => &xmap;
+ [⋻] => &xnis;
+ [⹀] => &xodot;
+ [𝕩] => &xopf;
+ [𝓍] => &xscr;
+ [⋁] => &xvee;
+ [⋀] => &xwedge;
+ [Ü] => &yacute;
+ [я] => &yacy;
+ [Å·] => &ycirc;
+ [ы] => &ycy;
+ [Â¥] => &yen;
+ [𝔶] => &yfr;
+ [ї] => &yicy;
+ [𝕪] => &yopf;
+ [𝓎] => &yscr;
+ [ю] => &yucy;
+ [ÿ] => &yuml;
+ [ź] => &zacute;
+ [ÅŸ] => &zcaron;
+ [з] => &zcy;
+ [Ō] => &zdot;
+ [ζ] => &zeta;
+ [𝔷] => &zfr;
+ [ж] => &zhcy;
+ [⇝] => &zigrarr;
+ [𝕫] => &zopf;
+ [𝓏] => &zscr;
+ [‍] => &zwj;
+ [‌] => &zwnj;
+)
+-- with table = HTML_ENTITIES, ENT_QUOTES --
+int(1510)
+-- with table = HTML_ENTITIES, ENT_NOQUOTES --
+int(1508)
+-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
+int(4)
+Array
+(
+ [&] => &amp;
+ [>] => &gt;
+ [<] => &lt;
+ ["] => &quot;
+)
+-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
+array(5) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&apos;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic6.phpt b/ext/standard/tests/strings/get_html_translation_table_basic6.phpt
new file mode 100644
index 0000000..a4b2909
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic6.phpt
@@ -0,0 +1,249 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - HTML 5/Windows-1251
+--FILE--
+<?php
+
+function so($a,$b) { return ord($a) - ord($b); }
+
+echo "*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 ***\n";
+
+echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT | ENT_HTML5, "Windows-1251");
+uksort( $tt, 'so' );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "Windows-1251");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "Windows-1251");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "Windows-1251");
+uksort( $tt, 'so' );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "Windows-1251");
+uksort( $tt, 'so' );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "Windows-1251");
+uasort( $tt, 'so' );
+var_dump( $tt );
+
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 ***
+-- with table = HTML_ENTITIES, ENT_COMPAT --
+int(157)
+Array
+(
+ [ ] => &Tab;
+ [
+] => &NewLine;
+ [!] => &excl;
+ ["] => &quot;
+ [#] => &num;
+ [$] => &dollar;
+ [%] => &percnt;
+ [&] => &amp;
+ [(] => &lpar;
+ [)] => &rpar;
+ [*] => &ast;
+ [+] => &plus;
+ [,] => &comma;
+ [.] => &period;
+ [/] => &sol;
+ [:] => &colon;
+ [;] => &semi;
+ [<] => &lt;
+ [=] => &equals;
+ [>] => &gt;
+ [?] => &quest;
+ [@] => &commat;
+ [[] => &lbrack;
+ [\] => &bsol;
+ []] => &rsqb;
+ [^] => &Hat;
+ [_] => &lowbar;
+ [`] => &grave;
+ [fj] => &fjlig
+ [{] => &lbrace;
+ [|] => &vert;
+ [}] => &rcub;
+ [€] => &DJcy;
+ [] => &GJcy;
+ [‚] => &sbquo;
+ [ƒ] => &gjcy;
+ [„] => &bdquo;
+ […] => &hellip;
+ [†] => &dagger;
+ [‡] => &Dagger;
+ [ˆ] => &euro;
+ [‰] => &permil;
+ [Š] => &LJcy;
+ [‹] => &lsaquo;
+ [Œ] => &NJcy;
+ [] => &KJcy;
+ [Ž] => &TSHcy;
+ [] => &DZcy;
+ [] => &djcy;
+ [‘] => &OpenCurlyQuote;
+ [’] => &rsquo;
+ [“] => &OpenCurlyDoubleQuote;
+ [”] => &rdquo;
+ [•] => &bull;
+ [–] => &ndash;
+ [—] => &mdash;
+ [™] => &trade;
+ [š] => &ljcy;
+ [›] => &rsaquo;
+ [œ] => &njcy;
+ [] => &kjcy;
+ [ž] => &tshcy;
+ [Ÿ] => &dzcy;
+ [ ] => &nbsp;
+ [¡] => &Ubrcy;
+ [¢] => &ubrcy;
+ [£] => &Jsercy;
+ [€] => &curren;
+ [Š] => &brvbar;
+ [§] => &sect;
+ [š] => &IOcy;
+ [©] => &copy;
+ [ª] => &Jukcy;
+ [«] => &laquo;
+ [¬] => &not;
+ [­] => &shy;
+ [®] => &reg;
+ [¯] => &YIcy;
+ [°] => &deg;
+ [±] => &plusmn;
+ [²] => &Iukcy;
+ [³] => &iukcy;
+ [µ] => &micro;
+ [¶] => &para;
+ [·] => &CenterDot;
+ [ž] => &iocy;
+ [¹] => &numero;
+ [º] => &jukcy;
+ [»] => &raquo;
+ [Œ] => &jsercy;
+ [œ] => &DScy;
+ [Ÿ] => &dscy;
+ [¿] => &yicy;
+ [À] => &Acy;
+ [Á] => &Bcy;
+ [Â] => &Vcy;
+ [Ã] => &Gcy;
+ [Ä] => &Dcy;
+ [Å] => &IEcy;
+ [Æ] => &ZHcy;
+ [Ç] => &Zcy;
+ [È] => &Icy;
+ [É] => &Jcy;
+ [Ê] => &Kcy;
+ [Ë] => &Lcy;
+ [Ì] => &Mcy;
+ [Í] => &Ncy;
+ [Î] => &Ocy;
+ [Ï] => &Pcy;
+ [Ð] => &Rcy;
+ [Ñ] => &Scy;
+ [Ò] => &Tcy;
+ [Ó] => &Ucy;
+ [Ô] => &Fcy;
+ [Õ] => &KHcy;
+ [Ö] => &TScy;
+ [×] => &CHcy;
+ [Ø] => &SHcy;
+ [Ù] => &SHCHcy;
+ [Ú] => &HARDcy;
+ [Û] => &Ycy;
+ [Ü] => &SOFTcy;
+ [Ý] => &Ecy;
+ [Þ] => &YUcy;
+ [ß] => &YAcy;
+ [à] => &acy;
+ [á] => &bcy;
+ [â] => &vcy;
+ [ã] => &gcy;
+ [ä] => &dcy;
+ [å] => &iecy;
+ [æ] => &zhcy;
+ [ç] => &zcy;
+ [è] => &icy;
+ [é] => &jcy;
+ [ê] => &kcy;
+ [ë] => &lcy;
+ [ì] => &mcy;
+ [í] => &ncy;
+ [î] => &ocy;
+ [ï] => &pcy;
+ [ð] => &rcy;
+ [ñ] => &scy;
+ [ò] => &tcy;
+ [ó] => &ucy;
+ [ô] => &fcy;
+ [õ] => &khcy;
+ [ö] => &tscy;
+ [÷] => &chcy;
+ [ø] => &shcy;
+ [ù] => &shchcy;
+ [ú] => &hardcy;
+ [û] => &ycy;
+ [ü] => &softcy;
+ [ý] => &ecy;
+ [þ] => &yucy;
+ [ÿ] => &yacy;
+)
+-- with table = HTML_ENTITIES, ENT_QUOTES --
+int(158)
+-- with table = HTML_ENTITIES, ENT_NOQUOTES --
+int(156)
+-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
+int(4)
+Array
+(
+ ["] => &quot;
+ [&] => &amp;
+ [<] => &lt;
+ [>] => &gt;
+)
+-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
+array(5) {
+ ["""]=>
+ string(6) "&quot;"
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&apos;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
+array(3) {
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic7.phpt b/ext/standard/tests/strings/get_html_translation_table_basic7.phpt
new file mode 100644
index 0000000..98ebbb9
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic7.phpt
@@ -0,0 +1,342 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - XHTML 1.0
+--FILE--
+<?php
+echo "*** Testing get_html_translation_table() : basic functionality/XHTML 1.0 ***\n";
+
+echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
+$table = HTML_ENTITIES;
+/* uses &#039; to share the code path with HTML 4.01 */
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XHTML, "UTF-8");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT | ENT_XHTML, "UTF-8");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XHTML, "UTF-8");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XHTML, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XHTML, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality/XHTML 1.0 ***
+-- with table = HTML_ENTITIES, ENT_QUOTES --
+int(253)
+Array
+(
+ ['] => &#039;
+ [Æ] => &AElig;
+ [Á] => &Aacute;
+ [Â] => &Acirc;
+ [À] => &Agrave;
+ [Α] => &Alpha;
+ [Å] => &Aring;
+ [Ã] => &Atilde;
+ [Ä] => &Auml;
+ [Β] => &Beta;
+ [Ç] => &Ccedil;
+ [Χ] => &Chi;
+ [‡] => &Dagger;
+ [Δ] => &Delta;
+ [Ð] => &ETH;
+ [É] => &Eacute;
+ [Ê] => &Ecirc;
+ [È] => &Egrave;
+ [Ε] => &Epsilon;
+ [Η] => &Eta;
+ [Ë] => &Euml;
+ [Γ] => &Gamma;
+ [Í] => &Iacute;
+ [Î] => &Icirc;
+ [Ì] => &Igrave;
+ [Ι] => &Iota;
+ [Ï] => &Iuml;
+ [Κ] => &Kappa;
+ [Λ] => &Lambda;
+ [Μ] => &Mu;
+ [Ñ] => &Ntilde;
+ [Ν] => &Nu;
+ [Œ] => &OElig;
+ [Ó] => &Oacute;
+ [Ô] => &Ocirc;
+ [Ò] => &Ograve;
+ [Ω] => &Omega;
+ [Ο] => &Omicron;
+ [Ø] => &Oslash;
+ [Õ] => &Otilde;
+ [Ö] => &Ouml;
+ [Ί] => &Phi;
+ [Π] => &Pi;
+ [″] => &Prime;
+ [Κ] => &Psi;
+ [Ρ] => &Rho;
+ [Å ] => &Scaron;
+ [Σ] => &Sigma;
+ [Þ] => &THORN;
+ [΀] => &Tau;
+ [Θ] => &Theta;
+ [Ú] => &Uacute;
+ [Û] => &Ucirc;
+ [Ù] => &Ugrave;
+ [Î¥] => &Upsilon;
+ [Ü] => &Uuml;
+ [Ξ] => &Xi;
+ [Ý] => &Yacute;
+ [Åž] => &Yuml;
+ [Ζ] => &Zeta;
+ [á] => &aacute;
+ [â] => &acirc;
+ [ÂŽ] => &acute;
+ [Ê] => &aelig;
+ [à] => &agrave;
+ [ℵ] => &alefsym;
+ [α] => &alpha;
+ [&] => &amp;
+ [∧] => &and;
+ [∠] => &ang;
+ [Ã¥] => &aring;
+ [≈] => &asymp;
+ [ã] => &atilde;
+ [À] => &auml;
+ [„] => &bdquo;
+ [β] => &beta;
+ [Š] => &brvbar;
+ [•] => &bull;
+ [∩] => &cap;
+ [ç] => &ccedil;
+ [ž] => &cedil;
+ [¢] => &cent;
+ [χ] => &chi;
+ [ˆ] => &circ;
+ [♣] => &clubs;
+ [≅] => &cong;
+ [©] => &copy;
+ [↵] => &crarr;
+ [∪] => &cup;
+ [€] => &curren;
+ [⇓] => &dArr;
+ [†] => &dagger;
+ [↓] => &darr;
+ [°] => &deg;
+ [ÎŽ] => &delta;
+ [♩] => &diams;
+ [÷] => &divide;
+ [é] => &eacute;
+ [ê] => &ecirc;
+ [Ú] => &egrave;
+ [∅] => &empty;
+ [ ] => &emsp;
+ [ ] => &ensp;
+ [ε] => &epsilon;
+ [≡] => &equiv;
+ [η] => &eta;
+ [ð] => &eth;
+ [ë] => &euml;
+ [€] => &euro;
+ [∃] => &exist;
+ [ƒ] => &fnof;
+ [∀] => &forall;
+ [œ] => &frac12;
+ [Œ] => &frac14;
+ [Ÿ] => &frac34;
+ [⁄] => &frasl;
+ [γ] => &gamma;
+ [≥] => &ge;
+ [>] => &gt;
+ [⇔] => &hArr;
+ [↔] => &harr;
+ [♥] => &hearts;
+ [
] => &hellip;
+ [í] => &iacute;
+ [î] => &icirc;
+ [¡] => &iexcl;
+ [ì] => &igrave;
+ [ℑ] => &image;
+ [∞] => &infin;
+ [∫] => &int;
+ [ι] => &iota;
+ [¿] => &iquest;
+ [∈] => &isin;
+ [ï] => &iuml;
+ [κ] => &kappa;
+ [⇐] => &lArr;
+ [λ] => &lambda;
+ [〈] => &lang;
+ [«] => &laquo;
+ [←] => &larr;
+ [⌈] => &lceil;
+ [“] => &ldquo;
+ [≀] => &le;
+ [⌊] => &lfloor;
+ [∗] => &lowast;
+ [◊] => &loz;
+ [‎] => &lrm;
+ [‹] => &lsaquo;
+ [‘] => &lsquo;
+ [<] => &lt;
+ [¯] => &macr;
+ [—] => &mdash;
+ [µ] => &micro;
+ [·] => &middot;
+ [−] => &minus;
+ [Ό] => &mu;
+ [∇] => &nabla;
+ [ ] => &nbsp;
+ [–] => &ndash;
+ [≠] => &ne;
+ [∋] => &ni;
+ [¬] => &not;
+ [∉] => &notin;
+ [⊄] => &nsub;
+ [ñ] => &ntilde;
+ [Μ] => &nu;
+ [ó] => &oacute;
+ [ÃŽ] => &ocirc;
+ [œ] => &oelig;
+ [ò] => &ograve;
+ [‟] => &oline;
+ [ω] => &omega;
+ [ο] => &omicron;
+ [⊕] => &oplus;
+ [√] => &or;
+ [ª] => &ordf;
+ [º] => &ordm;
+ [Þ] => &oslash;
+ [õ] => &otilde;
+ [⊗] => &otimes;
+ [ö] => &ouml;
+ [¶] => &para;
+ [∂] => &part;
+ [‰] => &permil;
+ [⊥] => &perp;
+ [φ] => &phi;
+ [π] => &pi;
+ [ϖ] => &piv;
+ [±] => &plusmn;
+ [£] => &pound;
+ [′] => &prime;
+ [∏] => &prod;
+ [∝] => &prop;
+ [ψ] => &psi;
+ ["] => &quot;
+ [⇒] => &rArr;
+ [√] => &radic;
+ [〉] => &rang;
+ [»] => &raquo;
+ [→] => &rarr;
+ [⌉] => &rceil;
+ [”] => &rdquo;
+ [ℜ] => &real;
+ [®] => &reg;
+ [⌋] => &rfloor;
+ [ρ] => &rho;
+ [‏] => &rlm;
+ [›] => &rsaquo;
+ [’] => &rsquo;
+ [‚] => &sbquo;
+ [Å¡] => &scaron;
+ [⋅] => &sdot;
+ [§] => &sect;
+ [­] => &shy;
+ [σ] => &sigma;
+ [ς] => &sigmaf;
+ [∌] => &sim;
+ [♠] => &spades;
+ [⊂] => &sub;
+ [⊆] => &sube;
+ [∑] => &sum;
+ [¹] => &sup1;
+ [²] => &sup2;
+ [³] => &sup3;
+ [⊃] => &sup;
+ [⊇] => &supe;
+ [ß] => &szlig;
+ [τ] => &tau;
+ [∎] => &there4;
+ [Ξ] => &theta;
+ [ϑ] => &thetasym;
+ [ ] => &thinsp;
+ [ß] => &thorn;
+ [˜] => &tilde;
+ [×] => &times;
+ [™] => &trade;
+ [⇑] => &uArr;
+ [ú] => &uacute;
+ [↑] => &uarr;
+ [û] => &ucirc;
+ [ù] => &ugrave;
+ [š] => &uml;
+ [ϒ] => &upsih;
+ [υ] => &upsilon;
+ [Ì] => &uuml;
+ [℘] => &weierp;
+ [Ο] => &xi;
+ [Ü] => &yacute;
+ [Â¥] => &yen;
+ [ÿ] => &yuml;
+ [ζ] => &zeta;
+ [‍] => &zwj;
+ [‌] => &zwnj;
+)
+-- with table = HTML_ENTITIES, ENT_COMPAT --
+int(252)
+-- with table = HTML_ENTITIES, ENT_NOQUOTES --
+int(251)
+-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
+int(4)
+Array
+(
+ [&] => &amp;
+ [>] => &gt;
+ [<] => &lt;
+ ["] => &quot;
+)
+-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
+array(5) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&apos;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic8.phpt b/ext/standard/tests/strings/get_html_translation_table_basic8.phpt
new file mode 100644
index 0000000..8f8ca58
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic8.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - XML 1.0
+--FILE--
+<?php
+echo "*** Testing get_html_translation_table() : basic functionality/XML 1.0 ***\n";
+
+echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XML1, "UTF-8");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT | ENT_XML1, "UTF-8");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XML1, "UTF-8");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XML1, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XML1, "UTF-8");
+asort( $tt );
+var_dump( $tt );
+
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality/XML 1.0 ***
+-- with table = HTML_ENTITIES, ENT_QUOTES --
+int(5)
+Array
+(
+ [&] => &amp;
+ ['] => &apos;
+ [>] => &gt;
+ [<] => &lt;
+ ["] => &quot;
+)
+-- with table = HTML_ENTITIES, ENT_COMPAT --
+int(4)
+-- with table = HTML_ENTITIES, ENT_NOQUOTES --
+int(3)
+-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
+int(4)
+Array
+(
+ [&] => &amp;
+ [>] => &gt;
+ [<] => &lt;
+ ["] => &quot;
+)
+-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
+array(5) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&apos;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic9.phpt b/ext/standard/tests/strings/get_html_translation_table_basic9.phpt
new file mode 100644
index 0000000..cd32ccc
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic9.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - HTML5 /sjis
+--FILE--
+<?php
+echo "*** Testing get_html_translation_table() : basic functionality/HTML5/SJIS ***\n";
+echo "*** Only basic entities supported! ***\n";
+
+echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "SJIS");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_COMPAT | ENT_HTML5, "SJIS");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
+$table = HTML_ENTITIES;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "SJIS");
+var_dump( count($tt) );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_COMPAT, "SJIS");
+asort( $tt );
+var_dump( count($tt) );
+print_r( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "SJIS");
+asort( $tt );
+var_dump( $tt );
+
+echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
+$table = HTML_SPECIALCHARS;
+$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "SJIS");
+asort( $tt );
+var_dump( $tt );
+
+
+echo "Done\n";
+?>
+--EXPECT--
+*** Testing get_html_translation_table() : basic functionality/HTML5/SJIS ***
+*** Only basic entities supported! ***
+-- with table = HTML_ENTITIES, ENT_QUOTES --
+int(5)
+Array
+(
+ [&] => &amp;
+ ['] => &apos;
+ [>] => &gt;
+ [<] => &lt;
+ ["] => &quot;
+)
+-- with table = HTML_ENTITIES, ENT_COMPAT --
+int(4)
+-- with table = HTML_ENTITIES, ENT_NOQUOTES --
+int(3)
+-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
+int(4)
+Array
+(
+ [&] => &amp;
+ [>] => &gt;
+ [<] => &lt;
+ ["] => &quot;
+)
+-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
+array(5) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&apos;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/get_html_translation_table_error.phpt b/ext/standard/tests/strings/get_html_translation_table_error.phpt
new file mode 100644
index 0000000..149adbc
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test get_html_translation_table() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing get_html_translation_table() : error conditions ***\n";
+
+// More than expected number of arguments
+echo "\n-- Testing get_html_translation_table() function with more than expected no. of arguments --\n";
+$table = HTML_ENTITIES;
+$quote_style = ENT_COMPAT;
+$extra_arg = 10;
+
+var_dump( get_html_translation_table($table, $quote_style, "UTF-8", $extra_arg) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : error conditions ***
+
+-- Testing get_html_translation_table() function with more than expected no. of arguments --
+
+Warning: get_html_translation_table() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_variation1.phpt b/ext/standard/tests/strings/get_html_translation_table_variation1.phpt
new file mode 100644
index 0000000..7f7e229
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_variation1.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test get_html_translation_table() function : usage variations - unexpected table values
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * test get_html_translation_table() with unexpected value for argument $table
+*/
+
+echo "*** Testing get_html_translation_table() : usage variations ***\n";
+// initialize all required variables
+$quote_style = ENT_COMPAT;
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// a resource variable
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // 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(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of get_html_translation_table()
+// when $table arugment is supplied with different values
+echo "\n--- Testing get_html_translation_table() by supplying different values for 'table' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $table = $values [$index];
+
+ $v = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
+ if (is_array($v) && count($v) > 100)
+ var_dump(count($v));
+ elseif (is_array($v)) {
+ asort($v);
+ var_dump($v);
+ } else {
+ var_dump($v);
+ }
+
+ $v = get_html_translation_table($table, $quote_style, "UTF-8");
+ if (is_array($v) && count($v) > 100)
+ var_dump(count($v));
+ elseif (is_array($v)) {
+ asort($v);
+ var_dump($v);
+ } else {
+ var_dump($v);
+ }
+
+ $counter ++;
+}
+
+// close resource
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : usage variations ***
+
+--- Testing get_html_translation_table() by supplying different values for 'table' argument ---
+-- Iteration 1 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 6 --
+int(252)
+int(252)
+-- Iteration 7 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- Iteration 8 --
+int(252)
+int(252)
+-- Iteration 9 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- Iteration 10 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %d
+NULL
+-- Iteration 15 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- Iteration 16 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- Iteration 17 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+-- Iteration 18 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+-- Iteration 19 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ [">"]=>
+ string(4) "&gt;"
+ ["<"]=>
+ string(4) "&lt;"
+ ["""]=>
+ string(6) "&quot;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_variation2.phpt b/ext/standard/tests/strings/get_html_translation_table_variation2.phpt
new file mode 100644
index 0000000..b792a55
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_variation2.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Test get_html_translation_table() function : usage variations - unexpected quote_style values
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * test get_html_translation_table() with unexpteced value for argument $quote_style
+*/
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+echo "*** Testing get_html_translation_table() : usage variations ***\n";
+// initialize all required variables
+$table = HTML_SPECIALCHARS;
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// a resource var
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // 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(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of get_html_translation_table()
+// when $quote_style arugment is supplied with different values
+echo "\n--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $quote_style = $values [$index];
+
+ var_dump( get_html_translation_table($table, $quote_style) );
+
+ $counter ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : usage variations ***
+
+--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---
+-- Iteration 1 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 2 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 3 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 4 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 5 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 6 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&#039;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 7 --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 8 --
+array(4) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["'"]=>
+ string(6) "&#039;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 9 --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 10 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 11 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 12 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, object given in %s on line %s
+NULL
+-- Iteration 13 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 14 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 15 --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 16 --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 17 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, resource given in %s on line %s
+NULL
+-- Iteration 18 --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+-- Iteration 19 --
+array(3) {
+ ["&"]=>
+ string(5) "&amp;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_meta_tags.phpt b/ext/standard/tests/strings/get_meta_tags.phpt
new file mode 100644
index 0000000..f086b99
--- /dev/null
+++ b/ext/standard/tests/strings/get_meta_tags.phpt
@@ -0,0 +1,95 @@
+--TEST--
+get_meta_tags() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/get_meta_tags.html";
+
+$data = <<<DATA
+<meta name="author" content="name">
+<meta name="keywords" content="php documentation">
+<meta name="DESCRIPTION" content="a php manual">
+<meta name="geo.position" content="49.33;-86.59">
+</head> <!-- parsing stops here -->
+DATA;
+
+$data1 = <<<DATA
+<html>
+ <head>
+ <meta name="author" content="name">
+ <meta name="keywords" content="php documentation">
+ <meta name="DESCRIPTION" content="a php manual">
+ <meta name="geo.position" content="49.33;-86.59">
+ </head>
+ <body>
+ <meta name="author" content="name1">
+ <meta name="keywords" content="php documentation1">
+ <meta name="DESCRIPTION" content="a php manual1">
+ <meta name="geo.position" content="49.33;-86.591">
+ </body>
+</html>
+DATA;
+
+$data2 = <<<DATA
+<meta name="author" content="name"
+<meta name="keywords" content="php documentation">
+DATA;
+
+$data3 = <<<DATA
+<meta <meta name="keywords" content="php documentation">
+DATA;
+
+$data4 = <<<DATA
+<meta name="author" content="name"
+<meta name="keywords" content="php documentation"
+DATA;
+
+$array = array($data, $data1, $data2, $data3, $data4, "", "<>", "<meta<<<<<");
+
+foreach ($array as $html) {
+ file_put_contents($filename, $html);
+ var_dump(get_meta_tags($filename));
+}
+
+@unlink($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(4) {
+ ["author"]=>
+ string(4) "name"
+ ["keywords"]=>
+ string(17) "php documentation"
+ ["description"]=>
+ string(12) "a php manual"
+ ["geo_position"]=>
+ string(12) "49.33;-86.59"
+}
+array(4) {
+ ["author"]=>
+ string(4) "name"
+ ["keywords"]=>
+ string(17) "php documentation"
+ ["description"]=>
+ string(12) "a php manual"
+ ["geo_position"]=>
+ string(12) "49.33;-86.59"
+}
+array(1) {
+ ["keywords"]=>
+ string(17) "php documentation"
+}
+array(1) {
+ ["keywords"]=>
+ string(17) "php documentation"
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/strings/hebrev_basic.phpt b/ext/standard/tests/strings/hebrev_basic.phpt
new file mode 100644
index 0000000..2f53c6f
--- /dev/null
+++ b/ext/standard/tests/strings/hebrev_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test hebrev() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() : basic functionality ***\n";
+
+$hebrew_text = "The hebrev function converts logical Hebrew text to visual text.\nThe function tries to avoid breaking words.\n";
+
+var_dump(hebrev($hebrew_text));
+var_dump(hebrev($hebrew_text, 15));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() : basic functionality ***
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+string(109) "to visual text
+Hebrew text
+logical
+converts
+hebrev function
+.The
+breaking words
+tries to avoid
+.The function
+"
+===DONE===
diff --git a/ext/standard/tests/strings/hebrev_error.phpt b/ext/standard/tests/strings/hebrev_error.phpt
new file mode 100644
index 0000000..8abf68c
--- /dev/null
+++ b/ext/standard/tests/strings/hebrev_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test hebrev() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() : error conditions ***\n";
+
+echo "\n-- Testing hebrev() function with no arguments --\n";
+var_dump( hebrev() );
+
+echo "\n-- Testing hebrev() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( hebrev("Hello World", 5, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() : error conditions ***
+
+-- Testing hebrev() function with no arguments --
+
+Warning: hebrev() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing hebrev() function with more than expected no. of arguments --
+
+Warning: hebrev() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/hebrev_variation1.phpt b/ext/standard/tests/strings/hebrev_variation1.phpt
new file mode 100644
index 0000000..210e41e
--- /dev/null
+++ b/ext/standard/tests/strings/hebrev_variation1.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test hebrev() function : usage variations - test values for $hebrew_text argument
+--FILE--
+<?php
+
+/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $hebrew_text
+$texts = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrev() function
+$count = 1;
+
+foreach($texts as $hebrew_text) {
+ echo "-- Iteration $count --\n";
+ var_dump( hebrev($hebrew_text) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' 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(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(10) "1012345.67"
+-- Iteration 10 --
+
+Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string(1) "1"
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+string(13) "sample object"
+-- Iteration 20 --
+
+Warning: hebrev() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/hebrev_variation2.phpt b/ext/standard/tests/strings/hebrev_variation2.phpt
new file mode 100644
index 0000000..00ada9a
--- /dev/null
+++ b/ext/standard/tests/strings/hebrev_variation2.phpt
@@ -0,0 +1,291 @@
+--TEST--
+Test hebrev() function : usage variations - test values for $max_chars_per_line argument
+--FILE--
+<?php
+
+/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $max_chars_per_line
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // string values
+/*19*/ "abc",
+ 'abc',
+ "3abc",
+ "0abc",
+ "0x3",
+
+ // objects
+/*24*/ new sample(),
+
+ // resource
+/*25*/ $file_handle,
+
+ // undefined variable
+/*26*/ @$undefined_var,
+
+ // unset variable
+/*27*/ @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrev() function
+$count = 1;
+
+$hebrew_text = "The hebrev function converts logical Hebrew text to visual text.\nThe function tries to avoid breaking words.\n";
+
+foreach($inputs as $max_chars_per_line) {
+ echo "-- Iteration $count --\n";
+ var_dump( hebrev($hebrew_text, $max_chars_per_line) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument ***
+-- Iteration 1 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 2 --
+string(109) "xttel uaisv
+tot ext
+ewbrHel cagilos rtveonc
+ontincfuv reebh
+he.Ts
+rdwog inakreb
+idvoa
+tos ietrn ioctunf
+he.T
+"
+-- Iteration 3 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 4 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 5 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 6 --
+string(109) "txet
+lausiv
+ot
+txet
+werbeH
+lacigol
+strevnoc
+noitcnuf
+verbeh
+ehT.
+sdrow
+gnikaerb
+diova
+ot
+seirt
+noitcnuf
+ehT.
+"
+-- Iteration 7 --
+string(109) "text
+to visual
+text
+Hebrew
+logical
+converts
+function
+hebrev
+.The
+words
+breaking
+to avoid
+tries
+function
+.The
+"
+-- Iteration 8 --
+string(109) "txet
+lausiv
+ot
+txet
+werbeH
+lacigol
+strevnoc
+noitcnuf
+verbeh
+ehT.
+sdrow
+gnikaerb
+diova
+ot
+seirt
+noitcnuf
+ehT.
+"
+-- Iteration 9 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 10 --
+
+Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string(109) "xttel uaisv
+tot ext
+ewbrHel cagilos rtveonc
+ontincfuv reebh
+he.Ts
+rdwog inakreb
+idvoa
+tos ietrn ioctunf
+he.T
+"
+-- Iteration 14 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 15 --
+string(109) "xttel uaisv
+tot ext
+ewbrHel cagilos rtveonc
+ontincfuv reebh
+he.Ts
+rdwog inakreb
+idvoa
+tos ietrn ioctunf
+he.T
+"
+-- Iteration 16 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 17 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 18 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 19 --
+
+Warning: hebrev() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: hebrev() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(109) "textual vis
+to
+textrew Heb
+icallog
+ertsconvion unctf
+brevhe
+.Therds
+wo
+kingbreaoid av
+to
+riest
+tionfuncThe .
+"
+-- Iteration 22 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 23 --
+string(109) "textual vis
+to
+textrew Heb
+icallog
+ertsconvion unctf
+brevhe
+.Therds
+wo
+kingbreaoid av
+to
+riest
+tionfuncThe .
+"
+-- Iteration 24 --
+
+Warning: hebrev() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 25 --
+
+Warning: hebrev() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+-- Iteration 26 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 27 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/hebrevc_basic.phpt b/ext/standard/tests/strings/hebrevc_basic.phpt
new file mode 100644
index 0000000..9d9a713
--- /dev/null
+++ b/ext/standard/tests/strings/hebrevc_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test hebrevc() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() : basic functionality ***\n";
+
+$hebrew_text = "The hebrevc function converts logical Hebrew text to visual text.\nThis function is similar to hebrev() with the difference that it converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking words.\n";
+
+var_dump(hebrevc($hebrew_text));
+var_dump(hebrevc($hebrew_text, 15));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() : basic functionality ***
+string(239) ".The hebrevc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrev() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+string(317) "to visual text<br />
+Hebrew text<br />
+logical<br />
+converts<br />
+function<br />
+.The hebrevc<br />
+newlines<br />
+it converts<br />
+difference that<br />
+with the<br />
+to hebrev()<br />
+is similar<br />
+) This function<br />
+<to '<br (<br />
+.'<br />
+breaking words<br />
+tries to avoid<br />
+.The function<br />
+"
+===DONE===
diff --git a/ext/standard/tests/strings/hebrevc_error.phpt b/ext/standard/tests/strings/hebrevc_error.phpt
new file mode 100644
index 0000000..f75abb3
--- /dev/null
+++ b/ext/standard/tests/strings/hebrevc_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test hebrevc() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() : error conditions ***\n";
+
+echo "\n-- Testing hebrevc() function with no arguments --\n";
+var_dump( hebrevc() );
+
+echo "\n-- Testing hebrevc() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( hebrevc("Hello World", 5, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() : error conditions ***
+
+-- Testing hebrevc() function with no arguments --
+
+Warning: hebrevc() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing hebrevc() function with more than expected no. of arguments --
+
+Warning: hebrevc() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+===DONE===
diff --git a/ext/standard/tests/strings/hebrevc_variation1.phpt b/ext/standard/tests/strings/hebrevc_variation1.phpt
new file mode 100644
index 0000000..92c6ffa
--- /dev/null
+++ b/ext/standard/tests/strings/hebrevc_variation1.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test hebrevc() function : usage variations - test values for $hebrew_text argument
+--FILE--
+<?php
+
+/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $hebrew_text
+$texts = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrevc() function
+$count = 1;
+
+foreach($texts as $hebrew_text) {
+ echo "-- Iteration $count --\n";
+ var_dump( hebrevc($hebrew_text) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' 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(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(10) "1012345.67"
+-- Iteration 10 --
+
+Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string(1) "1"
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+string(13) "sample object"
+-- Iteration 20 --
+
+Warning: hebrevc() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/strings/hebrevc_variation2.phpt b/ext/standard/tests/strings/hebrevc_variation2.phpt
new file mode 100644
index 0000000..924af9a
--- /dev/null
+++ b/ext/standard/tests/strings/hebrevc_variation2.phpt
@@ -0,0 +1,430 @@
+--TEST--
+Test hebrevc() function : usage variations - test values for $max_chars_per_line argument
+--FILE--
+<?php
+
+/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $max_chars_per_line
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // string values
+/*19*/ "abc",
+ 'abc',
+ "3abc",
+ "0abc",
+ "0x3",
+
+ // objects
+/*24*/ new sample(),
+
+ // resource
+/*25*/ $file_handle,
+
+ // undefined variable
+/*26*/ @$undefined_var,
+
+ // unset variable
+/*27*/ @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrevc() function
+$count = 1;
+
+$hebrew_text = "The hebrevcc function converts logical Hebrew text to visual text.\nThis function is similar to hebrevc() with the difference that it converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking words.\n";
+
+foreach($inputs as $max_chars_per_line) {
+ echo "-- Iteration $count --\n";
+ var_dump( hebrevc($hebrew_text, $max_chars_per_line) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***
+-- Iteration 1 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 2 --
+string(331) "xttel uaisv<br />
+tot ext<br />
+ewbrHel cagilos rtveonc<br />
+ontincfuc vcreebh<br />
+he.Ts<br />
+neliewn<br />
+tsernvcot i<br />
+atthe ncrefeifd<br />
+het<br />
+thwi) c(evbrheo t<br />
+arilims<br />
+isn ioctunf<br />
+isTh) (<br />
+r <b'<br />
+to<<br />
+.'s<br />
+rdwog inakreb<br />
+idvoa<br />
+tos ietrn ioctunf<br />
+he.T<br />
+"
+-- Iteration 3 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 4 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 5 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 6 --
+string(421) "txet<br />
+lausiv<br />
+ot<br />
+txet<br />
+werbeH<br />
+lacigol<br />
+strevnoc<br />
+noitcnuf<br />
+ccverbeh<br />
+ehT.<br />
+senilwen<br />
+strevnoc<br />
+ti<br />
+taht<br />
+ecnereffid<br />
+eht<br />
+htiw<br />
+)(cverbeh<br />
+ot<br />
+ralimis<br />
+si<br />
+noitcnuf<br />
+sihT<br />
+)<br />
+(<br />
+rb<'<br />
+ot<<br />
+'.<br />
+sdrow<br />
+gnikaerb<br />
+diova<br />
+ot<br />
+seirt<br />
+noitcnuf<br />
+ehT.<br />
+"
+-- Iteration 7 --
+string(373) "text<br />
+to visual<br />
+text<br />
+Hebrew<br />
+logical<br />
+converts<br />
+function<br />
+hebrevcc<br />
+.The<br />
+newlines<br />
+converts<br />
+that it<br />
+difference<br />
+with the<br />
+hebrevc()<br />
+similar to<br />
+is<br />
+function<br />
+) This<br />
+<to '<br (<br />
+.'<br />
+words<br />
+breaking<br />
+to avoid<br />
+tries<br />
+function<br />
+.The<br />
+"
+-- Iteration 8 --
+string(421) "txet<br />
+lausiv<br />
+ot<br />
+txet<br />
+werbeH<br />
+lacigol<br />
+strevnoc<br />
+noitcnuf<br />
+ccverbeh<br />
+ehT.<br />
+senilwen<br />
+strevnoc<br />
+ti<br />
+taht<br />
+ecnereffid<br />
+eht<br />
+htiw<br />
+)(cverbeh<br />
+ot<br />
+ralimis<br />
+si<br />
+noitcnuf<br />
+sihT<br />
+)<br />
+(<br />
+rb<'<br />
+ot<<br />
+'.<br />
+sdrow<br />
+gnikaerb<br />
+diova<br />
+ot<br />
+seirt<br />
+noitcnuf<br />
+ehT.<br />
+"
+-- Iteration 9 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 10 --
+
+Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string(331) "xttel uaisv<br />
+tot ext<br />
+ewbrHel cagilos rtveonc<br />
+ontincfuc vcreebh<br />
+he.Ts<br />
+neliewn<br />
+tsernvcot i<br />
+atthe ncrefeifd<br />
+het<br />
+thwi) c(evbrheo t<br />
+arilims<br />
+isn ioctunf<br />
+isTh) (<br />
+r <b'<br />
+to<<br />
+.'s<br />
+rdwog inakreb<br />
+idvoa<br />
+tos ietrn ioctunf<br />
+he.T<br />
+"
+-- Iteration 14 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 15 --
+string(331) "xttel uaisv<br />
+tot ext<br />
+ewbrHel cagilos rtveonc<br />
+ontincfuc vcreebh<br />
+he.Ts<br />
+neliewn<br />
+tsernvcot i<br />
+atthe ncrefeifd<br />
+het<br />
+thwi) c(evbrheo t<br />
+arilims<br />
+isn ioctunf<br />
+isTh) (<br />
+r <b'<br />
+to<<br />
+.'s<br />
+rdwog inakreb<br />
+idvoa<br />
+tos ietrn ioctunf<br />
+he.T<br />
+"
+-- Iteration 16 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 17 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 18 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 19 --
+
+Warning: hebrevc() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: hebrevc() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(349) "textual vis<br />
+to<br />
+textrew Heb<br />
+icallog<br />
+ertsconvion unctf<br />
+evcchebrThe .<br />
+inesnewlrts onvec<br />
+it<br />
+thatnce feredif<br />
+the<br />
+withc() brevhe<br />
+to<br />
+ilarsim<br />
+is<br />
+tionfunchis ) T<br />
+(<br />
+'<br<to .'<br />
+<br />
+ordsw<br />
+kingbreaoid av<br />
+to<br />
+riest<br />
+tionfuncThe .<br />
+"
+-- Iteration 22 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 23 --
+string(349) "textual vis<br />
+to<br />
+textrew Heb<br />
+icallog<br />
+ertsconvion unctf<br />
+evcchebrThe .<br />
+inesnewlrts onvec<br />
+it<br />
+thatnce feredif<br />
+the<br />
+withc() brevhe<br />
+to<br />
+ilarsim<br />
+is<br />
+tionfunchis ) T<br />
+(<br />
+'<br<to .'<br />
+<br />
+ordsw<br />
+kingbreaoid av<br />
+to<br />
+riest<br />
+tionfuncThe .<br />
+"
+-- Iteration 24 --
+
+Warning: hebrevc() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 25 --
+
+Warning: hebrevc() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+-- Iteration 26 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 27 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+===DONE===
diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt
new file mode 100644
index 0000000..d1a0323
--- /dev/null
+++ b/ext/standard/tests/strings/highlight_file.phpt
@@ -0,0 +1,59 @@
+--TEST--
+highlight_file() tests
+--INI--
+highlight.string=#DD0000
+highlight.comment=#FF9900
+highlight.keyword=#007700
+highlight.default=#0000BB
+highlight.html=#000000
+allow_url_include=1
+allow_url_fopen=1
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/highlight_file.dat";
+
+var_dump(highlight_file());
+var_dump(highlight_file($filename));
+
+var_dump(highlight_file('data:,<?php echo "test"; ?>'));
+
+var_dump(highlight_file('data:,<?php echo "test ?>'));
+
+$data = '
+<?php
+ class test {
+ public $var = 1;
+ private function foo() { echo "foo"; }
+ public function bar() { var_dump(test::foo()); }
+ }
+?>';
+
+file_put_contents($filename, $data);
+var_dump(highlight_file($filename));
+
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d
+
+Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
+bool(false)
+<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test"</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">?&gt;</span>
+</span>
+</code>bool(true)
+<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test&nbsp;?&gt;</span>
+</span>
+</code>bool(true)
+<code><span style="color: #000000">
+<br /><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;</span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">()&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">()&nbsp;{&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">test</span><span style="color: #007700">::</span><span style="color: #0000BB">foo</span><span style="color: #007700">());&nbsp;}<br />&nbsp;}&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
+</span>
+</code>bool(true)
+Done
diff --git a/ext/standard/tests/strings/html_entity_decode1.phpt b/ext/standard/tests/strings/html_entity_decode1.phpt
new file mode 100644
index 0000000..5eabfc3
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode1.phpt
@@ -0,0 +1,67 @@
+--TEST--
+html_entity_decode: Decoding of entities after invalid entities
+--FILE--
+<?php
+$arr = array(
+ "&",
+ "&&amp;",
+ "&&#x24;",
+ "&#&amp;",
+ "&#&#x24;",
+ "&#x&amp;",
+ "&#x&#x24;",
+ "&#x1&amp;",
+ "&#x1&#x24;",
+ "&#x20&amp;",
+ "&#x20&#x24;",
+ "&#1&amp;",
+ "&#1&#x24;",
+ "&#20&amp;",
+ "&#20&#x24;",
+ "&a&amp;",
+ "&a&#x24;",
+ "&aa&amp;",
+ "&aa&#x24;",
+ "&aa;&amp;",
+ "&aa;&#x24;",
+ "&;&amp;",
+ "&;&#x24;",
+);
+
+$i = 0;
+foreach ($arr as $ent) {
+ if ($i % 2 == 1) {
+ if (($a = html_entity_decode($ent, ENT_QUOTES, 'UTF-8')) !=
+ ($b = htmlspecialchars_decode($ent, ENT_QUOTES))) {
+ echo "htmlspecialchars_decode <-> html_entity_decode inconsistency","\n",
+ "$b <-> $a","\n";
+ }
+ }
+ echo html_entity_decode($ent, ENT_QUOTES, 'UTF-8'), "\n";
+}
+echo "Done.\n";
+--EXPECT--
+&
+&&
+&$
+&#&
+&#$
+&#x&
+&#x$
+&#x1&
+&#x1$
+&#x20&
+&#x20$
+&#1&
+&#1$
+&#20&
+&#20$
+&a&
+&a$
+&aa&
+&aa$
+&aa;&
+&aa;$
+&;&
+&;$
+Done. \ No newline at end of file
diff --git a/ext/standard/tests/strings/html_entity_decode2.phpt b/ext/standard/tests/strings/html_entity_decode2.phpt
new file mode 100644
index 0000000..b8a6e49
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+html_entity_decode: Handling of &apos;
+--FILE--
+<?php
+
+echo "*** HTML 4.01 implicit (shouldn't decode) ***\n";
+echo html_entity_decode("&apos;", ENT_QUOTES, "UTF-8"), "\n";
+
+echo "*** HTML 4.01 (shouldn't decode) ***\n";
+echo html_entity_decode("&apos;", ENT_QUOTES | ENT_HTML401, "UTF-8"), "\n";
+
+echo "*** HTML 5 ***\n";
+echo html_entity_decode("&apos;", ENT_QUOTES | ENT_HTML5, "UTF-8"), "\n";
+
+echo "*** XHTML 1.0 ***\n";
+echo html_entity_decode("&apos;", ENT_QUOTES | ENT_XHTML, "UTF-8"), "\n";
+
+echo "*** XML 1.0 ***\n";
+echo html_entity_decode("&apos;", ENT_QUOTES | ENT_XML1, "UTF-8"), "\n";
+
+echo "Done.\n";
+--EXPECT--
+*** HTML 4.01 implicit (shouldn't decode) ***
+&apos;
+*** HTML 4.01 (shouldn't decode) ***
+&apos;
+*** HTML 5 ***
+'
+*** XHTML 1.0 ***
+'
+*** XML 1.0 ***
+'
+Done. \ No newline at end of file
diff --git a/ext/standard/tests/strings/html_entity_decode3.phpt b/ext/standard/tests/strings/html_entity_decode3.phpt
new file mode 100644
index 0000000..fcf2710
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode3.phpt
@@ -0,0 +1,193 @@
+--TEST--
+html_entity_decode: Do not decode numerical entities that refer to non-SGML or otherwise disallowed chars
+--FILE--
+<?php
+
+$tests = array(
+ "&#0;", //C0
+ "&#1;",
+ "&#x09;",
+ "&#x0A;",
+ "&#x0B;",
+ "&#x0C;",
+ "&#x0D;", //note that HTML5 is unique in that it forbids this entity, but allows a literal U+0D
+ "&#x0E;",
+ "&#x1F;",
+ "&#x20;", //allowed always
+ "&#x7F;", //DEL
+ "&#x80;", //C1
+ "&#x9F;",
+ "&#xA0;", //allowed always
+ "&#xD7FF;", //surrogates
+ "&#xD800;",
+ "&#xDFFF;",
+ "&#xE000;", //allowed always
+ "&#xFFFE;", //nonchar
+ "&#xFFFF;",
+ "&#xFDCF;", //allowed always
+ "&#xFDD0;", //nonchar
+ "&#xFDEF;",
+ "&#xFDF0;", //allowed always
+ "&#x2FFFE;", //nonchar
+ "&#x2FFFF;",
+);
+
+echo "*** HTML 4.01 ***\n";
+
+foreach ($tests as $t) {
+ $dec = html_entity_decode($t, ENT_QUOTES | ENT_HTML401, "UTF-8");
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** XHTML 1.0 ***\n";
+
+foreach ($tests as $t) {
+ $dec = html_entity_decode($t, ENT_QUOTES | ENT_XHTML, "UTF-8");
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** HTML5 ***\n";
+
+foreach ($tests as $t) {
+ $dec = html_entity_decode($t, ENT_QUOTES | ENT_HTML5, "UTF-8");
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** XML 1.0 ***\n";
+
+foreach ($tests as $t) {
+ $dec = html_entity_decode($t, ENT_QUOTES | ENT_XML1, "UTF-8");
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\nDone.\n";
+--EXPECT--
+*** HTML 4.01 ***
+&#0; NOT DECODED
+&#1; NOT DECODED
+&#x09; DECODED
+&#x0A; DECODED
+&#x0B; NOT DECODED
+&#x0C; NOT DECODED
+&#x0D; DECODED
+&#x0E; NOT DECODED
+&#x1F; NOT DECODED
+&#x20; DECODED
+&#x7F; NOT DECODED
+&#x80; NOT DECODED
+&#x9F; NOT DECODED
+&#xA0; DECODED
+&#xD7FF; DECODED
+&#xD800; NOT DECODED
+&#xDFFF; NOT DECODED
+&#xE000; DECODED
+&#xFFFE; DECODED
+&#xFFFF; DECODED
+&#xFDCF; DECODED
+&#xFDD0; DECODED
+&#xFDEF; DECODED
+&#xFDF0; DECODED
+&#x2FFFE; DECODED
+&#x2FFFF; DECODED
+
+*** XHTML 1.0 ***
+&#0; NOT DECODED
+&#1; NOT DECODED
+&#x09; DECODED
+&#x0A; DECODED
+&#x0B; NOT DECODED
+&#x0C; NOT DECODED
+&#x0D; DECODED
+&#x0E; NOT DECODED
+&#x1F; NOT DECODED
+&#x20; DECODED
+&#x7F; DECODED
+&#x80; DECODED
+&#x9F; DECODED
+&#xA0; DECODED
+&#xD7FF; DECODED
+&#xD800; NOT DECODED
+&#xDFFF; NOT DECODED
+&#xE000; DECODED
+&#xFFFE; NOT DECODED
+&#xFFFF; NOT DECODED
+&#xFDCF; DECODED
+&#xFDD0; DECODED
+&#xFDEF; DECODED
+&#xFDF0; DECODED
+&#x2FFFE; DECODED
+&#x2FFFF; DECODED
+
+*** HTML5 ***
+&#0; NOT DECODED
+&#1; NOT DECODED
+&#x09; DECODED
+&#x0A; DECODED
+&#x0B; NOT DECODED
+&#x0C; DECODED
+&#x0D; NOT DECODED
+&#x0E; NOT DECODED
+&#x1F; NOT DECODED
+&#x20; DECODED
+&#x7F; NOT DECODED
+&#x80; NOT DECODED
+&#x9F; NOT DECODED
+&#xA0; DECODED
+&#xD7FF; DECODED
+&#xD800; NOT DECODED
+&#xDFFF; NOT DECODED
+&#xE000; DECODED
+&#xFFFE; NOT DECODED
+&#xFFFF; NOT DECODED
+&#xFDCF; DECODED
+&#xFDD0; NOT DECODED
+&#xFDEF; NOT DECODED
+&#xFDF0; DECODED
+&#x2FFFE; NOT DECODED
+&#x2FFFF; NOT DECODED
+
+*** XML 1.0 ***
+&#0; NOT DECODED
+&#1; NOT DECODED
+&#x09; DECODED
+&#x0A; DECODED
+&#x0B; NOT DECODED
+&#x0C; NOT DECODED
+&#x0D; DECODED
+&#x0E; NOT DECODED
+&#x1F; NOT DECODED
+&#x20; DECODED
+&#x7F; DECODED
+&#x80; DECODED
+&#x9F; DECODED
+&#xA0; DECODED
+&#xD7FF; DECODED
+&#xD800; NOT DECODED
+&#xDFFF; NOT DECODED
+&#xE000; DECODED
+&#xFFFE; NOT DECODED
+&#xFFFF; NOT DECODED
+&#xFDCF; DECODED
+&#xFDD0; DECODED
+&#xFDEF; DECODED
+&#xFDF0; DECODED
+&#x2FFFE; DECODED
+&#x2FFFF; DECODED
+
+Done.
diff --git a/ext/standard/tests/strings/html_entity_decode_cp866.phpt b/ext/standard/tests/strings/html_entity_decode_cp866.phpt
new file mode 100644
index 0000000..76323be
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_cp866.phpt
@@ -0,0 +1,533 @@
+--TEST--
+Translation of HTML entities for encoding CP866
+--FILE--
+<?php
+$arr = array(
+0x0410 => array(0x80, "CYRILLIC CAPITAL LETTER A"),
+0x0411 => array(0x81, "CYRILLIC CAPITAL LETTER BE"),
+0x0412 => array(0x82, "CYRILLIC CAPITAL LETTER VE"),
+0x0413 => array(0x83, "CYRILLIC CAPITAL LETTER GHE"),
+0x0414 => array(0x84, "CYRILLIC CAPITAL LETTER DE"),
+0x0415 => array(0x85, "CYRILLIC CAPITAL LETTER IE"),
+0x0416 => array(0x86, "CYRILLIC CAPITAL LETTER ZHE"),
+0x0417 => array(0x87, "CYRILLIC CAPITAL LETTER ZE"),
+0x0418 => array(0x88, "CYRILLIC CAPITAL LETTER I"),
+0x0419 => array(0x89, "CYRILLIC CAPITAL LETTER SHORT I"),
+0x041a => array(0x8a, "CYRILLIC CAPITAL LETTER KA"),
+0x041b => array(0x8b, "CYRILLIC CAPITAL LETTER EL"),
+0x041c => array(0x8c, "CYRILLIC CAPITAL LETTER EM"),
+0x041d => array(0x8d, "CYRILLIC CAPITAL LETTER EN"),
+0x041e => array(0x8e, "CYRILLIC CAPITAL LETTER O"),
+0x041f => array(0x8f, "CYRILLIC CAPITAL LETTER PE"),
+0x0420 => array(0x90, "CYRILLIC CAPITAL LETTER ER"),
+0x0421 => array(0x91, "CYRILLIC CAPITAL LETTER ES"),
+0x0422 => array(0x92, "CYRILLIC CAPITAL LETTER TE"),
+0x0423 => array(0x93, "CYRILLIC CAPITAL LETTER U"),
+0x0424 => array(0x94, "CYRILLIC CAPITAL LETTER EF"),
+0x0425 => array(0x95, "CYRILLIC CAPITAL LETTER HA"),
+0x0426 => array(0x96, "CYRILLIC CAPITAL LETTER TSE"),
+0x0427 => array(0x97, "CYRILLIC CAPITAL LETTER CHE"),
+0x0428 => array(0x98, "CYRILLIC CAPITAL LETTER SHA"),
+0x0429 => array(0x99, "CYRILLIC CAPITAL LETTER SHCHA"),
+0x042a => array(0x9a, "CYRILLIC CAPITAL LETTER HARD SIGN"),
+0x042b => array(0x9b, "CYRILLIC CAPITAL LETTER YERU"),
+0x042c => array(0x9c, "CYRILLIC CAPITAL LETTER SOFT SIGN"),
+0x042d => array(0x9d, "CYRILLIC CAPITAL LETTER E"),
+0x042e => array(0x9e, "CYRILLIC CAPITAL LETTER YU"),
+0x042f => array(0x9f, "CYRILLIC CAPITAL LETTER YA"),
+0x0430 => array(0xa0, "CYRILLIC SMALL LETTER A"),
+0x0431 => array(0xa1, "CYRILLIC SMALL LETTER BE"),
+0x0432 => array(0xa2, "CYRILLIC SMALL LETTER VE"),
+0x0433 => array(0xa3, "CYRILLIC SMALL LETTER GHE"),
+0x0434 => array(0xa4, "CYRILLIC SMALL LETTER DE"),
+0x0435 => array(0xa5, "CYRILLIC SMALL LETTER IE"),
+0x0436 => array(0xa6, "CYRILLIC SMALL LETTER ZHE"),
+0x0437 => array(0xa7, "CYRILLIC SMALL LETTER ZE"),
+0x0438 => array(0xa8, "CYRILLIC SMALL LETTER I"),
+0x0439 => array(0xa9, "CYRILLIC SMALL LETTER SHORT I"),
+0x043a => array(0xaa, "CYRILLIC SMALL LETTER KA"),
+0x043b => array(0xab, "CYRILLIC SMALL LETTER EL"),
+0x043c => array(0xac, "CYRILLIC SMALL LETTER EM"),
+0x043d => array(0xad, "CYRILLIC SMALL LETTER EN"),
+0x043e => array(0xae, "CYRILLIC SMALL LETTER O"),
+0x043f => array(0xaf, "CYRILLIC SMALL LETTER PE"),
+0x2591 => array(0xb0, "LIGHT SHADE"),
+0x2592 => array(0xb1, "MEDIUM SHADE"),
+0x2593 => array(0xb2, "DARK SHADE"),
+0x2502 => array(0xb3, "BOX DRAWINGS LIGHT VERTICAL"),
+0x2524 => array(0xb4, "BOX DRAWINGS LIGHT VERTICAL AND LEFT"),
+0x2561 => array(0xb5, "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE"),
+0x2562 => array(0xb6, "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE"),
+0x2556 => array(0xb7, "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE"),
+0x2555 => array(0xb8, "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE"),
+0x2563 => array(0xb9, "BOX DRAWINGS DOUBLE VERTICAL AND LEFT"),
+0x2551 => array(0xba, "BOX DRAWINGS DOUBLE VERTICAL"),
+0x2557 => array(0xbb, "BOX DRAWINGS DOUBLE DOWN AND LEFT"),
+0x255d => array(0xbc, "BOX DRAWINGS DOUBLE UP AND LEFT"),
+0x255c => array(0xbd, "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE"),
+0x255b => array(0xbe, "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE"),
+0x2510 => array(0xbf, "BOX DRAWINGS LIGHT DOWN AND LEFT"),
+0x2514 => array(0xc0, "BOX DRAWINGS LIGHT UP AND RIGHT"),
+0x2534 => array(0xc1, "BOX DRAWINGS LIGHT UP AND HORIZONTAL"),
+0x252c => array(0xc2, "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL"),
+0x251c => array(0xc3, "BOX DRAWINGS LIGHT VERTICAL AND RIGHT"),
+0x2500 => array(0xc4, "BOX DRAWINGS LIGHT HORIZONTAL"),
+0x253c => array(0xc5, "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL"),
+0x255e => array(0xc6, "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE"),
+0x255f => array(0xc7, "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE"),
+0x255a => array(0xc8, "BOX DRAWINGS DOUBLE UP AND RIGHT"),
+0x2554 => array(0xc9, "BOX DRAWINGS DOUBLE DOWN AND RIGHT"),
+0x2569 => array(0xca, "BOX DRAWINGS DOUBLE UP AND HORIZONTAL"),
+0x2566 => array(0xcb, "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL"),
+0x2560 => array(0xcc, "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT"),
+0x2550 => array(0xcd, "BOX DRAWINGS DOUBLE HORIZONTAL"),
+0x256c => array(0xce, "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL"),
+0x2567 => array(0xcf, "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE"),
+0x2568 => array(0xd0, "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE"),
+0x2564 => array(0xd1, "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE"),
+0x2565 => array(0xd2, "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE"),
+0x2559 => array(0xd3, "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE"),
+0x2558 => array(0xd4, "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE"),
+0x2552 => array(0xd5, "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE"),
+0x2553 => array(0xd6, "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE"),
+0x256b => array(0xd7, "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE"),
+0x256a => array(0xd8, "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE"),
+0x2518 => array(0xd9, "BOX DRAWINGS LIGHT UP AND LEFT"),
+0x250c => array(0xda, "BOX DRAWINGS LIGHT DOWN AND RIGHT"),
+0x2588 => array(0xdb, "FULL BLOCK"),
+0x2584 => array(0xdc, "LOWER HALF BLOCK"),
+0x258c => array(0xdd, "LEFT HALF BLOCK"),
+0x2590 => array(0xde, "RIGHT HALF BLOCK"),
+0x2580 => array(0xdf, "UPPER HALF BLOCK"),
+0x0440 => array(0xe0, "CYRILLIC SMALL LETTER ER"),
+0x0441 => array(0xe1, "CYRILLIC SMALL LETTER ES"),
+0x0442 => array(0xe2, "CYRILLIC SMALL LETTER TE"),
+0x0443 => array(0xe3, "CYRILLIC SMALL LETTER U"),
+0x0444 => array(0xe4, "CYRILLIC SMALL LETTER EF"),
+0x0445 => array(0xe5, "CYRILLIC SMALL LETTER HA"),
+0x0446 => array(0xe6, "CYRILLIC SMALL LETTER TSE"),
+0x0447 => array(0xe7, "CYRILLIC SMALL LETTER CHE"),
+0x0448 => array(0xe8, "CYRILLIC SMALL LETTER SHA"),
+0x0449 => array(0xe9, "CYRILLIC SMALL LETTER SHCHA"),
+0x044a => array(0xea, "CYRILLIC SMALL LETTER HARD SIGN"),
+0x044b => array(0xeb, "CYRILLIC SMALL LETTER YERU"),
+0x044c => array(0xec, "CYRILLIC SMALL LETTER SOFT SIGN"),
+0x044d => array(0xed, "CYRILLIC SMALL LETTER E"),
+0x044e => array(0xee, "CYRILLIC SMALL LETTER YU"),
+0x044f => array(0xef, "CYRILLIC SMALL LETTER YA"),
+0x0401 => array(0xf0, "CYRILLIC CAPITAL LETTER IO"),
+0x0451 => array(0xf1, "CYRILLIC SMALL LETTER IO"),
+0x0404 => array(0xf2, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"),
+0x0454 => array(0xf3, "CYRILLIC SMALL LETTER UKRAINIAN IE"),
+0x0407 => array(0xf4, "CYRILLIC CAPITAL LETTER YI"),
+0x0457 => array(0xf5, "CYRILLIC SMALL LETTER YI"),
+0x040e => array(0xf6, "CYRILLIC CAPITAL LETTER SHORT U"),
+0x045e => array(0xf7, "CYRILLIC SMALL LETTER SHORT U"),
+0x00b0 => array(0xf8, "DEGREE SIGN"),
+0x2219 => array(0xf9, "BULLET OPERATOR"),
+0x00b7 => array(0xfa, "MIDDLE DOT"),
+0x221a => array(0xfb, "SQUARE ROOT"),
+0x2116 => array(0xfc, "NUMERO SIGN"),
+0x00a4 => array(0xfd, "CURRENCY SIGN"),
+0x25a0 => array(0xfe, "BLACK SQUARE"),
+0x00a0 => array(0xff, "NO-BREAK SPACE"),
+);
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'CP866');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'CP866');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+CYRILLIC CAPITAL LETTER A: &#x410; => 80
+&#x80; => &#x80;
+
+CYRILLIC CAPITAL LETTER BE: &#x411; => 81
+&#x81; => &#x81;
+
+CYRILLIC CAPITAL LETTER VE: &#x412; => 82
+&#x82; => &#x82;
+
+CYRILLIC CAPITAL LETTER GHE: &#x413; => 83
+&#x83; => &#x83;
+
+CYRILLIC CAPITAL LETTER DE: &#x414; => 84
+&#x84; => &#x84;
+
+CYRILLIC CAPITAL LETTER IE: &#x415; => 85
+&#x85; => &#x85;
+
+CYRILLIC CAPITAL LETTER ZHE: &#x416; => 86
+&#x86; => &#x86;
+
+CYRILLIC CAPITAL LETTER ZE: &#x417; => 87
+&#x87; => &#x87;
+
+CYRILLIC CAPITAL LETTER I: &#x418; => 88
+&#x88; => &#x88;
+
+CYRILLIC CAPITAL LETTER SHORT I: &#x419; => 89
+&#x89; => &#x89;
+
+CYRILLIC CAPITAL LETTER KA: &#x41A; => 8a
+&#x8A; => &#x8A;
+
+CYRILLIC CAPITAL LETTER EL: &#x41B; => 8b
+&#x8B; => &#x8B;
+
+CYRILLIC CAPITAL LETTER EM: &#x41C; => 8c
+&#x8C; => &#x8C;
+
+CYRILLIC CAPITAL LETTER EN: &#x41D; => 8d
+&#x8D; => &#x8D;
+
+CYRILLIC CAPITAL LETTER O: &#x41E; => 8e
+&#x8E; => &#x8E;
+
+CYRILLIC CAPITAL LETTER PE: &#x41F; => 8f
+&#x8F; => &#x8F;
+
+CYRILLIC CAPITAL LETTER ER: &#x420; => 90
+&#x90; => &#x90;
+
+CYRILLIC CAPITAL LETTER ES: &#x421; => 91
+&#x91; => &#x91;
+
+CYRILLIC CAPITAL LETTER TE: &#x422; => 92
+&#x92; => &#x92;
+
+CYRILLIC CAPITAL LETTER U: &#x423; => 93
+&#x93; => &#x93;
+
+CYRILLIC CAPITAL LETTER EF: &#x424; => 94
+&#x94; => &#x94;
+
+CYRILLIC CAPITAL LETTER HA: &#x425; => 95
+&#x95; => &#x95;
+
+CYRILLIC CAPITAL LETTER TSE: &#x426; => 96
+&#x96; => &#x96;
+
+CYRILLIC CAPITAL LETTER CHE: &#x427; => 97
+&#x97; => &#x97;
+
+CYRILLIC CAPITAL LETTER SHA: &#x428; => 98
+&#x98; => &#x98;
+
+CYRILLIC CAPITAL LETTER SHCHA: &#x429; => 99
+&#x99; => &#x99;
+
+CYRILLIC CAPITAL LETTER HARD SIGN: &#x42A; => 9a
+&#x9A; => &#x9A;
+
+CYRILLIC CAPITAL LETTER YERU: &#x42B; => 9b
+&#x9B; => &#x9B;
+
+CYRILLIC CAPITAL LETTER SOFT SIGN: &#x42C; => 9c
+&#x9C; => &#x9C;
+
+CYRILLIC CAPITAL LETTER E: &#x42D; => 9d
+&#x9D; => &#x9D;
+
+CYRILLIC CAPITAL LETTER YU: &#x42E; => 9e
+&#x9E; => &#x9E;
+
+CYRILLIC CAPITAL LETTER YA: &#x42F; => 9f
+&#x9F; => &#x9F;
+
+CYRILLIC SMALL LETTER A: &#x430; => a0
+&#xA0; => ff
+
+CYRILLIC SMALL LETTER BE: &#x431; => a1
+&#xA1; => &#xA1;
+
+CYRILLIC SMALL LETTER VE: &#x432; => a2
+&#xA2; => &#xA2;
+
+CYRILLIC SMALL LETTER GHE: &#x433; => a3
+&#xA3; => &#xA3;
+
+CYRILLIC SMALL LETTER DE: &#x434; => a4
+&#xA4; => fd
+
+CYRILLIC SMALL LETTER IE: &#x435; => a5
+&#xA5; => &#xA5;
+
+CYRILLIC SMALL LETTER ZHE: &#x436; => a6
+&#xA6; => &#xA6;
+
+CYRILLIC SMALL LETTER ZE: &#x437; => a7
+&#xA7; => &#xA7;
+
+CYRILLIC SMALL LETTER I: &#x438; => a8
+&#xA8; => &#xA8;
+
+CYRILLIC SMALL LETTER SHORT I: &#x439; => a9
+&#xA9; => &#xA9;
+
+CYRILLIC SMALL LETTER KA: &#x43A; => aa
+&#xAA; => &#xAA;
+
+CYRILLIC SMALL LETTER EL: &#x43B; => ab
+&#xAB; => &#xAB;
+
+CYRILLIC SMALL LETTER EM: &#x43C; => ac
+&#xAC; => &#xAC;
+
+CYRILLIC SMALL LETTER EN: &#x43D; => ad
+&#xAD; => &#xAD;
+
+CYRILLIC SMALL LETTER O: &#x43E; => ae
+&#xAE; => &#xAE;
+
+CYRILLIC SMALL LETTER PE: &#x43F; => af
+&#xAF; => &#xAF;
+
+LIGHT SHADE: &#x2591; => b0
+&#xB0; => f8
+
+MEDIUM SHADE: &#x2592; => b1
+&#xB1; => &#xB1;
+
+DARK SHADE: &#x2593; => b2
+&#xB2; => &#xB2;
+
+BOX DRAWINGS LIGHT VERTICAL: &#x2502; => b3
+&#xB3; => &#xB3;
+
+BOX DRAWINGS LIGHT VERTICAL AND LEFT: &#x2524; => b4
+&#xB4; => &#xB4;
+
+BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE: &#x2561; => b5
+&#xB5; => &#xB5;
+
+BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE: &#x2562; => b6
+&#xB6; => &#xB6;
+
+BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE: &#x2556; => b7
+&#xB7; => fa
+
+BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE: &#x2555; => b8
+&#xB8; => &#xB8;
+
+BOX DRAWINGS DOUBLE VERTICAL AND LEFT: &#x2563; => b9
+&#xB9; => &#xB9;
+
+BOX DRAWINGS DOUBLE VERTICAL: &#x2551; => ba
+&#xBA; => &#xBA;
+
+BOX DRAWINGS DOUBLE DOWN AND LEFT: &#x2557; => bb
+&#xBB; => &#xBB;
+
+BOX DRAWINGS DOUBLE UP AND LEFT: &#x255D; => bc
+&#xBC; => &#xBC;
+
+BOX DRAWINGS UP DOUBLE AND LEFT SINGLE: &#x255C; => bd
+&#xBD; => &#xBD;
+
+BOX DRAWINGS UP SINGLE AND LEFT DOUBLE: &#x255B; => be
+&#xBE; => &#xBE;
+
+BOX DRAWINGS LIGHT DOWN AND LEFT: &#x2510; => bf
+&#xBF; => &#xBF;
+
+BOX DRAWINGS LIGHT UP AND RIGHT: &#x2514; => c0
+&#xC0; => &#xC0;
+
+BOX DRAWINGS LIGHT UP AND HORIZONTAL: &#x2534; => c1
+&#xC1; => &#xC1;
+
+BOX DRAWINGS LIGHT DOWN AND HORIZONTAL: &#x252C; => c2
+&#xC2; => &#xC2;
+
+BOX DRAWINGS LIGHT VERTICAL AND RIGHT: &#x251C; => c3
+&#xC3; => &#xC3;
+
+BOX DRAWINGS LIGHT HORIZONTAL: &#x2500; => c4
+&#xC4; => &#xC4;
+
+BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL: &#x253C; => c5
+&#xC5; => &#xC5;
+
+BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE: &#x255E; => c6
+&#xC6; => &#xC6;
+
+BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE: &#x255F; => c7
+&#xC7; => &#xC7;
+
+BOX DRAWINGS DOUBLE UP AND RIGHT: &#x255A; => c8
+&#xC8; => &#xC8;
+
+BOX DRAWINGS DOUBLE DOWN AND RIGHT: &#x2554; => c9
+&#xC9; => &#xC9;
+
+BOX DRAWINGS DOUBLE UP AND HORIZONTAL: &#x2569; => ca
+&#xCA; => &#xCA;
+
+BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL: &#x2566; => cb
+&#xCB; => &#xCB;
+
+BOX DRAWINGS DOUBLE VERTICAL AND RIGHT: &#x2560; => cc
+&#xCC; => &#xCC;
+
+BOX DRAWINGS DOUBLE HORIZONTAL: &#x2550; => cd
+&#xCD; => &#xCD;
+
+BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: &#x256C; => ce
+&#xCE; => &#xCE;
+
+BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE: &#x2567; => cf
+&#xCF; => &#xCF;
+
+BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE: &#x2568; => d0
+&#xD0; => &#xD0;
+
+BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE: &#x2564; => d1
+&#xD1; => &#xD1;
+
+BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE: &#x2565; => d2
+&#xD2; => &#xD2;
+
+BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE: &#x2559; => d3
+&#xD3; => &#xD3;
+
+BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE: &#x2558; => d4
+&#xD4; => &#xD4;
+
+BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE: &#x2552; => d5
+&#xD5; => &#xD5;
+
+BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE: &#x2553; => d6
+&#xD6; => &#xD6;
+
+BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE: &#x256B; => d7
+&#xD7; => &#xD7;
+
+BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE: &#x256A; => d8
+&#xD8; => &#xD8;
+
+BOX DRAWINGS LIGHT UP AND LEFT: &#x2518; => d9
+&#xD9; => &#xD9;
+
+BOX DRAWINGS LIGHT DOWN AND RIGHT: &#x250C; => da
+&#xDA; => &#xDA;
+
+FULL BLOCK: &#x2588; => db
+&#xDB; => &#xDB;
+
+LOWER HALF BLOCK: &#x2584; => dc
+&#xDC; => &#xDC;
+
+LEFT HALF BLOCK: &#x258C; => dd
+&#xDD; => &#xDD;
+
+RIGHT HALF BLOCK: &#x2590; => de
+&#xDE; => &#xDE;
+
+UPPER HALF BLOCK: &#x2580; => df
+&#xDF; => &#xDF;
+
+CYRILLIC SMALL LETTER ER: &#x440; => e0
+&#xE0; => &#xE0;
+
+CYRILLIC SMALL LETTER ES: &#x441; => e1
+&#xE1; => &#xE1;
+
+CYRILLIC SMALL LETTER TE: &#x442; => e2
+&#xE2; => &#xE2;
+
+CYRILLIC SMALL LETTER U: &#x443; => e3
+&#xE3; => &#xE3;
+
+CYRILLIC SMALL LETTER EF: &#x444; => e4
+&#xE4; => &#xE4;
+
+CYRILLIC SMALL LETTER HA: &#x445; => e5
+&#xE5; => &#xE5;
+
+CYRILLIC SMALL LETTER TSE: &#x446; => e6
+&#xE6; => &#xE6;
+
+CYRILLIC SMALL LETTER CHE: &#x447; => e7
+&#xE7; => &#xE7;
+
+CYRILLIC SMALL LETTER SHA: &#x448; => e8
+&#xE8; => &#xE8;
+
+CYRILLIC SMALL LETTER SHCHA: &#x449; => e9
+&#xE9; => &#xE9;
+
+CYRILLIC SMALL LETTER HARD SIGN: &#x44A; => ea
+&#xEA; => &#xEA;
+
+CYRILLIC SMALL LETTER YERU: &#x44B; => eb
+&#xEB; => &#xEB;
+
+CYRILLIC SMALL LETTER SOFT SIGN: &#x44C; => ec
+&#xEC; => &#xEC;
+
+CYRILLIC SMALL LETTER E: &#x44D; => ed
+&#xED; => &#xED;
+
+CYRILLIC SMALL LETTER YU: &#x44E; => ee
+&#xEE; => &#xEE;
+
+CYRILLIC SMALL LETTER YA: &#x44F; => ef
+&#xEF; => &#xEF;
+
+CYRILLIC CAPITAL LETTER IO: &#x401; => f0
+&#xF0; => &#xF0;
+
+CYRILLIC SMALL LETTER IO: &#x451; => f1
+&#xF1; => &#xF1;
+
+CYRILLIC CAPITAL LETTER UKRAINIAN IE: &#x404; => f2
+&#xF2; => &#xF2;
+
+CYRILLIC SMALL LETTER UKRAINIAN IE: &#x454; => f3
+&#xF3; => &#xF3;
+
+CYRILLIC CAPITAL LETTER YI: &#x407; => f4
+&#xF4; => &#xF4;
+
+CYRILLIC SMALL LETTER YI: &#x457; => f5
+&#xF5; => &#xF5;
+
+CYRILLIC CAPITAL LETTER SHORT U: &#x40E; => f6
+&#xF6; => &#xF6;
+
+CYRILLIC SMALL LETTER SHORT U: &#x45E; => f7
+&#xF7; => &#xF7;
+
+DEGREE SIGN: &#xB0; => f8
+&#xF8; => &#xF8;
+
+BULLET OPERATOR: &#x2219; => f9
+&#xF9; => &#xF9;
+
+MIDDLE DOT: &#xB7; => fa
+&#xFA; => &#xFA;
+
+SQUARE ROOT: &#x221A; => fb
+&#xFB; => &#xFB;
+
+NUMERO SIGN: &#x2116; => fc
+&#xFC; => &#xFC;
+
+CURRENCY SIGN: &#xA4; => fd
+&#xFD; => &#xFD;
+
+BLACK SQUARE: &#x25A0; => fe
+&#xFE; => &#xFE;
+
+NO-BREAK SPACE: &#xA0; => ff
+&#xFF; => &#xFF;
+
+
diff --git a/ext/standard/tests/strings/html_entity_decode_html4.phpt b/ext/standard/tests/strings/html_entity_decode_html4.phpt
new file mode 100644
index 0000000..3475339
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_html4.phpt
@@ -0,0 +1,516 @@
+--TEST--
+html_entity_decode() conformance check (HTML 4)
+--FILE--
+<?php
+$map = array(
+ "&quot;",
+ "&amp;",
+ "&lt;",
+ "&gt;",
+ "&nbsp;",
+ "&iexcl;",
+ "&cent;",
+ "&pound;",
+ "&curren;",
+ "&yen;",
+ "&brvbar;",
+ "&sect;",
+ "&uml;",
+ "&copy;",
+ "&ordf;",
+ "&laquo;",
+ "&not;",
+ "&shy;",
+ "&reg;",
+ "&macr;",
+ "&deg;",
+ "&plusmn;",
+ "&sup2;",
+ "&sup3;",
+ "&acute;",
+ "&micro;",
+ "&para;",
+ "&middot;",
+ "&cedil;",
+ "&sup1;",
+ "&ordm;",
+ "&raquo;",
+ "&frac14;",
+ "&frac12;",
+ "&frac34;",
+ "&iquest;",
+ "&Agrave;",
+ "&Aacute;",
+ "&Acirc;",
+ "&Atilde;",
+ "&Auml;",
+ "&Aring;",
+ "&AElig;",
+ "&Ccedil;",
+ "&Egrave;",
+ "&Eacute;",
+ "&Ecirc;",
+ "&Euml;",
+ "&Igrave;",
+ "&Iacute;",
+ "&Icirc;",
+ "&Iuml;",
+ "&ETH;",
+ "&Ntilde;",
+ "&Ograve;",
+ "&Oacute;",
+ "&Ocirc;",
+ "&Otilde;",
+ "&Ouml;",
+ "&times;",
+ "&Oslash;",
+ "&Ugrave;",
+ "&Uacute;",
+ "&Ucirc;",
+ "&Uuml;",
+ "&Yacute;",
+ "&THORN;",
+ "&szlig;",
+ "&agrave;",
+ "&aacute;",
+ "&acirc;",
+ "&atilde;",
+ "&auml;",
+ "&aring;",
+ "&aelig;",
+ "&ccedil;",
+ "&egrave;",
+ "&eacute;",
+ "&ecirc;",
+ "&euml;",
+ "&igrave;",
+ "&iacute;",
+ "&icirc;",
+ "&iuml;",
+ "&eth;",
+ "&ntilde;",
+ "&ograve;",
+ "&oacute;",
+ "&ocirc;",
+ "&otilde;",
+ "&ouml;",
+ "&divide;",
+ "&oslash;",
+ "&ugrave;",
+ "&uacute;",
+ "&ucirc;",
+ "&uuml;",
+ "&yacute;",
+ "&thorn;",
+ "&yuml;",
+ "&OElig;",
+ "&oelig;",
+ "&Scaron;",
+ "&scaron;",
+ "&Yuml;",
+ "&fnof;",
+ "&circ;",
+ "&tilde;",
+ "&Alpha;",
+ "&Beta;",
+ "&Gamma;",
+ "&Delta;",
+ "&Epsilon;",
+ "&Zeta;",
+ "&Eta;",
+ "&Theta;",
+ "&Iota;",
+ "&Kappa;",
+ "&Lambda;",
+ "&Mu;",
+ "&Nu;",
+ "&Xi;",
+ "&Omicron;",
+ "&Pi;",
+ "&Rho;",
+ "&Sigma;",
+ "&Tau;",
+ "&Upsilon;",
+ "&Phi;",
+ "&Chi;",
+ "&Psi;",
+ "&Omega;",
+ "&alpha;",
+ "&beta;",
+ "&gamma;",
+ "&delta;",
+ "&epsilon;",
+ "&zeta;",
+ "&eta;",
+ "&theta;",
+ "&iota;",
+ "&kappa;",
+ "&lambda;",
+ "&mu;",
+ "&nu;",
+ "&xi;",
+ "&omicron;",
+ "&pi;",
+ "&rho;",
+ "&sigmaf;",
+ "&sigma;",
+ "&tau;",
+ "&upsilon;",
+ "&phi;",
+ "&chi;",
+ "&psi;",
+ "&omega;",
+ "&thetasym;",
+ "&upsih;",
+ "&piv;",
+ "&ensp;",
+ "&emsp;",
+ "&thinsp;",
+ "&zwnj;",
+ "&zwj;",
+ "&lrm;",
+ "&rlm;",
+ "&ndash;",
+ "&mdash;",
+ "&lsquo;",
+ "&rsquo;",
+ "&sbquo;",
+ "&ldquo;",
+ "&rdquo;",
+ "&bdquo;",
+ "&dagger;",
+ "&Dagger;",
+ "&bull;",
+ "&hellip;",
+ "&permil;",
+ "&prime;",
+ "&Prime;",
+ "&lsaquo;",
+ "&rsaquo;",
+ "&oline;",
+ "&frasl;",
+ "&euro;",
+ "&image;",
+ "&weierp;",
+ "&real;",
+ "&trade;",
+ "&alefsym;",
+ "&larr;",
+ "&uarr;",
+ "&rarr;",
+ "&darr;",
+ "&harr;",
+ "&crarr;",
+ "&lArr;",
+ "&uArr;",
+ "&rArr;",
+ "&dArr;",
+ "&hArr;",
+ "&forall;",
+ "&part;",
+ "&exist;",
+ "&empty;",
+ "&nabla;",
+ "&isin;",
+ "&notin;",
+ "&ni;",
+ "&prod;",
+ "&sum;",
+ "&minus;",
+ "&lowast;",
+ "&radic;",
+ "&prop;",
+ "&infin;",
+ "&ang;",
+ "&and;",
+ "&or;",
+ "&cap;",
+ "&cup;",
+ "&int;",
+ "&there4;",
+ "&sim;",
+ "&cong;",
+ "&asymp;",
+ "&ne;",
+ "&equiv;",
+ "&le;",
+ "&ge;",
+ "&sub;",
+ "&sup;",
+ "&nsub;",
+ "&sube;",
+ "&supe;",
+ "&oplus;",
+ "&otimes;",
+ "&perp;",
+ "&sdot;",
+ "&lceil;",
+ "&rceil;",
+ "&lfloor;",
+ "&rfloor;",
+ "&lang;",
+ "&rang;",
+ "&loz;",
+ "&spades;",
+ "&clubs;",
+ "&hearts;",
+ "&diams;"
+);
+
+foreach ($map as $str) {
+ echo bin2hex(html_entity_decode($str, ENT_QUOTES, "UTF-8")), "\n";
+}
+?>
+--EXPECT--
+22
+26
+3c
+3e
+c2a0
+c2a1
+c2a2
+c2a3
+c2a4
+c2a5
+c2a6
+c2a7
+c2a8
+c2a9
+c2aa
+c2ab
+c2ac
+c2ad
+c2ae
+c2af
+c2b0
+c2b1
+c2b2
+c2b3
+c2b4
+c2b5
+c2b6
+c2b7
+c2b8
+c2b9
+c2ba
+c2bb
+c2bc
+c2bd
+c2be
+c2bf
+c380
+c381
+c382
+c383
+c384
+c385
+c386
+c387
+c388
+c389
+c38a
+c38b
+c38c
+c38d
+c38e
+c38f
+c390
+c391
+c392
+c393
+c394
+c395
+c396
+c397
+c398
+c399
+c39a
+c39b
+c39c
+c39d
+c39e
+c39f
+c3a0
+c3a1
+c3a2
+c3a3
+c3a4
+c3a5
+c3a6
+c3a7
+c3a8
+c3a9
+c3aa
+c3ab
+c3ac
+c3ad
+c3ae
+c3af
+c3b0
+c3b1
+c3b2
+c3b3
+c3b4
+c3b5
+c3b6
+c3b7
+c3b8
+c3b9
+c3ba
+c3bb
+c3bc
+c3bd
+c3be
+c3bf
+c592
+c593
+c5a0
+c5a1
+c5b8
+c692
+cb86
+cb9c
+ce91
+ce92
+ce93
+ce94
+ce95
+ce96
+ce97
+ce98
+ce99
+ce9a
+ce9b
+ce9c
+ce9d
+ce9e
+ce9f
+cea0
+cea1
+cea3
+cea4
+cea5
+cea6
+cea7
+cea8
+cea9
+ceb1
+ceb2
+ceb3
+ceb4
+ceb5
+ceb6
+ceb7
+ceb8
+ceb9
+ceba
+cebb
+cebc
+cebd
+cebe
+cebf
+cf80
+cf81
+cf82
+cf83
+cf84
+cf85
+cf86
+cf87
+cf88
+cf89
+cf91
+cf92
+cf96
+e28082
+e28083
+e28089
+e2808c
+e2808d
+e2808e
+e2808f
+e28093
+e28094
+e28098
+e28099
+e2809a
+e2809c
+e2809d
+e2809e
+e280a0
+e280a1
+e280a2
+e280a6
+e280b0
+e280b2
+e280b3
+e280b9
+e280ba
+e280be
+e28184
+e282ac
+e28491
+e28498
+e2849c
+e284a2
+e284b5
+e28690
+e28691
+e28692
+e28693
+e28694
+e286b5
+e28790
+e28791
+e28792
+e28793
+e28794
+e28880
+e28882
+e28883
+e28885
+e28887
+e28888
+e28889
+e2888b
+e2888f
+e28891
+e28892
+e28897
+e2889a
+e2889d
+e2889e
+e288a0
+e288a7
+e288a8
+e288a9
+e288aa
+e288ab
+e288b4
+e288bc
+e28985
+e28988
+e289a0
+e289a1
+e289a4
+e289a5
+e28a82
+e28a83
+e28a84
+e28a86
+e28a87
+e28a95
+e28a97
+e28aa5
+e28b85
+e28c88
+e28c89
+e28c8a
+e28c8b
+e28ca9
+e28caa
+e2978a
+e299a0
+e299a3
+e299a5
+e299a6
diff --git a/ext/standard/tests/strings/html_entity_decode_html5.phpt b/ext/standard/tests/strings/html_entity_decode_html5.phpt
new file mode 100644
index 0000000..6e0d4cf
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_html5.phpt
@@ -0,0 +1,4264 @@
+--TEST--
+html_entity_decode() conformance check (HTML 5)
+--FILE--
+<?php
+$map = array(
+ "&AElig;",
+ "&AMP;",
+ "&Aacute;",
+ "&Abreve;",
+ "&Acirc;",
+ "&Acy;",
+ "&Afr;",
+ "&Agrave;",
+ "&Alpha;",
+ "&Amacr;",
+ "&And;",
+ "&Aogon;",
+ "&Aopf;",
+ "&ApplyFunction;",
+ "&Aring;",
+ "&Ascr;",
+ "&Assign;",
+ "&Atilde;",
+ "&Auml;",
+ "&Backslash;",
+ "&Barv;",
+ "&Barwed;",
+ "&Bcy;",
+ "&Because;",
+ "&Bernoullis;",
+ "&Beta;",
+ "&Bfr;",
+ "&Bopf;",
+ "&Breve;",
+ "&Bscr;",
+ "&Bumpeq;",
+ "&CHcy;",
+ "&COPY;",
+ "&Cacute;",
+ "&Cap;",
+ "&CapitalDifferentialD;",
+ "&Cayleys;",
+ "&Ccaron;",
+ "&Ccedil;",
+ "&Ccirc;",
+ "&Cconint;",
+ "&Cdot;",
+ "&Cedilla;",
+ "&CenterDot;",
+ "&Cfr;",
+ "&Chi;",
+ "&CircleDot;",
+ "&CircleMinus;",
+ "&CirclePlus;",
+ "&CircleTimes;",
+ "&ClockwiseContourIntegral;",
+ "&CloseCurlyDoubleQuote;",
+ "&CloseCurlyQuote;",
+ "&Colon;",
+ "&Colone;",
+ "&Congruent;",
+ "&Conint;",
+ "&ContourIntegral;",
+ "&Copf;",
+ "&Coproduct;",
+ "&CounterClockwiseContourIntegral;",
+ "&Cross;",
+ "&Cscr;",
+ "&Cup;",
+ "&CupCap;",
+ "&DD;",
+ "&DDotrahd;",
+ "&DJcy;",
+ "&DScy;",
+ "&DZcy;",
+ "&Dagger;",
+ "&Darr;",
+ "&Dashv;",
+ "&Dcaron;",
+ "&Dcy;",
+ "&Del;",
+ "&Delta;",
+ "&Dfr;",
+ "&DiacriticalAcute;",
+ "&DiacriticalDot;",
+ "&DiacriticalDoubleAcute;",
+ "&DiacriticalGrave;",
+ "&DiacriticalTilde;",
+ "&Diamond;",
+ "&DifferentialD;",
+ "&Dopf;",
+ "&Dot;",
+ "&DotDot;",
+ "&DotEqual;",
+ "&DoubleContourIntegral;",
+ "&DoubleDot;",
+ "&DoubleDownArrow;",
+ "&DoubleLeftArrow;",
+ "&DoubleLeftRightArrow;",
+ "&DoubleLeftTee;",
+ "&DoubleLongLeftArrow;",
+ "&DoubleLongLeftRightArrow;",
+ "&DoubleLongRightArrow;",
+ "&DoubleRightArrow;",
+ "&DoubleRightTee;",
+ "&DoubleUpArrow;",
+ "&DoubleUpDownArrow;",
+ "&DoubleVerticalBar;",
+ "&DownArrow;",
+ "&DownArrowBar;",
+ "&DownArrowUpArrow;",
+ "&DownBreve;",
+ "&DownLeftRightVector;",
+ "&DownLeftTeeVector;",
+ "&DownLeftVector;",
+ "&DownLeftVectorBar;",
+ "&DownRightTeeVector;",
+ "&DownRightVector;",
+ "&DownRightVectorBar;",
+ "&DownTee;",
+ "&DownTeeArrow;",
+ "&Downarrow;",
+ "&Dscr;",
+ "&Dstrok;",
+ "&ENG;",
+ "&ETH;",
+ "&Eacute;",
+ "&Ecaron;",
+ "&Ecirc;",
+ "&Ecy;",
+ "&Edot;",
+ "&Efr;",
+ "&Egrave;",
+ "&Element;",
+ "&Emacr;",
+ "&EmptySmallSquare;",
+ "&EmptyVerySmallSquare;",
+ "&Eogon;",
+ "&Eopf;",
+ "&Epsilon;",
+ "&Equal;",
+ "&EqualTilde;",
+ "&Equilibrium;",
+ "&Escr;",
+ "&Esim;",
+ "&Eta;",
+ "&Euml;",
+ "&Exists;",
+ "&ExponentialE;",
+ "&Fcy;",
+ "&Ffr;",
+ "&FilledSmallSquare;",
+ "&FilledVerySmallSquare;",
+ "&Fopf;",
+ "&ForAll;",
+ "&Fouriertrf;",
+ "&Fscr;",
+ "&GJcy;",
+ "&GT;",
+ "&Gamma;",
+ "&Gammad;",
+ "&Gbreve;",
+ "&Gcedil;",
+ "&Gcirc;",
+ "&Gcy;",
+ "&Gdot;",
+ "&Gfr;",
+ "&Gg;",
+ "&Gopf;",
+ "&GreaterEqual;",
+ "&GreaterEqualLess;",
+ "&GreaterFullEqual;",
+ "&GreaterGreater;",
+ "&GreaterLess;",
+ "&GreaterSlantEqual;",
+ "&GreaterTilde;",
+ "&Gscr;",
+ "&Gt;",
+ "&HARDcy;",
+ "&Hacek;",
+ "&Hat;",
+ "&Hcirc;",
+ "&Hfr;",
+ "&HilbertSpace;",
+ "&Hopf;",
+ "&HorizontalLine;",
+ "&Hscr;",
+ "&Hstrok;",
+ "&HumpDownHump;",
+ "&HumpEqual;",
+ "&IEcy;",
+ "&IJlig;",
+ "&IOcy;",
+ "&Iacute;",
+ "&Icirc;",
+ "&Icy;",
+ "&Idot;",
+ "&Ifr;",
+ "&Igrave;",
+ "&Im;",
+ "&Imacr;",
+ "&ImaginaryI;",
+ "&Implies;",
+ "&Int;",
+ "&Integral;",
+ "&Intersection;",
+ "&InvisibleComma;",
+ "&InvisibleTimes;",
+ "&Iogon;",
+ "&Iopf;",
+ "&Iota;",
+ "&Iscr;",
+ "&Itilde;",
+ "&Iukcy;",
+ "&Iuml;",
+ "&Jcirc;",
+ "&Jcy;",
+ "&Jfr;",
+ "&Jopf;",
+ "&Jscr;",
+ "&Jsercy;",
+ "&Jukcy;",
+ "&KHcy;",
+ "&KJcy;",
+ "&Kappa;",
+ "&Kcedil;",
+ "&Kcy;",
+ "&Kfr;",
+ "&Kopf;",
+ "&Kscr;",
+ "&LJcy;",
+ "&LT;",
+ "&Lacute;",
+ "&Lambda;",
+ "&Lang;",
+ "&Laplacetrf;",
+ "&Larr;",
+ "&Lcaron;",
+ "&Lcedil;",
+ "&Lcy;",
+ "&LeftAngleBracket;",
+ "&LeftArrow;",
+ "&LeftArrowBar;",
+ "&LeftArrowRightArrow;",
+ "&LeftCeiling;",
+ "&LeftDoubleBracket;",
+ "&LeftDownTeeVector;",
+ "&LeftDownVector;",
+ "&LeftDownVectorBar;",
+ "&LeftFloor;",
+ "&LeftRightArrow;",
+ "&LeftRightVector;",
+ "&LeftTee;",
+ "&LeftTeeArrow;",
+ "&LeftTeeVector;",
+ "&LeftTriangle;",
+ "&LeftTriangleBar;",
+ "&LeftTriangleEqual;",
+ "&LeftUpDownVector;",
+ "&LeftUpTeeVector;",
+ "&LeftUpVector;",
+ "&LeftUpVectorBar;",
+ "&LeftVector;",
+ "&LeftVectorBar;",
+ "&Leftarrow;",
+ "&Leftrightarrow;",
+ "&LessEqualGreater;",
+ "&LessFullEqual;",
+ "&LessGreater;",
+ "&LessLess;",
+ "&LessSlantEqual;",
+ "&LessTilde;",
+ "&Lfr;",
+ "&Ll;",
+ "&Lleftarrow;",
+ "&Lmidot;",
+ "&LongLeftArrow;",
+ "&LongLeftRightArrow;",
+ "&LongRightArrow;",
+ "&Longleftarrow;",
+ "&Longleftrightarrow;",
+ "&Longrightarrow;",
+ "&Lopf;",
+ "&LowerLeftArrow;",
+ "&LowerRightArrow;",
+ "&Lscr;",
+ "&Lsh;",
+ "&Lstrok;",
+ "&Lt;",
+ "&Map;",
+ "&Mcy;",
+ "&MediumSpace;",
+ "&Mellintrf;",
+ "&Mfr;",
+ "&MinusPlus;",
+ "&Mopf;",
+ "&Mscr;",
+ "&Mu;",
+ "&NJcy;",
+ "&Nacute;",
+ "&Ncaron;",
+ "&Ncedil;",
+ "&Ncy;",
+ "&NegativeMediumSpace;",
+ "&NegativeThickSpace;",
+ "&NegativeThinSpace;",
+ "&NegativeVeryThinSpace;",
+ "&NestedGreaterGreater;",
+ "&NestedLessLess;",
+ "&NewLine;",
+ "&Nfr;",
+ "&NoBreak;",
+ "&NonBreakingSpace;",
+ "&Nopf;",
+ "&Not;",
+ "&NotCongruent;",
+ "&NotCupCap;",
+ "&NotDoubleVerticalBar;",
+ "&NotElement;",
+ "&NotEqual;",
+ "&NotEqualTilde;",
+ "&NotExists;",
+ "&NotGreater;",
+ "&NotGreaterEqual;",
+ "&NotGreaterFullEqual;",
+ "&NotGreaterGreater;",
+ "&NotGreaterLess;",
+ "&NotGreaterSlantEqual;",
+ "&NotGreaterTilde;",
+ "&NotHumpDownHump;",
+ "&NotHumpEqual;",
+ "&NotLeftTriangle;",
+ "&NotLeftTriangleBar;",
+ "&NotLeftTriangleEqual;",
+ "&NotLess;",
+ "&NotLessEqual;",
+ "&NotLessGreater;",
+ "&NotLessLess;",
+ "&NotLessSlantEqual;",
+ "&NotLessTilde;",
+ "&NotNestedGreaterGreater;",
+ "&NotNestedLessLess;",
+ "&NotPrecedes;",
+ "&NotPrecedesEqual;",
+ "&NotPrecedesSlantEqual;",
+ "&NotReverseElement;",
+ "&NotRightTriangle;",
+ "&NotRightTriangleBar;",
+ "&NotRightTriangleEqual;",
+ "&NotSquareSubset;",
+ "&NotSquareSubsetEqual;",
+ "&NotSquareSuperset;",
+ "&NotSquareSupersetEqual;",
+ "&NotSubset;",
+ "&NotSubsetEqual;",
+ "&NotSucceeds;",
+ "&NotSucceedsEqual;",
+ "&NotSucceedsSlantEqual;",
+ "&NotSucceedsTilde;",
+ "&NotSuperset;",
+ "&NotSupersetEqual;",
+ "&NotTilde;",
+ "&NotTildeEqual;",
+ "&NotTildeFullEqual;",
+ "&NotTildeTilde;",
+ "&NotVerticalBar;",
+ "&Nscr;",
+ "&Ntilde;",
+ "&Nu;",
+ "&OElig;",
+ "&Oacute;",
+ "&Ocirc;",
+ "&Ocy;",
+ "&Odblac;",
+ "&Ofr;",
+ "&Ograve;",
+ "&Omacr;",
+ "&Omega;",
+ "&Omicron;",
+ "&Oopf;",
+ "&OpenCurlyDoubleQuote;",
+ "&OpenCurlyQuote;",
+ "&Or;",
+ "&Oscr;",
+ "&Oslash;",
+ "&Otilde;",
+ "&Otimes;",
+ "&Ouml;",
+ "&OverBar;",
+ "&OverBrace;",
+ "&OverBracket;",
+ "&OverParenthesis;",
+ "&PartialD;",
+ "&Pcy;",
+ "&Pfr;",
+ "&Phi;",
+ "&Pi;",
+ "&PlusMinus;",
+ "&Poincareplane;",
+ "&Popf;",
+ "&Pr;",
+ "&Precedes;",
+ "&PrecedesEqual;",
+ "&PrecedesSlantEqual;",
+ "&PrecedesTilde;",
+ "&Prime;",
+ "&Product;",
+ "&Proportion;",
+ "&Proportional;",
+ "&Pscr;",
+ "&Psi;",
+ "&QUOT;",
+ "&Qfr;",
+ "&Qopf;",
+ "&Qscr;",
+ "&RBarr;",
+ "&REG;",
+ "&Racute;",
+ "&Rang;",
+ "&Rarr;",
+ "&Rarrtl;",
+ "&Rcaron;",
+ "&Rcedil;",
+ "&Rcy;",
+ "&Re;",
+ "&ReverseElement;",
+ "&ReverseEquilibrium;",
+ "&ReverseUpEquilibrium;",
+ "&Rfr;",
+ "&Rho;",
+ "&RightAngleBracket;",
+ "&RightArrow;",
+ "&RightArrowBar;",
+ "&RightArrowLeftArrow;",
+ "&RightCeiling;",
+ "&RightDoubleBracket;",
+ "&RightDownTeeVector;",
+ "&RightDownVector;",
+ "&RightDownVectorBar;",
+ "&RightFloor;",
+ "&RightTee;",
+ "&RightTeeArrow;",
+ "&RightTeeVector;",
+ "&RightTriangle;",
+ "&RightTriangleBar;",
+ "&RightTriangleEqual;",
+ "&RightUpDownVector;",
+ "&RightUpTeeVector;",
+ "&RightUpVector;",
+ "&RightUpVectorBar;",
+ "&RightVector;",
+ "&RightVectorBar;",
+ "&Rightarrow;",
+ "&Ropf;",
+ "&RoundImplies;",
+ "&Rrightarrow;",
+ "&Rscr;",
+ "&Rsh;",
+ "&RuleDelayed;",
+ "&SHCHcy;",
+ "&SHcy;",
+ "&SOFTcy;",
+ "&Sacute;",
+ "&Sc;",
+ "&Scaron;",
+ "&Scedil;",
+ "&Scirc;",
+ "&Scy;",
+ "&Sfr;",
+ "&ShortDownArrow;",
+ "&ShortLeftArrow;",
+ "&ShortRightArrow;",
+ "&ShortUpArrow;",
+ "&Sigma;",
+ "&SmallCircle;",
+ "&Sopf;",
+ "&Sqrt;",
+ "&Square;",
+ "&SquareIntersection;",
+ "&SquareSubset;",
+ "&SquareSubsetEqual;",
+ "&SquareSuperset;",
+ "&SquareSupersetEqual;",
+ "&SquareUnion;",
+ "&Sscr;",
+ "&Star;",
+ "&Sub;",
+ "&Subset;",
+ "&SubsetEqual;",
+ "&Succeeds;",
+ "&SucceedsEqual;",
+ "&SucceedsSlantEqual;",
+ "&SucceedsTilde;",
+ "&SuchThat;",
+ "&Sum;",
+ "&Sup;",
+ "&Superset;",
+ "&SupersetEqual;",
+ "&Supset;",
+ "&THORN;",
+ "&TRADE;",
+ "&TSHcy;",
+ "&TScy;",
+ "&Tab;",
+ "&Tau;",
+ "&Tcaron;",
+ "&Tcedil;",
+ "&Tcy;",
+ "&Tfr;",
+ "&Therefore;",
+ "&Theta;",
+ "&ThickSpace;",
+ "&ThinSpace;",
+ "&Tilde;",
+ "&TildeEqual;",
+ "&TildeFullEqual;",
+ "&TildeTilde;",
+ "&Topf;",
+ "&TripleDot;",
+ "&Tscr;",
+ "&Tstrok;",
+ "&Uacute;",
+ "&Uarr;",
+ "&Uarrocir;",
+ "&Ubrcy;",
+ "&Ubreve;",
+ "&Ucirc;",
+ "&Ucy;",
+ "&Udblac;",
+ "&Ufr;",
+ "&Ugrave;",
+ "&Umacr;",
+ "&UnderBar;",
+ "&UnderBrace;",
+ "&UnderBracket;",
+ "&UnderParenthesis;",
+ "&Union;",
+ "&UnionPlus;",
+ "&Uogon;",
+ "&Uopf;",
+ "&UpArrow;",
+ "&UpArrowBar;",
+ "&UpArrowDownArrow;",
+ "&UpDownArrow;",
+ "&UpEquilibrium;",
+ "&UpTee;",
+ "&UpTeeArrow;",
+ "&Uparrow;",
+ "&Updownarrow;",
+ "&UpperLeftArrow;",
+ "&UpperRightArrow;",
+ "&Upsi;",
+ "&Upsilon;",
+ "&Uring;",
+ "&Uscr;",
+ "&Utilde;",
+ "&Uuml;",
+ "&VDash;",
+ "&Vbar;",
+ "&Vcy;",
+ "&Vdash;",
+ "&Vdashl;",
+ "&Vee;",
+ "&Verbar;",
+ "&Vert;",
+ "&VerticalBar;",
+ "&VerticalLine;",
+ "&VerticalSeparator;",
+ "&VerticalTilde;",
+ "&VeryThinSpace;",
+ "&Vfr;",
+ "&Vopf;",
+ "&Vscr;",
+ "&Vvdash;",
+ "&Wcirc;",
+ "&Wedge;",
+ "&Wfr;",
+ "&Wopf;",
+ "&Wscr;",
+ "&Xfr;",
+ "&Xi;",
+ "&Xopf;",
+ "&Xscr;",
+ "&YAcy;",
+ "&YIcy;",
+ "&YUcy;",
+ "&Yacute;",
+ "&Ycirc;",
+ "&Ycy;",
+ "&Yfr;",
+ "&Yopf;",
+ "&Yscr;",
+ "&Yuml;",
+ "&ZHcy;",
+ "&Zacute;",
+ "&Zcaron;",
+ "&Zcy;",
+ "&Zdot;",
+ "&ZeroWidthSpace;",
+ "&Zeta;",
+ "&Zfr;",
+ "&Zopf;",
+ "&Zscr;",
+ "&aacute;",
+ "&abreve;",
+ "&ac;",
+ "&acE;",
+ "&acd;",
+ "&acirc;",
+ "&acute;",
+ "&acy;",
+ "&aelig;",
+ "&af;",
+ "&afr;",
+ "&agrave;",
+ "&alefsym;",
+ "&aleph;",
+ "&alpha;",
+ "&amacr;",
+ "&amalg;",
+ "&amp;",
+ "&and;",
+ "&andand;",
+ "&andd;",
+ "&andslope;",
+ "&andv;",
+ "&ang;",
+ "&ange;",
+ "&angle;",
+ "&angmsd;",
+ "&angmsdaa;",
+ "&angmsdab;",
+ "&angmsdac;",
+ "&angmsdad;",
+ "&angmsdae;",
+ "&angmsdaf;",
+ "&angmsdag;",
+ "&angmsdah;",
+ "&angrt;",
+ "&angrtvb;",
+ "&angrtvbd;",
+ "&angsph;",
+ "&angst;",
+ "&angzarr;",
+ "&aogon;",
+ "&aopf;",
+ "&ap;",
+ "&apE;",
+ "&apacir;",
+ "&ape;",
+ "&apid;",
+ "&apos;",
+ "&approx;",
+ "&approxeq;",
+ "&aring;",
+ "&ascr;",
+ "&ast;",
+ "&asymp;",
+ "&asympeq;",
+ "&atilde;",
+ "&auml;",
+ "&awconint;",
+ "&awint;",
+ "&bNot;",
+ "&backcong;",
+ "&backepsilon;",
+ "&backprime;",
+ "&backsim;",
+ "&backsimeq;",
+ "&barvee;",
+ "&barwed;",
+ "&barwedge;",
+ "&bbrk;",
+ "&bbrktbrk;",
+ "&bcong;",
+ "&bcy;",
+ "&bdquo;",
+ "&becaus;",
+ "&because;",
+ "&bemptyv;",
+ "&bepsi;",
+ "&bernou;",
+ "&beta;",
+ "&beth;",
+ "&between;",
+ "&bfr;",
+ "&bigcap;",
+ "&bigcirc;",
+ "&bigcup;",
+ "&bigodot;",
+ "&bigoplus;",
+ "&bigotimes;",
+ "&bigsqcup;",
+ "&bigstar;",
+ "&bigtriangledown;",
+ "&bigtriangleup;",
+ "&biguplus;",
+ "&bigvee;",
+ "&bigwedge;",
+ "&bkarow;",
+ "&blacklozenge;",
+ "&blacksquare;",
+ "&blacktriangle;",
+ "&blacktriangledown;",
+ "&blacktriangleleft;",
+ "&blacktriangleright;",
+ "&blank;",
+ "&blk12;",
+ "&blk14;",
+ "&blk34;",
+ "&block;",
+ "&bne;",
+ "&bnequiv;",
+ "&bnot;",
+ "&bopf;",
+ "&bot;",
+ "&bottom;",
+ "&bowtie;",
+ "&boxDL;",
+ "&boxDR;",
+ "&boxDl;",
+ "&boxDr;",
+ "&boxH;",
+ "&boxHD;",
+ "&boxHU;",
+ "&boxHd;",
+ "&boxHu;",
+ "&boxUL;",
+ "&boxUR;",
+ "&boxUl;",
+ "&boxUr;",
+ "&boxV;",
+ "&boxVH;",
+ "&boxVL;",
+ "&boxVR;",
+ "&boxVh;",
+ "&boxVl;",
+ "&boxVr;",
+ "&boxbox;",
+ "&boxdL;",
+ "&boxdR;",
+ "&boxdl;",
+ "&boxdr;",
+ "&boxh;",
+ "&boxhD;",
+ "&boxhU;",
+ "&boxhd;",
+ "&boxhu;",
+ "&boxminus;",
+ "&boxplus;",
+ "&boxtimes;",
+ "&boxuL;",
+ "&boxuR;",
+ "&boxul;",
+ "&boxur;",
+ "&boxv;",
+ "&boxvH;",
+ "&boxvL;",
+ "&boxvR;",
+ "&boxvh;",
+ "&boxvl;",
+ "&boxvr;",
+ "&bprime;",
+ "&breve;",
+ "&brvbar;",
+ "&bscr;",
+ "&bsemi;",
+ "&bsim;",
+ "&bsime;",
+ "&bsol;",
+ "&bsolb;",
+ "&bsolhsub;",
+ "&bull;",
+ "&bullet;",
+ "&bump;",
+ "&bumpE;",
+ "&bumpe;",
+ "&bumpeq;",
+ "&cacute;",
+ "&cap;",
+ "&capand;",
+ "&capbrcup;",
+ "&capcap;",
+ "&capcup;",
+ "&capdot;",
+ "&caps;",
+ "&caret;",
+ "&caron;",
+ "&ccaps;",
+ "&ccaron;",
+ "&ccedil;",
+ "&ccirc;",
+ "&ccups;",
+ "&ccupssm;",
+ "&cdot;",
+ "&cedil;",
+ "&cemptyv;",
+ "&cent;",
+ "&centerdot;",
+ "&cfr;",
+ "&chcy;",
+ "&check;",
+ "&checkmark;",
+ "&chi;",
+ "&cir;",
+ "&cirE;",
+ "&circ;",
+ "&circeq;",
+ "&circlearrowleft;",
+ "&circlearrowright;",
+ "&circledR;",
+ "&circledS;",
+ "&circledast;",
+ "&circledcirc;",
+ "&circleddash;",
+ "&cire;",
+ "&cirfnint;",
+ "&cirmid;",
+ "&cirscir;",
+ "&clubs;",
+ "&clubsuit;",
+ "&colon;",
+ "&colone;",
+ "&coloneq;",
+ "&comma;",
+ "&commat;",
+ "&comp;",
+ "&compfn;",
+ "&complement;",
+ "&complexes;",
+ "&cong;",
+ "&congdot;",
+ "&conint;",
+ "&copf;",
+ "&coprod;",
+ "&copy;",
+ "&copysr;",
+ "&crarr;",
+ "&cross;",
+ "&cscr;",
+ "&csub;",
+ "&csube;",
+ "&csup;",
+ "&csupe;",
+ "&ctdot;",
+ "&cudarrl;",
+ "&cudarrr;",
+ "&cuepr;",
+ "&cuesc;",
+ "&cularr;",
+ "&cularrp;",
+ "&cup;",
+ "&cupbrcap;",
+ "&cupcap;",
+ "&cupcup;",
+ "&cupdot;",
+ "&cupor;",
+ "&cups;",
+ "&curarr;",
+ "&curarrm;",
+ "&curlyeqprec;",
+ "&curlyeqsucc;",
+ "&curlyvee;",
+ "&curlywedge;",
+ "&curren;",
+ "&curvearrowleft;",
+ "&curvearrowright;",
+ "&cuvee;",
+ "&cuwed;",
+ "&cwconint;",
+ "&cwint;",
+ "&cylcty;",
+ "&dArr;",
+ "&dHar;",
+ "&dagger;",
+ "&daleth;",
+ "&darr;",
+ "&dash;",
+ "&dashv;",
+ "&dbkarow;",
+ "&dblac;",
+ "&dcaron;",
+ "&dcy;",
+ "&dd;",
+ "&ddagger;",
+ "&ddarr;",
+ "&ddotseq;",
+ "&deg;",
+ "&delta;",
+ "&demptyv;",
+ "&dfisht;",
+ "&dfr;",
+ "&dharl;",
+ "&dharr;",
+ "&diam;",
+ "&diamond;",
+ "&diamondsuit;",
+ "&diams;",
+ "&die;",
+ "&digamma;",
+ "&disin;",
+ "&div;",
+ "&divide;",
+ "&divideontimes;",
+ "&divonx;",
+ "&djcy;",
+ "&dlcorn;",
+ "&dlcrop;",
+ "&dollar;",
+ "&dopf;",
+ "&dot;",
+ "&doteq;",
+ "&doteqdot;",
+ "&dotminus;",
+ "&dotplus;",
+ "&dotsquare;",
+ "&doublebarwedge;",
+ "&downarrow;",
+ "&downdownarrows;",
+ "&downharpoonleft;",
+ "&downharpoonright;",
+ "&drbkarow;",
+ "&drcorn;",
+ "&drcrop;",
+ "&dscr;",
+ "&dscy;",
+ "&dsol;",
+ "&dstrok;",
+ "&dtdot;",
+ "&dtri;",
+ "&dtrif;",
+ "&duarr;",
+ "&duhar;",
+ "&dwangle;",
+ "&dzcy;",
+ "&dzigrarr;",
+ "&eDDot;",
+ "&eDot;",
+ "&eacute;",
+ "&easter;",
+ "&ecaron;",
+ "&ecir;",
+ "&ecirc;",
+ "&ecolon;",
+ "&ecy;",
+ "&edot;",
+ "&ee;",
+ "&efDot;",
+ "&efr;",
+ "&eg;",
+ "&egrave;",
+ "&egs;",
+ "&egsdot;",
+ "&el;",
+ "&elinters;",
+ "&ell;",
+ "&els;",
+ "&elsdot;",
+ "&emacr;",
+ "&empty;",
+ "&emptyset;",
+ "&emptyv;",
+ "&emsp;",
+ "&emsp13;",
+ "&emsp14;",
+ "&eng;",
+ "&ensp;",
+ "&eogon;",
+ "&eopf;",
+ "&epar;",
+ "&eparsl;",
+ "&eplus;",
+ "&epsi;",
+ "&epsilon;",
+ "&epsiv;",
+ "&eqcirc;",
+ "&eqcolon;",
+ "&eqsim;",
+ "&eqslantgtr;",
+ "&eqslantless;",
+ "&equals;",
+ "&equest;",
+ "&equiv;",
+ "&equivDD;",
+ "&eqvparsl;",
+ "&erDot;",
+ "&erarr;",
+ "&escr;",
+ "&esdot;",
+ "&esim;",
+ "&eta;",
+ "&eth;",
+ "&euml;",
+ "&euro;",
+ "&excl;",
+ "&exist;",
+ "&expectation;",
+ "&exponentiale;",
+ "&fallingdotseq;",
+ "&fcy;",
+ "&female;",
+ "&ffilig;",
+ "&fflig;",
+ "&ffllig;",
+ "&ffr;",
+ "&filig;",
+ "&fjlig;",
+ "&flat;",
+ "&fllig;",
+ "&fltns;",
+ "&fnof;",
+ "&fopf;",
+ "&forall;",
+ "&fork;",
+ "&forkv;",
+ "&fpartint;",
+ "&frac12;",
+ "&frac13;",
+ "&frac14;",
+ "&frac15;",
+ "&frac16;",
+ "&frac18;",
+ "&frac23;",
+ "&frac25;",
+ "&frac34;",
+ "&frac35;",
+ "&frac38;",
+ "&frac45;",
+ "&frac56;",
+ "&frac58;",
+ "&frac78;",
+ "&frasl;",
+ "&frown;",
+ "&fscr;",
+ "&gE;",
+ "&gEl;",
+ "&gacute;",
+ "&gamma;",
+ "&gammad;",
+ "&gap;",
+ "&gbreve;",
+ "&gcirc;",
+ "&gcy;",
+ "&gdot;",
+ "&ge;",
+ "&gel;",
+ "&geq;",
+ "&geqq;",
+ "&geqslant;",
+ "&ges;",
+ "&gescc;",
+ "&gesdot;",
+ "&gesdoto;",
+ "&gesdotol;",
+ "&gesl;",
+ "&gesles;",
+ "&gfr;",
+ "&gg;",
+ "&ggg;",
+ "&gimel;",
+ "&gjcy;",
+ "&gl;",
+ "&glE;",
+ "&gla;",
+ "&glj;",
+ "&gnE;",
+ "&gnap;",
+ "&gnapprox;",
+ "&gne;",
+ "&gneq;",
+ "&gneqq;",
+ "&gnsim;",
+ "&gopf;",
+ "&grave;",
+ "&gscr;",
+ "&gsim;",
+ "&gsime;",
+ "&gsiml;",
+ "&gt;",
+ "&gtcc;",
+ "&gtcir;",
+ "&gtdot;",
+ "&gtlPar;",
+ "&gtquest;",
+ "&gtrapprox;",
+ "&gtrarr;",
+ "&gtrdot;",
+ "&gtreqless;",
+ "&gtreqqless;",
+ "&gtrless;",
+ "&gtrsim;",
+ "&gvertneqq;",
+ "&gvnE;",
+ "&hArr;",
+ "&hairsp;",
+ "&half;",
+ "&hamilt;",
+ "&hardcy;",
+ "&harr;",
+ "&harrcir;",
+ "&harrw;",
+ "&hbar;",
+ "&hcirc;",
+ "&hearts;",
+ "&heartsuit;",
+ "&hellip;",
+ "&hercon;",
+ "&hfr;",
+ "&hksearow;",
+ "&hkswarow;",
+ "&hoarr;",
+ "&homtht;",
+ "&hookleftarrow;",
+ "&hookrightarrow;",
+ "&hopf;",
+ "&horbar;",
+ "&hscr;",
+ "&hslash;",
+ "&hstrok;",
+ "&hybull;",
+ "&hyphen;",
+ "&iacute;",
+ "&ic;",
+ "&icirc;",
+ "&icy;",
+ "&iecy;",
+ "&iexcl;",
+ "&iff;",
+ "&ifr;",
+ "&igrave;",
+ "&ii;",
+ "&iiiint;",
+ "&iiint;",
+ "&iinfin;",
+ "&iiota;",
+ "&ijlig;",
+ "&imacr;",
+ "&image;",
+ "&imagline;",
+ "&imagpart;",
+ "&imath;",
+ "&imof;",
+ "&imped;",
+ "&in;",
+ "&incare;",
+ "&infin;",
+ "&infintie;",
+ "&inodot;",
+ "&int;",
+ "&intcal;",
+ "&integers;",
+ "&intercal;",
+ "&intlarhk;",
+ "&intprod;",
+ "&iocy;",
+ "&iogon;",
+ "&iopf;",
+ "&iota;",
+ "&iprod;",
+ "&iquest;",
+ "&iscr;",
+ "&isin;",
+ "&isinE;",
+ "&isindot;",
+ "&isins;",
+ "&isinsv;",
+ "&isinv;",
+ "&it;",
+ "&itilde;",
+ "&iukcy;",
+ "&iuml;",
+ "&jcirc;",
+ "&jcy;",
+ "&jfr;",
+ "&jmath;",
+ "&jopf;",
+ "&jscr;",
+ "&jsercy;",
+ "&jukcy;",
+ "&kappa;",
+ "&kappav;",
+ "&kcedil;",
+ "&kcy;",
+ "&kfr;",
+ "&kgreen;",
+ "&khcy;",
+ "&kjcy;",
+ "&kopf;",
+ "&kscr;",
+ "&lAarr;",
+ "&lArr;",
+ "&lAtail;",
+ "&lBarr;",
+ "&lE;",
+ "&lEg;",
+ "&lHar;",
+ "&lacute;",
+ "&laemptyv;",
+ "&lagran;",
+ "&lambda;",
+ "&lang;",
+ "&langd;",
+ "&langle;",
+ "&lap;",
+ "&laquo;",
+ "&larr;",
+ "&larrb;",
+ "&larrbfs;",
+ "&larrfs;",
+ "&larrhk;",
+ "&larrlp;",
+ "&larrpl;",
+ "&larrsim;",
+ "&larrtl;",
+ "&lat;",
+ "&latail;",
+ "&late;",
+ "&lates;",
+ "&lbarr;",
+ "&lbbrk;",
+ "&lbrace;",
+ "&lbrack;",
+ "&lbrke;",
+ "&lbrksld;",
+ "&lbrkslu;",
+ "&lcaron;",
+ "&lcedil;",
+ "&lceil;",
+ "&lcub;",
+ "&lcy;",
+ "&ldca;",
+ "&ldquo;",
+ "&ldquor;",
+ "&ldrdhar;",
+ "&ldrushar;",
+ "&ldsh;",
+ "&le;",
+ "&leftarrow;",
+ "&leftarrowtail;",
+ "&leftharpoondown;",
+ "&leftharpoonup;",
+ "&leftleftarrows;",
+ "&leftrightarrow;",
+ "&leftrightarrows;",
+ "&leftrightharpoons;",
+ "&leftrightsquigarrow;",
+ "&leftthreetimes;",
+ "&leg;",
+ "&leq;",
+ "&leqq;",
+ "&leqslant;",
+ "&les;",
+ "&lescc;",
+ "&lesdot;",
+ "&lesdoto;",
+ "&lesdotor;",
+ "&lesg;",
+ "&lesges;",
+ "&lessapprox;",
+ "&lessdot;",
+ "&lesseqgtr;",
+ "&lesseqqgtr;",
+ "&lessgtr;",
+ "&lesssim;",
+ "&lfisht;",
+ "&lfloor;",
+ "&lfr;",
+ "&lg;",
+ "&lgE;",
+ "&lhard;",
+ "&lharu;",
+ "&lharul;",
+ "&lhblk;",
+ "&ljcy;",
+ "&ll;",
+ "&llarr;",
+ "&llcorner;",
+ "&llhard;",
+ "&lltri;",
+ "&lmidot;",
+ "&lmoust;",
+ "&lmoustache;",
+ "&lnE;",
+ "&lnap;",
+ "&lnapprox;",
+ "&lne;",
+ "&lneq;",
+ "&lneqq;",
+ "&lnsim;",
+ "&loang;",
+ "&loarr;",
+ "&lobrk;",
+ "&longleftarrow;",
+ "&longleftrightarrow;",
+ "&longmapsto;",
+ "&longrightarrow;",
+ "&looparrowleft;",
+ "&looparrowright;",
+ "&lopar;",
+ "&lopf;",
+ "&loplus;",
+ "&lotimes;",
+ "&lowast;",
+ "&lowbar;",
+ "&loz;",
+ "&lozenge;",
+ "&lozf;",
+ "&lpar;",
+ "&lparlt;",
+ "&lrarr;",
+ "&lrcorner;",
+ "&lrhar;",
+ "&lrhard;",
+ "&lrm;",
+ "&lrtri;",
+ "&lsaquo;",
+ "&lscr;",
+ "&lsh;",
+ "&lsim;",
+ "&lsime;",
+ "&lsimg;",
+ "&lsqb;",
+ "&lsquo;",
+ "&lsquor;",
+ "&lstrok;",
+ "&lt;",
+ "&ltcc;",
+ "&ltcir;",
+ "&ltdot;",
+ "&lthree;",
+ "&ltimes;",
+ "&ltlarr;",
+ "&ltquest;",
+ "&ltrPar;",
+ "&ltri;",
+ "&ltrie;",
+ "&ltrif;",
+ "&lurdshar;",
+ "&luruhar;",
+ "&lvertneqq;",
+ "&lvnE;",
+ "&mDDot;",
+ "&macr;",
+ "&male;",
+ "&malt;",
+ "&maltese;",
+ "&map;",
+ "&mapsto;",
+ "&mapstodown;",
+ "&mapstoleft;",
+ "&mapstoup;",
+ "&marker;",
+ "&mcomma;",
+ "&mcy;",
+ "&mdash;",
+ "&measuredangle;",
+ "&mfr;",
+ "&mho;",
+ "&micro;",
+ "&mid;",
+ "&midast;",
+ "&midcir;",
+ "&middot;",
+ "&minus;",
+ "&minusb;",
+ "&minusd;",
+ "&minusdu;",
+ "&mlcp;",
+ "&mldr;",
+ "&mnplus;",
+ "&models;",
+ "&mopf;",
+ "&mp;",
+ "&mscr;",
+ "&mstpos;",
+ "&mu;",
+ "&multimap;",
+ "&mumap;",
+ "&nGg;",
+ "&nGt;",
+ "&nGtv;",
+ "&nLeftarrow;",
+ "&nLeftrightarrow;",
+ "&nLl;",
+ "&nLt;",
+ "&nLtv;",
+ "&nRightarrow;",
+ "&nVDash;",
+ "&nVdash;",
+ "&nabla;",
+ "&nacute;",
+ "&nang;",
+ "&nap;",
+ "&napE;",
+ "&napid;",
+ "&napos;",
+ "&napprox;",
+ "&natur;",
+ "&natural;",
+ "&naturals;",
+ "&nbsp;",
+ "&nbump;",
+ "&nbumpe;",
+ "&ncap;",
+ "&ncaron;",
+ "&ncedil;",
+ "&ncong;",
+ "&ncongdot;",
+ "&ncup;",
+ "&ncy;",
+ "&ndash;",
+ "&ne;",
+ "&neArr;",
+ "&nearhk;",
+ "&nearr;",
+ "&nearrow;",
+ "&nedot;",
+ "&nequiv;",
+ "&nesear;",
+ "&nesim;",
+ "&nexist;",
+ "&nexists;",
+ "&nfr;",
+ "&ngE;",
+ "&nge;",
+ "&ngeq;",
+ "&ngeqq;",
+ "&ngeqslant;",
+ "&nges;",
+ "&ngsim;",
+ "&ngt;",
+ "&ngtr;",
+ "&nhArr;",
+ "&nharr;",
+ "&nhpar;",
+ "&ni;",
+ "&nis;",
+ "&nisd;",
+ "&niv;",
+ "&njcy;",
+ "&nlArr;",
+ "&nlE;",
+ "&nlarr;",
+ "&nldr;",
+ "&nle;",
+ "&nleftarrow;",
+ "&nleftrightarrow;",
+ "&nleq;",
+ "&nleqq;",
+ "&nleqslant;",
+ "&nles;",
+ "&nless;",
+ "&nlsim;",
+ "&nlt;",
+ "&nltri;",
+ "&nltrie;",
+ "&nmid;",
+ "&nopf;",
+ "&not;",
+ "&notin;",
+ "&notinE;",
+ "&notindot;",
+ "&notinva;",
+ "&notinvb;",
+ "&notinvc;",
+ "&notni;",
+ "&notniva;",
+ "&notnivb;",
+ "&notnivc;",
+ "&npar;",
+ "&nparallel;",
+ "&nparsl;",
+ "&npart;",
+ "&npolint;",
+ "&npr;",
+ "&nprcue;",
+ "&npre;",
+ "&nprec;",
+ "&npreceq;",
+ "&nrArr;",
+ "&nrarr;",
+ "&nrarrc;",
+ "&nrarrw;",
+ "&nrightarrow;",
+ "&nrtri;",
+ "&nrtrie;",
+ "&nsc;",
+ "&nsccue;",
+ "&nsce;",
+ "&nscr;",
+ "&nshortmid;",
+ "&nshortparallel;",
+ "&nsim;",
+ "&nsime;",
+ "&nsimeq;",
+ "&nsmid;",
+ "&nspar;",
+ "&nsqsube;",
+ "&nsqsupe;",
+ "&nsub;",
+ "&nsubE;",
+ "&nsube;",
+ "&nsubset;",
+ "&nsubseteq;",
+ "&nsubseteqq;",
+ "&nsucc;",
+ "&nsucceq;",
+ "&nsup;",
+ "&nsupE;",
+ "&nsupe;",
+ "&nsupset;",
+ "&nsupseteq;",
+ "&nsupseteqq;",
+ "&ntgl;",
+ "&ntilde;",
+ "&ntlg;",
+ "&ntriangleleft;",
+ "&ntrianglelefteq;",
+ "&ntriangleright;",
+ "&ntrianglerighteq;",
+ "&nu;",
+ "&num;",
+ "&numero;",
+ "&numsp;",
+ "&nvDash;",
+ "&nvHarr;",
+ "&nvap;",
+ "&nvdash;",
+ "&nvge;",
+ "&nvgt;",
+ "&nvinfin;",
+ "&nvlArr;",
+ "&nvle;",
+ "&nvlt;",
+ "&nvltrie;",
+ "&nvrArr;",
+ "&nvrtrie;",
+ "&nvsim;",
+ "&nwArr;",
+ "&nwarhk;",
+ "&nwarr;",
+ "&nwarrow;",
+ "&nwnear;",
+ "&oS;",
+ "&oacute;",
+ "&oast;",
+ "&ocir;",
+ "&ocirc;",
+ "&ocy;",
+ "&odash;",
+ "&odblac;",
+ "&odiv;",
+ "&odot;",
+ "&odsold;",
+ "&oelig;",
+ "&ofcir;",
+ "&ofr;",
+ "&ogon;",
+ "&ograve;",
+ "&ogt;",
+ "&ohbar;",
+ "&ohm;",
+ "&oint;",
+ "&olarr;",
+ "&olcir;",
+ "&olcross;",
+ "&oline;",
+ "&olt;",
+ "&omacr;",
+ "&omega;",
+ "&omicron;",
+ "&omid;",
+ "&ominus;",
+ "&oopf;",
+ "&opar;",
+ "&operp;",
+ "&oplus;",
+ "&or;",
+ "&orarr;",
+ "&ord;",
+ "&order;",
+ "&orderof;",
+ "&ordf;",
+ "&ordm;",
+ "&origof;",
+ "&oror;",
+ "&orslope;",
+ "&orv;",
+ "&oscr;",
+ "&oslash;",
+ "&osol;",
+ "&otilde;",
+ "&otimes;",
+ "&otimesas;",
+ "&ouml;",
+ "&ovbar;",
+ "&par;",
+ "&para;",
+ "&parallel;",
+ "&parsim;",
+ "&parsl;",
+ "&part;",
+ "&pcy;",
+ "&percnt;",
+ "&period;",
+ "&permil;",
+ "&perp;",
+ "&pertenk;",
+ "&pfr;",
+ "&phi;",
+ "&phiv;",
+ "&phmmat;",
+ "&phone;",
+ "&pi;",
+ "&pitchfork;",
+ "&piv;",
+ "&planck;",
+ "&planckh;",
+ "&plankv;",
+ "&plus;",
+ "&plusacir;",
+ "&plusb;",
+ "&pluscir;",
+ "&plusdo;",
+ "&plusdu;",
+ "&pluse;",
+ "&plusmn;",
+ "&plussim;",
+ "&plustwo;",
+ "&pm;",
+ "&pointint;",
+ "&popf;",
+ "&pound;",
+ "&pr;",
+ "&prE;",
+ "&prap;",
+ "&prcue;",
+ "&pre;",
+ "&prec;",
+ "&precapprox;",
+ "&preccurlyeq;",
+ "&preceq;",
+ "&precnapprox;",
+ "&precneqq;",
+ "&precnsim;",
+ "&precsim;",
+ "&prime;",
+ "&primes;",
+ "&prnE;",
+ "&prnap;",
+ "&prnsim;",
+ "&prod;",
+ "&profalar;",
+ "&profline;",
+ "&profsurf;",
+ "&prop;",
+ "&propto;",
+ "&prsim;",
+ "&prurel;",
+ "&pscr;",
+ "&psi;",
+ "&puncsp;",
+ "&qfr;",
+ "&qint;",
+ "&qopf;",
+ "&qprime;",
+ "&qscr;",
+ "&quaternions;",
+ "&quatint;",
+ "&quest;",
+ "&questeq;",
+ "&quot;",
+ "&rAarr;",
+ "&rArr;",
+ "&rAtail;",
+ "&rBarr;",
+ "&rHar;",
+ "&race;",
+ "&racute;",
+ "&radic;",
+ "&raemptyv;",
+ "&rang;",
+ "&rangd;",
+ "&range;",
+ "&rangle;",
+ "&raquo;",
+ "&rarr;",
+ "&rarrap;",
+ "&rarrb;",
+ "&rarrbfs;",
+ "&rarrc;",
+ "&rarrfs;",
+ "&rarrhk;",
+ "&rarrlp;",
+ "&rarrpl;",
+ "&rarrsim;",
+ "&rarrtl;",
+ "&rarrw;",
+ "&ratail;",
+ "&ratio;",
+ "&rationals;",
+ "&rbarr;",
+ "&rbbrk;",
+ "&rbrace;",
+ "&rbrack;",
+ "&rbrke;",
+ "&rbrksld;",
+ "&rbrkslu;",
+ "&rcaron;",
+ "&rcedil;",
+ "&rceil;",
+ "&rcub;",
+ "&rcy;",
+ "&rdca;",
+ "&rdldhar;",
+ "&rdquo;",
+ "&rdquor;",
+ "&rdsh;",
+ "&real;",
+ "&realine;",
+ "&realpart;",
+ "&reals;",
+ "&rect;",
+ "&reg;",
+ "&rfisht;",
+ "&rfloor;",
+ "&rfr;",
+ "&rhard;",
+ "&rharu;",
+ "&rharul;",
+ "&rho;",
+ "&rhov;",
+ "&rightarrow;",
+ "&rightarrowtail;",
+ "&rightharpoondown;",
+ "&rightharpoonup;",
+ "&rightleftarrows;",
+ "&rightleftharpoons;",
+ "&rightrightarrows;",
+ "&rightsquigarrow;",
+ "&rightthreetimes;",
+ "&ring;",
+ "&risingdotseq;",
+ "&rlarr;",
+ "&rlhar;",
+ "&rlm;",
+ "&rmoust;",
+ "&rmoustache;",
+ "&rnmid;",
+ "&roang;",
+ "&roarr;",
+ "&robrk;",
+ "&ropar;",
+ "&ropf;",
+ "&roplus;",
+ "&rotimes;",
+ "&rpar;",
+ "&rpargt;",
+ "&rppolint;",
+ "&rrarr;",
+ "&rsaquo;",
+ "&rscr;",
+ "&rsh;",
+ "&rsqb;",
+ "&rsquo;",
+ "&rsquor;",
+ "&rthree;",
+ "&rtimes;",
+ "&rtri;",
+ "&rtrie;",
+ "&rtrif;",
+ "&rtriltri;",
+ "&ruluhar;",
+ "&rx;",
+ "&sacute;",
+ "&sbquo;",
+ "&sc;",
+ "&scE;",
+ "&scap;",
+ "&scaron;",
+ "&sccue;",
+ "&sce;",
+ "&scedil;",
+ "&scirc;",
+ "&scnE;",
+ "&scnap;",
+ "&scnsim;",
+ "&scpolint;",
+ "&scsim;",
+ "&scy;",
+ "&sdot;",
+ "&sdotb;",
+ "&sdote;",
+ "&seArr;",
+ "&searhk;",
+ "&searr;",
+ "&searrow;",
+ "&sect;",
+ "&semi;",
+ "&seswar;",
+ "&setminus;",
+ "&setmn;",
+ "&sext;",
+ "&sfr;",
+ "&sfrown;",
+ "&sharp;",
+ "&shchcy;",
+ "&shcy;",
+ "&shortmid;",
+ "&shortparallel;",
+ "&shy;",
+ "&sigma;",
+ "&sigmaf;",
+ "&sigmav;",
+ "&sim;",
+ "&simdot;",
+ "&sime;",
+ "&simeq;",
+ "&simg;",
+ "&simgE;",
+ "&siml;",
+ "&simlE;",
+ "&simne;",
+ "&simplus;",
+ "&simrarr;",
+ "&slarr;",
+ "&smallsetminus;",
+ "&smashp;",
+ "&smeparsl;",
+ "&smid;",
+ "&smile;",
+ "&smt;",
+ "&smte;",
+ "&smtes;",
+ "&softcy;",
+ "&sol;",
+ "&solb;",
+ "&solbar;",
+ "&sopf;",
+ "&spades;",
+ "&spadesuit;",
+ "&spar;",
+ "&sqcap;",
+ "&sqcaps;",
+ "&sqcup;",
+ "&sqcups;",
+ "&sqsub;",
+ "&sqsube;",
+ "&sqsubset;",
+ "&sqsubseteq;",
+ "&sqsup;",
+ "&sqsupe;",
+ "&sqsupset;",
+ "&sqsupseteq;",
+ "&squ;",
+ "&square;",
+ "&squarf;",
+ "&squf;",
+ "&srarr;",
+ "&sscr;",
+ "&ssetmn;",
+ "&ssmile;",
+ "&sstarf;",
+ "&star;",
+ "&starf;",
+ "&straightepsilon;",
+ "&straightphi;",
+ "&strns;",
+ "&sub;",
+ "&subE;",
+ "&subdot;",
+ "&sube;",
+ "&subedot;",
+ "&submult;",
+ "&subnE;",
+ "&subne;",
+ "&subplus;",
+ "&subrarr;",
+ "&subset;",
+ "&subseteq;",
+ "&subseteqq;",
+ "&subsetneq;",
+ "&subsetneqq;",
+ "&subsim;",
+ "&subsub;",
+ "&subsup;",
+ "&succ;",
+ "&succapprox;",
+ "&succcurlyeq;",
+ "&succeq;",
+ "&succnapprox;",
+ "&succneqq;",
+ "&succnsim;",
+ "&succsim;",
+ "&sum;",
+ "&sung;",
+ "&sup;",
+ "&sup1;",
+ "&sup2;",
+ "&sup3;",
+ "&supE;",
+ "&supdot;",
+ "&supdsub;",
+ "&supe;",
+ "&supedot;",
+ "&suphsol;",
+ "&suphsub;",
+ "&suplarr;",
+ "&supmult;",
+ "&supnE;",
+ "&supne;",
+ "&supplus;",
+ "&supset;",
+ "&supseteq;",
+ "&supseteqq;",
+ "&supsetneq;",
+ "&supsetneqq;",
+ "&supsim;",
+ "&supsub;",
+ "&supsup;",
+ "&swArr;",
+ "&swarhk;",
+ "&swarr;",
+ "&swarrow;",
+ "&swnwar;",
+ "&szlig;",
+ "&target;",
+ "&tau;",
+ "&tbrk;",
+ "&tcaron;",
+ "&tcedil;",
+ "&tcy;",
+ "&tdot;",
+ "&telrec;",
+ "&tfr;",
+ "&there4;",
+ "&therefore;",
+ "&theta;",
+ "&thetasym;",
+ "&thetav;",
+ "&thickapprox;",
+ "&thicksim;",
+ "&thinsp;",
+ "&thkap;",
+ "&thksim;",
+ "&thorn;",
+ "&tilde;",
+ "&times;",
+ "&timesb;",
+ "&timesbar;",
+ "&timesd;",
+ "&tint;",
+ "&toea;",
+ "&top;",
+ "&topbot;",
+ "&topcir;",
+ "&topf;",
+ "&topfork;",
+ "&tosa;",
+ "&tprime;",
+ "&trade;",
+ "&triangle;",
+ "&triangledown;",
+ "&triangleleft;",
+ "&trianglelefteq;",
+ "&triangleq;",
+ "&triangleright;",
+ "&trianglerighteq;",
+ "&tridot;",
+ "&trie;",
+ "&triminus;",
+ "&triplus;",
+ "&trisb;",
+ "&tritime;",
+ "&trpezium;",
+ "&tscr;",
+ "&tscy;",
+ "&tshcy;",
+ "&tstrok;",
+ "&twixt;",
+ "&twoheadleftarrow;",
+ "&twoheadrightarrow;",
+ "&uArr;",
+ "&uHar;",
+ "&uacute;",
+ "&uarr;",
+ "&ubrcy;",
+ "&ubreve;",
+ "&ucirc;",
+ "&ucy;",
+ "&udarr;",
+ "&udblac;",
+ "&udhar;",
+ "&ufisht;",
+ "&ufr;",
+ "&ugrave;",
+ "&uharl;",
+ "&uharr;",
+ "&uhblk;",
+ "&ulcorn;",
+ "&ulcorner;",
+ "&ulcrop;",
+ "&ultri;",
+ "&umacr;",
+ "&uml;",
+ "&uogon;",
+ "&uopf;",
+ "&uparrow;",
+ "&updownarrow;",
+ "&upharpoonleft;",
+ "&upharpoonright;",
+ "&uplus;",
+ "&upsi;",
+ "&upsih;",
+ "&upsilon;",
+ "&upuparrows;",
+ "&urcorn;",
+ "&urcorner;",
+ "&urcrop;",
+ "&uring;",
+ "&urtri;",
+ "&uscr;",
+ "&utdot;",
+ "&utilde;",
+ "&utri;",
+ "&utrif;",
+ "&uuarr;",
+ "&uuml;",
+ "&uwangle;",
+ "&vArr;",
+ "&vBar;",
+ "&vBarv;",
+ "&vDash;",
+ "&vangrt;",
+ "&varepsilon;",
+ "&varkappa;",
+ "&varnothing;",
+ "&varphi;",
+ "&varpi;",
+ "&varpropto;",
+ "&varr;",
+ "&varrho;",
+ "&varsigma;",
+ "&varsubsetneq;",
+ "&varsubsetneqq;",
+ "&varsupsetneq;",
+ "&varsupsetneqq;",
+ "&vartheta;",
+ "&vartriangleleft;",
+ "&vartriangleright;",
+ "&vcy;",
+ "&vdash;",
+ "&vee;",
+ "&veebar;",
+ "&veeeq;",
+ "&vellip;",
+ "&verbar;",
+ "&vert;",
+ "&vfr;",
+ "&vltri;",
+ "&vnsub;",
+ "&vnsup;",
+ "&vopf;",
+ "&vprop;",
+ "&vrtri;",
+ "&vscr;",
+ "&vsubnE;",
+ "&vsubne;",
+ "&vsupnE;",
+ "&vsupne;",
+ "&vzigzag;",
+ "&wcirc;",
+ "&wedbar;",
+ "&wedge;",
+ "&wedgeq;",
+ "&weierp;",
+ "&wfr;",
+ "&wopf;",
+ "&wp;",
+ "&wr;",
+ "&wreath;",
+ "&wscr;",
+ "&xcap;",
+ "&xcirc;",
+ "&xcup;",
+ "&xdtri;",
+ "&xfr;",
+ "&xhArr;",
+ "&xharr;",
+ "&xi;",
+ "&xlArr;",
+ "&xlarr;",
+ "&xmap;",
+ "&xnis;",
+ "&xodot;",
+ "&xopf;",
+ "&xoplus;",
+ "&xotime;",
+ "&xrArr;",
+ "&xrarr;",
+ "&xscr;",
+ "&xsqcup;",
+ "&xuplus;",
+ "&xutri;",
+ "&xvee;",
+ "&xwedge;",
+ "&yacute;",
+ "&yacy;",
+ "&ycirc;",
+ "&ycy;",
+ "&yen;",
+ "&yfr;",
+ "&yicy;",
+ "&yopf;",
+ "&yscr;",
+ "&yucy;",
+ "&yuml;",
+ "&zacute;",
+ "&zcaron;",
+ "&zcy;",
+ "&zdot;",
+ "&zeetrf;",
+ "&zeta;",
+ "&zfr;",
+ "&zhcy;",
+ "&zigrarr;",
+ "&zopf;",
+ "&zscr;",
+ "&zwj;",
+ "&zwnj;",
+);
+
+foreach ($map as $str) {
+ $de = html_entity_decode($str, ENT_QUOTES | ENT_HTML5, "UTF-8");
+ echo "$str => $de ", bin2hex($de), "\n";
+}
+?>
+--EXPECT--
+&AElig; => Æ c386
+&AMP; => & 26
+&Aacute; => Á c381
+&Abreve; => Ă c482
+&Acirc; => Â c382
+&Acy; => А d090
+&Afr; => 𝔄 f09d9484
+&Agrave; => À c380
+&Alpha; => Α ce91
+&Amacr; => Ā c480
+&And; => ⩓ e2a993
+&Aogon; => Ą c484
+&Aopf; => 𝔞 f09d94b8
+&ApplyFunction; => ⁡ e281a1
+&Aring; => Å c385
+&Ascr; => 𝒜 f09d929c
+&Assign; => ≔ e28994
+&Atilde; => Ã c383
+&Auml; => Ä c384
+&Backslash; => ∖ e28896
+&Barv; => â«§ e2aba7
+&Barwed; => ⌆ e28c86
+&Bcy; => Б d091
+&Because; => ∵ e288b5
+&Bernoullis; => ℬ e284ac
+&Beta; => Β ce92
+&Bfr; => 𝔅 f09d9485
+&Bopf; => 𝔹 f09d94b9
+&Breve; => ˘ cb98
+&Bscr; => ℬ e284ac
+&Bumpeq; => ≎ e2898e
+&CHcy; => Ч d0a7
+&COPY; => © c2a9
+&Cacute; => Ć c486
+&Cap; => ⋒ e28b92
+&CapitalDifferentialD; => ⅅ e28585
+&Cayleys; => ℭ e284ad
+&Ccaron; => Č c48c
+&Ccedil; => Ç c387
+&Ccirc; => Ĉ c488
+&Cconint; => ∰ e288b0
+&Cdot; => Ċ c48a
+&Cedilla; => ž c2b8
+&CenterDot; => · c2b7
+&Cfr; => ℭ e284ad
+&Chi; => Χ cea7
+&CircleDot; => ⊙ e28a99
+&CircleMinus; => ⊖ e28a96
+&CirclePlus; => ⊕ e28a95
+&CircleTimes; => ⊗ e28a97
+&ClockwiseContourIntegral; => ∲ e288b2
+&CloseCurlyDoubleQuote; => ” e2809d
+&CloseCurlyQuote; => ’ e28099
+&Colon; => ∷ e288b7
+&Colone; => ⩎ e2a9b4
+&Congruent; => ≡ e289a1
+&Conint; => ∯ e288af
+&ContourIntegral; => ∮ e288ae
+&Copf; => ℂ e28482
+&Coproduct; => ∐ e28890
+&CounterClockwiseContourIntegral; => ∳ e288b3
+&Cross; => ⚯ e2a8af
+&Cscr; => 𝒞 f09d929e
+&Cup; => ⋓ e28b93
+&CupCap; => ≍ e2898d
+&DD; => ⅅ e28585
+&DDotrahd; => ‑ e2a491
+&DJcy; => Ђ d082
+&DScy; => Ѕ d085
+&DZcy; => Џ d08f
+&Dagger; => ‡ e280a1
+&Darr; => ↡ e286a1
+&Dashv; => â«€ e2aba4
+&Dcaron; => Ď c48e
+&Dcy; => Д d094
+&Del; => ∇ e28887
+&Delta; => Δ ce94
+&Dfr; => 𝔇 f09d9487
+&DiacriticalAcute; => ÂŽ c2b4
+&DiacriticalDot; => ˙ cb99
+&DiacriticalDoubleAcute; => ˝ cb9d
+&DiacriticalGrave; => ` 60
+&DiacriticalTilde; => ˜ cb9c
+&Diamond; => ⋄ e28b84
+&DifferentialD; => ⅆ e28586
+&Dopf; => 𝔻 f09d94bb
+&Dot; => š c2a8
+&DotDot; => ⃜ e2839c
+&DotEqual; => ≐ e28990
+&DoubleContourIntegral; => ∯ e288af
+&DoubleDot; => š c2a8
+&DoubleDownArrow; => ⇓ e28793
+&DoubleLeftArrow; => ⇐ e28790
+&DoubleLeftRightArrow; => ⇔ e28794
+&DoubleLeftTee; => â«€ e2aba4
+&DoubleLongLeftArrow; => ⟾ e29fb8
+&DoubleLongLeftRightArrow; => ⟺ e29fba
+&DoubleLongRightArrow; => ⟹ e29fb9
+&DoubleRightArrow; => ⇒ e28792
+&DoubleRightTee; => ⊹ e28aa8
+&DoubleUpArrow; => ⇑ e28791
+&DoubleUpDownArrow; => ⇕ e28795
+&DoubleVerticalBar; => ∥ e288a5
+&DownArrow; => ↓ e28693
+&DownArrowBar; => – e2a493
+&DownArrowUpArrow; => ⇵ e287b5
+&DownBreve; => ̑ cc91
+&DownLeftRightVector; => ⥐ e2a590
+&DownLeftTeeVector; => ⥞ e2a59e
+&DownLeftVector; => ↜ e286bd
+&DownLeftVectorBar; => ⥖ e2a596
+&DownRightTeeVector; => ⥟ e2a59f
+&DownRightVector; => ⇁ e28781
+&DownRightVectorBar; => ⥗ e2a597
+&DownTee; => ⊀ e28aa4
+&DownTeeArrow; => ↧ e286a7
+&Downarrow; => ⇓ e28793
+&Dscr; => 𝒟 f09d929f
+&Dstrok; => Đ c490
+&ENG; => Ŋ c58a
+&ETH; => Ð c390
+&Eacute; => É c389
+&Ecaron; => Ě c49a
+&Ecirc; => Ê c38a
+&Ecy; => Э d0ad
+&Edot; => Ė c496
+&Efr; => 𝔈 f09d9488
+&Egrave; => È c388
+&Element; => ∈ e28888
+&Emacr; => Ē c492
+&EmptySmallSquare; => ◻ e297bb
+&EmptyVerySmallSquare; => ▫ e296ab
+&Eogon; => Ę c498
+&Eopf; => 𝔌 f09d94bc
+&Epsilon; => Ε ce95
+&Equal; => ⩵ e2a9b5
+&EqualTilde; => ≂ e28982
+&Equilibrium; => ⇌ e2878c
+&Escr; => ℰ e284b0
+&Esim; => ⩳ e2a9b3
+&Eta; => Η ce97
+&Euml; => Ë c38b
+&Exists; => ∃ e28883
+&ExponentialE; => ⅇ e28587
+&Fcy; => Ѐ d0a4
+&Ffr; => 𝔉 f09d9489
+&FilledSmallSquare; => ◌ e297bc
+&FilledVerySmallSquare; => ▪ e296aa
+&Fopf; => 𝔜 f09d94bd
+&ForAll; => ∀ e28880
+&Fouriertrf; => ℱ e284b1
+&Fscr; => ℱ e284b1
+&GJcy; => Ѓ d083
+&GT; => > 3e
+&Gamma; => Γ ce93
+&Gammad; => Ϝ cf9c
+&Gbreve; => Ğ c49e
+&Gcedil; => Ģ c4a2
+&Gcirc; => Ĝ c49c
+&Gcy; => Г d093
+&Gdot; => Ä  c4a0
+&Gfr; => 𝔊 f09d948a
+&Gg; => ⋙ e28b99
+&Gopf; => 𝔟 f09d94be
+&GreaterEqual; => ≥ e289a5
+&GreaterEqualLess; => ⋛ e28b9b
+&GreaterFullEqual; => ≧ e289a7
+&GreaterGreater; => ⪢ e2aaa2
+&GreaterLess; => ≷ e289b7
+&GreaterSlantEqual; => ⩟ e2a9be
+&GreaterTilde; => ≳ e289b3
+&Gscr; => 𝒢 f09d92a2
+&Gt; => ≫ e289ab
+&HARDcy; => Ъ d0aa
+&Hacek; => ˇ cb87
+&Hat; => ^ 5e
+&Hcirc; => Ā c4a4
+&Hfr; => ℌ e2848c
+&HilbertSpace; => ℋ e2848b
+&Hopf; => ℍ e2848d
+&HorizontalLine; => ─ e29480
+&Hscr; => ℋ e2848b
+&Hstrok; => ÄŠ c4a6
+&HumpDownHump; => ≎ e2898e
+&HumpEqual; => ≏ e2898f
+&IEcy; => Е d095
+&IJlig; => IJ c4b2
+&IOcy; => Ё d081
+&Iacute; => Í c38d
+&Icirc; => Î c38e
+&Icy; => И d098
+&Idot; => İ c4b0
+&Ifr; => ℑ e28491
+&Igrave; => Ì c38c
+&Im; => ℑ e28491
+&Imacr; => Ī c4aa
+&ImaginaryI; => ⅈ e28588
+&Implies; => ⇒ e28792
+&Int; => ∬ e288ac
+&Integral; => ∫ e288ab
+&Intersection; => ⋂ e28b82
+&InvisibleComma; => ⁣ e281a3
+&InvisibleTimes; => ⁢ e281a2
+&Iogon; => Ä® c4ae
+&Iopf; => 𝕀 f09d9580
+&Iota; => Ι ce99
+&Iscr; => ℐ e28490
+&Itilde; => Äš c4a8
+&Iukcy; => І d086
+&Iuml; => Ï c38f
+&Jcirc; => ÄŽ c4b4
+&Jcy; => Й d099
+&Jfr; => 𝔍 f09d948d
+&Jopf; => 𝕁 f09d9581
+&Jscr; => 𝒥 f09d92a5
+&Jsercy; => Ј d088
+&Jukcy; => Є d084
+&KHcy; => Х d0a5
+&KJcy; => Ќ d08c
+&Kappa; => Κ ce9a
+&Kcedil; => Ķ c4b6
+&Kcy; => К d09a
+&Kfr; => 𝔎 f09d948e
+&Kopf; => 𝕂 f09d9582
+&Kscr; => 𝒊 f09d92a6
+&LJcy; => Љ d089
+&LT; => < 3c
+&Lacute; => Ĺ c4b9
+&Lambda; => Λ ce9b
+&Lang; => ⟪ e29faa
+&Laplacetrf; => ℒ e28492
+&Larr; => ↞ e2869e
+&Lcaron; => Ĝ c4bd
+&Lcedil; => Ä» c4bb
+&Lcy; => Л d09b
+&LeftAngleBracket; => ⟹ e29fa8
+&LeftArrow; => ← e28690
+&LeftArrowBar; => ⇀ e287a4
+&LeftArrowRightArrow; => ⇆ e28786
+&LeftCeiling; => ⌈ e28c88
+&LeftDoubleBracket; => ⟩ e29fa6
+&LeftDownTeeVector; => ⥡ e2a5a1
+&LeftDownVector; => ⇃ e28783
+&LeftDownVectorBar; => ⥙ e2a599
+&LeftFloor; => ⌊ e28c8a
+&LeftRightArrow; => ↔ e28694
+&LeftRightVector; => ⥎ e2a58e
+&LeftTee; => ⊣ e28aa3
+&LeftTeeArrow; => ↀ e286a4
+&LeftTeeVector; => ⥚ e2a59a
+&LeftTriangle; => ⊲ e28ab2
+&LeftTriangleBar; => ⧏ e2a78f
+&LeftTriangleEqual; => ⊮ e28ab4
+&LeftUpDownVector; => ⥑ e2a591
+&LeftUpTeeVector; => ⥠ e2a5a0
+&LeftUpVector; => ↿ e286bf
+&LeftUpVectorBar; => ⥘ e2a598
+&LeftVector; => ↌ e286bc
+&LeftVectorBar; => ⥒ e2a592
+&Leftarrow; => ⇐ e28790
+&Leftrightarrow; => ⇔ e28794
+&LessEqualGreater; => ⋚ e28b9a
+&LessFullEqual; => ≩ e289a6
+&LessGreater; => ≶ e289b6
+&LessLess; => ⪡ e2aaa1
+&LessSlantEqual; => ⩜ e2a9bd
+&LessTilde; => ≲ e289b2
+&Lfr; => 𝔏 f09d948f
+&Ll; => ⋘ e28b98
+&Lleftarrow; => ⇚ e2879a
+&Lmidot; => Ä¿ c4bf
+&LongLeftArrow; => ⟵ e29fb5
+&LongLeftRightArrow; => ⟷ e29fb7
+&LongRightArrow; => ⟶ e29fb6
+&Longleftarrow; => ⟾ e29fb8
+&Longleftrightarrow; => ⟺ e29fba
+&Longrightarrow; => ⟹ e29fb9
+&Lopf; => 𝕃 f09d9583
+&LowerLeftArrow; => ↙ e28699
+&LowerRightArrow; => ↘ e28698
+&Lscr; => ℒ e28492
+&Lsh; => ↰ e286b0
+&Lstrok; => Ł c581
+&Lt; => ≪ e289aa
+&Map; =>   e2a485
+&Mcy; => М d09c
+&MediumSpace; =>   e2819f
+&Mellintrf; => ℳ e284b3
+&Mfr; => 𝔐 f09d9490
+&MinusPlus; => ∓ e28893
+&Mopf; => 𝕄 f09d9584
+&Mscr; => ℳ e284b3
+&Mu; => Μ ce9c
+&NJcy; => Њ d08a
+&Nacute; => Ń c583
+&Ncaron; => Ň c587
+&Ncedil; => Ņ c585
+&Ncy; => Н d09d
+&NegativeMediumSpace; => ​ e2808b
+&NegativeThickSpace; => ​ e2808b
+&NegativeThinSpace; => ​ e2808b
+&NegativeVeryThinSpace; => ​ e2808b
+&NestedGreaterGreater; => ≫ e289ab
+&NestedLessLess; => ≪ e289aa
+&NewLine; =>
+ 0a
+&Nfr; => 𝔑 f09d9491
+&NoBreak; => ⁠ e281a0
+&NonBreakingSpace; =>   c2a0
+&Nopf; => ℕ e28495
+&Not; => ⫬ e2abac
+&NotCongruent; => ≢ e289a2
+&NotCupCap; => ≭ e289ad
+&NotDoubleVerticalBar; => ∊ e288a6
+&NotElement; => ∉ e28889
+&NotEqual; => ≠ e289a0
+&NotEqualTilde; => ≂̞ e28982ccb8
+&NotExists; => ∄ e28884
+&NotGreater; => ≯ e289af
+&NotGreaterEqual; => ≱ e289b1
+&NotGreaterFullEqual; => ≧̞ e289a7ccb8
+&NotGreaterGreater; => ≫̞ e289abccb8
+&NotGreaterLess; => ≹ e289b9
+&NotGreaterSlantEqual; => ⩟̞ e2a9beccb8
+&NotGreaterTilde; => ≵ e289b5
+&NotHumpDownHump; => ≎̞ e2898eccb8
+&NotHumpEqual; => ≏̞ e2898fccb8
+&NotLeftTriangle; => ⋪ e28baa
+&NotLeftTriangleBar; => ⧏̞ e2a78fccb8
+&NotLeftTriangleEqual; => ⋬ e28bac
+&NotLess; => ≮ e289ae
+&NotLessEqual; => ≰ e289b0
+&NotLessGreater; => ≾ e289b8
+&NotLessLess; => ≪̞ e289aaccb8
+&NotLessSlantEqual; => ⩜̞ e2a9bdccb8
+&NotLessTilde; => ≮ e289b4
+&NotNestedGreaterGreater; => ⪢̞ e2aaa2ccb8
+&NotNestedLessLess; => ⪡̞ e2aaa1ccb8
+&NotPrecedes; => ⊀ e28a80
+&NotPrecedesEqual; => ⪯̞ e2aaafccb8
+&NotPrecedesSlantEqual; => ⋠ e28ba0
+&NotReverseElement; => ∌ e2888c
+&NotRightTriangle; => ⋫ e28bab
+&NotRightTriangleBar; => ⧐̞ e2a790ccb8
+&NotRightTriangleEqual; => ⋭ e28bad
+&NotSquareSubset; => ⊏̞ e28a8fccb8
+&NotSquareSubsetEqual; => ⋢ e28ba2
+&NotSquareSuperset; => ⊐̞ e28a90ccb8
+&NotSquareSupersetEqual; => ⋣ e28ba3
+&NotSubset; => ⊂⃒ e28a82e28392
+&NotSubsetEqual; => ⊈ e28a88
+&NotSucceeds; => ⊁ e28a81
+&NotSucceedsEqual; => ⪰̞ e2aab0ccb8
+&NotSucceedsSlantEqual; => ⋡ e28ba1
+&NotSucceedsTilde; => ≿̞ e289bfccb8
+&NotSuperset; => ⊃⃒ e28a83e28392
+&NotSupersetEqual; => ⊉ e28a89
+&NotTilde; => ≁ e28981
+&NotTildeEqual; => ≄ e28984
+&NotTildeFullEqual; => ≇ e28987
+&NotTildeTilde; => ≉ e28989
+&NotVerticalBar; => ∀ e288a4
+&Nscr; => 𝒩 f09d92a9
+&Ntilde; => Ñ c391
+&Nu; => Ν ce9d
+&OElig; => Œ c592
+&Oacute; => Ó c393
+&Ocirc; => Ô c394
+&Ocy; => О d09e
+&Odblac; => Ő c590
+&Ofr; => 𝔒 f09d9492
+&Ograve; => Ò c392
+&Omacr; => Ō c58c
+&Omega; => Ω cea9
+&Omicron; => Ο ce9f
+&Oopf; => 𝕆 f09d9586
+&OpenCurlyDoubleQuote; => “ e2809c
+&OpenCurlyQuote; => ‘ e28098
+&Or; => ⩔ e2a994
+&Oscr; => 𝒪 f09d92aa
+&Oslash; => Ø c398
+&Otilde; => Õ c395
+&Otimes; => âš· e2a8b7
+&Ouml; => Ö c396
+&OverBar; => ‟ e280be
+&OverBrace; => ⏞ e28f9e
+&OverBracket; => ⎮ e28eb4
+&OverParenthesis; => ⏜ e28f9c
+&PartialD; => ∂ e28882
+&Pcy; => П d09f
+&Pfr; => 𝔓 f09d9493
+&Phi; => Ί cea6
+&Pi; => Π cea0
+&PlusMinus; => ± c2b1
+&Poincareplane; => ℌ e2848c
+&Popf; => ℙ e28499
+&Pr; => ⪻ e2aabb
+&Precedes; => ≺ e289ba
+&PrecedesEqual; => ⪯ e2aaaf
+&PrecedesSlantEqual; => ≌ e289bc
+&PrecedesTilde; => ≟ e289be
+&Prime; => ″ e280b3
+&Product; => ∏ e2888f
+&Proportion; => ∷ e288b7
+&Proportional; => ∝ e2889d
+&Pscr; => 𝒫 f09d92ab
+&Psi; => Κ cea8
+&QUOT; => " 22
+&Qfr; => 𝔔 f09d9494
+&Qopf; => ℚ e2849a
+&Qscr; => 𝒬 f09d92ac
+&RBarr; => ‐ e2a490
+&REG; => ® c2ae
+&Racute; => Ŕ c594
+&Rang; => ⟫ e29fab
+&Rarr; => ↠ e286a0
+&Rarrtl; => ‖ e2a496
+&Rcaron; => Ř c598
+&Rcedil; => Ŗ c596
+&Rcy; => Р d0a0
+&Re; => ℜ e2849c
+&ReverseElement; => ∋ e2888b
+&ReverseEquilibrium; => ⇋ e2878b
+&ReverseUpEquilibrium; => ⥯ e2a5af
+&Rfr; => ℜ e2849c
+&Rho; => Ρ cea1
+&RightAngleBracket; => ⟩ e29fa9
+&RightArrow; => → e28692
+&RightArrowBar; => ⇥ e287a5
+&RightArrowLeftArrow; => ⇄ e28784
+&RightCeiling; => ⌉ e28c89
+&RightDoubleBracket; => ⟧ e29fa7
+&RightDownTeeVector; => ⥝ e2a59d
+&RightDownVector; => ⇂ e28782
+&RightDownVectorBar; => ⥕ e2a595
+&RightFloor; => ⌋ e28c8b
+&RightTee; => ⊢ e28aa2
+&RightTeeArrow; => ↩ e286a6
+&RightTeeVector; => ⥛ e2a59b
+&RightTriangle; => ⊳ e28ab3
+&RightTriangleBar; => ⧐ e2a790
+&RightTriangleEqual; => ⊵ e28ab5
+&RightUpDownVector; => ⥏ e2a58f
+&RightUpTeeVector; => ⥜ e2a59c
+&RightUpVector; => ↟ e286be
+&RightUpVectorBar; => ⥔ e2a594
+&RightVector; => ⇀ e28780
+&RightVectorBar; => ⥓ e2a593
+&Rightarrow; => ⇒ e28792
+&Ropf; => ℝ e2849d
+&RoundImplies; => ⥰ e2a5b0
+&Rrightarrow; => ⇛ e2879b
+&Rscr; => ℛ e2849b
+&Rsh; => ↱ e286b1
+&RuleDelayed; => â§Ž e2a7b4
+&SHCHcy; => Щ d0a9
+&SHcy; => К d0a8
+&SOFTcy; => Ь d0ac
+&Sacute; => Ś c59a
+&Sc; => ⪌ e2aabc
+&Scaron; => Å  c5a0
+&Scedil; => Ş c59e
+&Scirc; => Ŝ c59c
+&Scy; => С d0a1
+&Sfr; => 𝔖 f09d9496
+&ShortDownArrow; => ↓ e28693
+&ShortLeftArrow; => ← e28690
+&ShortRightArrow; => → e28692
+&ShortUpArrow; => ↑ e28691
+&Sigma; => Σ cea3
+&SmallCircle; => ∘ e28898
+&Sopf; => 𝕊 f09d958a
+&Sqrt; => √ e2889a
+&Square; => □ e296a1
+&SquareIntersection; => ⊓ e28a93
+&SquareSubset; => ⊏ e28a8f
+&SquareSubsetEqual; => ⊑ e28a91
+&SquareSuperset; => ⊐ e28a90
+&SquareSupersetEqual; => ⊒ e28a92
+&SquareUnion; => ⊔ e28a94
+&Sscr; => 𝒮 f09d92ae
+&Star; => ⋆ e28b86
+&Sub; => ⋐ e28b90
+&Subset; => ⋐ e28b90
+&SubsetEqual; => ⊆ e28a86
+&Succeeds; => ≻ e289bb
+&SucceedsEqual; => ⪰ e2aab0
+&SucceedsSlantEqual; => ≜ e289bd
+&SucceedsTilde; => ≿ e289bf
+&SuchThat; => ∋ e2888b
+&Sum; => ∑ e28891
+&Sup; => ⋑ e28b91
+&Superset; => ⊃ e28a83
+&SupersetEqual; => ⊇ e28a87
+&Supset; => ⋑ e28b91
+&THORN; => Þ c39e
+&TRADE; => ™ e284a2
+&TSHcy; => Ћ d08b
+&TScy; => Њ d0a6
+&Tab; => 09
+&Tau; => ΀ cea4
+&Tcaron; => ŀ c5a4
+&Tcedil; => Ţ c5a2
+&Tcy; => Т d0a2
+&Tfr; => 𝔗 f09d9497
+&Therefore; => ∎ e288b4
+&Theta; => Θ ce98
+&ThickSpace; =>    e2819fe2808a
+&ThinSpace; =>   e28089
+&Tilde; => ∌ e288bc
+&TildeEqual; => ≃ e28983
+&TildeFullEqual; => ≅ e28985
+&TildeTilde; => ≈ e28988
+&Topf; => 𝕋 f09d958b
+&TripleDot; => ⃛ e2839b
+&Tscr; => 𝒯 f09d92af
+&Tstrok; => ÅŠ c5a6
+&Uacute; => Ú c39a
+&Uarr; => ↟ e2869f
+&Uarrocir; => ⥉ e2a589
+&Ubrcy; => Ў d08e
+&Ubreve; => Ŭ c5ac
+&Ucirc; => Û c39b
+&Ucy; => У d0a3
+&Udblac; => Ű c5b0
+&Ufr; => 𝔘 f09d9498
+&Ugrave; => Ù c399
+&Umacr; => Ū c5aa
+&UnderBar; => _ 5f
+&UnderBrace; => ⏟ e28f9f
+&UnderBracket; => ⎵ e28eb5
+&UnderParenthesis; => ⏝ e28f9d
+&Union; => ⋃ e28b83
+&UnionPlus; => ⊎ e28a8e
+&Uogon; => Ų c5b2
+&Uopf; => 𝕌 f09d958c
+&UpArrow; => ↑ e28691
+&UpArrowBar; => ‒ e2a492
+&UpArrowDownArrow; => ⇅ e28785
+&UpDownArrow; => ↕ e28695
+&UpEquilibrium; => ⥮ e2a5ae
+&UpTee; => ⊥ e28aa5
+&UpTeeArrow; => ↥ e286a5
+&Uparrow; => ⇑ e28791
+&Updownarrow; => ⇕ e28795
+&UpperLeftArrow; => ↖ e28696
+&UpperRightArrow; => ↗ e28697
+&Upsi; => ϒ cf92
+&Upsilon; => Υ cea5
+&Uring; => Å® c5ae
+&Uscr; => 𝒰 f09d92b0
+&Utilde; => Åš c5a8
+&Uuml; => Ü c39c
+&VDash; => ⊫ e28aab
+&Vbar; => â«« e2abab
+&Vcy; => В d092
+&Vdash; => ⊩ e28aa9
+&Vdashl; => ⫊ e2aba6
+&Vee; => ⋁ e28b81
+&Verbar; => ‖ e28096
+&Vert; => ‖ e28096
+&VerticalBar; => ∣ e288a3
+&VerticalLine; => | 7c
+&VerticalSeparator; => ❘ e29d98
+&VerticalTilde; => ≀ e28980
+&VeryThinSpace; =>   e2808a
+&Vfr; => 𝔙 f09d9499
+&Vopf; => 𝕍 f09d958d
+&Vscr; => 𝒱 f09d92b1
+&Vvdash; => ⊪ e28aaa
+&Wcirc; => ÅŽ c5b4
+&Wedge; => ⋀ e28b80
+&Wfr; => 𝔚 f09d949a
+&Wopf; => 𝕎 f09d958e
+&Wscr; => 𝒲 f09d92b2
+&Xfr; => 𝔛 f09d949b
+&Xi; => Ξ ce9e
+&Xopf; => 𝕏 f09d958f
+&Xscr; => 𝒳 f09d92b3
+&YAcy; => Я d0af
+&YIcy; => Ї d087
+&YUcy; => Ю d0ae
+&Yacute; => Ý c39d
+&Ycirc; => Ŷ c5b6
+&Ycy; => Ы d0ab
+&Yfr; => 𝔜 f09d949c
+&Yopf; => 𝕐 f09d9590
+&Yscr; => 𝒎 f09d92b4
+&Yuml; => Åž c5b8
+&ZHcy; => Ж d096
+&Zacute; => Ź c5b9
+&Zcaron; => Ŝ c5bd
+&Zcy; => З d097
+&Zdot; => Å» c5bb
+&ZeroWidthSpace; => ​ e2808b
+&Zeta; => Ζ ce96
+&Zfr; => ℹ e284a8
+&Zopf; => â„€ e284a4
+&Zscr; => 𝒵 f09d92b5
+&aacute; => á c3a1
+&abreve; => ă c483
+&ac; => ∟ e288be
+&acE; => ∟̳ e288beccb3
+&acd; => ∿ e288bf
+&acirc; => â c3a2
+&acute; => ÂŽ c2b4
+&acy; => а d0b0
+&aelig; => Ê c3a6
+&af; => ⁡ e281a1
+&afr; => 𝔞 f09d949e
+&agrave; => à c3a0
+&alefsym; => ℵ e284b5
+&aleph; => ℵ e284b5
+&alpha; => α ceb1
+&amacr; => ā c481
+&amalg; => âš¿ e2a8bf
+&amp; => & 26
+&and; => ∧ e288a7
+&andand; => ⩕ e2a995
+&andd; => ⩜ e2a99c
+&andslope; => ⩘ e2a998
+&andv; => ⩚ e2a99a
+&ang; => ∠ e288a0
+&ange; => ⊀ e2a6a4
+&angle; => ∠ e288a0
+&angmsd; => ∡ e288a1
+&angmsdaa; => ⊚ e2a6a8
+&angmsdab; => ⊩ e2a6a9
+&angmsdac; => ⊪ e2a6aa
+&angmsdad; => ⊫ e2a6ab
+&angmsdae; => ⊬ e2a6ac
+&angmsdaf; => ⊭ e2a6ad
+&angmsdag; => ⊮ e2a6ae
+&angmsdah; => ⊯ e2a6af
+&angrt; => ∟ e2889f
+&angrtvb; => ⊟ e28abe
+&angrtvbd; => ⊝ e2a69d
+&angsph; => ∢ e288a2
+&angst; => Å c385
+&angzarr; => ⍌ e28dbc
+&aogon; => ą c485
+&aopf; => 𝕒 f09d9592
+&ap; => ≈ e28988
+&apE; => â©° e2a9b0
+&apacir; => ⩯ e2a9af
+&ape; => ≊ e2898a
+&apid; => ≋ e2898b
+&apos; => ' 27
+&approx; => ≈ e28988
+&approxeq; => ≊ e2898a
+&aring; => å c3a5
+&ascr; => 𝒶 f09d92b6
+&ast; => * 2a
+&asymp; => ≈ e28988
+&asympeq; => ≍ e2898d
+&atilde; => ã c3a3
+&auml; => À c3a4
+&awconint; => ∳ e288b3
+&awint; => ⹑ e2a891
+&bNot; => â«­ e2abad
+&backcong; => ≌ e2898c
+&backepsilon; => ϶ cfb6
+&backprime; => ‵ e280b5
+&backsim; => ∜ e288bd
+&backsimeq; => ⋍ e28b8d
+&barvee; => ⊜ e28abd
+&barwed; => ⌅ e28c85
+&barwedge; => ⌅ e28c85
+&bbrk; => ⎵ e28eb5
+&bbrktbrk; => ⎶ e28eb6
+&bcong; => ≌ e2898c
+&bcy; => б d0b1
+&bdquo; => „ e2809e
+&becaus; => ∵ e288b5
+&because; => ∵ e288b5
+&bemptyv; => ⊰ e2a6b0
+&bepsi; => ϶ cfb6
+&bernou; => ℬ e284ac
+&beta; => β ceb2
+&beth; => ℶ e284b6
+&between; => ≬ e289ac
+&bfr; => 𝔟 f09d949f
+&bigcap; => ⋂ e28b82
+&bigcirc; => ◯ e297af
+&bigcup; => ⋃ e28b83
+&bigodot; => ⹀ e2a880
+&bigoplus; => ⚁ e2a881
+&bigotimes; => ⹂ e2a882
+&bigsqcup; => ⹆ e2a886
+&bigstar; => ★ e29885
+&bigtriangledown; => ▜ e296bd
+&bigtriangleup; => △ e296b3
+&biguplus; => ⹄ e2a884
+&bigvee; => ⋁ e28b81
+&bigwedge; => ⋀ e28b80
+&bkarow; => ‍ e2a48d
+&blacklozenge; => â§« e2a7ab
+&blacksquare; => ▪ e296aa
+&blacktriangle; => ▮ e296b4
+&blacktriangledown; => â–Ÿ e296be
+&blacktriangleleft; => ◂ e29782
+&blacktriangleright; => ▾ e296b8
+&blank; => ␣ e290a3
+&blk12; => ▒ e29692
+&blk14; => ░ e29691
+&blk34; => ▓ e29693
+&block; => █ e29688
+&bne; => =⃥ 3de283a5
+&bnequiv; => ≡⃥ e289a1e283a5
+&bnot; => ⌐ e28c90
+&bopf; => 𝕓 f09d9593
+&bot; => ⊥ e28aa5
+&bottom; => ⊥ e28aa5
+&bowtie; => ⋈ e28b88
+&boxDL; => ╗ e29597
+&boxDR; => ╔ e29594
+&boxDl; => ╖ e29596
+&boxDr; => ╓ e29593
+&boxH; => ═ e29590
+&boxHD; => ╩ e295a6
+&boxHU; => ╩ e295a9
+&boxHd; => â•€ e295a4
+&boxHu; => ╧ e295a7
+&boxUL; => ╝ e2959d
+&boxUR; => ╚ e2959a
+&boxUl; => ╜ e2959c
+&boxUr; => ╙ e29599
+&boxV; => ║ e29591
+&boxVH; => ╬ e295ac
+&boxVL; => ╣ e295a3
+&boxVR; => ╠ e295a0
+&boxVh; => ╫ e295ab
+&boxVl; => ╢ e295a2
+&boxVr; => ╟ e2959f
+&boxbox; => ⧉ e2a789
+&boxdL; => ╕ e29595
+&boxdR; => ╒ e29592
+&boxdl; => ┐ e29490
+&boxdr; => ┌ e2948c
+&boxh; => ─ e29480
+&boxhD; => ╥ e295a5
+&boxhU; => ╹ e295a8
+&boxhd; => ┬ e294ac
+&boxhu; => ┮ e294b4
+&boxminus; => ⊟ e28a9f
+&boxplus; => ⊞ e28a9e
+&boxtimes; => ⊠ e28aa0
+&boxuL; => ╛ e2959b
+&boxuR; => ╘ e29598
+&boxul; => ┘ e29498
+&boxur; => └ e29494
+&boxv; => │ e29482
+&boxvH; => ╪ e295aa
+&boxvL; => ╡ e295a1
+&boxvR; => ╞ e2959e
+&boxvh; => ┌ e294bc
+&boxvl; => ─ e294a4
+&boxvr; => ├ e2949c
+&bprime; => ‵ e280b5
+&breve; => ˘ cb98
+&brvbar; => Š c2a6
+&bscr; => 𝒷 f09d92b7
+&bsemi; => ⁏ e2818f
+&bsim; => ∜ e288bd
+&bsime; => ⋍ e28b8d
+&bsol; => \ 5c
+&bsolb; => ⧅ e2a785
+&bsolhsub; => ⟈ e29f88
+&bull; => • e280a2
+&bullet; => • e280a2
+&bump; => ≎ e2898e
+&bumpE; => ⪮ e2aaae
+&bumpe; => ≏ e2898f
+&bumpeq; => ≏ e2898f
+&cacute; => ć c487
+&cap; => ∩ e288a9
+&capand; => ⩄ e2a984
+&capbrcup; => ⩉ e2a989
+&capcap; => ⩋ e2a98b
+&capcup; => ⩇ e2a987
+&capdot; => ⩀ e2a980
+&caps; => ∩ e288a9efb880
+&caret; => ⁁ e28181
+&caron; => ˇ cb87
+&ccaps; => ⩍ e2a98d
+&ccaron; => č c48d
+&ccedil; => ç c3a7
+&ccirc; => ĉ c489
+&ccups; => ⩌ e2a98c
+&ccupssm; => ⩐ e2a990
+&cdot; => ċ c48b
+&cedil; => ž c2b8
+&cemptyv; => ⊲ e2a6b2
+&cent; => ¢ c2a2
+&centerdot; => · c2b7
+&cfr; => 𝔠 f09d94a0
+&chcy; => ч d187
+&check; => ✓ e29c93
+&checkmark; => ✓ e29c93
+&chi; => χ cf87
+&cir; => ○ e2978b
+&cirE; => ⧃ e2a783
+&circ; => ˆ cb86
+&circeq; => ≗ e28997
+&circlearrowleft; => ↺ e286ba
+&circlearrowright; => ↻ e286bb
+&circledR; => ® c2ae
+&circledS; => Ⓢ e29388
+&circledast; => ⊛ e28a9b
+&circledcirc; => ⊚ e28a9a
+&circleddash; => ⊝ e28a9d
+&cire; => ≗ e28997
+&cirfnint; => ⚐ e2a890
+&cirmid; => ⫯ e2abaf
+&cirscir; => ⧂ e2a782
+&clubs; => ♣ e299a3
+&clubsuit; => ♣ e299a3
+&colon; => : 3a
+&colone; => ≔ e28994
+&coloneq; => ≔ e28994
+&comma; => , 2c
+&commat; => @ 40
+&comp; => ∁ e28881
+&compfn; => ∘ e28898
+&complement; => ∁ e28881
+&complexes; => ℂ e28482
+&cong; => ≅ e28985
+&congdot; => â©­ e2a9ad
+&conint; => ∮ e288ae
+&copf; => 𝕔 f09d9594
+&coprod; => ∐ e28890
+&copy; => © c2a9
+&copysr; => ℗ e28497
+&crarr; => ↵ e286b5
+&cross; => ✗ e29c97
+&cscr; => 𝒞 f09d92b8
+&csub; => ⫏ e2ab8f
+&csube; => ⫑ e2ab91
+&csup; => ⫐ e2ab90
+&csupe; => ⫒ e2ab92
+&ctdot; => ⋯ e28baf
+&cudarrl; => „ e2a4b8
+&cudarrr; => ‵ e2a4b5
+&cuepr; => ⋞ e28b9e
+&cuesc; => ⋟ e28b9f
+&cularr; => ↶ e286b6
+&cularrp; => “ e2a4bd
+&cup; => ∪ e288aa
+&cupbrcap; => ⩈ e2a988
+&cupcap; => ⩆ e2a986
+&cupcup; => ⩊ e2a98a
+&cupdot; => ⊍ e28a8d
+&cupor; => ⩅ e2a985
+&cups; => ∪ e288aaefb880
+&curarr; => ↷ e286b7
+&curarrm; => ‌ e2a4bc
+&curlyeqprec; => ⋞ e28b9e
+&curlyeqsucc; => ⋟ e28b9f
+&curlyvee; => ⋎ e28b8e
+&curlywedge; => ⋏ e28b8f
+&curren; => € c2a4
+&curvearrowleft; => ↶ e286b6
+&curvearrowright; => ↷ e286b7
+&cuvee; => ⋎ e28b8e
+&cuwed; => ⋏ e28b8f
+&cwconint; => ∲ e288b2
+&cwint; => ∱ e288b1
+&cylcty; => ⌭ e28cad
+&dArr; => ⇓ e28793
+&dHar; => ⥥ e2a5a5
+&dagger; => † e280a0
+&daleth; => ℾ e284b8
+&darr; => ↓ e28693
+&dash; => ‐ e28090
+&dashv; => ⊣ e28aa3
+&dbkarow; => ‏ e2a48f
+&dblac; => ˝ cb9d
+&dcaron; => ď c48f
+&dcy; => ÐŽ d0b4
+&dd; => ⅆ e28586
+&ddagger; => ‡ e280a1
+&ddarr; => ⇊ e2878a
+&ddotseq; => â©· e2a9b7
+&deg; => ° c2b0
+&delta; => ÎŽ ceb4
+&demptyv; => ⊱ e2a6b1
+&dfisht; => ⥿ e2a5bf
+&dfr; => 𝔡 f09d94a1
+&dharl; => ⇃ e28783
+&dharr; => ⇂ e28782
+&diam; => ⋄ e28b84
+&diamond; => ⋄ e28b84
+&diamondsuit; => ♩ e299a6
+&diams; => ♩ e299a6
+&die; => š c2a8
+&digamma; => ϝ cf9d
+&disin; => ⋲ e28bb2
+&div; => ÷ c3b7
+&divide; => ÷ c3b7
+&divideontimes; => ⋇ e28b87
+&divonx; => ⋇ e28b87
+&djcy; => ђ d192
+&dlcorn; => ⌞ e28c9e
+&dlcrop; => ⌍ e28c8d
+&dollar; => $ 24
+&dopf; => 𝕕 f09d9595
+&dot; => ˙ cb99
+&doteq; => ≐ e28990
+&doteqdot; => ≑ e28991
+&dotminus; => ∞ e288b8
+&dotplus; => ∔ e28894
+&dotsquare; => ⊡ e28aa1
+&doublebarwedge; => ⌆ e28c86
+&downarrow; => ↓ e28693
+&downdownarrows; => ⇊ e2878a
+&downharpoonleft; => ⇃ e28783
+&downharpoonright; => ⇂ e28782
+&drbkarow; => ‐ e2a490
+&drcorn; => ⌟ e28c9f
+&drcrop; => ⌌ e28c8c
+&dscr; => 𝒹 f09d92b9
+&dscy; => ѕ d195
+&dsol; => â§¶ e2a7b6
+&dstrok; => đ c491
+&dtdot; => ⋱ e28bb1
+&dtri; => ▿ e296bf
+&dtrif; => â–Ÿ e296be
+&duarr; => ⇵ e287b5
+&duhar; => ⥯ e2a5af
+&dwangle; => ⊊ e2a6a6
+&dzcy; => џ d19f
+&dzigrarr; => ⟿ e29fbf
+&eDDot; => â©· e2a9b7
+&eDot; => ≑ e28991
+&eacute; => é c3a9
+&easter; => â©® e2a9ae
+&ecaron; => ě c49b
+&ecir; => ≖ e28996
+&ecirc; => ê c3aa
+&ecolon; => ≕ e28995
+&ecy; => э d18d
+&edot; => ė c497
+&ee; => ⅇ e28587
+&efDot; => ≒ e28992
+&efr; => 𝔢 f09d94a2
+&eg; => ⪚ e2aa9a
+&egrave; => Ú c3a8
+&egs; => ⪖ e2aa96
+&egsdot; => ⪘ e2aa98
+&el; => ⪙ e2aa99
+&elinters; => ⏧ e28fa7
+&ell; => ℓ e28493
+&els; => ⪕ e2aa95
+&elsdot; => ⪗ e2aa97
+&emacr; => ē c493
+&empty; => ∅ e28885
+&emptyset; => ∅ e28885
+&emptyv; => ∅ e28885
+&emsp; =>   e28083
+&emsp13; =>   e28084
+&emsp14; =>   e28085
+&eng; => ŋ c58b
+&ensp; =>   e28082
+&eogon; => ę c499
+&eopf; => 𝕖 f09d9596
+&epar; => ⋕ e28b95
+&eparsl; => â§£ e2a7a3
+&eplus; => ⩱ e2a9b1
+&epsi; => ε ceb5
+&epsilon; => ε ceb5
+&epsiv; => ϵ cfb5
+&eqcirc; => ≖ e28996
+&eqcolon; => ≕ e28995
+&eqsim; => ≂ e28982
+&eqslantgtr; => ⪖ e2aa96
+&eqslantless; => ⪕ e2aa95
+&equals; => = 3d
+&equest; => ≟ e2899f
+&equiv; => ≡ e289a1
+&equivDD; => ⩞ e2a9b8
+&eqvparsl; => â§¥ e2a7a5
+&erDot; => ≓ e28993
+&erarr; => ⥱ e2a5b1
+&escr; => ℯ e284af
+&esdot; => ≐ e28990
+&esim; => ≂ e28982
+&eta; => η ceb7
+&eth; => ð c3b0
+&euml; => ë c3ab
+&euro; => € e282ac
+&excl; => ! 21
+&exist; => ∃ e28883
+&expectation; => ℰ e284b0
+&exponentiale; => ⅇ e28587
+&fallingdotseq; => ≒ e28992
+&fcy; => ф d184
+&female; => ♀ e29980
+&ffilig; => ffi efac83
+&fflig; => ff efac80
+&ffllig; => ffl efac84
+&ffr; => 𝔣 f09d94a3
+&filig; => fi efac81
+&fjlig; => fj 666a
+&flat; => ♭ e299ad
+&fllig; => fl efac82
+&fltns; => ▱ e296b1
+&fnof; => ƒ c692
+&fopf; => 𝕗 f09d9597
+&forall; => ∀ e28880
+&fork; => ⋔ e28b94
+&forkv; => ⫙ e2ab99
+&fpartint; => ⚍ e2a88d
+&frac12; => œ c2bd
+&frac13; => ⅓ e28593
+&frac14; => Œ c2bc
+&frac15; => ⅕ e28595
+&frac16; => ⅙ e28599
+&frac18; => ⅛ e2859b
+&frac23; => ⅔ e28594
+&frac25; => ⅖ e28596
+&frac34; => Ÿ c2be
+&frac35; => ⅗ e28597
+&frac38; => ⅜ e2859c
+&frac45; => ⅘ e28598
+&frac56; => ⅚ e2859a
+&frac58; => ⅝ e2859d
+&frac78; => ⅞ e2859e
+&frasl; => ⁄ e28184
+&frown; => ⌢ e28ca2
+&fscr; => 𝒻 f09d92bb
+&gE; => ≧ e289a7
+&gEl; => ⪌ e2aa8c
+&gacute; => ǵ c7b5
+&gamma; => γ ceb3
+&gammad; => ϝ cf9d
+&gap; => ⪆ e2aa86
+&gbreve; => ğ c49f
+&gcirc; => ĝ c49d
+&gcy; => г d0b3
+&gdot; => Ä¡ c4a1
+&ge; => ≥ e289a5
+&gel; => ⋛ e28b9b
+&geq; => ≥ e289a5
+&geqq; => ≧ e289a7
+&geqslant; => ⩟ e2a9be
+&ges; => ⩟ e2a9be
+&gescc; => ⪩ e2aaa9
+&gesdot; => ⪀ e2aa80
+&gesdoto; => ⪂ e2aa82
+&gesdotol; => ⪄ e2aa84
+&gesl; => ⋛ e28b9befb880
+&gesles; => ⪔ e2aa94
+&gfr; => 𝔀 f09d94a4
+&gg; => ≫ e289ab
+&ggg; => ⋙ e28b99
+&gimel; => ℷ e284b7
+&gjcy; => ѓ d193
+&gl; => ≷ e289b7
+&glE; => ⪒ e2aa92
+&gla; => ⪥ e2aaa5
+&glj; => ⪀ e2aaa4
+&gnE; => ≩ e289a9
+&gnap; => ⪊ e2aa8a
+&gnapprox; => ⪊ e2aa8a
+&gne; => ⪈ e2aa88
+&gneq; => ⪈ e2aa88
+&gneqq; => ≩ e289a9
+&gnsim; => ⋧ e28ba7
+&gopf; => 𝕘 f09d9598
+&grave; => ` 60
+&gscr; => ℊ e2848a
+&gsim; => ≳ e289b3
+&gsime; => ⪎ e2aa8e
+&gsiml; => ⪐ e2aa90
+&gt; => > 3e
+&gtcc; => ⪧ e2aaa7
+&gtcir; => ⩺ e2a9ba
+&gtdot; => ⋗ e28b97
+&gtlPar; => ⩕ e2a695
+&gtquest; => ⩌ e2a9bc
+&gtrapprox; => ⪆ e2aa86
+&gtrarr; => ⥞ e2a5b8
+&gtrdot; => ⋗ e28b97
+&gtreqless; => ⋛ e28b9b
+&gtreqqless; => ⪌ e2aa8c
+&gtrless; => ≷ e289b7
+&gtrsim; => ≳ e289b3
+&gvertneqq; => ≩ e289a9efb880
+&gvnE; => ≩ e289a9efb880
+&hArr; => ⇔ e28794
+&hairsp; =>   e2808a
+&half; => œ c2bd
+&hamilt; => ℋ e2848b
+&hardcy; => ъ d18a
+&harr; => ↔ e28694
+&harrcir; => ⥈ e2a588
+&harrw; => ↭ e286ad
+&hbar; => ℏ e2848f
+&hcirc; => ĥ c4a5
+&hearts; => ♥ e299a5
+&heartsuit; => ♥ e299a5
+&hellip; => 
 e280a6
+&hercon; => ⊹ e28ab9
+&hfr; => 𝔥 f09d94a5
+&hksearow; => ‥ e2a4a5
+&hkswarow; =>   e2a4a6
+&hoarr; => ⇿ e287bf
+&homtht; => ∻ e288bb
+&hookleftarrow; => ↩ e286a9
+&hookrightarrow; => ↪ e286aa
+&hopf; => 𝕙 f09d9599
+&horbar; => ― e28095
+&hscr; => 𝒜 f09d92bd
+&hslash; => ℏ e2848f
+&hstrok; => ħ c4a7
+&hybull; => ⁃ e28183
+&hyphen; => ‐ e28090
+&iacute; => í c3ad
+&ic; => ⁣ e281a3
+&icirc; => î c3ae
+&icy; => О d0b8
+&iecy; => е d0b5
+&iexcl; => ¡ c2a1
+&iff; => ⇔ e28794
+&ifr; => 𝔊 f09d94a6
+&igrave; => ì c3ac
+&ii; => ⅈ e28588
+&iiiint; => ⹌ e2a88c
+&iiint; => ∭ e288ad
+&iinfin; => ⧜ e2a79c
+&iiota; => ℩ e284a9
+&ijlig; => ij c4b3
+&imacr; => Ä« c4ab
+&image; => ℑ e28491
+&imagline; => ℐ e28490
+&imagpart; => ℑ e28491
+&imath; => ı c4b1
+&imof; => ⊷ e28ab7
+&imped; => Ƶ c6b5
+&in; => ∈ e28888
+&incare; => ℅ e28485
+&infin; => ∞ e2889e
+&infintie; => ⧝ e2a79d
+&inodot; => ı c4b1
+&int; => ∫ e288ab
+&intcal; => ⊺ e28aba
+&integers; => â„€ e284a4
+&intercal; => ⊺ e28aba
+&intlarhk; => ⹗ e2a897
+&intprod; => ⚌ e2a8bc
+&iocy; => ё d191
+&iogon; => į c4af
+&iopf; => 𝕚 f09d959a
+&iota; => ι ceb9
+&iprod; => ⚌ e2a8bc
+&iquest; => ¿ c2bf
+&iscr; => 𝒟 f09d92be
+&isin; => ∈ e28888
+&isinE; => ⋹ e28bb9
+&isindot; => ⋵ e28bb5
+&isins; => ⋮ e28bb4
+&isinsv; => ⋳ e28bb3
+&isinv; => ∈ e28888
+&it; => ⁢ e281a2
+&itilde; => Ä© c4a9
+&iukcy; => і d196
+&iuml; => ï c3af
+&jcirc; => ĵ c4b5
+&jcy; => й d0b9
+&jfr; => 𝔧 f09d94a7
+&jmath; => È· c8b7
+&jopf; => 𝕛 f09d959b
+&jscr; => 𝒿 f09d92bf
+&jsercy; => ј d198
+&jukcy; => є d194
+&kappa; => κ ceba
+&kappav; => ϰ cfb0
+&kcedil; => Ä· c4b7
+&kcy; => к d0ba
+&kfr; => 𝔚 f09d94a8
+&kgreen; => Äž c4b8
+&khcy; => х d185
+&kjcy; => ќ d19c
+&kopf; => 𝕜 f09d959c
+&kscr; => 𝓀 f09d9380
+&lAarr; => ⇚ e2879a
+&lArr; => ⇐ e28790
+&lAtail; => ‛ e2a49b
+&lBarr; => ‎ e2a48e
+&lE; => ≩ e289a6
+&lEg; => ⪋ e2aa8b
+&lHar; => ⥢ e2a5a2
+&lacute; => ĺ c4ba
+&laemptyv; => ⊎ e2a6b4
+&lagran; => ℒ e28492
+&lambda; => λ cebb
+&lang; => ⟹ e29fa8
+&langd; => ⩑ e2a691
+&langle; => ⟹ e29fa8
+&lap; => ⪅ e2aa85
+&laquo; => « c2ab
+&larr; => ← e28690
+&larrb; => ⇀ e287a4
+&larrbfs; => ‟ e2a49f
+&larrfs; => ” e2a49d
+&larrhk; => ↩ e286a9
+&larrlp; => ↫ e286ab
+&larrpl; => ‹ e2a4b9
+&larrsim; => ⥳ e2a5b3
+&larrtl; => ↢ e286a2
+&lat; => ⪫ e2aaab
+&latail; => ’ e2a499
+&late; => ⪭ e2aaad
+&lates; => ⪭ e2aaadefb880
+&lbarr; => ‌ e2a48c
+&lbbrk; => ❲ e29db2
+&lbrace; => { 7b
+&lbrack; => [ 5b
+&lbrke; => ⩋ e2a68b
+&lbrksld; => ⊏ e2a68f
+&lbrkslu; => ⊍ e2a68d
+&lcaron; => ÄŸ c4be
+&lcedil; => Č c4bc
+&lceil; => ⌈ e28c88
+&lcub; => { 7b
+&lcy; => л d0bb
+&ldca; => ‶ e2a4b6
+&ldquo; => “ e2809c
+&ldquor; => „ e2809e
+&ldrdhar; => ⥧ e2a5a7
+&ldrushar; => ⥋ e2a58b
+&ldsh; => ↲ e286b2
+&le; => ≀ e289a4
+&leftarrow; => ← e28690
+&leftarrowtail; => ↢ e286a2
+&leftharpoondown; => ↜ e286bd
+&leftharpoonup; => ↌ e286bc
+&leftleftarrows; => ⇇ e28787
+&leftrightarrow; => ↔ e28694
+&leftrightarrows; => ⇆ e28786
+&leftrightharpoons; => ⇋ e2878b
+&leftrightsquigarrow; => ↭ e286ad
+&leftthreetimes; => ⋋ e28b8b
+&leg; => ⋚ e28b9a
+&leq; => ≀ e289a4
+&leqq; => ≩ e289a6
+&leqslant; => ⩜ e2a9bd
+&les; => ⩜ e2a9bd
+&lescc; => ⪚ e2aaa8
+&lesdot; => â©¿ e2a9bf
+&lesdoto; => ⪁ e2aa81
+&lesdotor; => ⪃ e2aa83
+&lesg; => ⋚ e28b9aefb880
+&lesges; => ⪓ e2aa93
+&lessapprox; => ⪅ e2aa85
+&lessdot; => ⋖ e28b96
+&lesseqgtr; => ⋚ e28b9a
+&lesseqqgtr; => ⪋ e2aa8b
+&lessgtr; => ≶ e289b6
+&lesssim; => ≲ e289b2
+&lfisht; => ⥌ e2a5bc
+&lfloor; => ⌊ e28c8a
+&lfr; => 𝔩 f09d94a9
+&lg; => ≶ e289b6
+&lgE; => ⪑ e2aa91
+&lhard; => ↜ e286bd
+&lharu; => ↌ e286bc
+&lharul; => ⥪ e2a5aa
+&lhblk; => ▄ e29684
+&ljcy; => љ d199
+&ll; => ≪ e289aa
+&llarr; => ⇇ e28787
+&llcorner; => ⌞ e28c9e
+&llhard; => ⥫ e2a5ab
+&lltri; => ◺ e297ba
+&lmidot; => ŀ c580
+&lmoust; => ⎰ e28eb0
+&lmoustache; => ⎰ e28eb0
+&lnE; => ≹ e289a8
+&lnap; => ⪉ e2aa89
+&lnapprox; => ⪉ e2aa89
+&lne; => ⪇ e2aa87
+&lneq; => ⪇ e2aa87
+&lneqq; => ≹ e289a8
+&lnsim; => ⋩ e28ba6
+&loang; => ⟬ e29fac
+&loarr; => ⇜ e287bd
+&lobrk; => ⟩ e29fa6
+&longleftarrow; => ⟵ e29fb5
+&longleftrightarrow; => ⟷ e29fb7
+&longmapsto; => ⟌ e29fbc
+&longrightarrow; => ⟶ e29fb6
+&looparrowleft; => ↫ e286ab
+&looparrowright; => ↬ e286ac
+&lopar; => ⩅ e2a685
+&lopf; => 𝕝 f09d959d
+&loplus; => âš­ e2a8ad
+&lotimes; => ⚎ e2a8b4
+&lowast; => ∗ e28897
+&lowbar; => _ 5f
+&loz; => ◊ e2978a
+&lozenge; => ◊ e2978a
+&lozf; => â§« e2a7ab
+&lpar; => ( 28
+&lparlt; => ⩓ e2a693
+&lrarr; => ⇆ e28786
+&lrcorner; => ⌟ e28c9f
+&lrhar; => ⇋ e2878b
+&lrhard; => ⥭ e2a5ad
+&lrm; => ‎ e2808e
+&lrtri; => ⊿ e28abf
+&lsaquo; => ‹ e280b9
+&lscr; => 𝓁 f09d9381
+&lsh; => ↰ e286b0
+&lsim; => ≲ e289b2
+&lsime; => ⪍ e2aa8d
+&lsimg; => ⪏ e2aa8f
+&lsqb; => [ 5b
+&lsquo; => ‘ e28098
+&lsquor; => ‚ e2809a
+&lstrok; => ł c582
+&lt; => < 3c
+&ltcc; => ⪊ e2aaa6
+&ltcir; => ⩹ e2a9b9
+&ltdot; => ⋖ e28b96
+&lthree; => ⋋ e28b8b
+&ltimes; => ⋉ e28b89
+&ltlarr; => ⥶ e2a5b6
+&ltquest; => â©» e2a9bb
+&ltrPar; => ⩖ e2a696
+&ltri; => ◃ e29783
+&ltrie; => ⊮ e28ab4
+&ltrif; => ◂ e29782
+&lurdshar; => ⥊ e2a58a
+&luruhar; => ⥊ e2a5a6
+&lvertneqq; => ≚ e289a8efb880
+&lvnE; => ≚ e289a8efb880
+&mDDot; => ∺ e288ba
+&macr; => ¯ c2af
+&male; => ♂ e29982
+&malt; => ✠ e29ca0
+&maltese; => ✠ e29ca0
+&map; => ↩ e286a6
+&mapsto; => ↩ e286a6
+&mapstodown; => ↧ e286a7
+&mapstoleft; => ↀ e286a4
+&mapstoup; => ↥ e286a5
+&marker; => ▮ e296ae
+&mcomma; => âš© e2a8a9
+&mcy; => Ќ d0bc
+&mdash; => — e28094
+&measuredangle; => ∡ e288a1
+&mfr; => 𝔪 f09d94aa
+&mho; => ℧ e284a7
+&micro; => µ c2b5
+&mid; => ∣ e288a3
+&midast; => * 2a
+&midcir; => â«° e2abb0
+&middot; => · c2b7
+&minus; => − e28892
+&minusb; => ⊟ e28a9f
+&minusd; => ∞ e288b8
+&minusdu; => ⚪ e2a8aa
+&mlcp; => ⫛ e2ab9b
+&mldr; => 
 e280a6
+&mnplus; => ∓ e28893
+&models; => ⊧ e28aa7
+&mopf; => 𝕞 f09d959e
+&mp; => ∓ e28893
+&mscr; => 𝓂 f09d9382
+&mstpos; => ∟ e288be
+&mu; => Ό cebc
+&multimap; => ⊾ e28ab8
+&mumap; => ⊾ e28ab8
+&nGg; => ⋙̞ e28b99ccb8
+&nGt; => ≫⃒ e289abe28392
+&nGtv; => ≫̞ e289abccb8
+&nLeftarrow; => ⇍ e2878d
+&nLeftrightarrow; => ⇎ e2878e
+&nLl; => ⋘̞ e28b98ccb8
+&nLt; => ≪⃒ e289aae28392
+&nLtv; => ≪̞ e289aaccb8
+&nRightarrow; => ⇏ e2878f
+&nVDash; => ⊯ e28aaf
+&nVdash; => ⊮ e28aae
+&nabla; => ∇ e28887
+&nacute; => ń c584
+&nang; => ∠⃒ e288a0e28392
+&nap; => ≉ e28989
+&napE; => â©°Ìž e2a9b0ccb8
+&napid; => ≋̞ e2898bccb8
+&napos; => ʼn c589
+&napprox; => ≉ e28989
+&natur; => ♮ e299ae
+&natural; => ♮ e299ae
+&naturals; => ℕ e28495
+&nbsp; =>   c2a0
+&nbump; => ≎̞ e2898eccb8
+&nbumpe; => ≏̞ e2898fccb8
+&ncap; => ⩃ e2a983
+&ncaron; => ň c588
+&ncedil; => ņ c586
+&ncong; => ≇ e28987
+&ncongdot; => â©­Ìž e2a9adccb8
+&ncup; => ⩂ e2a982
+&ncy; => М d0bd
+&ndash; => – e28093
+&ne; => ≠ e289a0
+&neArr; => ⇗ e28797
+&nearhk; =>   e2a4a4
+&nearr; => ↗ e28697
+&nearrow; => ↗ e28697
+&nedot; => ≐̞ e28990ccb8
+&nequiv; => ≢ e289a2
+&nesear; => ‚ e2a4a8
+&nesim; => ≂̞ e28982ccb8
+&nexist; => ∄ e28884
+&nexists; => ∄ e28884
+&nfr; => 𝔫 f09d94ab
+&ngE; => ≧̞ e289a7ccb8
+&nge; => ≱ e289b1
+&ngeq; => ≱ e289b1
+&ngeqq; => ≧̞ e289a7ccb8
+&ngeqslant; => ⩟̞ e2a9beccb8
+&nges; => ⩟̞ e2a9beccb8
+&ngsim; => ≵ e289b5
+&ngt; => ≯ e289af
+&ngtr; => ≯ e289af
+&nhArr; => ⇎ e2878e
+&nharr; => ↮ e286ae
+&nhpar; => ⫲ e2abb2
+&ni; => ∋ e2888b
+&nis; => ⋌ e28bbc
+&nisd; => ⋺ e28bba
+&niv; => ∋ e2888b
+&njcy; => њ d19a
+&nlArr; => ⇍ e2878d
+&nlE; => ≊̞ e289a6ccb8
+&nlarr; => ↚ e2869a
+&nldr; => ‥ e280a5
+&nle; => ≰ e289b0
+&nleftarrow; => ↚ e2869a
+&nleftrightarrow; => ↮ e286ae
+&nleq; => ≰ e289b0
+&nleqq; => ≊̞ e289a6ccb8
+&nleqslant; => ⩜̞ e2a9bdccb8
+&nles; => ⩜̞ e2a9bdccb8
+&nless; => ≮ e289ae
+&nlsim; => ≮ e289b4
+&nlt; => ≮ e289ae
+&nltri; => ⋪ e28baa
+&nltrie; => ⋬ e28bac
+&nmid; => ∀ e288a4
+&nopf; => 𝕟 f09d959f
+&not; => ¬ c2ac
+&notin; => ∉ e28889
+&notinE; => ⋹̞ e28bb9ccb8
+&notindot; => ⋵̞ e28bb5ccb8
+&notinva; => ∉ e28889
+&notinvb; => ⋷ e28bb7
+&notinvc; => ⋶ e28bb6
+&notni; => ∌ e2888c
+&notniva; => ∌ e2888c
+&notnivb; => ⋟ e28bbe
+&notnivc; => ⋜ e28bbd
+&npar; => ∊ e288a6
+&nparallel; => ∊ e288a6
+&nparsl; => ⫝̸⃥ e2abbde283a5
+&npart; => ∂̞ e28882ccb8
+&npolint; => ⹔ e2a894
+&npr; => ⊀ e28a80
+&nprcue; => ⋠ e28ba0
+&npre; => ⪯̞ e2aaafccb8
+&nprec; => ⊀ e28a80
+&npreceq; => ⪯̞ e2aaafccb8
+&nrArr; => ⇏ e2878f
+&nrarr; => ↛ e2869b
+&nrarrc; => ″̞ e2a4b3ccb8
+&nrarrw; => ↝̞ e2869dccb8
+&nrightarrow; => ↛ e2869b
+&nrtri; => ⋫ e28bab
+&nrtrie; => ⋭ e28bad
+&nsc; => ⊁ e28a81
+&nsccue; => ⋡ e28ba1
+&nsce; => ⪰̞ e2aab0ccb8
+&nscr; => 𝓃 f09d9383
+&nshortmid; => ∀ e288a4
+&nshortparallel; => ∊ e288a6
+&nsim; => ≁ e28981
+&nsime; => ≄ e28984
+&nsimeq; => ≄ e28984
+&nsmid; => ∀ e288a4
+&nspar; => ∊ e288a6
+&nsqsube; => ⋢ e28ba2
+&nsqsupe; => ⋣ e28ba3
+&nsub; => ⊄ e28a84
+&nsubE; => â«…Ìž e2ab85ccb8
+&nsube; => ⊈ e28a88
+&nsubset; => ⊂⃒ e28a82e28392
+&nsubseteq; => ⊈ e28a88
+&nsubseteqq; => â«…Ìž e2ab85ccb8
+&nsucc; => ⊁ e28a81
+&nsucceq; => ⪰̞ e2aab0ccb8
+&nsup; => ⊅ e28a85
+&nsupE; => ⫆̞ e2ab86ccb8
+&nsupe; => ⊉ e28a89
+&nsupset; => ⊃⃒ e28a83e28392
+&nsupseteq; => ⊉ e28a89
+&nsupseteqq; => ⫆̞ e2ab86ccb8
+&ntgl; => ≹ e289b9
+&ntilde; => ñ c3b1
+&ntlg; => ≾ e289b8
+&ntriangleleft; => ⋪ e28baa
+&ntrianglelefteq; => ⋬ e28bac
+&ntriangleright; => ⋫ e28bab
+&ntrianglerighteq; => ⋭ e28bad
+&nu; => Μ cebd
+&num; => # 23
+&numero; => № e28496
+&numsp; =>   e28087
+&nvDash; => ⊭ e28aad
+&nvHarr; =>   e2a484
+&nvap; => ≍⃒ e2898de28392
+&nvdash; => ⊬ e28aac
+&nvge; => ≥⃒ e289a5e28392
+&nvgt; => >⃒ 3ee28392
+&nvinfin; => ⧞ e2a79e
+&nvlArr; =>   e2a482
+&nvle; => ≀⃒ e289a4e28392
+&nvlt; => <⃒ 3ce28392
+&nvltrie; => ⊮⃒ e28ab4e28392
+&nvrArr; =>   e2a483
+&nvrtrie; => ⊵⃒ e28ab5e28392
+&nvsim; => ∌⃒ e288bce28392
+&nwArr; => ⇖ e28796
+&nwarhk; => ‣ e2a4a3
+&nwarr; => ↖ e28696
+&nwarrow; => ↖ e28696
+&nwnear; => ‧ e2a4a7
+&oS; => Ⓢ e29388
+&oacute; => ó c3b3
+&oast; => ⊛ e28a9b
+&ocir; => ⊚ e28a9a
+&ocirc; => ÃŽ c3b4
+&ocy; => П d0be
+&odash; => ⊝ e28a9d
+&odblac; => ő c591
+&odiv; => âšž e2a8b8
+&odot; => ⊙ e28a99
+&odsold; => ⊌ e2a6bc
+&oelig; => œ c593
+&ofcir; => ⊿ e2a6bf
+&ofr; => 𝔬 f09d94ac
+&ogon; => ˛ cb9b
+&ograve; => ò c3b2
+&ogt; => ⧁ e2a781
+&ohbar; => ⊵ e2a6b5
+&ohm; => Ω cea9
+&oint; => ∮ e288ae
+&olarr; => ↺ e286ba
+&olcir; => ⊟ e2a6be
+&olcross; => ⊻ e2a6bb
+&oline; => ‟ e280be
+&olt; => ⧀ e2a780
+&omacr; => ō c58d
+&omega; => ω cf89
+&omicron; => ο cebf
+&omid; => ⊶ e2a6b6
+&ominus; => ⊖ e28a96
+&oopf; => 𝕠 f09d95a0
+&opar; => ⊷ e2a6b7
+&operp; => ⊹ e2a6b9
+&oplus; => ⊕ e28a95
+&or; => √ e288a8
+&orarr; => ↻ e286bb
+&ord; => ⩝ e2a99d
+&order; => ℮ e284b4
+&orderof; => ℮ e284b4
+&ordf; => ª c2aa
+&ordm; => º c2ba
+&origof; => ⊶ e28ab6
+&oror; => ⩖ e2a996
+&orslope; => ⩗ e2a997
+&orv; => ⩛ e2a99b
+&oscr; => ℮ e284b4
+&oslash; => Þ c3b8
+&osol; => ⊘ e28a98
+&otilde; => õ c3b5
+&otimes; => ⊗ e28a97
+&otimesas; => âš¶ e2a8b6
+&ouml; => ö c3b6
+&ovbar; => ⌜ e28cbd
+&par; => ∥ e288a5
+&para; => ¶ c2b6
+&parallel; => ∥ e288a5
+&parsim; => ⫳ e2abb3
+&parsl; => ⫝̸ e2abbd
+&part; => ∂ e28882
+&pcy; => п d0bf
+&percnt; => % 25
+&period; => . 2e
+&permil; => ‰ e280b0
+&perp; => ⊥ e28aa5
+&pertenk; => ‱ e280b1
+&pfr; => 𝔭 f09d94ad
+&phi; => φ cf86
+&phiv; => ϕ cf95
+&phmmat; => ℳ e284b3
+&phone; => ☎ e2988e
+&pi; => π cf80
+&pitchfork; => ⋔ e28b94
+&piv; => ϖ cf96
+&planck; => ℏ e2848f
+&planckh; => ℎ e2848e
+&plankv; => ℏ e2848f
+&plus; => + 2b
+&plusacir; => ⚣ e2a8a3
+&plusb; => ⊞ e28a9e
+&pluscir; => ⚢ e2a8a2
+&plusdo; => ∔ e28894
+&plusdu; => ⚥ e2a8a5
+&pluse; => ⩲ e2a9b2
+&plusmn; => ± c2b1
+&plussim; => ⚊ e2a8a6
+&plustwo; => âš§ e2a8a7
+&pm; => ± c2b1
+&pointint; => ⹕ e2a895
+&popf; => 𝕡 f09d95a1
+&pound; => £ c2a3
+&pr; => ≺ e289ba
+&prE; => ⪳ e2aab3
+&prap; => ⪷ e2aab7
+&prcue; => ≌ e289bc
+&pre; => ⪯ e2aaaf
+&prec; => ≺ e289ba
+&precapprox; => ⪷ e2aab7
+&preccurlyeq; => ≌ e289bc
+&preceq; => ⪯ e2aaaf
+&precnapprox; => ⪹ e2aab9
+&precneqq; => ⪵ e2aab5
+&precnsim; => ⋹ e28ba8
+&precsim; => ≟ e289be
+&prime; => ′ e280b2
+&primes; => ℙ e28499
+&prnE; => ⪵ e2aab5
+&prnap; => ⪹ e2aab9
+&prnsim; => ⋹ e28ba8
+&prod; => ∏ e2888f
+&profalar; => ⌮ e28cae
+&profline; => ⌒ e28c92
+&profsurf; => ⌓ e28c93
+&prop; => ∝ e2889d
+&propto; => ∝ e2889d
+&prsim; => ≟ e289be
+&prurel; => ⊰ e28ab0
+&pscr; => 𝓅 f09d9385
+&psi; => ψ cf88
+&puncsp; =>   e28088
+&qfr; => 𝔮 f09d94ae
+&qint; => ⹌ e2a88c
+&qopf; => 𝕢 f09d95a2
+&qprime; => ⁗ e28197
+&qscr; => 𝓆 f09d9386
+&quaternions; => ℍ e2848d
+&quatint; => ⹖ e2a896
+&quest; => ? 3f
+&questeq; => ≟ e2899f
+&quot; => " 22
+&rAarr; => ⇛ e2879b
+&rArr; => ⇒ e28792
+&rAtail; => “ e2a49c
+&rBarr; => ‏ e2a48f
+&rHar; => ⥀ e2a5a4
+&race; => ∜̱ e288bdccb1
+&racute; => ŕ c595
+&radic; => √ e2889a
+&raemptyv; => ⊳ e2a6b3
+&rang; => ⟩ e29fa9
+&rangd; => ⩒ e2a692
+&range; => ⊥ e2a6a5
+&rangle; => ⟩ e29fa9
+&raquo; => » c2bb
+&rarr; => → e28692
+&rarrap; => ⥵ e2a5b5
+&rarrb; => ⇥ e287a5
+&rarrbfs; => † e2a4a0
+&rarrc; => ″ e2a4b3
+&rarrfs; => „ e2a49e
+&rarrhk; => ↪ e286aa
+&rarrlp; => ↬ e286ac
+&rarrpl; => ⥅ e2a585
+&rarrsim; => ⥎ e2a5b4
+&rarrtl; => ↣ e286a3
+&rarrw; => ↝ e2869d
+&ratail; => ‚ e2a49a
+&ratio; => ∶ e288b6
+&rationals; => ℚ e2849a
+&rbarr; => ‍ e2a48d
+&rbbrk; => ❳ e29db3
+&rbrace; => } 7d
+&rbrack; => ] 5d
+&rbrke; => ⩌ e2a68c
+&rbrksld; => ⊎ e2a68e
+&rbrkslu; => ⊐ e2a690
+&rcaron; => ř c599
+&rcedil; => ŗ c597
+&rceil; => ⌉ e28c89
+&rcub; => } 7d
+&rcy; => р d180
+&rdca; => ‷ e2a4b7
+&rdldhar; => ⥩ e2a5a9
+&rdquo; => ” e2809d
+&rdquor; => ” e2809d
+&rdsh; => ↳ e286b3
+&real; => ℜ e2849c
+&realine; => ℛ e2849b
+&realpart; => ℜ e2849c
+&reals; => ℝ e2849d
+&rect; => ▭ e296ad
+&reg; => ® c2ae
+&rfisht; => ⥜ e2a5bd
+&rfloor; => ⌋ e28c8b
+&rfr; => 𝔯 f09d94af
+&rhard; => ⇁ e28781
+&rharu; => ⇀ e28780
+&rharul; => ⥬ e2a5ac
+&rho; => ρ cf81
+&rhov; => ϱ cfb1
+&rightarrow; => → e28692
+&rightarrowtail; => ↣ e286a3
+&rightharpoondown; => ⇁ e28781
+&rightharpoonup; => ⇀ e28780
+&rightleftarrows; => ⇄ e28784
+&rightleftharpoons; => ⇌ e2878c
+&rightrightarrows; => ⇉ e28789
+&rightsquigarrow; => ↝ e2869d
+&rightthreetimes; => ⋌ e28b8c
+&ring; => ˚ cb9a
+&risingdotseq; => ≓ e28993
+&rlarr; => ⇄ e28784
+&rlhar; => ⇌ e2878c
+&rlm; => ‏ e2808f
+&rmoust; => ⎱ e28eb1
+&rmoustache; => ⎱ e28eb1
+&rnmid; => â«® e2abae
+&roang; => ⟭ e29fad
+&roarr; => ⇟ e287be
+&robrk; => ⟧ e29fa7
+&ropar; => ⩆ e2a686
+&ropf; => 𝕣 f09d95a3
+&roplus; => âš® e2a8ae
+&rotimes; => âšµ e2a8b5
+&rpar; => ) 29
+&rpargt; => ⩔ e2a694
+&rppolint; => ⹒ e2a892
+&rrarr; => ⇉ e28789
+&rsaquo; => › e280ba
+&rscr; => 𝓇 f09d9387
+&rsh; => ↱ e286b1
+&rsqb; => ] 5d
+&rsquo; => ’ e28099
+&rsquor; => ’ e28099
+&rthree; => ⋌ e28b8c
+&rtimes; => ⋊ e28b8a
+&rtri; => ▹ e296b9
+&rtrie; => ⊵ e28ab5
+&rtrif; => ▾ e296b8
+&rtriltri; => ⧎ e2a78e
+&ruluhar; => ⥚ e2a5a8
+&rx; => ℞ e2849e
+&sacute; => ś c59b
+&sbquo; => ‚ e2809a
+&sc; => ≻ e289bb
+&scE; => ⪎ e2aab4
+&scap; => ⪞ e2aab8
+&scaron; => Å¡ c5a1
+&sccue; => ≜ e289bd
+&sce; => ⪰ e2aab0
+&scedil; => ş c59f
+&scirc; => ŝ c59d
+&scnE; => ⪶ e2aab6
+&scnap; => ⪺ e2aaba
+&scnsim; => ⋩ e28ba9
+&scpolint; => ⹓ e2a893
+&scsim; => ≿ e289bf
+&scy; => с d181
+&sdot; => ⋅ e28b85
+&sdotb; => ⊡ e28aa1
+&sdote; => ⩊ e2a9a6
+&seArr; => ⇘ e28798
+&searhk; => ‥ e2a4a5
+&searr; => ↘ e28698
+&searrow; => ↘ e28698
+&sect; => § c2a7
+&semi; => ; 3b
+&seswar; => 
 e2a4a9
+&setminus; => ∖ e28896
+&setmn; => ∖ e28896
+&sext; => ✶ e29cb6
+&sfr; => 𝔰 f09d94b0
+&sfrown; => ⌢ e28ca2
+&sharp; => ♯ e299af
+&shchcy; => щ d189
+&shcy; => ш d188
+&shortmid; => ∣ e288a3
+&shortparallel; => ∥ e288a5
+&shy; => ­ c2ad
+&sigma; => σ cf83
+&sigmaf; => ς cf82
+&sigmav; => ς cf82
+&sim; => ∌ e288bc
+&simdot; => ⩪ e2a9aa
+&sime; => ≃ e28983
+&simeq; => ≃ e28983
+&simg; => ⪞ e2aa9e
+&simgE; => ⪠ e2aaa0
+&siml; => ⪝ e2aa9d
+&simlE; => ⪟ e2aa9f
+&simne; => ≆ e28986
+&simplus; => ⚀ e2a8a4
+&simrarr; => ⥲ e2a5b2
+&slarr; => ← e28690
+&smallsetminus; => ∖ e28896
+&smashp; => âš³ e2a8b3
+&smeparsl; => â§€ e2a7a4
+&smid; => ∣ e288a3
+&smile; => ⌣ e28ca3
+&smt; => ⪪ e2aaaa
+&smte; => ⪬ e2aaac
+&smtes; => ⪬ e2aaacefb880
+&softcy; => ь d18c
+&sol; => / 2f
+&solb; => ⧄ e2a784
+&solbar; => ⌿ e28cbf
+&sopf; => 𝕀 f09d95a4
+&spades; => ♠ e299a0
+&spadesuit; => ♠ e299a0
+&spar; => ∥ e288a5
+&sqcap; => ⊓ e28a93
+&sqcaps; => ⊓ e28a93efb880
+&sqcup; => ⊔ e28a94
+&sqcups; => ⊔ e28a94efb880
+&sqsub; => ⊏ e28a8f
+&sqsube; => ⊑ e28a91
+&sqsubset; => ⊏ e28a8f
+&sqsubseteq; => ⊑ e28a91
+&sqsup; => ⊐ e28a90
+&sqsupe; => ⊒ e28a92
+&sqsupset; => ⊐ e28a90
+&sqsupseteq; => ⊒ e28a92
+&squ; => □ e296a1
+&square; => □ e296a1
+&squarf; => ▪ e296aa
+&squf; => ▪ e296aa
+&srarr; => → e28692
+&sscr; => 𝓈 f09d9388
+&ssetmn; => ∖ e28896
+&ssmile; => ⌣ e28ca3
+&sstarf; => ⋆ e28b86
+&star; => ☆ e29886
+&starf; => ★ e29885
+&straightepsilon; => ϵ cfb5
+&straightphi; => ϕ cf95
+&strns; => ¯ c2af
+&sub; => ⊂ e28a82
+&subE; => ⫅ e2ab85
+&subdot; => ⪜ e2aabd
+&sube; => ⊆ e28a86
+&subedot; => ⫃ e2ab83
+&submult; => ⫁ e2ab81
+&subnE; => ⫋ e2ab8b
+&subne; => ⊊ e28a8a
+&subplus; => ⪿ e2aabf
+&subrarr; => ⥹ e2a5b9
+&subset; => ⊂ e28a82
+&subseteq; => ⊆ e28a86
+&subseteqq; => ⫅ e2ab85
+&subsetneq; => ⊊ e28a8a
+&subsetneqq; => ⫋ e2ab8b
+&subsim; => ⫇ e2ab87
+&subsub; => ⫕ e2ab95
+&subsup; => ⫓ e2ab93
+&succ; => ≻ e289bb
+&succapprox; => ⪞ e2aab8
+&succcurlyeq; => ≜ e289bd
+&succeq; => ⪰ e2aab0
+&succnapprox; => ⪺ e2aaba
+&succneqq; => ⪶ e2aab6
+&succnsim; => ⋩ e28ba9
+&succsim; => ≿ e289bf
+&sum; => ∑ e28891
+&sung; => ♪ e299aa
+&sup; => ⊃ e28a83
+&sup1; => ¹ c2b9
+&sup2; => ² c2b2
+&sup3; => ³ c2b3
+&supE; => ⫆ e2ab86
+&supdot; => ⪟ e2aabe
+&supdsub; => ⫘ e2ab98
+&supe; => ⊇ e28a87
+&supedot; => ⫄ e2ab84
+&suphsol; => ⟉ e29f89
+&suphsub; => ⫗ e2ab97
+&suplarr; => ⥻ e2a5bb
+&supmult; => ⫂ e2ab82
+&supnE; => ⫌ e2ab8c
+&supne; => ⊋ e28a8b
+&supplus; => ⫀ e2ab80
+&supset; => ⊃ e28a83
+&supseteq; => ⊇ e28a87
+&supseteqq; => ⫆ e2ab86
+&supsetneq; => ⊋ e28a8b
+&supsetneqq; => ⫌ e2ab8c
+&supsim; => ⫈ e2ab88
+&supsub; => ⫔ e2ab94
+&supsup; => ⫖ e2ab96
+&swArr; => ⇙ e28799
+&swarhk; =>   e2a4a6
+&swarr; => ↙ e28699
+&swarrow; => ↙ e28699
+&swnwar; => ‪ e2a4aa
+&szlig; => ß c39f
+&target; => ⌖ e28c96
+&tau; => τ cf84
+&tbrk; => ⎮ e28eb4
+&tcaron; => ť c5a5
+&tcedil; => ţ c5a3
+&tcy; => т d182
+&tdot; => ⃛ e2839b
+&telrec; => ⌕ e28c95
+&tfr; => 𝔱 f09d94b1
+&there4; => ∎ e288b4
+&therefore; => ∎ e288b4
+&theta; => Ξ ceb8
+&thetasym; => ϑ cf91
+&thetav; => ϑ cf91
+&thickapprox; => ≈ e28988
+&thicksim; => ∌ e288bc
+&thinsp; =>   e28089
+&thkap; => ≈ e28988
+&thksim; => ∌ e288bc
+&thorn; => ß c3be
+&tilde; => ˜ cb9c
+&times; => × c397
+&timesb; => ⊠ e28aa0
+&timesbar; => âš± e2a8b1
+&timesd; => âš° e2a8b0
+&tint; => ∭ e288ad
+&toea; => ‚ e2a4a8
+&top; => ⊀ e28aa4
+&topbot; => ⌶ e28cb6
+&topcir; => ⫱ e2abb1
+&topf; => 𝕥 f09d95a5
+&topfork; => ⫚ e2ab9a
+&tosa; => 
 e2a4a9
+&tprime; => ‮ e280b4
+&trade; => ™ e284a2
+&triangle; => ▵ e296b5
+&triangledown; => ▿ e296bf
+&triangleleft; => ◃ e29783
+&trianglelefteq; => ⊮ e28ab4
+&triangleq; => ≜ e2899c
+&triangleright; => ▹ e296b9
+&trianglerighteq; => ⊵ e28ab5
+&tridot; => ◬ e297ac
+&trie; => ≜ e2899c
+&triminus; => ⚺ e2a8ba
+&triplus; => âš¹ e2a8b9
+&trisb; => ⧍ e2a78d
+&tritime; => âš» e2a8bb
+&trpezium; => ⏢ e28fa2
+&tscr; => 𝓉 f09d9389
+&tscy; => ц d186
+&tshcy; => ћ d19b
+&tstrok; => ŧ c5a7
+&twixt; => ≬ e289ac
+&twoheadleftarrow; => ↞ e2869e
+&twoheadrightarrow; => ↠ e286a0
+&uArr; => ⇑ e28791
+&uHar; => ⥣ e2a5a3
+&uacute; => ú c3ba
+&uarr; => ↑ e28691
+&ubrcy; => ў d19e
+&ubreve; => Å­ c5ad
+&ucirc; => û c3bb
+&ucy; => у d183
+&udarr; => ⇅ e28785
+&udblac; => ű c5b1
+&udhar; => ⥮ e2a5ae
+&ufisht; => ⥟ e2a5be
+&ufr; => 𝔲 f09d94b2
+&ugrave; => ù c3b9
+&uharl; => ↿ e286bf
+&uharr; => ↟ e286be
+&uhblk; => ▀ e29680
+&ulcorn; => ⌜ e28c9c
+&ulcorner; => ⌜ e28c9c
+&ulcrop; => ⌏ e28c8f
+&ultri; => ◾ e297b8
+&umacr; => Å« c5ab
+&uml; => š c2a8
+&uogon; => ų c5b3
+&uopf; => 𝕊 f09d95a6
+&uparrow; => ↑ e28691
+&updownarrow; => ↕ e28695
+&upharpoonleft; => ↿ e286bf
+&upharpoonright; => ↟ e286be
+&uplus; => ⊎ e28a8e
+&upsi; => υ cf85
+&upsih; => ϒ cf92
+&upsilon; => υ cf85
+&upuparrows; => ⇈ e28788
+&urcorn; => ⌝ e28c9d
+&urcorner; => ⌝ e28c9d
+&urcrop; => ⌎ e28c8e
+&uring; => ů c5af
+&urtri; => ◹ e297b9
+&uscr; => 𝓊 f09d938a
+&utdot; => ⋰ e28bb0
+&utilde; => Å© c5a9
+&utri; => ▵ e296b5
+&utrif; => ▮ e296b4
+&uuarr; => ⇈ e28788
+&uuml; => Ì c3bc
+&uwangle; => ⊧ e2a6a7
+&vArr; => ⇕ e28795
+&vBar; => ⫚ e2aba8
+&vBarv; => â«© e2aba9
+&vDash; => ⊹ e28aa8
+&vangrt; => ⩜ e2a69c
+&varepsilon; => ϵ cfb5
+&varkappa; => ϰ cfb0
+&varnothing; => ∅ e28885
+&varphi; => ϕ cf95
+&varpi; => ϖ cf96
+&varpropto; => ∝ e2889d
+&varr; => ↕ e28695
+&varrho; => ϱ cfb1
+&varsigma; => ς cf82
+&varsubsetneq; => ⊊ e28a8aefb880
+&varsubsetneqq; => ⫋ e2ab8befb880
+&varsupsetneq; => ⊋ e28a8befb880
+&varsupsetneqq; => ⫌ e2ab8cefb880
+&vartheta; => ϑ cf91
+&vartriangleleft; => ⊲ e28ab2
+&vartriangleright; => ⊳ e28ab3
+&vcy; => в d0b2
+&vdash; => ⊢ e28aa2
+&vee; => √ e288a8
+&veebar; => ⊻ e28abb
+&veeeq; => ≚ e2899a
+&vellip; => ⋮ e28bae
+&verbar; => | 7c
+&vert; => | 7c
+&vfr; => 𝔳 f09d94b3
+&vltri; => ⊲ e28ab2
+&vnsub; => ⊂⃒ e28a82e28392
+&vnsup; => ⊃⃒ e28a83e28392
+&vopf; => 𝕧 f09d95a7
+&vprop; => ∝ e2889d
+&vrtri; => ⊳ e28ab3
+&vscr; => 𝓋 f09d938b
+&vsubnE; => ⫋ e2ab8befb880
+&vsubne; => ⊊ e28a8aefb880
+&vsupnE; => ⫌ e2ab8cefb880
+&vsupne; => ⊋ e28a8befb880
+&vzigzag; => ⩚ e2a69a
+&wcirc; => ŵ c5b5
+&wedbar; => ⩟ e2a99f
+&wedge; => ∧ e288a7
+&wedgeq; => ≙ e28999
+&weierp; => ℘ e28498
+&wfr; => 𝔎 f09d94b4
+&wopf; => 𝕚 f09d95a8
+&wp; => ℘ e28498
+&wr; => ≀ e28980
+&wreath; => ≀ e28980
+&wscr; => 𝓌 f09d938c
+&xcap; => ⋂ e28b82
+&xcirc; => ◯ e297af
+&xcup; => ⋃ e28b83
+&xdtri; => ▜ e296bd
+&xfr; => 𝔵 f09d94b5
+&xhArr; => ⟺ e29fba
+&xharr; => ⟷ e29fb7
+&xi; => Ο cebe
+&xlArr; => ⟾ e29fb8
+&xlarr; => ⟵ e29fb5
+&xmap; => ⟌ e29fbc
+&xnis; => ⋻ e28bbb
+&xodot; => ⹀ e2a880
+&xopf; => 𝕩 f09d95a9
+&xoplus; => ⚁ e2a881
+&xotime; => ⹂ e2a882
+&xrArr; => ⟹ e29fb9
+&xrarr; => ⟶ e29fb6
+&xscr; => 𝓍 f09d938d
+&xsqcup; => ⹆ e2a886
+&xuplus; => ⹄ e2a884
+&xutri; => △ e296b3
+&xvee; => ⋁ e28b81
+&xwedge; => ⋀ e28b80
+&yacute; => Ü c3bd
+&yacy; => я d18f
+&ycirc; => Å· c5b7
+&ycy; => ы d18b
+&yen; => ¥ c2a5
+&yfr; => 𝔶 f09d94b6
+&yicy; => ї d197
+&yopf; => 𝕪 f09d95aa
+&yscr; => 𝓎 f09d938e
+&yucy; => ю d18e
+&yuml; => ÿ c3bf
+&zacute; => ź c5ba
+&zcaron; => ÅŸ c5be
+&zcy; => з d0b7
+&zdot; => Ō c5bc
+&zeetrf; => ℹ e284a8
+&zeta; => ζ ceb6
+&zfr; => 𝔷 f09d94b7
+&zhcy; => ж d0b6
+&zigrarr; => ⇝ e2879d
+&zopf; => 𝕫 f09d95ab
+&zscr; => 𝓏 f09d938f
+&zwj; => ‍ e2808d
+&zwnj; => ‌ e2808c
diff --git a/ext/standard/tests/strings/html_entity_decode_iso8859-15.phpt b/ext/standard/tests/strings/html_entity_decode_iso8859-15.phpt
new file mode 100644
index 0000000..a3be8f3
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_iso8859-15.phpt
@@ -0,0 +1,405 @@
+--TEST--
+Translation of HTML entities for encoding ISO-8859-15
+--FILE--
+<?php
+$arr = array(
+0x00A0 => array(0xA0, "NO-BREAK SPACE"),
+0x00A1 => array(0xA1, "INVERTED EXCLAMATION MARK"),
+0x00A2 => array(0xA2, "CENT SIGN"),
+0x00A3 => array(0xA3, "POUND SIGN"),
+0x20AC => array(0xA4, "EURO SIGN"),
+0x00A5 => array(0xA5, "YEN SIGN"),
+0x0160 => array(0xA6, "LATIN CAPITAL LETTER S WITH CARON"),
+0x00A7 => array(0xA7, "SECTION SIGN"),
+0x0161 => array(0xA8, "LATIN SMALL LETTER S WITH CARON"),
+0x00A9 => array(0xA9, "COPYRIGHT SIGN"),
+0x00AA => array(0xAA, "FEMININE ORDINAL INDICATOR"),
+0x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"),
+0x00AC => array(0xAC, "NOT SIGN"),
+0x00AD => array(0xAD, "SOFT HYPHEN"),
+0x00AE => array(0xAE, "REGISTERED SIGN"),
+0x00AF => array(0xAF, "MACRON"),
+0x00B0 => array(0xB0, "DEGREE SIGN"),
+0x00B1 => array(0xB1, "PLUS-MINUS SIGN"),
+0x00B2 => array(0xB2, "SUPERSCRIPT TWO"),
+0x00B3 => array(0xB3, "SUPERSCRIPT THREE"),
+0x017D => array(0xB4, "LATIN CAPITAL LETTER Z WITH CARON"),
+0x00B5 => array(0xB5, "MICRO SIGN"),
+0x00B6 => array(0xB6, "PILCROW SIGN"),
+0x00B7 => array(0xB7, "MIDDLE DOT"),
+0x017E => array(0xB8, "LATIN SMALL LETTER Z WITH CARON"),
+0x00B9 => array(0xB9, "SUPERSCRIPT ONE"),
+0x00BA => array(0xBA, "MASCULINE ORDINAL INDICATOR"),
+0x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"),
+0x0152 => array(0xBC, "LATIN CAPITAL LIGATURE OE"),
+0x0153 => array(0xBD, "LATIN SMALL LIGATURE OE"),
+0x0178 => array(0xBE, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
+0x00BF => array(0xBF, "INVERTED QUESTION MARK"),
+0x00C0 => array(0xC0, "LATIN CAPITAL LETTER A WITH GRAVE"),
+0x00C1 => array(0xC1, "LATIN CAPITAL LETTER A WITH ACUTE"),
+0x00C2 => array(0xC2, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"),
+0x00C3 => array(0xC3, "LATIN CAPITAL LETTER A WITH TILDE"),
+0x00C4 => array(0xC4, "LATIN CAPITAL LETTER A WITH DIAERESIS"),
+0x00C5 => array(0xC5, "LATIN CAPITAL LETTER A WITH RING ABOVE"),
+0x00C6 => array(0xC6, "LATIN CAPITAL LETTER AE"),
+0x00C7 => array(0xC7, "LATIN CAPITAL LETTER C WITH CEDILLA"),
+0x00C8 => array(0xC8, "LATIN CAPITAL LETTER E WITH GRAVE"),
+0x00C9 => array(0xC9, "LATIN CAPITAL LETTER E WITH ACUTE"),
+0x00CA => array(0xCA, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"),
+0x00CB => array(0xCB, "LATIN CAPITAL LETTER E WITH DIAERESIS"),
+0x00CC => array(0xCC, "LATIN CAPITAL LETTER I WITH GRAVE"),
+0x00CD => array(0xCD, "LATIN CAPITAL LETTER I WITH ACUTE"),
+0x00CE => array(0xCE, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"),
+0x00CF => array(0xCF, "LATIN CAPITAL LETTER I WITH DIAERESIS"),
+0x00D0 => array(0xD0, "LATIN CAPITAL LETTER ETH"),
+0x00D1 => array(0xD1, "LATIN CAPITAL LETTER N WITH TILDE"),
+0x00D2 => array(0xD2, "LATIN CAPITAL LETTER O WITH GRAVE"),
+0x00D3 => array(0xD3, "LATIN CAPITAL LETTER O WITH ACUTE"),
+0x00D4 => array(0xD4, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"),
+0x00D5 => array(0xD5, "LATIN CAPITAL LETTER O WITH TILDE"),
+0x00D6 => array(0xD6, "LATIN CAPITAL LETTER O WITH DIAERESIS"),
+0x00D7 => array(0xD7, "MULTIPLICATION SIGN"),
+0x00D8 => array(0xD8, "LATIN CAPITAL LETTER O WITH STROKE"),
+0x00D9 => array(0xD9, "LATIN CAPITAL LETTER U WITH GRAVE"),
+0x00DA => array(0xDA, "LATIN CAPITAL LETTER U WITH ACUTE"),
+0x00DB => array(0xDB, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"),
+0x00DC => array(0xDC, "LATIN CAPITAL LETTER U WITH DIAERESIS"),
+0x00DD => array(0xDD, "LATIN CAPITAL LETTER Y WITH ACUTE"),
+0x00DE => array(0xDE, "LATIN CAPITAL LETTER THORN"),
+0x00DF => array(0xDF, "LATIN SMALL LETTER SHARP S"),
+0x00E0 => array(0xE0, "LATIN SMALL LETTER A WITH GRAVE"),
+0x00E1 => array(0xE1, "LATIN SMALL LETTER A WITH ACUTE"),
+0x00E2 => array(0xE2, "LATIN SMALL LETTER A WITH CIRCUMFLEX"),
+0x00E3 => array(0xE3, "LATIN SMALL LETTER A WITH TILDE"),
+0x00E4 => array(0xE4, "LATIN SMALL LETTER A WITH DIAERESIS"),
+0x00E5 => array(0xE5, "LATIN SMALL LETTER A WITH RING ABOVE"),
+0x00E6 => array(0xE6, "LATIN SMALL LETTER AE"),
+0x00E7 => array(0xE7, "LATIN SMALL LETTER C WITH CEDILLA"),
+0x00E8 => array(0xE8, "LATIN SMALL LETTER E WITH GRAVE"),
+0x00E9 => array(0xE9, "LATIN SMALL LETTER E WITH ACUTE"),
+0x00EA => array(0xEA, "LATIN SMALL LETTER E WITH CIRCUMFLEX"),
+0x00EB => array(0xEB, "LATIN SMALL LETTER E WITH DIAERESIS"),
+0x00EC => array(0xEC, "LATIN SMALL LETTER I WITH GRAVE"),
+0x00ED => array(0xED, "LATIN SMALL LETTER I WITH ACUTE"),
+0x00EE => array(0xEE, "LATIN SMALL LETTER I WITH CIRCUMFLEX"),
+0x00EF => array(0xEF, "LATIN SMALL LETTER I WITH DIAERESIS"),
+0x00F0 => array(0xF0, "LATIN SMALL LETTER ETH"),
+0x00F1 => array(0xF1, "LATIN SMALL LETTER N WITH TILDE"),
+0x00F2 => array(0xF2, "LATIN SMALL LETTER O WITH GRAVE"),
+0x00F3 => array(0xF3, "LATIN SMALL LETTER O WITH ACUTE"),
+0x00F4 => array(0xF4, "LATIN SMALL LETTER O WITH CIRCUMFLEX"),
+0x00F5 => array(0xF5, "LATIN SMALL LETTER O WITH TILDE"),
+0x00F6 => array(0xF6, "LATIN SMALL LETTER O WITH DIAERESIS"),
+0x00F7 => array(0xF7, "DIVISION SIGN"),
+0x00F8 => array(0xF8, "LATIN SMALL LETTER O WITH STROKE"),
+0x00F9 => array(0xF9, "LATIN SMALL LETTER U WITH GRAVE"),
+0x00FA => array(0xFA, "LATIN SMALL LETTER U WITH ACUTE"),
+0x00FB => array(0xFB, "LATIN SMALL LETTER U WITH CIRCUMFLEX"),
+0x00FC => array(0xFC, "LATIN SMALL LETTER U WITH DIAERESIS"),
+0x00FD => array(0xFD, "LATIN SMALL LETTER Y WITH ACUTE"),
+0x00FE => array(0xFE, "LATIN SMALL LETTER THORN"),
+0x00FF => array(0xFF, "LATIN SMALL LETTER Y WITH DIAERESIS"),
+);
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+NO-BREAK SPACE: &#xA0; => a0
+&#xA0; => a0
+
+INVERTED EXCLAMATION MARK: &#xA1; => a1
+&#xA1; => a1
+
+CENT SIGN: &#xA2; => a2
+&#xA2; => a2
+
+POUND SIGN: &#xA3; => a3
+&#xA3; => a3
+
+EURO SIGN: &#x20AC; => a4
+&#xA4; => &#xA4;
+
+YEN SIGN: &#xA5; => a5
+&#xA5; => a5
+
+LATIN CAPITAL LETTER S WITH CARON: &#x160; => a6
+&#xA6; => &#xA6;
+
+SECTION SIGN: &#xA7; => a7
+&#xA7; => a7
+
+LATIN SMALL LETTER S WITH CARON: &#x161; => a8
+&#xA8; => &#xA8;
+
+COPYRIGHT SIGN: &#xA9; => a9
+&#xA9; => a9
+
+FEMININE ORDINAL INDICATOR: &#xAA; => aa
+&#xAA; => aa
+
+LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xAB; => ab
+&#xAB; => ab
+
+NOT SIGN: &#xAC; => ac
+&#xAC; => ac
+
+SOFT HYPHEN: &#xAD; => ad
+&#xAD; => ad
+
+REGISTERED SIGN: &#xAE; => ae
+&#xAE; => ae
+
+MACRON: &#xAF; => af
+&#xAF; => af
+
+DEGREE SIGN: &#xB0; => b0
+&#xB0; => b0
+
+PLUS-MINUS SIGN: &#xB1; => b1
+&#xB1; => b1
+
+SUPERSCRIPT TWO: &#xB2; => b2
+&#xB2; => b2
+
+SUPERSCRIPT THREE: &#xB3; => b3
+&#xB3; => b3
+
+LATIN CAPITAL LETTER Z WITH CARON: &#x17D; => b4
+&#xB4; => &#xB4;
+
+MICRO SIGN: &#xB5; => b5
+&#xB5; => b5
+
+PILCROW SIGN: &#xB6; => b6
+&#xB6; => b6
+
+MIDDLE DOT: &#xB7; => b7
+&#xB7; => b7
+
+LATIN SMALL LETTER Z WITH CARON: &#x17E; => b8
+&#xB8; => &#xB8;
+
+SUPERSCRIPT ONE: &#xB9; => b9
+&#xB9; => b9
+
+MASCULINE ORDINAL INDICATOR: &#xBA; => ba
+&#xBA; => ba
+
+RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xBB; => bb
+&#xBB; => bb
+
+LATIN CAPITAL LIGATURE OE: &#x152; => bc
+&#xBC; => &#xBC;
+
+LATIN SMALL LIGATURE OE: &#x153; => bd
+&#xBD; => &#xBD;
+
+LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => be
+&#xBE; => &#xBE;
+
+INVERTED QUESTION MARK: &#xBF; => bf
+&#xBF; => bf
+
+LATIN CAPITAL LETTER A WITH GRAVE: &#xC0; => c0
+&#xC0; => c0
+
+LATIN CAPITAL LETTER A WITH ACUTE: &#xC1; => c1
+&#xC1; => c1
+
+LATIN CAPITAL LETTER A WITH CIRCUMFLEX: &#xC2; => c2
+&#xC2; => c2
+
+LATIN CAPITAL LETTER A WITH TILDE: &#xC3; => c3
+&#xC3; => c3
+
+LATIN CAPITAL LETTER A WITH DIAERESIS: &#xC4; => c4
+&#xC4; => c4
+
+LATIN CAPITAL LETTER A WITH RING ABOVE: &#xC5; => c5
+&#xC5; => c5
+
+LATIN CAPITAL LETTER AE: &#xC6; => c6
+&#xC6; => c6
+
+LATIN CAPITAL LETTER C WITH CEDILLA: &#xC7; => c7
+&#xC7; => c7
+
+LATIN CAPITAL LETTER E WITH GRAVE: &#xC8; => c8
+&#xC8; => c8
+
+LATIN CAPITAL LETTER E WITH ACUTE: &#xC9; => c9
+&#xC9; => c9
+
+LATIN CAPITAL LETTER E WITH CIRCUMFLEX: &#xCA; => ca
+&#xCA; => ca
+
+LATIN CAPITAL LETTER E WITH DIAERESIS: &#xCB; => cb
+&#xCB; => cb
+
+LATIN CAPITAL LETTER I WITH GRAVE: &#xCC; => cc
+&#xCC; => cc
+
+LATIN CAPITAL LETTER I WITH ACUTE: &#xCD; => cd
+&#xCD; => cd
+
+LATIN CAPITAL LETTER I WITH CIRCUMFLEX: &#xCE; => ce
+&#xCE; => ce
+
+LATIN CAPITAL LETTER I WITH DIAERESIS: &#xCF; => cf
+&#xCF; => cf
+
+LATIN CAPITAL LETTER ETH: &#xD0; => d0
+&#xD0; => d0
+
+LATIN CAPITAL LETTER N WITH TILDE: &#xD1; => d1
+&#xD1; => d1
+
+LATIN CAPITAL LETTER O WITH GRAVE: &#xD2; => d2
+&#xD2; => d2
+
+LATIN CAPITAL LETTER O WITH ACUTE: &#xD3; => d3
+&#xD3; => d3
+
+LATIN CAPITAL LETTER O WITH CIRCUMFLEX: &#xD4; => d4
+&#xD4; => d4
+
+LATIN CAPITAL LETTER O WITH TILDE: &#xD5; => d5
+&#xD5; => d5
+
+LATIN CAPITAL LETTER O WITH DIAERESIS: &#xD6; => d6
+&#xD6; => d6
+
+MULTIPLICATION SIGN: &#xD7; => d7
+&#xD7; => d7
+
+LATIN CAPITAL LETTER O WITH STROKE: &#xD8; => d8
+&#xD8; => d8
+
+LATIN CAPITAL LETTER U WITH GRAVE: &#xD9; => d9
+&#xD9; => d9
+
+LATIN CAPITAL LETTER U WITH ACUTE: &#xDA; => da
+&#xDA; => da
+
+LATIN CAPITAL LETTER U WITH CIRCUMFLEX: &#xDB; => db
+&#xDB; => db
+
+LATIN CAPITAL LETTER U WITH DIAERESIS: &#xDC; => dc
+&#xDC; => dc
+
+LATIN CAPITAL LETTER Y WITH ACUTE: &#xDD; => dd
+&#xDD; => dd
+
+LATIN CAPITAL LETTER THORN: &#xDE; => de
+&#xDE; => de
+
+LATIN SMALL LETTER SHARP S: &#xDF; => df
+&#xDF; => df
+
+LATIN SMALL LETTER A WITH GRAVE: &#xE0; => e0
+&#xE0; => e0
+
+LATIN SMALL LETTER A WITH ACUTE: &#xE1; => e1
+&#xE1; => e1
+
+LATIN SMALL LETTER A WITH CIRCUMFLEX: &#xE2; => e2
+&#xE2; => e2
+
+LATIN SMALL LETTER A WITH TILDE: &#xE3; => e3
+&#xE3; => e3
+
+LATIN SMALL LETTER A WITH DIAERESIS: &#xE4; => e4
+&#xE4; => e4
+
+LATIN SMALL LETTER A WITH RING ABOVE: &#xE5; => e5
+&#xE5; => e5
+
+LATIN SMALL LETTER AE: &#xE6; => e6
+&#xE6; => e6
+
+LATIN SMALL LETTER C WITH CEDILLA: &#xE7; => e7
+&#xE7; => e7
+
+LATIN SMALL LETTER E WITH GRAVE: &#xE8; => e8
+&#xE8; => e8
+
+LATIN SMALL LETTER E WITH ACUTE: &#xE9; => e9
+&#xE9; => e9
+
+LATIN SMALL LETTER E WITH CIRCUMFLEX: &#xEA; => ea
+&#xEA; => ea
+
+LATIN SMALL LETTER E WITH DIAERESIS: &#xEB; => eb
+&#xEB; => eb
+
+LATIN SMALL LETTER I WITH GRAVE: &#xEC; => ec
+&#xEC; => ec
+
+LATIN SMALL LETTER I WITH ACUTE: &#xED; => ed
+&#xED; => ed
+
+LATIN SMALL LETTER I WITH CIRCUMFLEX: &#xEE; => ee
+&#xEE; => ee
+
+LATIN SMALL LETTER I WITH DIAERESIS: &#xEF; => ef
+&#xEF; => ef
+
+LATIN SMALL LETTER ETH: &#xF0; => f0
+&#xF0; => f0
+
+LATIN SMALL LETTER N WITH TILDE: &#xF1; => f1
+&#xF1; => f1
+
+LATIN SMALL LETTER O WITH GRAVE: &#xF2; => f2
+&#xF2; => f2
+
+LATIN SMALL LETTER O WITH ACUTE: &#xF3; => f3
+&#xF3; => f3
+
+LATIN SMALL LETTER O WITH CIRCUMFLEX: &#xF4; => f4
+&#xF4; => f4
+
+LATIN SMALL LETTER O WITH TILDE: &#xF5; => f5
+&#xF5; => f5
+
+LATIN SMALL LETTER O WITH DIAERESIS: &#xF6; => f6
+&#xF6; => f6
+
+DIVISION SIGN: &#xF7; => f7
+&#xF7; => f7
+
+LATIN SMALL LETTER O WITH STROKE: &#xF8; => f8
+&#xF8; => f8
+
+LATIN SMALL LETTER U WITH GRAVE: &#xF9; => f9
+&#xF9; => f9
+
+LATIN SMALL LETTER U WITH ACUTE: &#xFA; => fa
+&#xFA; => fa
+
+LATIN SMALL LETTER U WITH CIRCUMFLEX: &#xFB; => fb
+&#xFB; => fb
+
+LATIN SMALL LETTER U WITH DIAERESIS: &#xFC; => fc
+&#xFC; => fc
+
+LATIN SMALL LETTER Y WITH ACUTE: &#xFD; => fd
+&#xFD; => fd
+
+LATIN SMALL LETTER THORN: &#xFE; => fe
+&#xFE; => fe
+
+LATIN SMALL LETTER Y WITH DIAERESIS: &#xFF; => ff
+&#xFF; => ff
+
+
diff --git a/ext/standard/tests/strings/html_entity_decode_iso8859-5.phpt b/ext/standard/tests/strings/html_entity_decode_iso8859-5.phpt
new file mode 100644
index 0000000..6a65413
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_iso8859-5.phpt
@@ -0,0 +1,405 @@
+--TEST--
+Translation of HTML entities for encoding ISO-8859-5
+--FILE--
+<?php
+$arr = array(
+0x00A0 => array(0xA0, "NO-BREAK SPACE"),
+0x0401 => array(0xA1, "CYRILLIC CAPITAL LETTER IO"),
+0x0402 => array(0xA2, "CYRILLIC CAPITAL LETTER DJE"),
+0x0403 => array(0xA3, "CYRILLIC CAPITAL LETTER GJE"),
+0x0404 => array(0xA4, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"),
+0x0405 => array(0xA5, "CYRILLIC CAPITAL LETTER DZE"),
+0x0406 => array(0xA6, "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I"),
+0x0407 => array(0xA7, "CYRILLIC CAPITAL LETTER YI"),
+0x0408 => array(0xA8, "CYRILLIC CAPITAL LETTER JE"),
+0x0409 => array(0xA9, "CYRILLIC CAPITAL LETTER LJE"),
+0x040A => array(0xAA, "CYRILLIC CAPITAL LETTER NJE"),
+0x040B => array(0xAB, "CYRILLIC CAPITAL LETTER TSHE"),
+0x040C => array(0xAC, "CYRILLIC CAPITAL LETTER KJE"),
+0x00AD => array(0xAD, "SOFT HYPHEN"),
+0x040E => array(0xAE, "CYRILLIC CAPITAL LETTER SHORT U"),
+0x040F => array(0xAF, "CYRILLIC CAPITAL LETTER DZHE"),
+0x0410 => array(0xB0, "CYRILLIC CAPITAL LETTER A"),
+0x0411 => array(0xB1, "CYRILLIC CAPITAL LETTER BE"),
+0x0412 => array(0xB2, "CYRILLIC CAPITAL LETTER VE"),
+0x0413 => array(0xB3, "CYRILLIC CAPITAL LETTER GHE"),
+0x0414 => array(0xB4, "CYRILLIC CAPITAL LETTER DE"),
+0x0415 => array(0xB5, "CYRILLIC CAPITAL LETTER IE"),
+0x0416 => array(0xB6, "CYRILLIC CAPITAL LETTER ZHE"),
+0x0417 => array(0xB7, "CYRILLIC CAPITAL LETTER ZE"),
+0x0418 => array(0xB8, "CYRILLIC CAPITAL LETTER I"),
+0x0419 => array(0xB9, "CYRILLIC CAPITAL LETTER SHORT I"),
+0x041A => array(0xBA, "CYRILLIC CAPITAL LETTER KA"),
+0x041B => array(0xBB, "CYRILLIC CAPITAL LETTER EL"),
+0x041C => array(0xBC, "CYRILLIC CAPITAL LETTER EM"),
+0x041D => array(0xBD, "CYRILLIC CAPITAL LETTER EN"),
+0x041E => array(0xBE, "CYRILLIC CAPITAL LETTER O"),
+0x041F => array(0xBF, "CYRILLIC CAPITAL LETTER PE"),
+0x0420 => array(0xC0, "CYRILLIC CAPITAL LETTER ER"),
+0x0421 => array(0xC1, "CYRILLIC CAPITAL LETTER ES"),
+0x0422 => array(0xC2, "CYRILLIC CAPITAL LETTER TE"),
+0x0423 => array(0xC3, "CYRILLIC CAPITAL LETTER U"),
+0x0424 => array(0xC4, "CYRILLIC CAPITAL LETTER EF"),
+0x0425 => array(0xC5, "CYRILLIC CAPITAL LETTER HA"),
+0x0426 => array(0xC6, "CYRILLIC CAPITAL LETTER TSE"),
+0x0427 => array(0xC7, "CYRILLIC CAPITAL LETTER CHE"),
+0x0428 => array(0xC8, "CYRILLIC CAPITAL LETTER SHA"),
+0x0429 => array(0xC9, "CYRILLIC CAPITAL LETTER SHCHA"),
+0x042A => array(0xCA, "CYRILLIC CAPITAL LETTER HARD SIGN"),
+0x042B => array(0xCB, "CYRILLIC CAPITAL LETTER YERU"),
+0x042C => array(0xCC, "CYRILLIC CAPITAL LETTER SOFT SIGN"),
+0x042D => array(0xCD, "CYRILLIC CAPITAL LETTER E"),
+0x042E => array(0xCE, "CYRILLIC CAPITAL LETTER YU"),
+0x042F => array(0xCF, "CYRILLIC CAPITAL LETTER YA"),
+0x0430 => array(0xD0, "CYRILLIC SMALL LETTER A"),
+0x0431 => array(0xD1, "CYRILLIC SMALL LETTER BE"),
+0x0432 => array(0xD2, "CYRILLIC SMALL LETTER VE"),
+0x0433 => array(0xD3, "CYRILLIC SMALL LETTER GHE"),
+0x0434 => array(0xD4, "CYRILLIC SMALL LETTER DE"),
+0x0435 => array(0xD5, "CYRILLIC SMALL LETTER IE"),
+0x0436 => array(0xD6, "CYRILLIC SMALL LETTER ZHE"),
+0x0437 => array(0xD7, "CYRILLIC SMALL LETTER ZE"),
+0x0438 => array(0xD8, "CYRILLIC SMALL LETTER I"),
+0x0439 => array(0xD9, "CYRILLIC SMALL LETTER SHORT I"),
+0x043A => array(0xDA, "CYRILLIC SMALL LETTER KA"),
+0x043B => array(0xDB, "CYRILLIC SMALL LETTER EL"),
+0x043C => array(0xDC, "CYRILLIC SMALL LETTER EM"),
+0x043D => array(0xDD, "CYRILLIC SMALL LETTER EN"),
+0x043E => array(0xDE, "CYRILLIC SMALL LETTER O"),
+0x043F => array(0xDF, "CYRILLIC SMALL LETTER PE"),
+0x0440 => array(0xE0, "CYRILLIC SMALL LETTER ER"),
+0x0441 => array(0xE1, "CYRILLIC SMALL LETTER ES"),
+0x0442 => array(0xE2, "CYRILLIC SMALL LETTER TE"),
+0x0443 => array(0xE3, "CYRILLIC SMALL LETTER U"),
+0x0444 => array(0xE4, "CYRILLIC SMALL LETTER EF"),
+0x0445 => array(0xE5, "CYRILLIC SMALL LETTER HA"),
+0x0446 => array(0xE6, "CYRILLIC SMALL LETTER TSE"),
+0x0447 => array(0xE7, "CYRILLIC SMALL LETTER CHE"),
+0x0448 => array(0xE8, "CYRILLIC SMALL LETTER SHA"),
+0x0449 => array(0xE9, "CYRILLIC SMALL LETTER SHCHA"),
+0x044A => array(0xEA, "CYRILLIC SMALL LETTER HARD SIGN"),
+0x044B => array(0xEB, "CYRILLIC SMALL LETTER YERU"),
+0x044C => array(0xEC, "CYRILLIC SMALL LETTER SOFT SIGN"),
+0x044D => array(0xED, "CYRILLIC SMALL LETTER E"),
+0x044E => array(0xEE, "CYRILLIC SMALL LETTER YU"),
+0x044F => array(0xEF, "CYRILLIC SMALL LETTER YA"),
+0x2116 => array(0xF0, "NUMERO SIGN"),
+0x0451 => array(0xF1, "CYRILLIC SMALL LETTER IO"),
+0x0452 => array(0xF2, "CYRILLIC SMALL LETTER DJE"),
+0x0453 => array(0xF3, "CYRILLIC SMALL LETTER GJE"),
+0x0454 => array(0xF4, "CYRILLIC SMALL LETTER UKRAINIAN IE"),
+0x0455 => array(0xF5, "CYRILLIC SMALL LETTER DZE"),
+0x0456 => array(0xF6, "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I"),
+0x0457 => array(0xF7, "CYRILLIC SMALL LETTER YI"),
+0x0458 => array(0xF8, "CYRILLIC SMALL LETTER JE"),
+0x0459 => array(0xF9, "CYRILLIC SMALL LETTER LJE"),
+0x045A => array(0xFA, "CYRILLIC SMALL LETTER NJE"),
+0x045B => array(0xFB, "CYRILLIC SMALL LETTER TSHE"),
+0x045C => array(0xFC, "CYRILLIC SMALL LETTER KJE"),
+0x00A7 => array(0xFD, "SECTION SIGN"),
+0x045E => array(0xFE, "CYRILLIC SMALL LETTER SHORT U"),
+0x045F => array(0xFF, "CYRILLIC SMALL LETTER DZHE"),
+);
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-5');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-5');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+NO-BREAK SPACE: &#xA0; => a0
+&#xA0; => a0
+
+CYRILLIC CAPITAL LETTER IO: &#x401; => a1
+&#xA1; => &#xA1;
+
+CYRILLIC CAPITAL LETTER DJE: &#x402; => a2
+&#xA2; => &#xA2;
+
+CYRILLIC CAPITAL LETTER GJE: &#x403; => a3
+&#xA3; => &#xA3;
+
+CYRILLIC CAPITAL LETTER UKRAINIAN IE: &#x404; => a4
+&#xA4; => &#xA4;
+
+CYRILLIC CAPITAL LETTER DZE: &#x405; => a5
+&#xA5; => &#xA5;
+
+CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: &#x406; => a6
+&#xA6; => &#xA6;
+
+CYRILLIC CAPITAL LETTER YI: &#x407; => a7
+&#xA7; => fd
+
+CYRILLIC CAPITAL LETTER JE: &#x408; => a8
+&#xA8; => &#xA8;
+
+CYRILLIC CAPITAL LETTER LJE: &#x409; => a9
+&#xA9; => &#xA9;
+
+CYRILLIC CAPITAL LETTER NJE: &#x40A; => aa
+&#xAA; => &#xAA;
+
+CYRILLIC CAPITAL LETTER TSHE: &#x40B; => ab
+&#xAB; => &#xAB;
+
+CYRILLIC CAPITAL LETTER KJE: &#x40C; => ac
+&#xAC; => &#xAC;
+
+SOFT HYPHEN: &#xAD; => ad
+&#xAD; => ad
+
+CYRILLIC CAPITAL LETTER SHORT U: &#x40E; => ae
+&#xAE; => &#xAE;
+
+CYRILLIC CAPITAL LETTER DZHE: &#x40F; => af
+&#xAF; => &#xAF;
+
+CYRILLIC CAPITAL LETTER A: &#x410; => b0
+&#xB0; => &#xB0;
+
+CYRILLIC CAPITAL LETTER BE: &#x411; => b1
+&#xB1; => &#xB1;
+
+CYRILLIC CAPITAL LETTER VE: &#x412; => b2
+&#xB2; => &#xB2;
+
+CYRILLIC CAPITAL LETTER GHE: &#x413; => b3
+&#xB3; => &#xB3;
+
+CYRILLIC CAPITAL LETTER DE: &#x414; => b4
+&#xB4; => &#xB4;
+
+CYRILLIC CAPITAL LETTER IE: &#x415; => b5
+&#xB5; => &#xB5;
+
+CYRILLIC CAPITAL LETTER ZHE: &#x416; => b6
+&#xB6; => &#xB6;
+
+CYRILLIC CAPITAL LETTER ZE: &#x417; => b7
+&#xB7; => &#xB7;
+
+CYRILLIC CAPITAL LETTER I: &#x418; => b8
+&#xB8; => &#xB8;
+
+CYRILLIC CAPITAL LETTER SHORT I: &#x419; => b9
+&#xB9; => &#xB9;
+
+CYRILLIC CAPITAL LETTER KA: &#x41A; => ba
+&#xBA; => &#xBA;
+
+CYRILLIC CAPITAL LETTER EL: &#x41B; => bb
+&#xBB; => &#xBB;
+
+CYRILLIC CAPITAL LETTER EM: &#x41C; => bc
+&#xBC; => &#xBC;
+
+CYRILLIC CAPITAL LETTER EN: &#x41D; => bd
+&#xBD; => &#xBD;
+
+CYRILLIC CAPITAL LETTER O: &#x41E; => be
+&#xBE; => &#xBE;
+
+CYRILLIC CAPITAL LETTER PE: &#x41F; => bf
+&#xBF; => &#xBF;
+
+CYRILLIC CAPITAL LETTER ER: &#x420; => c0
+&#xC0; => &#xC0;
+
+CYRILLIC CAPITAL LETTER ES: &#x421; => c1
+&#xC1; => &#xC1;
+
+CYRILLIC CAPITAL LETTER TE: &#x422; => c2
+&#xC2; => &#xC2;
+
+CYRILLIC CAPITAL LETTER U: &#x423; => c3
+&#xC3; => &#xC3;
+
+CYRILLIC CAPITAL LETTER EF: &#x424; => c4
+&#xC4; => &#xC4;
+
+CYRILLIC CAPITAL LETTER HA: &#x425; => c5
+&#xC5; => &#xC5;
+
+CYRILLIC CAPITAL LETTER TSE: &#x426; => c6
+&#xC6; => &#xC6;
+
+CYRILLIC CAPITAL LETTER CHE: &#x427; => c7
+&#xC7; => &#xC7;
+
+CYRILLIC CAPITAL LETTER SHA: &#x428; => c8
+&#xC8; => &#xC8;
+
+CYRILLIC CAPITAL LETTER SHCHA: &#x429; => c9
+&#xC9; => &#xC9;
+
+CYRILLIC CAPITAL LETTER HARD SIGN: &#x42A; => ca
+&#xCA; => &#xCA;
+
+CYRILLIC CAPITAL LETTER YERU: &#x42B; => cb
+&#xCB; => &#xCB;
+
+CYRILLIC CAPITAL LETTER SOFT SIGN: &#x42C; => cc
+&#xCC; => &#xCC;
+
+CYRILLIC CAPITAL LETTER E: &#x42D; => cd
+&#xCD; => &#xCD;
+
+CYRILLIC CAPITAL LETTER YU: &#x42E; => ce
+&#xCE; => &#xCE;
+
+CYRILLIC CAPITAL LETTER YA: &#x42F; => cf
+&#xCF; => &#xCF;
+
+CYRILLIC SMALL LETTER A: &#x430; => d0
+&#xD0; => &#xD0;
+
+CYRILLIC SMALL LETTER BE: &#x431; => d1
+&#xD1; => &#xD1;
+
+CYRILLIC SMALL LETTER VE: &#x432; => d2
+&#xD2; => &#xD2;
+
+CYRILLIC SMALL LETTER GHE: &#x433; => d3
+&#xD3; => &#xD3;
+
+CYRILLIC SMALL LETTER DE: &#x434; => d4
+&#xD4; => &#xD4;
+
+CYRILLIC SMALL LETTER IE: &#x435; => d5
+&#xD5; => &#xD5;
+
+CYRILLIC SMALL LETTER ZHE: &#x436; => d6
+&#xD6; => &#xD6;
+
+CYRILLIC SMALL LETTER ZE: &#x437; => d7
+&#xD7; => &#xD7;
+
+CYRILLIC SMALL LETTER I: &#x438; => d8
+&#xD8; => &#xD8;
+
+CYRILLIC SMALL LETTER SHORT I: &#x439; => d9
+&#xD9; => &#xD9;
+
+CYRILLIC SMALL LETTER KA: &#x43A; => da
+&#xDA; => &#xDA;
+
+CYRILLIC SMALL LETTER EL: &#x43B; => db
+&#xDB; => &#xDB;
+
+CYRILLIC SMALL LETTER EM: &#x43C; => dc
+&#xDC; => &#xDC;
+
+CYRILLIC SMALL LETTER EN: &#x43D; => dd
+&#xDD; => &#xDD;
+
+CYRILLIC SMALL LETTER O: &#x43E; => de
+&#xDE; => &#xDE;
+
+CYRILLIC SMALL LETTER PE: &#x43F; => df
+&#xDF; => &#xDF;
+
+CYRILLIC SMALL LETTER ER: &#x440; => e0
+&#xE0; => &#xE0;
+
+CYRILLIC SMALL LETTER ES: &#x441; => e1
+&#xE1; => &#xE1;
+
+CYRILLIC SMALL LETTER TE: &#x442; => e2
+&#xE2; => &#xE2;
+
+CYRILLIC SMALL LETTER U: &#x443; => e3
+&#xE3; => &#xE3;
+
+CYRILLIC SMALL LETTER EF: &#x444; => e4
+&#xE4; => &#xE4;
+
+CYRILLIC SMALL LETTER HA: &#x445; => e5
+&#xE5; => &#xE5;
+
+CYRILLIC SMALL LETTER TSE: &#x446; => e6
+&#xE6; => &#xE6;
+
+CYRILLIC SMALL LETTER CHE: &#x447; => e7
+&#xE7; => &#xE7;
+
+CYRILLIC SMALL LETTER SHA: &#x448; => e8
+&#xE8; => &#xE8;
+
+CYRILLIC SMALL LETTER SHCHA: &#x449; => e9
+&#xE9; => &#xE9;
+
+CYRILLIC SMALL LETTER HARD SIGN: &#x44A; => ea
+&#xEA; => &#xEA;
+
+CYRILLIC SMALL LETTER YERU: &#x44B; => eb
+&#xEB; => &#xEB;
+
+CYRILLIC SMALL LETTER SOFT SIGN: &#x44C; => ec
+&#xEC; => &#xEC;
+
+CYRILLIC SMALL LETTER E: &#x44D; => ed
+&#xED; => &#xED;
+
+CYRILLIC SMALL LETTER YU: &#x44E; => ee
+&#xEE; => &#xEE;
+
+CYRILLIC SMALL LETTER YA: &#x44F; => ef
+&#xEF; => &#xEF;
+
+NUMERO SIGN: &#x2116; => f0
+&#xF0; => &#xF0;
+
+CYRILLIC SMALL LETTER IO: &#x451; => 2623783435313b
+&#xF1; => &#xF1;
+
+CYRILLIC SMALL LETTER DJE: &#x452; => 2623783435323b
+&#xF2; => &#xF2;
+
+CYRILLIC SMALL LETTER GJE: &#x453; => 2623783435333b
+&#xF3; => &#xF3;
+
+CYRILLIC SMALL LETTER UKRAINIAN IE: &#x454; => 2623783435343b
+&#xF4; => &#xF4;
+
+CYRILLIC SMALL LETTER DZE: &#x455; => 2623783435353b
+&#xF5; => &#xF5;
+
+CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: &#x456; => 2623783435363b
+&#xF6; => &#xF6;
+
+CYRILLIC SMALL LETTER YI: &#x457; => 2623783435373b
+&#xF7; => &#xF7;
+
+CYRILLIC SMALL LETTER JE: &#x458; => 2623783435383b
+&#xF8; => &#xF8;
+
+CYRILLIC SMALL LETTER LJE: &#x459; => 2623783435393b
+&#xF9; => &#xF9;
+
+CYRILLIC SMALL LETTER NJE: &#x45A; => 2623783435413b
+&#xFA; => &#xFA;
+
+CYRILLIC SMALL LETTER TSHE: &#x45B; => 2623783435423b
+&#xFB; => &#xFB;
+
+CYRILLIC SMALL LETTER KJE: &#x45C; => 2623783435433b
+&#xFC; => &#xFC;
+
+SECTION SIGN: &#xA7; => fd
+&#xFD; => &#xFD;
+
+CYRILLIC SMALL LETTER SHORT U: &#x45E; => 2623783435453b
+&#xFE; => &#xFE;
+
+CYRILLIC SMALL LETTER DZHE: &#x45F; => 2623783435463b
+&#xFF; => &#xFF;
+
+
diff --git a/ext/standard/tests/strings/html_entity_decode_koi8-r.phpt b/ext/standard/tests/strings/html_entity_decode_koi8-r.phpt
new file mode 100644
index 0000000..cb7fc7d
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_koi8-r.phpt
@@ -0,0 +1,533 @@
+--TEST--
+Translation of HTML entities for encoding KOI8-R
+--FILE--
+<?php
+$arr = array(
+0x2500 => array(0x80, "BOX DRAWINGS LIGHT HORIZONTAL"),
+0x2502 => array(0x81, "BOX DRAWINGS LIGHT VERTICAL"),
+0x250C => array(0x82, "BOX DRAWINGS LIGHT DOWN AND RIGHT"),
+0x2510 => array(0x83, "BOX DRAWINGS LIGHT DOWN AND LEFT"),
+0x2514 => array(0x84, "BOX DRAWINGS LIGHT UP AND RIGHT"),
+0x2518 => array(0x85, "BOX DRAWINGS LIGHT UP AND LEFT"),
+0x251C => array(0x86, "BOX DRAWINGS LIGHT VERTICAL AND RIGHT"),
+0x2524 => array(0x87, "BOX DRAWINGS LIGHT VERTICAL AND LEFT"),
+0x252C => array(0x88, "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL"),
+0x2534 => array(0x89, "BOX DRAWINGS LIGHT UP AND HORIZONTAL"),
+0x253C => array(0x8A, "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL"),
+0x2580 => array(0x8B, "UPPER HALF BLOCK"),
+0x2584 => array(0x8C, "LOWER HALF BLOCK"),
+0x2588 => array(0x8D, "FULL BLOCK"),
+0x258C => array(0x8E, "LEFT HALF BLOCK"),
+0x2590 => array(0x8F, "RIGHT HALF BLOCK"),
+0x2591 => array(0x90, "LIGHT SHADE"),
+0x2592 => array(0x91, "MEDIUM SHADE"),
+0x2593 => array(0x92, "DARK SHADE"),
+0x2320 => array(0x93, "TOP HALF INTEGRAL"),
+0x25A0 => array(0x94, "BLACK SQUARE"),
+0x2219 => array(0x95, "BULLET OPERATOR"),
+0x221A => array(0x96, "SQUARE ROOT"),
+0x2248 => array(0x97, "ALMOST EQUAL TO"),
+0x2264 => array(0x98, "LESS-THAN OR EQUAL TO"),
+0x2265 => array(0x99, "GREATER-THAN OR EQUAL TO"),
+0x00A0 => array(0x9A, "NO-BREAK SPACE"),
+0x2321 => array(0x9B, "BOTTOM HALF INTEGRAL"),
+0x00B0 => array(0x9C, "DEGREE SIGN"),
+0x00B2 => array(0x9D, "SUPERSCRIPT TWO"),
+0x00B7 => array(0x9E, "MIDDLE DOT"),
+0x00F7 => array(0x9F, "DIVISION SIGN"),
+0x2550 => array(0xA0, "BOX DRAWINGS DOUBLE HORIZONTAL"),
+0x2551 => array(0xA1, "BOX DRAWINGS DOUBLE VERTICAL"),
+0x2552 => array(0xA2, "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE"),
+0x0451 => array(0xA3, "CYRILLIC SMALL LETTER IO"),
+0x2553 => array(0xA4, "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE"),
+0x2554 => array(0xA5, "BOX DRAWINGS DOUBLE DOWN AND RIGHT"),
+0x2555 => array(0xA6, "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE"),
+0x2556 => array(0xA7, "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE"),
+0x2557 => array(0xA8, "BOX DRAWINGS DOUBLE DOWN AND LEFT"),
+0x2558 => array(0xA9, "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE"),
+0x2559 => array(0xAA, "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE"),
+0x255A => array(0xAB, "BOX DRAWINGS DOUBLE UP AND RIGHT"),
+0x255B => array(0xAC, "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE"),
+0x255C => array(0xAD, "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE"),
+0x255D => array(0xAE, "BOX DRAWINGS DOUBLE UP AND LEFT"),
+0x255E => array(0xAF, "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE"),
+0x255F => array(0xB0, "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE"),
+0x2560 => array(0xB1, "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT"),
+0x2561 => array(0xB2, "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE"),
+0x0401 => array(0xB3, "CYRILLIC CAPITAL LETTER IO"),
+0x2562 => array(0xB4, "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE"),
+0x2563 => array(0xB5, "BOX DRAWINGS DOUBLE VERTICAL AND LEFT"),
+0x2564 => array(0xB6, "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE"),
+0x2565 => array(0xB7, "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE"),
+0x2566 => array(0xB8, "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL"),
+0x2567 => array(0xB9, "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE"),
+0x2568 => array(0xBA, "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE"),
+0x2569 => array(0xBB, "BOX DRAWINGS DOUBLE UP AND HORIZONTAL"),
+0x256A => array(0xBC, "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE"),
+0x256B => array(0xBD, "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE"),
+0x256C => array(0xBE, "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL"),
+0x00A9 => array(0xBF, "COPYRIGHT SIGN"),
+0x044E => array(0xC0, "CYRILLIC SMALL LETTER YU"),
+0x0430 => array(0xC1, "CYRILLIC SMALL LETTER A"),
+0x0431 => array(0xC2, "CYRILLIC SMALL LETTER BE"),
+0x0446 => array(0xC3, "CYRILLIC SMALL LETTER TSE"),
+0x0434 => array(0xC4, "CYRILLIC SMALL LETTER DE"),
+0x0435 => array(0xC5, "CYRILLIC SMALL LETTER IE"),
+0x0444 => array(0xC6, "CYRILLIC SMALL LETTER EF"),
+0x0433 => array(0xC7, "CYRILLIC SMALL LETTER GHE"),
+0x0445 => array(0xC8, "CYRILLIC SMALL LETTER HA"),
+0x0438 => array(0xC9, "CYRILLIC SMALL LETTER I"),
+0x0439 => array(0xCA, "CYRILLIC SMALL LETTER SHORT I"),
+0x043A => array(0xCB, "CYRILLIC SMALL LETTER KA"),
+0x043B => array(0xCC, "CYRILLIC SMALL LETTER EL"),
+0x043C => array(0xCD, "CYRILLIC SMALL LETTER EM"),
+0x043D => array(0xCE, "CYRILLIC SMALL LETTER EN"),
+0x043E => array(0xCF, "CYRILLIC SMALL LETTER O"),
+0x043F => array(0xD0, "CYRILLIC SMALL LETTER PE"),
+0x044F => array(0xD1, "CYRILLIC SMALL LETTER YA"),
+0x0440 => array(0xD2, "CYRILLIC SMALL LETTER ER"),
+0x0441 => array(0xD3, "CYRILLIC SMALL LETTER ES"),
+0x0442 => array(0xD4, "CYRILLIC SMALL LETTER TE"),
+0x0443 => array(0xD5, "CYRILLIC SMALL LETTER U"),
+0x0436 => array(0xD6, "CYRILLIC SMALL LETTER ZHE"),
+0x0432 => array(0xD7, "CYRILLIC SMALL LETTER VE"),
+0x044C => array(0xD8, "CYRILLIC SMALL LETTER SOFT SIGN"),
+0x044B => array(0xD9, "CYRILLIC SMALL LETTER YERU"),
+0x0437 => array(0xDA, "CYRILLIC SMALL LETTER ZE"),
+0x0448 => array(0xDB, "CYRILLIC SMALL LETTER SHA"),
+0x044D => array(0xDC, "CYRILLIC SMALL LETTER E"),
+0x0449 => array(0xDD, "CYRILLIC SMALL LETTER SHCHA"),
+0x0447 => array(0xDE, "CYRILLIC SMALL LETTER CHE"),
+0x044A => array(0xDF, "CYRILLIC SMALL LETTER HARD SIGN"),
+0x042E => array(0xE0, "CYRILLIC CAPITAL LETTER YU"),
+0x0410 => array(0xE1, "CYRILLIC CAPITAL LETTER A"),
+0x0411 => array(0xE2, "CYRILLIC CAPITAL LETTER BE"),
+0x0426 => array(0xE3, "CYRILLIC CAPITAL LETTER TSE"),
+0x0414 => array(0xE4, "CYRILLIC CAPITAL LETTER DE"),
+0x0415 => array(0xE5, "CYRILLIC CAPITAL LETTER IE"),
+0x0424 => array(0xE6, "CYRILLIC CAPITAL LETTER EF"),
+0x0413 => array(0xE7, "CYRILLIC CAPITAL LETTER GHE"),
+0x0425 => array(0xE8, "CYRILLIC CAPITAL LETTER HA"),
+0x0418 => array(0xE9, "CYRILLIC CAPITAL LETTER I"),
+0x0419 => array(0xEA, "CYRILLIC CAPITAL LETTER SHORT I"),
+0x041A => array(0xEB, "CYRILLIC CAPITAL LETTER KA"),
+0x041B => array(0xEC, "CYRILLIC CAPITAL LETTER EL"),
+0x041C => array(0xED, "CYRILLIC CAPITAL LETTER EM"),
+0x041D => array(0xEE, "CYRILLIC CAPITAL LETTER EN"),
+0x041E => array(0xEF, "CYRILLIC CAPITAL LETTER O"),
+0x041F => array(0xF0, "CYRILLIC CAPITAL LETTER PE"),
+0x042F => array(0xF1, "CYRILLIC CAPITAL LETTER YA"),
+0x0420 => array(0xF2, "CYRILLIC CAPITAL LETTER ER"),
+0x0421 => array(0xF3, "CYRILLIC CAPITAL LETTER ES"),
+0x0422 => array(0xF4, "CYRILLIC CAPITAL LETTER TE"),
+0x0423 => array(0xF5, "CYRILLIC CAPITAL LETTER U"),
+0x0416 => array(0xF6, "CYRILLIC CAPITAL LETTER ZHE"),
+0x0412 => array(0xF7, "CYRILLIC CAPITAL LETTER VE"),
+0x042C => array(0xF8, "CYRILLIC CAPITAL LETTER SOFT SIGN"),
+0x042B => array(0xF9, "CYRILLIC CAPITAL LETTER YERU"),
+0x0417 => array(0xFA, "CYRILLIC CAPITAL LETTER ZE"),
+0x0428 => array(0xFB, "CYRILLIC CAPITAL LETTER SHA"),
+0x042D => array(0xFC, "CYRILLIC CAPITAL LETTER E"),
+0x0429 => array(0xFD, "CYRILLIC CAPITAL LETTER SHCHA"),
+0x0427 => array(0xFE, "CYRILLIC CAPITAL LETTER CHE"),
+0x042A => array(0xFF, "CYRILLIC CAPITAL LETTER HARD SIGN"),
+);
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'KOI8-R');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'KOI8-R');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+BOX DRAWINGS LIGHT HORIZONTAL: &#x2500; => 80
+&#x80; => &#x80;
+
+BOX DRAWINGS LIGHT VERTICAL: &#x2502; => 81
+&#x81; => &#x81;
+
+BOX DRAWINGS LIGHT DOWN AND RIGHT: &#x250C; => 82
+&#x82; => &#x82;
+
+BOX DRAWINGS LIGHT DOWN AND LEFT: &#x2510; => 83
+&#x83; => &#x83;
+
+BOX DRAWINGS LIGHT UP AND RIGHT: &#x2514; => 84
+&#x84; => &#x84;
+
+BOX DRAWINGS LIGHT UP AND LEFT: &#x2518; => 85
+&#x85; => &#x85;
+
+BOX DRAWINGS LIGHT VERTICAL AND RIGHT: &#x251C; => 86
+&#x86; => &#x86;
+
+BOX DRAWINGS LIGHT VERTICAL AND LEFT: &#x2524; => 87
+&#x87; => &#x87;
+
+BOX DRAWINGS LIGHT DOWN AND HORIZONTAL: &#x252C; => 88
+&#x88; => &#x88;
+
+BOX DRAWINGS LIGHT UP AND HORIZONTAL: &#x2534; => 89
+&#x89; => &#x89;
+
+BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL: &#x253C; => 8a
+&#x8A; => &#x8A;
+
+UPPER HALF BLOCK: &#x2580; => 8b
+&#x8B; => &#x8B;
+
+LOWER HALF BLOCK: &#x2584; => 8c
+&#x8C; => &#x8C;
+
+FULL BLOCK: &#x2588; => 8d
+&#x8D; => &#x8D;
+
+LEFT HALF BLOCK: &#x258C; => 8e
+&#x8E; => &#x8E;
+
+RIGHT HALF BLOCK: &#x2590; => 8f
+&#x8F; => &#x8F;
+
+LIGHT SHADE: &#x2591; => 90
+&#x90; => &#x90;
+
+MEDIUM SHADE: &#x2592; => 91
+&#x91; => &#x91;
+
+DARK SHADE: &#x2593; => 92
+&#x92; => &#x92;
+
+TOP HALF INTEGRAL: &#x2320; => 93
+&#x93; => &#x93;
+
+BLACK SQUARE: &#x25A0; => 94
+&#x94; => &#x94;
+
+BULLET OPERATOR: &#x2219; => 95
+&#x95; => &#x95;
+
+SQUARE ROOT: &#x221A; => 96
+&#x96; => &#x96;
+
+ALMOST EQUAL TO: &#x2248; => 97
+&#x97; => &#x97;
+
+LESS-THAN OR EQUAL TO: &#x2264; => 98
+&#x98; => &#x98;
+
+GREATER-THAN OR EQUAL TO: &#x2265; => 99
+&#x99; => &#x99;
+
+NO-BREAK SPACE: &#xA0; => 9a
+&#x9A; => &#x9A;
+
+BOTTOM HALF INTEGRAL: &#x2321; => 9b
+&#x9B; => &#x9B;
+
+DEGREE SIGN: &#xB0; => 9c
+&#x9C; => &#x9C;
+
+SUPERSCRIPT TWO: &#xB2; => 9d
+&#x9D; => &#x9D;
+
+MIDDLE DOT: &#xB7; => 9e
+&#x9E; => &#x9E;
+
+DIVISION SIGN: &#xF7; => 9f
+&#x9F; => &#x9F;
+
+BOX DRAWINGS DOUBLE HORIZONTAL: &#x2550; => a0
+&#xA0; => 9a
+
+BOX DRAWINGS DOUBLE VERTICAL: &#x2551; => a1
+&#xA1; => &#xA1;
+
+BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE: &#x2552; => a2
+&#xA2; => &#xA2;
+
+CYRILLIC SMALL LETTER IO: &#x451; => a3
+&#xA3; => &#xA3;
+
+BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE: &#x2553; => a4
+&#xA4; => &#xA4;
+
+BOX DRAWINGS DOUBLE DOWN AND RIGHT: &#x2554; => a5
+&#xA5; => &#xA5;
+
+BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE: &#x2555; => a6
+&#xA6; => &#xA6;
+
+BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE: &#x2556; => a7
+&#xA7; => &#xA7;
+
+BOX DRAWINGS DOUBLE DOWN AND LEFT: &#x2557; => a8
+&#xA8; => &#xA8;
+
+BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE: &#x2558; => a9
+&#xA9; => bf
+
+BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE: &#x2559; => aa
+&#xAA; => &#xAA;
+
+BOX DRAWINGS DOUBLE UP AND RIGHT: &#x255A; => ab
+&#xAB; => &#xAB;
+
+BOX DRAWINGS UP SINGLE AND LEFT DOUBLE: &#x255B; => ac
+&#xAC; => &#xAC;
+
+BOX DRAWINGS UP DOUBLE AND LEFT SINGLE: &#x255C; => ad
+&#xAD; => &#xAD;
+
+BOX DRAWINGS DOUBLE UP AND LEFT: &#x255D; => ae
+&#xAE; => &#xAE;
+
+BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE: &#x255E; => af
+&#xAF; => &#xAF;
+
+BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE: &#x255F; => b0
+&#xB0; => 9c
+
+BOX DRAWINGS DOUBLE VERTICAL AND RIGHT: &#x2560; => b1
+&#xB1; => &#xB1;
+
+BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE: &#x2561; => b2
+&#xB2; => 9d
+
+CYRILLIC CAPITAL LETTER IO: &#x401; => b3
+&#xB3; => &#xB3;
+
+BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE: &#x2562; => b4
+&#xB4; => &#xB4;
+
+BOX DRAWINGS DOUBLE VERTICAL AND LEFT: &#x2563; => b5
+&#xB5; => &#xB5;
+
+BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE: &#x2564; => b6
+&#xB6; => &#xB6;
+
+BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE: &#x2565; => b7
+&#xB7; => 9e
+
+BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL: &#x2566; => b8
+&#xB8; => &#xB8;
+
+BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE: &#x2567; => b9
+&#xB9; => &#xB9;
+
+BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE: &#x2568; => ba
+&#xBA; => &#xBA;
+
+BOX DRAWINGS DOUBLE UP AND HORIZONTAL: &#x2569; => bb
+&#xBB; => &#xBB;
+
+BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE: &#x256A; => bc
+&#xBC; => &#xBC;
+
+BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE: &#x256B; => bd
+&#xBD; => &#xBD;
+
+BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: &#x256C; => be
+&#xBE; => &#xBE;
+
+COPYRIGHT SIGN: &#xA9; => bf
+&#xBF; => &#xBF;
+
+CYRILLIC SMALL LETTER YU: &#x44E; => c0
+&#xC0; => &#xC0;
+
+CYRILLIC SMALL LETTER A: &#x430; => c1
+&#xC1; => &#xC1;
+
+CYRILLIC SMALL LETTER BE: &#x431; => c2
+&#xC2; => &#xC2;
+
+CYRILLIC SMALL LETTER TSE: &#x446; => c3
+&#xC3; => &#xC3;
+
+CYRILLIC SMALL LETTER DE: &#x434; => c4
+&#xC4; => &#xC4;
+
+CYRILLIC SMALL LETTER IE: &#x435; => c5
+&#xC5; => &#xC5;
+
+CYRILLIC SMALL LETTER EF: &#x444; => c6
+&#xC6; => &#xC6;
+
+CYRILLIC SMALL LETTER GHE: &#x433; => c7
+&#xC7; => &#xC7;
+
+CYRILLIC SMALL LETTER HA: &#x445; => c8
+&#xC8; => &#xC8;
+
+CYRILLIC SMALL LETTER I: &#x438; => c9
+&#xC9; => &#xC9;
+
+CYRILLIC SMALL LETTER SHORT I: &#x439; => ca
+&#xCA; => &#xCA;
+
+CYRILLIC SMALL LETTER KA: &#x43A; => cb
+&#xCB; => &#xCB;
+
+CYRILLIC SMALL LETTER EL: &#x43B; => cc
+&#xCC; => &#xCC;
+
+CYRILLIC SMALL LETTER EM: &#x43C; => cd
+&#xCD; => &#xCD;
+
+CYRILLIC SMALL LETTER EN: &#x43D; => ce
+&#xCE; => &#xCE;
+
+CYRILLIC SMALL LETTER O: &#x43E; => cf
+&#xCF; => &#xCF;
+
+CYRILLIC SMALL LETTER PE: &#x43F; => d0
+&#xD0; => &#xD0;
+
+CYRILLIC SMALL LETTER YA: &#x44F; => d1
+&#xD1; => &#xD1;
+
+CYRILLIC SMALL LETTER ER: &#x440; => d2
+&#xD2; => &#xD2;
+
+CYRILLIC SMALL LETTER ES: &#x441; => d3
+&#xD3; => &#xD3;
+
+CYRILLIC SMALL LETTER TE: &#x442; => d4
+&#xD4; => &#xD4;
+
+CYRILLIC SMALL LETTER U: &#x443; => d5
+&#xD5; => &#xD5;
+
+CYRILLIC SMALL LETTER ZHE: &#x436; => d6
+&#xD6; => &#xD6;
+
+CYRILLIC SMALL LETTER VE: &#x432; => d7
+&#xD7; => &#xD7;
+
+CYRILLIC SMALL LETTER SOFT SIGN: &#x44C; => d8
+&#xD8; => &#xD8;
+
+CYRILLIC SMALL LETTER YERU: &#x44B; => d9
+&#xD9; => &#xD9;
+
+CYRILLIC SMALL LETTER ZE: &#x437; => da
+&#xDA; => &#xDA;
+
+CYRILLIC SMALL LETTER SHA: &#x448; => db
+&#xDB; => &#xDB;
+
+CYRILLIC SMALL LETTER E: &#x44D; => dc
+&#xDC; => &#xDC;
+
+CYRILLIC SMALL LETTER SHCHA: &#x449; => dd
+&#xDD; => &#xDD;
+
+CYRILLIC SMALL LETTER CHE: &#x447; => de
+&#xDE; => &#xDE;
+
+CYRILLIC SMALL LETTER HARD SIGN: &#x44A; => df
+&#xDF; => &#xDF;
+
+CYRILLIC CAPITAL LETTER YU: &#x42E; => e0
+&#xE0; => &#xE0;
+
+CYRILLIC CAPITAL LETTER A: &#x410; => e1
+&#xE1; => &#xE1;
+
+CYRILLIC CAPITAL LETTER BE: &#x411; => e2
+&#xE2; => &#xE2;
+
+CYRILLIC CAPITAL LETTER TSE: &#x426; => e3
+&#xE3; => &#xE3;
+
+CYRILLIC CAPITAL LETTER DE: &#x414; => e4
+&#xE4; => &#xE4;
+
+CYRILLIC CAPITAL LETTER IE: &#x415; => e5
+&#xE5; => &#xE5;
+
+CYRILLIC CAPITAL LETTER EF: &#x424; => e6
+&#xE6; => &#xE6;
+
+CYRILLIC CAPITAL LETTER GHE: &#x413; => e7
+&#xE7; => &#xE7;
+
+CYRILLIC CAPITAL LETTER HA: &#x425; => e8
+&#xE8; => &#xE8;
+
+CYRILLIC CAPITAL LETTER I: &#x418; => e9
+&#xE9; => &#xE9;
+
+CYRILLIC CAPITAL LETTER SHORT I: &#x419; => ea
+&#xEA; => &#xEA;
+
+CYRILLIC CAPITAL LETTER KA: &#x41A; => eb
+&#xEB; => &#xEB;
+
+CYRILLIC CAPITAL LETTER EL: &#x41B; => ec
+&#xEC; => &#xEC;
+
+CYRILLIC CAPITAL LETTER EM: &#x41C; => ed
+&#xED; => &#xED;
+
+CYRILLIC CAPITAL LETTER EN: &#x41D; => ee
+&#xEE; => &#xEE;
+
+CYRILLIC CAPITAL LETTER O: &#x41E; => ef
+&#xEF; => &#xEF;
+
+CYRILLIC CAPITAL LETTER PE: &#x41F; => f0
+&#xF0; => &#xF0;
+
+CYRILLIC CAPITAL LETTER YA: &#x42F; => f1
+&#xF1; => &#xF1;
+
+CYRILLIC CAPITAL LETTER ER: &#x420; => f2
+&#xF2; => &#xF2;
+
+CYRILLIC CAPITAL LETTER ES: &#x421; => f3
+&#xF3; => &#xF3;
+
+CYRILLIC CAPITAL LETTER TE: &#x422; => f4
+&#xF4; => &#xF4;
+
+CYRILLIC CAPITAL LETTER U: &#x423; => f5
+&#xF5; => &#xF5;
+
+CYRILLIC CAPITAL LETTER ZHE: &#x416; => f6
+&#xF6; => &#xF6;
+
+CYRILLIC CAPITAL LETTER VE: &#x412; => f7
+&#xF7; => 9f
+
+CYRILLIC CAPITAL LETTER SOFT SIGN: &#x42C; => f8
+&#xF8; => &#xF8;
+
+CYRILLIC CAPITAL LETTER YERU: &#x42B; => f9
+&#xF9; => &#xF9;
+
+CYRILLIC CAPITAL LETTER ZE: &#x417; => fa
+&#xFA; => &#xFA;
+
+CYRILLIC CAPITAL LETTER SHA: &#x428; => fb
+&#xFB; => &#xFB;
+
+CYRILLIC CAPITAL LETTER E: &#x42D; => fc
+&#xFC; => &#xFC;
+
+CYRILLIC CAPITAL LETTER SHCHA: &#x429; => fd
+&#xFD; => &#xFD;
+
+CYRILLIC CAPITAL LETTER CHE: &#x427; => fe
+&#xFE; => &#xFE;
+
+CYRILLIC CAPITAL LETTER HARD SIGN: &#x42A; => ff
+&#xFF; => &#xFF;
+
+
diff --git a/ext/standard/tests/strings/html_entity_decode_macroman.phpt b/ext/standard/tests/strings/html_entity_decode_macroman.phpt
new file mode 100644
index 0000000..4691bcf
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_macroman.phpt
@@ -0,0 +1,540 @@
+--TEST--
+Translation of HTML entities for encoding MacRoman
+--FILE--
+<?php
+$arr = array(
+0x00C4 => array(0x80, "LATIN CAPITAL LETTER A WITH DIAERESIS"),
+0x00C5 => array(0x81, "LATIN CAPITAL LETTER A WITH RING ABOVE"),
+0x00C7 => array(0x82, "LATIN CAPITAL LETTER C WITH CEDILLA"),
+0x00C9 => array(0x83, "LATIN CAPITAL LETTER E WITH ACUTE"),
+0x00D1 => array(0x84, "LATIN CAPITAL LETTER N WITH TILDE"),
+0x00D6 => array(0x85, "LATIN CAPITAL LETTER O WITH DIAERESIS"),
+0x00DC => array(0x86, "LATIN CAPITAL LETTER U WITH DIAERESIS"),
+0x00E1 => array(0x87, "LATIN SMALL LETTER A WITH ACUTE"),
+0x00E0 => array(0x88, "LATIN SMALL LETTER A WITH GRAVE"),
+0x00E2 => array(0x89, "LATIN SMALL LETTER A WITH CIRCUMFLEX"),
+0x00E4 => array(0x8A, "LATIN SMALL LETTER A WITH DIAERESIS"),
+0x00E3 => array(0x8B, "LATIN SMALL LETTER A WITH TILDE"),
+0x00E5 => array(0x8C, "LATIN SMALL LETTER A WITH RING ABOVE"),
+0x00E7 => array(0x8D, "LATIN SMALL LETTER C WITH CEDILLA"),
+0x00E9 => array(0x8E, "LATIN SMALL LETTER E WITH ACUTE"),
+0x00E8 => array(0x8F, "LATIN SMALL LETTER E WITH GRAVE"),
+0x00EA => array(0x90, "LATIN SMALL LETTER E WITH CIRCUMFLEX"),
+0x00EB => array(0x91, "LATIN SMALL LETTER E WITH DIAERESIS"),
+0x00ED => array(0x92, "LATIN SMALL LETTER I WITH ACUTE"),
+0x00EC => array(0x93, "LATIN SMALL LETTER I WITH GRAVE"),
+0x00EE => array(0x94, "LATIN SMALL LETTER I WITH CIRCUMFLEX"),
+0x00EF => array(0x95, "LATIN SMALL LETTER I WITH DIAERESIS"),
+0x00F1 => array(0x96, "LATIN SMALL LETTER N WITH TILDE"),
+0x00F3 => array(0x97, "LATIN SMALL LETTER O WITH ACUTE"),
+0x00F2 => array(0x98, "LATIN SMALL LETTER O WITH GRAVE"),
+0x00F4 => array(0x99, "LATIN SMALL LETTER O WITH CIRCUMFLEX"),
+0x00F6 => array(0x9A, "LATIN SMALL LETTER O WITH DIAERESIS"),
+0x00F5 => array(0x9B, "LATIN SMALL LETTER O WITH TILDE"),
+0x00FA => array(0x9C, "LATIN SMALL LETTER U WITH ACUTE"),
+0x00F9 => array(0x9D, "LATIN SMALL LETTER U WITH GRAVE"),
+0x00FB => array(0x9E, "LATIN SMALL LETTER U WITH CIRCUMFLEX"),
+0x00FC => array(0x9F, "LATIN SMALL LETTER U WITH DIAERESIS"),
+0x2020 => array(0xA0, "DAGGER"),
+0x00B0 => array(0xA1, "DEGREE SIGN"),
+0x00A2 => array(0xA2, "CENT SIGN"),
+0x00A3 => array(0xA3, "POUND SIGN"),
+0x00A7 => array(0xA4, "SECTION SIGN"),
+0x2022 => array(0xA5, "BULLET"),
+0x00B6 => array(0xA6, "PILCROW SIGN"),
+0x00DF => array(0xA7, "LATIN SMALL LETTER SHARP S"),
+0x00AE => array(0xA8, "REGISTERED SIGN"),
+0x00A9 => array(0xA9, "COPYRIGHT SIGN"),
+0x2122 => array(0xAA, "TRADE MARK SIGN"),
+0x00B4 => array(0xAB, "ACUTE ACCENT"),
+0x00A8 => array(0xAC, "DIAERESIS"),
+0x2260 => array(0xAD, "NOT EQUAL TO"),
+0x00C6 => array(0xAE, "LATIN CAPITAL LETTER AE"),
+0x00D8 => array(0xAF, "LATIN CAPITAL LETTER O WITH STROKE"),
+0x221E => array(0xB0, "INFINITY"),
+0x00B1 => array(0xB1, "PLUS-MINUS SIGN"),
+0x2264 => array(0xB2, "LESS-THAN OR EQUAL TO"),
+0x2265 => array(0xB3, "GREATER-THAN OR EQUAL TO"),
+0x00A5 => array(0xB4, "YEN SIGN"),
+0x00B5 => array(0xB5, "MICRO SIGN"),
+0x2202 => array(0xB6, "PARTIAL DIFFERENTIAL"),
+0x2211 => array(0xB7, "N-ARY SUMMATION"),
+0x220F => array(0xB8, "N-ARY PRODUCT"),
+0x03C0 => array(0xB9, "GREEK SMALL LETTER PI"),
+0x222B => array(0xBA, "INTEGRAL"),
+0x00AA => array(0xBB, "FEMININE ORDINAL INDICATOR"),
+0x00BA => array(0xBC, "MASCULINE ORDINAL INDICATOR"),
+0x03A9 => array(0xBD, "GREEK CAPITAL LETTER OMEGA"),
+0x00E6 => array(0xBE, "LATIN SMALL LETTER AE"),
+0x00F8 => array(0xBF, "LATIN SMALL LETTER O WITH STROKE"),
+0x00BF => array(0xC0, "INVERTED QUESTION MARK"),
+0x00A1 => array(0xC1, "INVERTED EXCLAMATION MARK"),
+0x00AC => array(0xC2, "NOT SIGN"),
+0x221A => array(0xC3, "SQUARE ROOT"),
+0x0192 => array(0xC4, "LATIN SMALL LETTER F WITH HOOK"),
+0x2248 => array(0xC5, "ALMOST EQUAL TO"),
+0x2206 => array(0xC6, "INCREMENT"),
+0x00AB => array(0xC7, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"),
+0x00BB => array(0xC8, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"),
+0x2026 => array(0xC9, "HORIZONTAL ELLIPSIS"),
+0x00A0 => array(0xCA, "NO-BREAK SPACE"),
+0x00C0 => array(0xCB, "LATIN CAPITAL LETTER A WITH GRAVE"),
+0x00C3 => array(0xCC, "LATIN CAPITAL LETTER A WITH TILDE"),
+0x00D5 => array(0xCD, "LATIN CAPITAL LETTER O WITH TILDE"),
+0x0152 => array(0xCE, "LATIN CAPITAL LIGATURE OE"),
+0x0153 => array(0xCF, "LATIN SMALL LIGATURE OE"),
+0x2013 => array(0xD0, "EN DASH"),
+0x2014 => array(0xD1, "EM DASH"),
+0x201C => array(0xD2, "LEFT DOUBLE QUOTATION MARK"),
+0x201D => array(0xD3, "RIGHT DOUBLE QUOTATION MARK"),
+0x2018 => array(0xD4, "LEFT SINGLE QUOTATION MARK"),
+0x2019 => array(0xD5, "RIGHT SINGLE QUOTATION MARK"),
+0x00F7 => array(0xD6, "DIVISION SIGN"),
+0x25CA => array(0xD7, "LOZENGE"),
+0x00FF => array(0xD8, "LATIN SMALL LETTER Y WITH DIAERESIS"),
+0x0178 => array(0xD9, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
+0x2044 => array(0xDA, "FRACTION SLASH"),
+0x20AC => array(0xDB, "EURO SIGN"),
+0x2039 => array(0xDC, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
+0x203A => array(0xDD, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
+0xFB01 => array(0xDE, "LATIN SMALL LIGATURE FI"),
+0xFB02 => array(0xDF, "LATIN SMALL LIGATURE FL"),
+0x2021 => array(0xE0, "DOUBLE DAGGER"),
+0x00B7 => array(0xE1, "MIDDLE DOT"),
+0x201A => array(0xE2, "SINGLE LOW-9 QUOTATION MARK"),
+0x201E => array(0xE3, "DOUBLE LOW-9 QUOTATION MARK"),
+0x2030 => array(0xE4, "PER MILLE SIGN"),
+0x00C2 => array(0xE5, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"),
+0x00CA => array(0xE6, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"),
+0x00C1 => array(0xE7, "LATIN CAPITAL LETTER A WITH ACUTE"),
+0x00CB => array(0xE8, "LATIN CAPITAL LETTER E WITH DIAERESIS"),
+0x00C8 => array(0xE9, "LATIN CAPITAL LETTER E WITH GRAVE"),
+0x00CD => array(0xEA, "LATIN CAPITAL LETTER I WITH ACUTE"),
+0x00CE => array(0xEB, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"),
+0x00CF => array(0xEC, "LATIN CAPITAL LETTER I WITH DIAERESIS"),
+0x00CC => array(0xED, "LATIN CAPITAL LETTER I WITH GRAVE"),
+0x00D3 => array(0xEE, "LATIN CAPITAL LETTER O WITH ACUTE"),
+0x00D4 => array(0xEF, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"),
+0xF8FF => array(0xF0, "Apple logo"),
+0x00D2 => array(0xF1, "LATIN CAPITAL LETTER O WITH GRAVE"),
+0x00DA => array(0xF2, "LATIN CAPITAL LETTER U WITH ACUTE"),
+0x00DB => array(0xF3, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"),
+0x00D9 => array(0xF4, "LATIN CAPITAL LETTER U WITH GRAVE"),
+0x0131 => array(0xF5, "LATIN SMALL LETTER DOTLESS I"),
+0x02C6 => array(0xF6, "MODIFIER LETTER CIRCUMFLEX ACCENT"),
+0x02DC => array(0xF7, "SMALL TILDE"),
+0x00AF => array(0xF8, "MACRON"),
+0x02D8 => array(0xF9, "BREVE"),
+0x02D9 => array(0xFA, "DOT ABOVE"),
+0x02DA => array(0xFB, "RING ABOVE"),
+0x00B8 => array(0xFC, "CEDILLA"),
+0x02DD => array(0xFD, "DOUBLE ACUTE ACCENT"),
+0x02DB => array(0xFE, "OGONEK"),
+0x02C7 => array(0xFF, "CARON"),
+);
+
+$res = html_entity_decode("&#x7F;", ENT_QUOTES, 'MacRoman');
+echo "Special test for &#x7F; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+Special test for &#x7F; (shouldn't decode):
+&#x7F;
+
+LATIN CAPITAL LETTER A WITH DIAERESIS: &#xC4; => 80
+&#x80; => &#x80;
+
+LATIN CAPITAL LETTER A WITH RING ABOVE: &#xC5; => 81
+&#x81; => &#x81;
+
+LATIN CAPITAL LETTER C WITH CEDILLA: &#xC7; => 82
+&#x82; => &#x82;
+
+LATIN CAPITAL LETTER E WITH ACUTE: &#xC9; => 83
+&#x83; => &#x83;
+
+LATIN CAPITAL LETTER N WITH TILDE: &#xD1; => 84
+&#x84; => &#x84;
+
+LATIN CAPITAL LETTER O WITH DIAERESIS: &#xD6; => 85
+&#x85; => &#x85;
+
+LATIN CAPITAL LETTER U WITH DIAERESIS: &#xDC; => 86
+&#x86; => &#x86;
+
+LATIN SMALL LETTER A WITH ACUTE: &#xE1; => 87
+&#x87; => &#x87;
+
+LATIN SMALL LETTER A WITH GRAVE: &#xE0; => 88
+&#x88; => &#x88;
+
+LATIN SMALL LETTER A WITH CIRCUMFLEX: &#xE2; => 89
+&#x89; => &#x89;
+
+LATIN SMALL LETTER A WITH DIAERESIS: &#xE4; => 8a
+&#x8A; => &#x8A;
+
+LATIN SMALL LETTER A WITH TILDE: &#xE3; => 8b
+&#x8B; => &#x8B;
+
+LATIN SMALL LETTER A WITH RING ABOVE: &#xE5; => 8c
+&#x8C; => &#x8C;
+
+LATIN SMALL LETTER C WITH CEDILLA: &#xE7; => 8d
+&#x8D; => &#x8D;
+
+LATIN SMALL LETTER E WITH ACUTE: &#xE9; => 8e
+&#x8E; => &#x8E;
+
+LATIN SMALL LETTER E WITH GRAVE: &#xE8; => 8f
+&#x8F; => &#x8F;
+
+LATIN SMALL LETTER E WITH CIRCUMFLEX: &#xEA; => 90
+&#x90; => &#x90;
+
+LATIN SMALL LETTER E WITH DIAERESIS: &#xEB; => 91
+&#x91; => &#x91;
+
+LATIN SMALL LETTER I WITH ACUTE: &#xED; => 92
+&#x92; => &#x92;
+
+LATIN SMALL LETTER I WITH GRAVE: &#xEC; => 93
+&#x93; => &#x93;
+
+LATIN SMALL LETTER I WITH CIRCUMFLEX: &#xEE; => 94
+&#x94; => &#x94;
+
+LATIN SMALL LETTER I WITH DIAERESIS: &#xEF; => 95
+&#x95; => &#x95;
+
+LATIN SMALL LETTER N WITH TILDE: &#xF1; => 96
+&#x96; => &#x96;
+
+LATIN SMALL LETTER O WITH ACUTE: &#xF3; => 97
+&#x97; => &#x97;
+
+LATIN SMALL LETTER O WITH GRAVE: &#xF2; => 98
+&#x98; => &#x98;
+
+LATIN SMALL LETTER O WITH CIRCUMFLEX: &#xF4; => 99
+&#x99; => &#x99;
+
+LATIN SMALL LETTER O WITH DIAERESIS: &#xF6; => 9a
+&#x9A; => &#x9A;
+
+LATIN SMALL LETTER O WITH TILDE: &#xF5; => 9b
+&#x9B; => &#x9B;
+
+LATIN SMALL LETTER U WITH ACUTE: &#xFA; => 9c
+&#x9C; => &#x9C;
+
+LATIN SMALL LETTER U WITH GRAVE: &#xF9; => 9d
+&#x9D; => &#x9D;
+
+LATIN SMALL LETTER U WITH CIRCUMFLEX: &#xFB; => 9e
+&#x9E; => &#x9E;
+
+LATIN SMALL LETTER U WITH DIAERESIS: &#xFC; => 9f
+&#x9F; => &#x9F;
+
+DAGGER: &#x2020; => a0
+&#xA0; => ca
+
+DEGREE SIGN: &#xB0; => a1
+&#xA1; => c1
+
+CENT SIGN: &#xA2; => a2
+&#xA2; => a2
+
+POUND SIGN: &#xA3; => a3
+&#xA3; => a3
+
+SECTION SIGN: &#xA7; => a4
+&#xA4; => &#xA4;
+
+BULLET: &#x2022; => a5
+&#xA5; => b4
+
+PILCROW SIGN: &#xB6; => a6
+&#xA6; => &#xA6;
+
+LATIN SMALL LETTER SHARP S: &#xDF; => a7
+&#xA7; => a4
+
+REGISTERED SIGN: &#xAE; => a8
+&#xA8; => ac
+
+COPYRIGHT SIGN: &#xA9; => a9
+&#xA9; => a9
+
+TRADE MARK SIGN: &#x2122; => aa
+&#xAA; => bb
+
+ACUTE ACCENT: &#xB4; => ab
+&#xAB; => c7
+
+DIAERESIS: &#xA8; => ac
+&#xAC; => c2
+
+NOT EQUAL TO: &#x2260; => ad
+&#xAD; => &#xAD;
+
+LATIN CAPITAL LETTER AE: &#xC6; => ae
+&#xAE; => a8
+
+LATIN CAPITAL LETTER O WITH STROKE: &#xD8; => af
+&#xAF; => f8
+
+INFINITY: &#x221E; => b0
+&#xB0; => a1
+
+PLUS-MINUS SIGN: &#xB1; => b1
+&#xB1; => b1
+
+LESS-THAN OR EQUAL TO: &#x2264; => b2
+&#xB2; => &#xB2;
+
+GREATER-THAN OR EQUAL TO: &#x2265; => b3
+&#xB3; => &#xB3;
+
+YEN SIGN: &#xA5; => b4
+&#xB4; => ab
+
+MICRO SIGN: &#xB5; => b5
+&#xB5; => b5
+
+PARTIAL DIFFERENTIAL: &#x2202; => b6
+&#xB6; => a6
+
+N-ARY SUMMATION: &#x2211; => b7
+&#xB7; => e1
+
+N-ARY PRODUCT: &#x220F; => b8
+&#xB8; => fc
+
+GREEK SMALL LETTER PI: &#x3C0; => b9
+&#xB9; => &#xB9;
+
+INTEGRAL: &#x222B; => ba
+&#xBA; => bc
+
+FEMININE ORDINAL INDICATOR: &#xAA; => bb
+&#xBB; => c8
+
+MASCULINE ORDINAL INDICATOR: &#xBA; => bc
+&#xBC; => &#xBC;
+
+GREEK CAPITAL LETTER OMEGA: &#x3A9; => bd
+&#xBD; => &#xBD;
+
+LATIN SMALL LETTER AE: &#xE6; => be
+&#xBE; => &#xBE;
+
+LATIN SMALL LETTER O WITH STROKE: &#xF8; => bf
+&#xBF; => c0
+
+INVERTED QUESTION MARK: &#xBF; => c0
+&#xC0; => cb
+
+INVERTED EXCLAMATION MARK: &#xA1; => c1
+&#xC1; => e7
+
+NOT SIGN: &#xAC; => c2
+&#xC2; => e5
+
+SQUARE ROOT: &#x221A; => c3
+&#xC3; => cc
+
+LATIN SMALL LETTER F WITH HOOK: &#x192; => c4
+&#xC4; => 80
+
+ALMOST EQUAL TO: &#x2248; => c5
+&#xC5; => 81
+
+INCREMENT: &#x2206; => c6
+&#xC6; => ae
+
+LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xAB; => c7
+&#xC7; => 82
+
+RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xBB; => c8
+&#xC8; => e9
+
+HORIZONTAL ELLIPSIS: &#x2026; => c9
+&#xC9; => 83
+
+NO-BREAK SPACE: &#xA0; => ca
+&#xCA; => e6
+
+LATIN CAPITAL LETTER A WITH GRAVE: &#xC0; => cb
+&#xCB; => e8
+
+LATIN CAPITAL LETTER A WITH TILDE: &#xC3; => cc
+&#xCC; => ed
+
+LATIN CAPITAL LETTER O WITH TILDE: &#xD5; => cd
+&#xCD; => ea
+
+LATIN CAPITAL LIGATURE OE: &#x152; => ce
+&#xCE; => eb
+
+LATIN SMALL LIGATURE OE: &#x153; => cf
+&#xCF; => ec
+
+EN DASH: &#x2013; => d0
+&#xD0; => &#xD0;
+
+EM DASH: &#x2014; => d1
+&#xD1; => 84
+
+LEFT DOUBLE QUOTATION MARK: &#x201C; => d2
+&#xD2; => f1
+
+RIGHT DOUBLE QUOTATION MARK: &#x201D; => d3
+&#xD3; => ee
+
+LEFT SINGLE QUOTATION MARK: &#x2018; => d4
+&#xD4; => ef
+
+RIGHT SINGLE QUOTATION MARK: &#x2019; => d5
+&#xD5; => cd
+
+DIVISION SIGN: &#xF7; => d6
+&#xD6; => 85
+
+LOZENGE: &#x25CA; => d7
+&#xD7; => &#xD7;
+
+LATIN SMALL LETTER Y WITH DIAERESIS: &#xFF; => d8
+&#xD8; => af
+
+LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => d9
+&#xD9; => f4
+
+FRACTION SLASH: &#x2044; => da
+&#xDA; => f2
+
+EURO SIGN: &#x20AC; => db
+&#xDB; => f3
+
+SINGLE LEFT-POINTING ANGLE QUOTATION MARK: &#x2039; => dc
+&#xDC; => 86
+
+SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: &#x203A; => dd
+&#xDD; => &#xDD;
+
+LATIN SMALL LIGATURE FI: &#xFB01; => de
+&#xDE; => &#xDE;
+
+LATIN SMALL LIGATURE FL: &#xFB02; => df
+&#xDF; => a7
+
+DOUBLE DAGGER: &#x2021; => e0
+&#xE0; => 88
+
+MIDDLE DOT: &#xB7; => e1
+&#xE1; => 87
+
+SINGLE LOW-9 QUOTATION MARK: &#x201A; => e2
+&#xE2; => 89
+
+DOUBLE LOW-9 QUOTATION MARK: &#x201E; => e3
+&#xE3; => 8b
+
+PER MILLE SIGN: &#x2030; => e4
+&#xE4; => 8a
+
+LATIN CAPITAL LETTER A WITH CIRCUMFLEX: &#xC2; => e5
+&#xE5; => 8c
+
+LATIN CAPITAL LETTER E WITH CIRCUMFLEX: &#xCA; => e6
+&#xE6; => be
+
+LATIN CAPITAL LETTER A WITH ACUTE: &#xC1; => e7
+&#xE7; => 8d
+
+LATIN CAPITAL LETTER E WITH DIAERESIS: &#xCB; => e8
+&#xE8; => 8f
+
+LATIN CAPITAL LETTER E WITH GRAVE: &#xC8; => e9
+&#xE9; => 8e
+
+LATIN CAPITAL LETTER I WITH ACUTE: &#xCD; => ea
+&#xEA; => 90
+
+LATIN CAPITAL LETTER I WITH CIRCUMFLEX: &#xCE; => eb
+&#xEB; => 91
+
+LATIN CAPITAL LETTER I WITH DIAERESIS: &#xCF; => ec
+&#xEC; => 93
+
+LATIN CAPITAL LETTER I WITH GRAVE: &#xCC; => ed
+&#xED; => 92
+
+LATIN CAPITAL LETTER O WITH ACUTE: &#xD3; => ee
+&#xEE; => 94
+
+LATIN CAPITAL LETTER O WITH CIRCUMFLEX: &#xD4; => ef
+&#xEF; => 95
+
+Apple logo: &#xF8FF; => f0
+&#xF0; => &#xF0;
+
+LATIN CAPITAL LETTER O WITH GRAVE: &#xD2; => f1
+&#xF1; => 96
+
+LATIN CAPITAL LETTER U WITH ACUTE: &#xDA; => f2
+&#xF2; => 98
+
+LATIN CAPITAL LETTER U WITH CIRCUMFLEX: &#xDB; => f3
+&#xF3; => 97
+
+LATIN CAPITAL LETTER U WITH GRAVE: &#xD9; => f4
+&#xF4; => 99
+
+LATIN SMALL LETTER DOTLESS I: &#x131; => f5
+&#xF5; => 9b
+
+MODIFIER LETTER CIRCUMFLEX ACCENT: &#x2C6; => f6
+&#xF6; => 9a
+
+SMALL TILDE: &#x2DC; => f7
+&#xF7; => d6
+
+MACRON: &#xAF; => f8
+&#xF8; => bf
+
+BREVE: &#x2D8; => f9
+&#xF9; => 9d
+
+DOT ABOVE: &#x2D9; => fa
+&#xFA; => 9c
+
+RING ABOVE: &#x2DA; => fb
+&#xFB; => 9e
+
+CEDILLA: &#xB8; => fc
+&#xFC; => 9f
+
+DOUBLE ACUTE ACCENT: &#x2DD; => fd
+&#xFD; => &#xFD;
+
+OGONEK: &#x2DB; => fe
+&#xFE; => &#xFE;
+
+CARON: &#x2C7; => ff
+&#xFF; => d8
+
+
diff --git a/ext/standard/tests/strings/html_entity_decode_win1251.phpt b/ext/standard/tests/strings/html_entity_decode_win1251.phpt
new file mode 100644
index 0000000..e473926
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_win1251.phpt
@@ -0,0 +1,537 @@
+--TEST--
+Translation of HTML entities for encoding WIN-1251
+--FILE--
+<?php
+$arr = array(
+0x0402 => array(0x80, "CYRILLIC CAPITAL LETTER DJE"),
+0x0403 => array(0x81, "CYRILLIC CAPITAL LETTER GJE"),
+0x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"),
+0x0453 => array(0x83, "CYRILLIC SMALL LETTER GJE"),
+0x201E => array(0x84, "DOUBLE LOW-9 QUOTATION MARK"),
+0x2026 => array(0x85, "HORIZONTAL ELLIPSIS"),
+0x2020 => array(0x86, "DAGGER"),
+0x2021 => array(0x87, "DOUBLE DAGGER"),
+0x20AC => array(0x88, "EURO SIGN"),
+0x2030 => array(0x89, "PER MILLE SIGN"),
+0x0409 => array(0x8A, "CYRILLIC CAPITAL LETTER LJE"),
+0x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
+0x040A => array(0x8C, "CYRILLIC CAPITAL LETTER NJE"),
+0x040C => array(0x8D, "CYRILLIC CAPITAL LETTER KJE"),
+0x040B => array(0x8E, "CYRILLIC CAPITAL LETTER TSHE"),
+0x040F => array(0x8F, "CYRILLIC CAPITAL LETTER DZHE"),
+0x0452 => array(0x90, "CYRILLIC SMALL LETTER DJE"),
+0x2018 => array(0x91, "LEFT SINGLE QUOTATION MARK"),
+0x2019 => array(0x92, "RIGHT SINGLE QUOTATION MARK"),
+0x201C => array(0x93, "LEFT DOUBLE QUOTATION MARK"),
+0x201D => array(0x94, "RIGHT DOUBLE QUOTATION MARK"),
+0x2022 => array(0x95, "BULLET"),
+0x2013 => array(0x96, "EN DASH"),
+0x2014 => array(0x97, "EM DASH"),
+//0x98 #UNDEFINED
+0x2122 => array(0x99, "TRADE MARK SIGN"),
+0x0459 => array(0x9A, "CYRILLIC SMALL LETTER LJE"),
+0x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
+0x045A => array(0x9C, "CYRILLIC SMALL LETTER NJE"),
+0x045C => array(0x9D, "CYRILLIC SMALL LETTER KJE"),
+0x045B => array(0x9E, "CYRILLIC SMALL LETTER TSHE"),
+0x045F => array(0x9F, "CYRILLIC SMALL LETTER DZHE"),
+0x00A0 => array(0xA0, "NO-BREAK SPACE"),
+0x040E => array(0xA1, "CYRILLIC CAPITAL LETTER SHORT U"),
+0x045E => array(0xA2, "CYRILLIC SMALL LETTER SHORT U"),
+0x0408 => array(0xA3, "CYRILLIC CAPITAL LETTER JE"),
+0x00A4 => array(0xA4, "CURRENCY SIGN"),
+0x0490 => array(0xA5, "CYRILLIC CAPITAL LETTER GHE WITH UPTURN"),
+0x00A6 => array(0xA6, "BROKEN BAR"),
+0x00A7 => array(0xA7, "SECTION SIGN"),
+0x0401 => array(0xA8, "CYRILLIC CAPITAL LETTER IO"),
+0x00A9 => array(0xA9, "COPYRIGHT SIGN"),
+0x0404 => array(0xAA, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"),
+0x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"),
+0x00AC => array(0xAC, "NOT SIGN"),
+0x00AD => array(0xAD, "SOFT HYPHEN"),
+0x00AE => array(0xAE, "REGISTERED SIGN"),
+0x0407 => array(0xAF, "CYRILLIC CAPITAL LETTER YI"),
+0x00B0 => array(0xB0, "DEGREE SIGN"),
+0x00B1 => array(0xB1, "PLUS-MINUS SIGN"),
+0x0406 => array(0xB2, "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I"),
+0x0456 => array(0xB3, "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I"),
+0x0491 => array(0xB4, "CYRILLIC SMALL LETTER GHE WITH UPTURN"),
+0x00B5 => array(0xB5, "MICRO SIGN"),
+0x00B6 => array(0xB6, "PILCROW SIGN"),
+0x00B7 => array(0xB7, "MIDDLE DOT"),
+0x0451 => array(0xB8, "CYRILLIC SMALL LETTER IO"),
+0x2116 => array(0xB9, "NUMERO SIGN"),
+0x0454 => array(0xBA, "CYRILLIC SMALL LETTER UKRAINIAN IE"),
+0x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"),
+0x0458 => array(0xBC, "CYRILLIC SMALL LETTER JE"),
+0x0405 => array(0xBD, "CYRILLIC CAPITAL LETTER DZE"),
+0x0455 => array(0xBE, "CYRILLIC SMALL LETTER DZE"),
+0x0457 => array(0xBF, "CYRILLIC SMALL LETTER YI"),
+0x0410 => array(0xC0, "CYRILLIC CAPITAL LETTER A"),
+0x0411 => array(0xC1, "CYRILLIC CAPITAL LETTER BE"),
+0x0412 => array(0xC2, "CYRILLIC CAPITAL LETTER VE"),
+0x0413 => array(0xC3, "CYRILLIC CAPITAL LETTER GHE"),
+0x0414 => array(0xC4, "CYRILLIC CAPITAL LETTER DE"),
+0x0415 => array(0xC5, "CYRILLIC CAPITAL LETTER IE"),
+0x0416 => array(0xC6, "CYRILLIC CAPITAL LETTER ZHE"),
+0x0417 => array(0xC7, "CYRILLIC CAPITAL LETTER ZE"),
+0x0418 => array(0xC8, "CYRILLIC CAPITAL LETTER I"),
+0x0419 => array(0xC9, "CYRILLIC CAPITAL LETTER SHORT I"),
+0x041A => array(0xCA, "CYRILLIC CAPITAL LETTER KA"),
+0x041B => array(0xCB, "CYRILLIC CAPITAL LETTER EL"),
+0x041C => array(0xCC, "CYRILLIC CAPITAL LETTER EM"),
+0x041D => array(0xCD, "CYRILLIC CAPITAL LETTER EN"),
+0x041E => array(0xCE, "CYRILLIC CAPITAL LETTER O"),
+0x041F => array(0xCF, "CYRILLIC CAPITAL LETTER PE"),
+0x0420 => array(0xD0, "CYRILLIC CAPITAL LETTER ER"),
+0x0421 => array(0xD1, "CYRILLIC CAPITAL LETTER ES"),
+0x0422 => array(0xD2, "CYRILLIC CAPITAL LETTER TE"),
+0x0423 => array(0xD3, "CYRILLIC CAPITAL LETTER U"),
+0x0424 => array(0xD4, "CYRILLIC CAPITAL LETTER EF"),
+0x0425 => array(0xD5, "CYRILLIC CAPITAL LETTER HA"),
+0x0426 => array(0xD6, "CYRILLIC CAPITAL LETTER TSE"),
+0x0427 => array(0xD7, "CYRILLIC CAPITAL LETTER CHE"),
+0x0428 => array(0xD8, "CYRILLIC CAPITAL LETTER SHA"),
+0x0429 => array(0xD9, "CYRILLIC CAPITAL LETTER SHCHA"),
+0x042A => array(0xDA, "CYRILLIC CAPITAL LETTER HARD SIGN"),
+0x042B => array(0xDB, "CYRILLIC CAPITAL LETTER YERU"),
+0x042C => array(0xDC, "CYRILLIC CAPITAL LETTER SOFT SIGN"),
+0x042D => array(0xDD, "CYRILLIC CAPITAL LETTER E"),
+0x042E => array(0xDE, "CYRILLIC CAPITAL LETTER YU"),
+0x042F => array(0xDF, "CYRILLIC CAPITAL LETTER YA"),
+0x0430 => array(0xE0, "CYRILLIC SMALL LETTER A"),
+0x0431 => array(0xE1, "CYRILLIC SMALL LETTER BE"),
+0x0432 => array(0xE2, "CYRILLIC SMALL LETTER VE"),
+0x0433 => array(0xE3, "CYRILLIC SMALL LETTER GHE"),
+0x0434 => array(0xE4, "CYRILLIC SMALL LETTER DE"),
+0x0435 => array(0xE5, "CYRILLIC SMALL LETTER IE"),
+0x0436 => array(0xE6, "CYRILLIC SMALL LETTER ZHE"),
+0x0437 => array(0xE7, "CYRILLIC SMALL LETTER ZE"),
+0x0438 => array(0xE8, "CYRILLIC SMALL LETTER I"),
+0x0439 => array(0xE9, "CYRILLIC SMALL LETTER SHORT I"),
+0x043A => array(0xEA, "CYRILLIC SMALL LETTER KA"),
+0x043B => array(0xEB, "CYRILLIC SMALL LETTER EL"),
+0x043C => array(0xEC, "CYRILLIC SMALL LETTER EM"),
+0x043D => array(0xED, "CYRILLIC SMALL LETTER EN"),
+0x043E => array(0xEE, "CYRILLIC SMALL LETTER O"),
+0x043F => array(0xEF, "CYRILLIC SMALL LETTER PE"),
+0x0440 => array(0xF0, "CYRILLIC SMALL LETTER ER"),
+0x0441 => array(0xF1, "CYRILLIC SMALL LETTER ES"),
+0x0442 => array(0xF2, "CYRILLIC SMALL LETTER TE"),
+0x0443 => array(0xF3, "CYRILLIC SMALL LETTER U"),
+0x0444 => array(0xF4, "CYRILLIC SMALL LETTER EF"),
+0x0445 => array(0xF5, "CYRILLIC SMALL LETTER HA"),
+0x0446 => array(0xF6, "CYRILLIC SMALL LETTER TSE"),
+0x0447 => array(0xF7, "CYRILLIC SMALL LETTER CHE"),
+0x0448 => array(0xF8, "CYRILLIC SMALL LETTER SHA"),
+0x0449 => array(0xF9, "CYRILLIC SMALL LETTER SHCHA"),
+0x044A => array(0xFA, "CYRILLIC SMALL LETTER HARD SIGN"),
+0x044B => array(0xFB, "CYRILLIC SMALL LETTER YERU"),
+0x044C => array(0xFC, "CYRILLIC SMALL LETTER SOFT SIGN"),
+0x044D => array(0xFD, "CYRILLIC SMALL LETTER E"),
+0x044E => array(0xFE, "CYRILLIC SMALL LETTER YU"),
+0x044F => array(0xFF, "CYRILLIC SMALL LETTER YA"),
+);
+
+$res = html_entity_decode("&#x98;", ENT_QUOTES, 'WINDOWS-1251');
+echo "Special test for &#x98; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1251');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1251');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+Special test for &#x98; (shouldn't decode):
+&#x98;
+
+CYRILLIC CAPITAL LETTER DJE: &#x402; => 80
+&#x80; => &#x80;
+
+CYRILLIC CAPITAL LETTER GJE: &#x403; => 81
+&#x81; => &#x81;
+
+SINGLE LOW-9 QUOTATION MARK: &#x201A; => 82
+&#x82; => &#x82;
+
+CYRILLIC SMALL LETTER GJE: &#x453; => 83
+&#x83; => &#x83;
+
+DOUBLE LOW-9 QUOTATION MARK: &#x201E; => 84
+&#x84; => &#x84;
+
+HORIZONTAL ELLIPSIS: &#x2026; => 85
+&#x85; => &#x85;
+
+DAGGER: &#x2020; => 86
+&#x86; => &#x86;
+
+DOUBLE DAGGER: &#x2021; => 87
+&#x87; => &#x87;
+
+EURO SIGN: &#x20AC; => 88
+&#x88; => &#x88;
+
+PER MILLE SIGN: &#x2030; => 89
+&#x89; => &#x89;
+
+CYRILLIC CAPITAL LETTER LJE: &#x409; => 8a
+&#x8A; => &#x8A;
+
+SINGLE LEFT-POINTING ANGLE QUOTATION MARK: &#x2039; => 8b
+&#x8B; => &#x8B;
+
+CYRILLIC CAPITAL LETTER NJE: &#x40A; => 8c
+&#x8C; => &#x8C;
+
+CYRILLIC CAPITAL LETTER KJE: &#x40C; => 8d
+&#x8D; => &#x8D;
+
+CYRILLIC CAPITAL LETTER TSHE: &#x40B; => 8e
+&#x8E; => &#x8E;
+
+CYRILLIC CAPITAL LETTER DZHE: &#x40F; => 8f
+&#x8F; => &#x8F;
+
+CYRILLIC SMALL LETTER DJE: &#x452; => 90
+&#x90; => &#x90;
+
+LEFT SINGLE QUOTATION MARK: &#x2018; => 91
+&#x91; => &#x91;
+
+RIGHT SINGLE QUOTATION MARK: &#x2019; => 92
+&#x92; => &#x92;
+
+LEFT DOUBLE QUOTATION MARK: &#x201C; => 93
+&#x93; => &#x93;
+
+RIGHT DOUBLE QUOTATION MARK: &#x201D; => 94
+&#x94; => &#x94;
+
+BULLET: &#x2022; => 95
+&#x95; => &#x95;
+
+EN DASH: &#x2013; => 96
+&#x96; => &#x96;
+
+EM DASH: &#x2014; => 97
+&#x97; => &#x97;
+
+TRADE MARK SIGN: &#x2122; => 99
+&#x99; => &#x99;
+
+CYRILLIC SMALL LETTER LJE: &#x459; => 9a
+&#x9A; => &#x9A;
+
+SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: &#x203A; => 9b
+&#x9B; => &#x9B;
+
+CYRILLIC SMALL LETTER NJE: &#x45A; => 9c
+&#x9C; => &#x9C;
+
+CYRILLIC SMALL LETTER KJE: &#x45C; => 9d
+&#x9D; => &#x9D;
+
+CYRILLIC SMALL LETTER TSHE: &#x45B; => 9e
+&#x9E; => &#x9E;
+
+CYRILLIC SMALL LETTER DZHE: &#x45F; => 9f
+&#x9F; => &#x9F;
+
+NO-BREAK SPACE: &#xA0; => a0
+&#xA0; => a0
+
+CYRILLIC CAPITAL LETTER SHORT U: &#x40E; => a1
+&#xA1; => &#xA1;
+
+CYRILLIC SMALL LETTER SHORT U: &#x45E; => a2
+&#xA2; => &#xA2;
+
+CYRILLIC CAPITAL LETTER JE: &#x408; => a3
+&#xA3; => &#xA3;
+
+CURRENCY SIGN: &#xA4; => a4
+&#xA4; => a4
+
+CYRILLIC CAPITAL LETTER GHE WITH UPTURN: &#x490; => a5
+&#xA5; => &#xA5;
+
+BROKEN BAR: &#xA6; => a6
+&#xA6; => a6
+
+SECTION SIGN: &#xA7; => a7
+&#xA7; => a7
+
+CYRILLIC CAPITAL LETTER IO: &#x401; => a8
+&#xA8; => &#xA8;
+
+COPYRIGHT SIGN: &#xA9; => a9
+&#xA9; => a9
+
+CYRILLIC CAPITAL LETTER UKRAINIAN IE: &#x404; => aa
+&#xAA; => &#xAA;
+
+LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xAB; => ab
+&#xAB; => ab
+
+NOT SIGN: &#xAC; => ac
+&#xAC; => ac
+
+SOFT HYPHEN: &#xAD; => ad
+&#xAD; => ad
+
+REGISTERED SIGN: &#xAE; => ae
+&#xAE; => ae
+
+CYRILLIC CAPITAL LETTER YI: &#x407; => af
+&#xAF; => &#xAF;
+
+DEGREE SIGN: &#xB0; => b0
+&#xB0; => b0
+
+PLUS-MINUS SIGN: &#xB1; => b1
+&#xB1; => b1
+
+CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: &#x406; => b2
+&#xB2; => &#xB2;
+
+CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: &#x456; => b3
+&#xB3; => &#xB3;
+
+CYRILLIC SMALL LETTER GHE WITH UPTURN: &#x491; => b4
+&#xB4; => &#xB4;
+
+MICRO SIGN: &#xB5; => b5
+&#xB5; => b5
+
+PILCROW SIGN: &#xB6; => b6
+&#xB6; => b6
+
+MIDDLE DOT: &#xB7; => b7
+&#xB7; => b7
+
+CYRILLIC SMALL LETTER IO: &#x451; => b8
+&#xB8; => &#xB8;
+
+NUMERO SIGN: &#x2116; => b9
+&#xB9; => &#xB9;
+
+CYRILLIC SMALL LETTER UKRAINIAN IE: &#x454; => ba
+&#xBA; => &#xBA;
+
+RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xBB; => bb
+&#xBB; => bb
+
+CYRILLIC SMALL LETTER JE: &#x458; => bc
+&#xBC; => &#xBC;
+
+CYRILLIC CAPITAL LETTER DZE: &#x405; => bd
+&#xBD; => &#xBD;
+
+CYRILLIC SMALL LETTER DZE: &#x455; => be
+&#xBE; => &#xBE;
+
+CYRILLIC SMALL LETTER YI: &#x457; => bf
+&#xBF; => &#xBF;
+
+CYRILLIC CAPITAL LETTER A: &#x410; => c0
+&#xC0; => &#xC0;
+
+CYRILLIC CAPITAL LETTER BE: &#x411; => c1
+&#xC1; => &#xC1;
+
+CYRILLIC CAPITAL LETTER VE: &#x412; => c2
+&#xC2; => &#xC2;
+
+CYRILLIC CAPITAL LETTER GHE: &#x413; => c3
+&#xC3; => &#xC3;
+
+CYRILLIC CAPITAL LETTER DE: &#x414; => c4
+&#xC4; => &#xC4;
+
+CYRILLIC CAPITAL LETTER IE: &#x415; => c5
+&#xC5; => &#xC5;
+
+CYRILLIC CAPITAL LETTER ZHE: &#x416; => c6
+&#xC6; => &#xC6;
+
+CYRILLIC CAPITAL LETTER ZE: &#x417; => c7
+&#xC7; => &#xC7;
+
+CYRILLIC CAPITAL LETTER I: &#x418; => c8
+&#xC8; => &#xC8;
+
+CYRILLIC CAPITAL LETTER SHORT I: &#x419; => c9
+&#xC9; => &#xC9;
+
+CYRILLIC CAPITAL LETTER KA: &#x41A; => ca
+&#xCA; => &#xCA;
+
+CYRILLIC CAPITAL LETTER EL: &#x41B; => cb
+&#xCB; => &#xCB;
+
+CYRILLIC CAPITAL LETTER EM: &#x41C; => cc
+&#xCC; => &#xCC;
+
+CYRILLIC CAPITAL LETTER EN: &#x41D; => cd
+&#xCD; => &#xCD;
+
+CYRILLIC CAPITAL LETTER O: &#x41E; => ce
+&#xCE; => &#xCE;
+
+CYRILLIC CAPITAL LETTER PE: &#x41F; => cf
+&#xCF; => &#xCF;
+
+CYRILLIC CAPITAL LETTER ER: &#x420; => d0
+&#xD0; => &#xD0;
+
+CYRILLIC CAPITAL LETTER ES: &#x421; => d1
+&#xD1; => &#xD1;
+
+CYRILLIC CAPITAL LETTER TE: &#x422; => d2
+&#xD2; => &#xD2;
+
+CYRILLIC CAPITAL LETTER U: &#x423; => d3
+&#xD3; => &#xD3;
+
+CYRILLIC CAPITAL LETTER EF: &#x424; => d4
+&#xD4; => &#xD4;
+
+CYRILLIC CAPITAL LETTER HA: &#x425; => d5
+&#xD5; => &#xD5;
+
+CYRILLIC CAPITAL LETTER TSE: &#x426; => d6
+&#xD6; => &#xD6;
+
+CYRILLIC CAPITAL LETTER CHE: &#x427; => d7
+&#xD7; => &#xD7;
+
+CYRILLIC CAPITAL LETTER SHA: &#x428; => d8
+&#xD8; => &#xD8;
+
+CYRILLIC CAPITAL LETTER SHCHA: &#x429; => d9
+&#xD9; => &#xD9;
+
+CYRILLIC CAPITAL LETTER HARD SIGN: &#x42A; => da
+&#xDA; => &#xDA;
+
+CYRILLIC CAPITAL LETTER YERU: &#x42B; => db
+&#xDB; => &#xDB;
+
+CYRILLIC CAPITAL LETTER SOFT SIGN: &#x42C; => dc
+&#xDC; => &#xDC;
+
+CYRILLIC CAPITAL LETTER E: &#x42D; => dd
+&#xDD; => &#xDD;
+
+CYRILLIC CAPITAL LETTER YU: &#x42E; => de
+&#xDE; => &#xDE;
+
+CYRILLIC CAPITAL LETTER YA: &#x42F; => df
+&#xDF; => &#xDF;
+
+CYRILLIC SMALL LETTER A: &#x430; => e0
+&#xE0; => &#xE0;
+
+CYRILLIC SMALL LETTER BE: &#x431; => e1
+&#xE1; => &#xE1;
+
+CYRILLIC SMALL LETTER VE: &#x432; => e2
+&#xE2; => &#xE2;
+
+CYRILLIC SMALL LETTER GHE: &#x433; => e3
+&#xE3; => &#xE3;
+
+CYRILLIC SMALL LETTER DE: &#x434; => e4
+&#xE4; => &#xE4;
+
+CYRILLIC SMALL LETTER IE: &#x435; => e5
+&#xE5; => &#xE5;
+
+CYRILLIC SMALL LETTER ZHE: &#x436; => e6
+&#xE6; => &#xE6;
+
+CYRILLIC SMALL LETTER ZE: &#x437; => e7
+&#xE7; => &#xE7;
+
+CYRILLIC SMALL LETTER I: &#x438; => e8
+&#xE8; => &#xE8;
+
+CYRILLIC SMALL LETTER SHORT I: &#x439; => e9
+&#xE9; => &#xE9;
+
+CYRILLIC SMALL LETTER KA: &#x43A; => ea
+&#xEA; => &#xEA;
+
+CYRILLIC SMALL LETTER EL: &#x43B; => eb
+&#xEB; => &#xEB;
+
+CYRILLIC SMALL LETTER EM: &#x43C; => ec
+&#xEC; => &#xEC;
+
+CYRILLIC SMALL LETTER EN: &#x43D; => ed
+&#xED; => &#xED;
+
+CYRILLIC SMALL LETTER O: &#x43E; => ee
+&#xEE; => &#xEE;
+
+CYRILLIC SMALL LETTER PE: &#x43F; => ef
+&#xEF; => &#xEF;
+
+CYRILLIC SMALL LETTER ER: &#x440; => f0
+&#xF0; => &#xF0;
+
+CYRILLIC SMALL LETTER ES: &#x441; => f1
+&#xF1; => &#xF1;
+
+CYRILLIC SMALL LETTER TE: &#x442; => f2
+&#xF2; => &#xF2;
+
+CYRILLIC SMALL LETTER U: &#x443; => f3
+&#xF3; => &#xF3;
+
+CYRILLIC SMALL LETTER EF: &#x444; => f4
+&#xF4; => &#xF4;
+
+CYRILLIC SMALL LETTER HA: &#x445; => f5
+&#xF5; => &#xF5;
+
+CYRILLIC SMALL LETTER TSE: &#x446; => f6
+&#xF6; => &#xF6;
+
+CYRILLIC SMALL LETTER CHE: &#x447; => f7
+&#xF7; => &#xF7;
+
+CYRILLIC SMALL LETTER SHA: &#x448; => f8
+&#xF8; => &#xF8;
+
+CYRILLIC SMALL LETTER SHCHA: &#x449; => f9
+&#xF9; => &#xF9;
+
+CYRILLIC SMALL LETTER HARD SIGN: &#x44A; => fa
+&#xFA; => &#xFA;
+
+CYRILLIC SMALL LETTER YERU: &#x44B; => fb
+&#xFB; => &#xFB;
+
+CYRILLIC SMALL LETTER SOFT SIGN: &#x44C; => fc
+&#xFC; => &#xFC;
+
+CYRILLIC SMALL LETTER E: &#x44D; => fd
+&#xFD; => &#xFD;
+
+CYRILLIC SMALL LETTER YU: &#x44E; => fe
+&#xFE; => &#xFE;
+
+CYRILLIC SMALL LETTER YA: &#x44F; => ff
+&#xFF; => &#xFF;
+
+
diff --git a/ext/standard/tests/strings/html_entity_decode_win1252.phpt b/ext/standard/tests/strings/html_entity_decode_win1252.phpt
new file mode 100644
index 0000000..2a7a698
--- /dev/null
+++ b/ext/standard/tests/strings/html_entity_decode_win1252.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Translation of HTML entities for encoding WIN-1252
+--FILE--
+<?php
+$arr = array(
+0x20AC => array(0x80, "EURO SIGN"),
+//0x81 #UNDEFINED
+0x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"),
+0x0192 => array(0x83, "LATIN SMALL LETTER F WITH HOOK"),
+0x201E => array(0x84, "DOUBLE LOW-9 QUOTATION MARK"),
+0x2026 => array(0x85, "HORIZONTAL ELLIPSIS"),
+0x2020 => array(0x86, "DAGGER"),
+0x2021 => array(0x87, "DOUBLE DAGGER"),
+0x02C6 => array(0x88, "MODIFIER LETTER CIRCUMFLEX ACCENT"),
+0x2030 => array(0x89, "PER MILLE SIGN"),
+0x0160 => array(0x8A, "LATIN CAPITAL LETTER S WITH CARON"),
+0x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
+0x0152 => array(0x8C, "LATIN CAPITAL LIGATURE OE"),
+//0x8D #UNDEFINED
+0x017D => array(0x8E, "LATIN CAPITAL LETTER Z WITH CARON"),
+//0x8F #UNDEFINED
+//0x90 #UNDEFINED
+0x2018 => array(0x91, "LEFT SINGLE QUOTATION MARK"),
+0x2019 => array(0x92, "RIGHT SINGLE QUOTATION MARK"),
+0x201C => array(0x93, "LEFT DOUBLE QUOTATION MARK"),
+0x201D => array(0x94, "RIGHT DOUBLE QUOTATION MARK"),
+0x2022 => array(0x95, "BULLET"),
+0x2013 => array(0x96, "EN DASH"),
+0x2014 => array(0x97, "EM DASH"),
+0x02DC => array(0x98, "SMALL TILDE"),
+0x2122 => array(0x99, "TRADE MARK SIGN"),
+0x0161 => array(0x9A, "LATIN SMALL LETTER S WITH CARON"),
+0x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
+0x0153 => array(0x9C, "LATIN SMALL LIGATURE OE"),
+//0x9D #UNDEFINED
+0x017E => array(0x9E, "LATIN SMALL LETTER Z WITH CARON"),
+0x0178 => array(0x9F, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
+);
+
+$res = html_entity_decode("&#x81;", ENT_QUOTES, 'WINDOWS-1252');
+echo "Special test for &#x81; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+$res = html_entity_decode("&#x8D;", ENT_QUOTES, 'WINDOWS-1252');
+echo "Special test for &#x8D; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+$res = html_entity_decode("&#x8F;", ENT_QUOTES, 'WINDOWS-1252');
+echo "Special test for &#x8F; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+$res = html_entity_decode("&#x90;", ENT_QUOTES, 'WINDOWS-1252');
+echo "Special test for &#x90; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+$res = html_entity_decode("&#x9D;", ENT_QUOTES, 'WINDOWS-1252');
+echo "Special test for &#x9D; (shouldn't decode):\n";
+echo $res,"\n\n";
+
+foreach ($arr as $u => $v) {
+ $ent = sprintf("&#x%X;", $u);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252');
+ $d = unpack("H*", $res);
+ echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
+
+ $ent = sprintf("&#x%X;", $v[0]);
+ $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252');
+ if ($res[0] != "&" || $res[1] != "#")
+ $res = unpack("H*", $res)[1];
+ echo sprintf("%s => %s\n\n", $ent, $res);
+}
+--EXPECT--
+Special test for &#x81; (shouldn't decode):
+&#x81;
+
+Special test for &#x8D; (shouldn't decode):
+&#x8D;
+
+Special test for &#x8F; (shouldn't decode):
+&#x8F;
+
+Special test for &#x90; (shouldn't decode):
+&#x90;
+
+Special test for &#x9D; (shouldn't decode):
+&#x9D;
+
+EURO SIGN: &#x20AC; => 80
+&#x80; => &#x80;
+
+SINGLE LOW-9 QUOTATION MARK: &#x201A; => 82
+&#x82; => &#x82;
+
+LATIN SMALL LETTER F WITH HOOK: &#x192; => 83
+&#x83; => &#x83;
+
+DOUBLE LOW-9 QUOTATION MARK: &#x201E; => 84
+&#x84; => &#x84;
+
+HORIZONTAL ELLIPSIS: &#x2026; => 85
+&#x85; => &#x85;
+
+DAGGER: &#x2020; => 86
+&#x86; => &#x86;
+
+DOUBLE DAGGER: &#x2021; => 87
+&#x87; => &#x87;
+
+MODIFIER LETTER CIRCUMFLEX ACCENT: &#x2C6; => 88
+&#x88; => &#x88;
+
+PER MILLE SIGN: &#x2030; => 89
+&#x89; => &#x89;
+
+LATIN CAPITAL LETTER S WITH CARON: &#x160; => 8a
+&#x8A; => &#x8A;
+
+SINGLE LEFT-POINTING ANGLE QUOTATION MARK: &#x2039; => 8b
+&#x8B; => &#x8B;
+
+LATIN CAPITAL LIGATURE OE: &#x152; => 8c
+&#x8C; => &#x8C;
+
+LATIN CAPITAL LETTER Z WITH CARON: &#x17D; => 8e
+&#x8E; => &#x8E;
+
+LEFT SINGLE QUOTATION MARK: &#x2018; => 91
+&#x91; => &#x91;
+
+RIGHT SINGLE QUOTATION MARK: &#x2019; => 92
+&#x92; => &#x92;
+
+LEFT DOUBLE QUOTATION MARK: &#x201C; => 93
+&#x93; => &#x93;
+
+RIGHT DOUBLE QUOTATION MARK: &#x201D; => 94
+&#x94; => &#x94;
+
+BULLET: &#x2022; => 95
+&#x95; => &#x95;
+
+EN DASH: &#x2013; => 96
+&#x96; => &#x96;
+
+EM DASH: &#x2014; => 97
+&#x97; => &#x97;
+
+SMALL TILDE: &#x2DC; => 98
+&#x98; => &#x98;
+
+TRADE MARK SIGN: &#x2122; => 99
+&#x99; => &#x99;
+
+LATIN SMALL LETTER S WITH CARON: &#x161; => 9a
+&#x9A; => &#x9A;
+
+SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: &#x203A; => 9b
+&#x9B; => &#x9B;
+
+LATIN SMALL LIGATURE OE: &#x153; => 9c
+&#x9C; => &#x9C;
+
+LATIN SMALL LETTER Z WITH CARON: &#x17E; => 9e
+&#x9E; => &#x9E;
+
+LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => 9f
+&#x9F; => &#x9F;
+
+
diff --git a/ext/standard/tests/strings/htmlentities-utf-2.phpt b/ext/standard/tests/strings/htmlentities-utf-2.phpt
new file mode 100644
index 0000000..d515dc0
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities-utf-2.phpt
@@ -0,0 +1,70 @@
+--TEST--
+HTML entities with invalid chars and ENT_IGNORE
+--INI--
+output_handler=
+--FILE--
+<?php
+@setlocale (LC_CTYPE, "C");
+$strings = array(b"<", b"\xD0", b"\xD0\x90", b"\xD0\x90\xD0", b"\xD0\x90\xD0\xB0", b"\xE0", b"A\xE0", b"\xE0\x80", b"\xE0\x79", b"\xE0\x80\xBE",
+ b"Voil\xE0", b"Clich\xE9s",
+ b"\xFE", b"\xFE\x41", b"\xC3\xA9", b"\xC3\x79", b"\xF7\xBF\xBF\xBF", b"\xFB\xBF\xBF\xBF\xBF", b"\xFD\xBF\xBF\xBF\xBF\xBF",
+ b"\x41\xF7\xF7\x42", b"\x42\xFB\xFB\x42", b"\x43\xFD\xFD\x42", b"\x44\xF7\xF7", b"\x45\xFB\xFB", b"\x46\xFD\xFD"
+ );
+foreach($strings as $string) {
+ $sc_encoded = htmlspecialchars ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
+ var_dump(bin2hex($sc_encoded));
+ $ent_encoded = htmlentities ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
+ var_dump(bin2hex($ent_encoded));
+}
+?>
+--EXPECTF--
+%unicode|string%(8) "266c743b"
+%unicode|string%(8) "266c743b"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(4) "d090"
+%unicode|string%(4) "d090"
+%unicode|string%(4) "d090"
+%unicode|string%(4) "d090"
+%unicode|string%(8) "d090d0b0"
+%unicode|string%(8) "d090d0b0"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(2) "41"
+%unicode|string%(2) "41"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(2) "79"
+%unicode|string%(2) "79"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(8) "566f696c"
+%unicode|string%(8) "566f696c"
+%unicode|string%(12) "436c69636873"
+%unicode|string%(12) "436c69636873"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(2) "41"
+%unicode|string%(2) "41"
+%unicode|string%(4) "c3a9"
+%unicode|string%(16) "266561637574653b"
+%unicode|string%(2) "79"
+%unicode|string%(2) "79"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(4) "4142"
+%unicode|string%(4) "4142"
+%unicode|string%(4) "4242"
+%unicode|string%(4) "4242"
+%unicode|string%(4) "4342"
+%unicode|string%(4) "4342"
+%unicode|string%(2) "44"
+%unicode|string%(2) "44"
+%unicode|string%(2) "45"
+%unicode|string%(2) "45"
+%unicode|string%(2) "46"
+%unicode|string%(2) "46"
diff --git a/ext/standard/tests/strings/htmlentities-utf-3.phpt b/ext/standard/tests/strings/htmlentities-utf-3.phpt
new file mode 100644
index 0000000..c28917b
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities-utf-3.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences
+--FILE--
+<?php
+
+/* conformance to Unicode 5.2, section 3.9, D92 */
+
+$val_ranges = array(
+ array(array(0x00, 0x7F)),
+ array(array(0xC2, 0xDF), array(0x80, 0xBF)),
+ array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
+ array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
+ array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
+);
+
+function is_valid($seq) {
+ global $val_ranges;
+ $b = ord($seq[0]);
+ foreach ($val_ranges as $l) {
+ if ($b >= $l[0][0] && $b <= $l[0][1]) {
+ if (count($l) != strlen($seq)) {
+ return false;
+ }
+ for ($n = 1; $n < strlen($seq); $n++) {
+ if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+function concordance($s) {
+ $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
+ $v = is_valid($s);
+ return ($vhe === $v);
+}
+
+for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2);
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+
+
+for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+
+for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\x80\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
+}
+echo "Done.\n";
+--EXPECT--
+Done.
diff --git a/ext/standard/tests/strings/htmlentities-utf.phpt b/ext/standard/tests/strings/htmlentities-utf.phpt
new file mode 100644
index 0000000..6a66e4d
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities-utf.phpt
@@ -0,0 +1,70 @@
+--TEST--
+HTML entities with invalid chars
+--INI--
+output_handler=
+--FILE--
+<?php
+@setlocale (LC_CTYPE, "C");
+$strings = array(b"<", b"\xD0", b"\xD0\x90", b"\xD0\x90\xD0", b"\xD0\x90\xD0\xB0", b"\xE0", b"A\xE0", b"\xE0\x80", b"\xE0\x79", b"\xE0\x80\xBE",
+ b"Voil\xE0", b"Clich\xE9s",
+ b"\xFE", b"\xFE\x41", b"\xC3\xA9", b"\xC3\x79", b"\xF7\xBF\xBF\xBF", b"\xFB\xBF\xBF\xBF\xBF", b"\xFD\xBF\xBF\xBF\xBF\xBF",
+ b"\x41\xF7\xF7\x42", b"\x42\xFB\xFB\x42", b"\x43\xFD\xFD\x42", b"\x44\xF7\xF7", b"\x45\xFB\xFB", b"\x46\xFD\xFD"
+ );
+foreach($strings as $string) {
+ $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8");
+ var_dump(bin2hex($sc_encoded));
+ $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8");
+ var_dump(bin2hex($ent_encoded));
+}
+?>
+--EXPECTF--
+%unicode|string%(8) "266c743b"
+%unicode|string%(8) "266c743b"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(4) "d090"
+%unicode|string%(4) "d090"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(8) "d090d0b0"
+%unicode|string%(8) "d090d0b0"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(4) "c3a9"
+%unicode|string%(16) "266561637574653b"
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
+%unicode|string%(0) ""
diff --git a/ext/standard/tests/strings/htmlentities.phpt b/ext/standard/tests/strings/htmlentities.phpt
new file mode 100644
index 0000000..f2e107a
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities.phpt
@@ -0,0 +1,19 @@
+--TEST--
+HTML entities of ISO-8859 chars
+--INI--
+output_handler=
+--FILE--
+<?php
+setlocale (LC_CTYPE, "C");
+$sc_encoded = htmlspecialchars ("<>\"&åÄ\n",ENT_COMPAT,"ISO-8859-1");
+echo $sc_encoded;
+$ent_encoded = htmlentities ("<>\"&åÄ\n",ENT_COMPAT,"ISO-8859-1");
+echo $ent_encoded;
+echo html_entity_decode($sc_encoded,ENT_COMPAT,"ISO-8859-1");
+echo html_entity_decode($ent_encoded,ENT_COMPAT,"ISO-8859-1");
+?>
+--EXPECT--
+&lt;&gt;&quot;&amp;åÄ
+&lt;&gt;&quot;&amp;&aring;&Auml;
+<>"&åÄ
+<>"&åÄ
diff --git a/ext/standard/tests/strings/htmlentities01.phpt b/ext/standard/tests/strings/htmlentities01.phpt
new file mode 100644
index 0000000..eb64b0a
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities01.phpt
@@ -0,0 +1,13 @@
+--TEST--
+htmlentities() test 1 (cp1252)
+--INI--
+output_handler=
+mbstring.internal_encoding=pass
+--FILE--
+<?php
+ var_dump(htmlentities(b"\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252'));
+ var_dump(htmlentities(b"\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252'));
+?>
+--EXPECT--
+string(28) "&sbquo;&dagger;&trade;&Yuml;"
+string(32) "&euro;&cent;&pound;&curren;&yen;"
diff --git a/ext/standard/tests/strings/htmlentities02.phpt b/ext/standard/tests/strings/htmlentities02.phpt
new file mode 100644
index 0000000..5d708c2
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities02.phpt
@@ -0,0 +1,20 @@
+--TEST--
+htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15)
+--SKIPIF--
+<?php
+$result = (bool)setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro');
+if (!$result) {
+ die("skip setlocale() failed\n");
+}
+?>
+--INI--
+output_handler=
+default_charset=
+mbstring.internal_encoding=pass
+--FILE--
+<?php
+ setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro');
+ var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
+?>
+--EXPECT--
+string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities03.phpt b/ext/standard/tests/strings/htmlentities03.phpt
new file mode 100644
index 0000000..9f40ff3
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities03.phpt
@@ -0,0 +1,20 @@
+--TEST--
+htmlentities() test 3 (setlocale / de_DE.ISO-8859-1)
+--SKIPIF--
+<?php
+$result = (bool)setlocale(LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1");
+if (!$result || preg_match('/ISO/i', setlocale(LC_CTYPE, 0)) == 0) {
+ die("skip setlocale() failed\n");
+}
+?>
+--INI--
+output_handler=
+default_charset=
+mbstring.internal_encoding=pass
+--FILE--
+<?php
+ setlocale( LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1");
+ var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
+?>
+--EXPECT--
+string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities04.phpt b/ext/standard/tests/strings/htmlentities04.phpt
new file mode 100644
index 0000000..2501ff0
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities04.phpt
@@ -0,0 +1,21 @@
+--TEST--
+htmlentities() test 4 (setlocale / ja_JP.EUC-JP)
+--SKIPIF--
+<?php
+$result = (bool)setlocale(LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP");
+if (!$result || preg_match('/EUC[^a-zA-Z]*JP/i', setlocale(LC_CTYPE, 0)) == 0) {
+ die("skip setlocale() failed\n");
+}
+?>
+--INI--
+output_handler=
+default_charset=
+mbstring.internal_encoding=pass
+--FILE--
+<?php
+ setlocale( LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP" );
+ var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
+?>
+--EXPECTF--
+Strict Standards: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
+string(6) "¡¢¡£¡€"
diff --git a/ext/standard/tests/strings/htmlentities05.phpt b/ext/standard/tests/strings/htmlentities05.phpt
new file mode 100644
index 0000000..7f8adb6
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities05.phpt
@@ -0,0 +1,18 @@
+--TEST--
+htmlentities() test 5 (mbstring / cp1252)
+--INI--
+output_handler=
+mbstring.internal_encoding=cp1252
+--SKIPIF--
+<?php
+ extension_loaded("mbstring") or die("skip mbstring not available\n");
+--FILE--
+<?php
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
+ var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
+?>
+--EXPECT--
+Windows-1252
+string(28) "&sbquo;&dagger;&trade;&Yuml;"
+string(32) "&euro;&cent;&pound;&curren;&yen;"
diff --git a/ext/standard/tests/strings/htmlentities06.phpt b/ext/standard/tests/strings/htmlentities06.phpt
new file mode 100644
index 0000000..4cc68d2
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities06.phpt
@@ -0,0 +1,17 @@
+--TEST--
+htmlentities() test 6 (mbstring / ISO-8859-15)
+--INI--
+output_handler=
+mbstring.internal_encoding=ISO-8859-15
+--SKIPIF--
+<?php
+ extension_loaded("mbstring") or die("skip mbstring not available\n");
+--FILE--
+<?php
+ mb_internal_encoding('ISO-8859-15');
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
+?>
+--EXPECT--
+ISO-8859-15
+string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities07.phpt b/ext/standard/tests/strings/htmlentities07.phpt
new file mode 100644
index 0000000..144734c
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities07.phpt
@@ -0,0 +1,17 @@
+--TEST--
+htmlentities() test 7 (mbstring / ISO-8859-1)
+--INI--
+output_handler=
+mbstring.internal_encoding=ISO-8859-1
+--SKIPIF--
+<?php
+ extension_loaded("mbstring") or die("skip mbstring not available\n");
+--FILE--
+<?php
+ mb_internal_encoding('ISO-8859-1');
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
+?>
+--EXPECT--
+ISO-8859-1
+string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities08.phpt b/ext/standard/tests/strings/htmlentities08.phpt
new file mode 100644
index 0000000..1f6dc90
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities08.phpt
@@ -0,0 +1,18 @@
+--TEST--
+htmlentities() test 8 (mbstring / EUC-JP)
+--INI--
+output_handler=
+error_reporting=~E_STRICT
+mbstring.internal_encoding=EUC-JP
+--SKIPIF--
+<?php
+ extension_loaded("mbstring") or die("skip mbstring not available\n");
+--FILE--
+<?php
+ mb_internal_encoding('EUC-JP');
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
+?>
+--EXPECT--
+EUC-JP
+string(6) "¡¢¡£¡€"
diff --git a/ext/standard/tests/strings/htmlentities09.phpt b/ext/standard/tests/strings/htmlentities09.phpt
new file mode 100644
index 0000000..c80a77d
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities09.phpt
@@ -0,0 +1,20 @@
+--TEST--
+htmlentities() test 9 (mbstring / Shift_JIS)
+--INI--
+output_handler=
+error_reporting=~E_STRICT
+mbstring.internal_encoding=Shift_JIS
+--SKIPIF--
+<?php
+ extension_loaded("mbstring") or die("skip mbstring not available\n");
+--FILE--
+<?php
+ mb_internal_encoding('Shift_JIS');
+ print mb_internal_encoding()."\n";
+ var_dump(bin2hex(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '')));
+?>
+===DONE===
+--EXPECT--
+SJIS
+string(12) "814181428143"
+===DONE===
diff --git a/ext/standard/tests/strings/htmlentities10.phpt b/ext/standard/tests/strings/htmlentities10.phpt
new file mode 100644
index 0000000..ee5099c
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities10.phpt
@@ -0,0 +1,16 @@
+--TEST--
+htmlentities() test 10 (default_charset / cp1252)
+--INI--
+output_handler=
+mbstring.internal_encoding=pass
+default_charset=cp1252
+--FILE--
+<?php
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
+ var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
+?>
+--EXPECT--
+cp1252
+string(28) "&sbquo;&dagger;&trade;&Yuml;"
+string(32) "&euro;&cent;&pound;&curren;&yen;"
diff --git a/ext/standard/tests/strings/htmlentities11.phpt b/ext/standard/tests/strings/htmlentities11.phpt
new file mode 100644
index 0000000..62b6aec
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities11.phpt
@@ -0,0 +1,14 @@
+--TEST--
+htmlentities() test 11 (default_charset / ISO-8859-15)
+--INI--
+output_handler=
+mbstring.internal_encoding=pass
+default_charset=ISO-8859-15
+--FILE--
+<?php
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
+?>
+--EXPECT--
+ISO-8859-15
+string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities12.phpt b/ext/standard/tests/strings/htmlentities12.phpt
new file mode 100644
index 0000000..8267066
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities12.phpt
@@ -0,0 +1,14 @@
+--TEST--
+htmlentities() test 12 (default_charset / ISO-8859-1)
+--INI--
+output_handler=
+mbstring.internal_encoding=pass
+default_charset=ISO-8859-1
+--FILE--
+<?php
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
+?>
+--EXPECT--
+ISO-8859-1
+string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities13.phpt b/ext/standard/tests/strings/htmlentities13.phpt
new file mode 100644
index 0000000..769c77f
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities13.phpt
@@ -0,0 +1,17 @@
+--TEST--
+htmlentities() test 13 (default_charset / EUC-JP)
+--INI--
+output_handler=
+mbstring.internal_encoding=pass
+default_charset=EUC-JP
+filter.default=unsafe_raw
+--FILE--
+<?php
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
+?>
+--EXPECTF--
+EUC-JP
+
+Strict Standards: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d
+string(6) "¡¢¡£¡€"
diff --git a/ext/standard/tests/strings/htmlentities14.phpt b/ext/standard/tests/strings/htmlentities14.phpt
new file mode 100644
index 0000000..0928f08
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities14.phpt
@@ -0,0 +1,17 @@
+--TEST--
+htmlentities() test 14 (default_charset / Shift_JIS)
+--INI--
+output_handler=
+mbstring.internal_encoding=pass
+default_charset=Shift_JIS
+filter.default=unsafe_raw
+--FILE--
+<?php
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''));
+?>
+--EXPECTF--
+Shift_JIS
+
+Strict Standards: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d
+string(6) "ABC"
diff --git a/ext/standard/tests/strings/htmlentities15.phpt b/ext/standard/tests/strings/htmlentities15.phpt
new file mode 100644
index 0000000..e5729f9
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities15.phpt
@@ -0,0 +1,25 @@
+--TEST--
+htmlentities() test 15 (setlocale / KOI8-R)
+--INI--
+output_handler=
+default_charset=
+mbstring.internal_encoding=pass
+--SKIPIF--
+<?php
+$result = (bool)setlocale(LC_CTYPE, "ru_RU.koi8r", "ru_RU.KOI8-R");
+if (!$result || preg_match('/koi8/i', setlocale(LC_CTYPE, 0)) == 0) {
+ die("skip setlocale() failed\n");
+}
+?>
+--DESCRIPTION--
+As of PHP 5.4, htmlentities() no longer makes replacements with numerical
+entities. Hence, for this input there's no substitution.
+--FILE--
+<?php
+setlocale(LC_CTYPE, "ru_RU.koi8r", "ru_RU.KOI8-R");
+$str = "ÒÏÓËÏÛÎÙÊ";
+var_dump($str, htmlentities($str, ENT_QUOTES, ''));
+?>
+--EXPECT--
+string(9) "ÒÏÓËÏÛÎÙÊ"
+string(9) "ÒÏÓËÏÛÎÙÊ"
diff --git a/ext/standard/tests/strings/htmlentities16.phpt b/ext/standard/tests/strings/htmlentities16.phpt
new file mode 100644
index 0000000..ed54670
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities16.phpt
@@ -0,0 +1,21 @@
+--TEST--
+htmlentities() test 16 (mbstring / cp1251)
+--INI--
+output_handler=
+mbstring.internal_encoding=cp1251
+--SKIPIF--
+<?php
+ extension_loaded("mbstring") or die("skip mbstring not available\n");
+?>
+--FILE--
+<?php
+$str = "\x88\xa9\xf0\xee\xf1\xea\xee\xf8\xed\xfb\xe9";
+var_dump(bin2hex($str), bin2hex(htmlentities($str, ENT_QUOTES, '')));
+var_dump(htmlentities($str, ENT_QUOTES | ENT_HTML5, ''));
+?>
+===DONE===
+--EXPECT--
+string(22) "88a9f0eef1eaeef8edfbe9"
+string(42) "266575726f3b26636f70793bf0eef1eaeef8edfbe9"
+string(58) "&euro;&copy;&rcy;&ocy;&scy;&kcy;&ocy;&shcy;&ncy;&ycy;&jcy;"
+===DONE===
diff --git a/ext/standard/tests/strings/htmlentities17.phpt b/ext/standard/tests/strings/htmlentities17.phpt
new file mode 100644
index 0000000..d9e67a9
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities17.phpt
@@ -0,0 +1,47 @@
+--TEST--
+htmlentities() / html_entity_decode() #8592 - #9002 table test
+--FILE--
+<?php
+$tests = array(
+ array(8853, '&oplus;', "e28a95"),
+ array(8855, '&otimes;', "e28a97"),
+ array(8869, '&perp;', "e28aa5"),
+ array(8901, '&sdot;', "e28b85"),
+ array(8968, '&lceil;', "e28c88"),
+ array(8969, '&rceil;', "e28c89"),
+ array(8970, '&lfloor;', "e28c8a"),
+ array(8971, '&rfloor;', "e28c8b"),
+ array(9001, '&lang;', "e28ca9"),
+ array(9002, '&rang;', "e28caa")
+);
+
+foreach ($tests as $test) {
+ var_dump(htmlentities(pack('H*', $test[2]), ENT_QUOTES, 'UTF-8'));
+}
+
+foreach ($tests as $test) {
+ list(,$result) = unpack('H6', html_entity_decode($test[1], ENT_QUOTES, 'UTF-8'));
+ var_dump($result);
+}
+?>
+--EXPECT--
+string(7) "&oplus;"
+string(8) "&otimes;"
+string(6) "&perp;"
+string(6) "&sdot;"
+string(7) "&lceil;"
+string(7) "&rceil;"
+string(8) "&lfloor;"
+string(8) "&rfloor;"
+string(6) "&lang;"
+string(6) "&rang;"
+string(6) "e28a95"
+string(6) "e28a97"
+string(6) "e28aa5"
+string(6) "e28b85"
+string(6) "e28c88"
+string(6) "e28c89"
+string(6) "e28c8a"
+string(6) "e28c8b"
+string(6) "e28ca9"
+string(6) "e28caa"
diff --git a/ext/standard/tests/strings/htmlentities18.phpt b/ext/standard/tests/strings/htmlentities18.phpt
new file mode 100644
index 0000000..d7bd230
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities18.phpt
@@ -0,0 +1,43 @@
+--TEST--
+htmlentities() / htmlspecialchars() "don't double encode" flag support
+--FILE--
+<?php
+$tests = array(
+ "abc",
+ "abc&amp;sfdsa",
+ "test&#043;s &amp; some more &#68;",
+ "test&#x2b;s &amp; some more &#X44;",
+ "&; &amp &#a; &9; &#xyz;",
+ "&kffjadfdhsjfhjasdhffasdfas;",
+ "&#8787978789",
+ "&",
+ "&&amp;&",
+ "&ab&amp;&",
+);
+
+foreach ($tests as $test) {
+ var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE));
+ var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE));
+}
+?>
+--EXPECT--
+string(3) "abc"
+string(3) "abc"
+string(13) "abc&amp;sfdsa"
+string(13) "abc&amp;sfdsa"
+string(33) "test&#043;s &amp; some more &#68;"
+string(33) "test&#043;s &amp; some more &#68;"
+string(34) "test&#x2b;s &amp; some more &#X44;"
+string(34) "test&#x2b;s &amp; some more &#X44;"
+string(43) "&amp;; &amp;amp &amp;#a; &amp;9; &amp;#xyz;"
+string(43) "&amp;; &amp;amp &amp;#a; &amp;9; &amp;#xyz;"
+string(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
+string(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
+string(16) "&amp;#8787978789"
+string(16) "&amp;#8787978789"
+string(5) "&amp;"
+string(5) "&amp;"
+string(15) "&amp;&amp;&amp;"
+string(15) "&amp;&amp;&amp;"
+string(17) "&amp;ab&amp;&amp;"
+string(17) "&amp;ab&amp;&amp;"
diff --git a/ext/standard/tests/strings/htmlentities19.phpt b/ext/standard/tests/strings/htmlentities19.phpt
new file mode 100644
index 0000000..a90358c
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities19.phpt
@@ -0,0 +1,30 @@
+--TEST--
+htmlentities() / htmlspecialchars() ENT_SUBSTITUTE
+--FILE--
+<?php
+$tests = array(
+ "\x41\xC2\x3E\x42", // Unicode TR #36, 3.1.1; do not consume valid successor bytes
+ "\xE3\x80\x22", // Unicode TR #36, 3.6.1; use strategy #2
+ "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98", // example from HTML5, section 2.4
+);
+
+foreach ($tests as $test) {
+ $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
+ var_dump($a, bin2hex($a));
+ $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
+ var_dump($a, bin2hex($a));
+}
+?>
+--EXPECT--
+string(9) "Aᅵ&gt;B"
+string(18) "41efbfbd2667743b42"
+string(9) "Aᅵ&gt;B"
+string(18) "41efbfbd2667743b42"
+string(9) "ᅵ&quot;"
+string(18) "efbfbd2671756f743b"
+string(9) "ᅵ&quot;"
+string(18) "efbfbd2671756f743b"
+string(18) "AᅵᅵBᅵC☺ᅵ"
+string(36) "41efbfbdefbfbd42efbfbd43e298baefbfbd"
+string(18) "AᅵᅵBᅵC☺ᅵ"
+string(36) "41efbfbdefbfbd42efbfbd43e298baefbfbd"
diff --git a/ext/standard/tests/strings/htmlentities20.phpt b/ext/standard/tests/strings/htmlentities20.phpt
new file mode 100644
index 0000000..92c996b
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities20.phpt
@@ -0,0 +1,199 @@
+--TEST--
+htmlentities() / htmlspecialchars() ENT_DISALLOWED
+--FILE--
+<?php
+function codepoint_to_utf8($k) {
+ if ($k < 0x80) {
+ $retval = pack('C', $k);
+ } else if ($k < 0x800) {
+ $retval = pack('C2',
+ 0xc0 | ($k >> 6),
+ 0x80 | ($k & 0x3f));
+ } else if ($k < 0x10000) {
+ $retval = pack('C3',
+ 0xe0 | ($k >> 12),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ } else {
+ $retval = pack('C4',
+ 0xf0 | ($k >> 18),
+ 0x80 | (($k >> 12) & 0x3f),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ }
+ return $retval;
+}
+
+$tests = array(
+ 0x00, //C0
+ 0x01,
+ 0x09,
+ 0x0A,
+ 0x0B,
+ 0x0C,
+ 0x0D,
+ 0x0E,
+ 0x1F,
+ 0x20, //allowed always
+ 0x7F, //DEL
+ 0x80, //C1
+ 0x9F,
+ 0xA0, //allowed always
+ 0xD7FF, //surrogates
+ 0xD800,
+ 0xDFFF,
+ 0xE000, //allowed always
+ 0xFFFE, //nonchar
+ 0xFFFF,
+ 0xFDCF, //allowed always
+ 0xFDD0, //nonchar
+ 0xFDEF,
+ 0xFDF0, //allowed always
+ 0x2FFFE, //nonchar
+ 0x2FFFF,
+);
+$tests2 = array_map('codepoint_to_utf8', $tests);
+
+$subchr = codepoint_to_utf8(0xFFFD);
+
+function test($flag) {
+ global $tests, $tests2;
+ $i = -1;
+ foreach ($tests2 as $test) {
+ $i++;
+ $a = htmlentities($test, $flag | ENT_DISALLOWED, "UTF-8");
+ $b = htmlspecialchars($test, $flag | ENT_DISALLOWED, "UTF-8");
+ if ($a == "" && $b == "") { echo sprintf("%05X", $tests[$i]), ": INVALID SEQUENCE\n"; continue; }
+ echo sprintf("%05X", $tests[$i]), ": ", bin2hex($a), " ", bin2hex($b), "\n";
+ }
+}
+
+echo "*** Testing HTML 4.01 ***\n";
+
+test(ENT_HTML401);
+
+echo "\n*** Testing XHTML 1.0 ***\n";
+
+test(ENT_XHTML);
+
+echo "\n*** Testing HTML 5 ***\n";
+
+test(ENT_HTML5);
+
+echo "\n*** Testing XML 1.0 ***\n";
+
+test(ENT_XML1);
+
+?>
+--EXPECT--
+*** Testing HTML 4.01 ***
+00000: efbfbd efbfbd
+00001: efbfbd efbfbd
+00009: 09 09
+0000A: 0a 0a
+0000B: efbfbd efbfbd
+0000C: efbfbd efbfbd
+0000D: 0d 0d
+0000E: efbfbd efbfbd
+0001F: efbfbd efbfbd
+00020: 20 20
+0007F: efbfbd efbfbd
+00080: efbfbd efbfbd
+0009F: efbfbd efbfbd
+000A0: 266e6273703b c2a0
+0D7FF: ed9fbf ed9fbf
+0D800: INVALID SEQUENCE
+0DFFF: INVALID SEQUENCE
+0E000: ee8080 ee8080
+0FFFE: efbfbe efbfbe
+0FFFF: efbfbf efbfbf
+0FDCF: efb78f efb78f
+0FDD0: efb790 efb790
+0FDEF: efb7af efb7af
+0FDF0: efb7b0 efb7b0
+2FFFE: f0afbfbe f0afbfbe
+2FFFF: f0afbfbf f0afbfbf
+
+*** Testing XHTML 1.0 ***
+00000: efbfbd efbfbd
+00001: efbfbd efbfbd
+00009: 09 09
+0000A: 0a 0a
+0000B: efbfbd efbfbd
+0000C: efbfbd efbfbd
+0000D: 0d 0d
+0000E: efbfbd efbfbd
+0001F: efbfbd efbfbd
+00020: 20 20
+0007F: 7f 7f
+00080: c280 c280
+0009F: c29f c29f
+000A0: 266e6273703b c2a0
+0D7FF: ed9fbf ed9fbf
+0D800: INVALID SEQUENCE
+0DFFF: INVALID SEQUENCE
+0E000: ee8080 ee8080
+0FFFE: efbfbd efbfbd
+0FFFF: efbfbd efbfbd
+0FDCF: efb78f efb78f
+0FDD0: efb790 efb790
+0FDEF: efb7af efb7af
+0FDF0: efb7b0 efb7b0
+2FFFE: f0afbfbe f0afbfbe
+2FFFF: f0afbfbf f0afbfbf
+
+*** Testing HTML 5 ***
+00000: efbfbd efbfbd
+00001: efbfbd efbfbd
+00009: 265461623b 09
+0000A: 264e65774c696e653b 0a
+0000B: efbfbd efbfbd
+0000C: 0c 0c
+0000D: 0d 0d
+0000E: efbfbd efbfbd
+0001F: efbfbd efbfbd
+00020: 20 20
+0007F: efbfbd efbfbd
+00080: efbfbd efbfbd
+0009F: efbfbd efbfbd
+000A0: 266e6273703b c2a0
+0D7FF: ed9fbf ed9fbf
+0D800: INVALID SEQUENCE
+0DFFF: INVALID SEQUENCE
+0E000: ee8080 ee8080
+0FFFE: efbfbd efbfbd
+0FFFF: efbfbd efbfbd
+0FDCF: efb78f efb78f
+0FDD0: efbfbd efbfbd
+0FDEF: efbfbd efbfbd
+0FDF0: efb7b0 efb7b0
+2FFFE: efbfbd efbfbd
+2FFFF: efbfbd efbfbd
+
+*** Testing XML 1.0 ***
+00000: efbfbd efbfbd
+00001: efbfbd efbfbd
+00009: 09 09
+0000A: 0a 0a
+0000B: efbfbd efbfbd
+0000C: efbfbd efbfbd
+0000D: 0d 0d
+0000E: efbfbd efbfbd
+0001F: efbfbd efbfbd
+00020: 20 20
+0007F: 7f 7f
+00080: c280 c280
+0009F: c29f c29f
+000A0: c2a0 c2a0
+0D7FF: ed9fbf ed9fbf
+0D800: INVALID SEQUENCE
+0DFFF: INVALID SEQUENCE
+0E000: ee8080 ee8080
+0FFFE: efbfbd efbfbd
+0FFFF: efbfbd efbfbd
+0FDCF: efb78f efb78f
+0FDD0: efb790 efb790
+0FDEF: efb7af efb7af
+0FDF0: efb7b0 efb7b0
+2FFFE: f0afbfbe f0afbfbe
+2FFFF: f0afbfbf f0afbfbf
diff --git a/ext/standard/tests/strings/htmlentities21.phpt b/ext/standard/tests/strings/htmlentities21.phpt
new file mode 100644
index 0000000..f34ff26
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities21.phpt
@@ -0,0 +1,198 @@
+--TEST--
+htmlentities() / htmlspecialchars() ENT_DISALLOWED charset variation
+--FILE--
+<?php
+$tests = array(
+ 0x00, //C0
+ 0x01,
+ 0x09,
+ 0x0A,
+ 0x0B,
+ 0x0C,
+ 0x0D,
+ 0x0E,
+ 0x1F,
+ 0x20, //allowed always
+ 0x7F, //DEL
+ 0x80, //C1
+ 0x9F,
+ 0xA0, //allowed always
+);
+
+function test($flag, $charset) {
+ global $tests;
+ $i = -1;
+ error_reporting(-1 & ~E_STRICT);
+ foreach ($tests as $test) {
+ $test = chr($test);
+ $i++;
+ $a = htmlentities($test, $flag | ENT_DISALLOWED, $charset);
+ $b = htmlspecialchars($test, $flag | ENT_DISALLOWED, $charset);
+ if ($a == "" && $b == "") { echo sprintf("%05X", $tests[$i]), ": INVALID SEQUENCE\n"; continue; }
+ echo sprintf("%05X", $tests[$i]), ": ", bin2hex($a), " ", bin2hex($b), "\n";
+ }
+ error_reporting(-1);
+}
+
+echo "*** Testing HTML 4.01/Windows-1251 ***\n";
+
+test(ENT_HTML401, "Windows-1251");
+
+echo "\n*** Testing XHTML 1.0/Windows-1251 ***\n";
+
+test(ENT_XHTML, "Windows-1251");
+
+echo "\n*** Testing HTML 5/Windows-1251 ***\n";
+
+test(ENT_HTML5, "Windows-1251");
+
+echo "\n*** Testing XML 1.0/Windows-1251 ***\n";
+
+test(ENT_XML1, "Windows-1251");
+
+echo "\n*** Testing HTML 4.01/SJIS ***\n";
+
+test(ENT_HTML401, "SJIS");
+
+echo "\n*** Testing XHTML 1.0/SJIS ***\n";
+
+test(ENT_XHTML, "SJIS");
+
+echo "\n*** Testing HTML 5/SJIS ***\n";
+
+test(ENT_HTML5, "SJIS");
+
+echo "\n*** Testing XML 1.0/SJIS ***\n";
+
+test(ENT_XML1, "SJIS");
+
+
+?>
+--EXPECT--
+*** Testing HTML 4.01/Windows-1251 ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 262378464646443b 262378464646443b
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 262378464646443b 7f
+00080: 80 80
+0009F: 9f 9f
+000A0: 266e6273703b a0
+
+*** Testing XHTML 1.0/Windows-1251 ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 262378464646443b 262378464646443b
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 7f 7f
+00080: 80 80
+0009F: 9f 9f
+000A0: 266e6273703b a0
+
+*** Testing HTML 5/Windows-1251 ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 265461623b 09
+0000A: 264e65774c696e653b 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 0c 0c
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 262378464646443b 7f
+00080: 26444a63793b 80
+0009F: 26647a63793b 9f
+000A0: 266e6273703b a0
+
+*** Testing XML 1.0/Windows-1251 ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 262378464646443b 262378464646443b
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 7f 7f
+00080: 80 80
+0009F: 9f 9f
+000A0: a0 a0
+
+*** Testing HTML 4.01/SJIS ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 262378464646443b 262378464646443b
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 7f 7f
+00080: INVALID SEQUENCE
+0009F: INVALID SEQUENCE
+000A0: INVALID SEQUENCE
+
+*** Testing XHTML 1.0/SJIS ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 262378464646443b 262378464646443b
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 7f 7f
+00080: INVALID SEQUENCE
+0009F: INVALID SEQUENCE
+000A0: INVALID SEQUENCE
+
+*** Testing HTML 5/SJIS ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 0c 0c
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 7f 7f
+00080: INVALID SEQUENCE
+0009F: INVALID SEQUENCE
+000A0: INVALID SEQUENCE
+
+*** Testing XML 1.0/SJIS ***
+00000: 262378464646443b 262378464646443b
+00001: 262378464646443b 262378464646443b
+00009: 09 09
+0000A: 0a 0a
+0000B: 262378464646443b 262378464646443b
+0000C: 262378464646443b 262378464646443b
+0000D: 0d 0d
+0000E: 262378464646443b 262378464646443b
+0001F: 262378464646443b 262378464646443b
+00020: 20 20
+0007F: 7f 7f
+00080: INVALID SEQUENCE
+0009F: INVALID SEQUENCE
+000A0: INVALID SEQUENCE
diff --git a/ext/standard/tests/strings/htmlentities22.phpt b/ext/standard/tests/strings/htmlentities22.phpt
new file mode 100644
index 0000000..f119820
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities22.phpt
@@ -0,0 +1,283 @@
+--TEST--
+htmlentities() / htmlspecialchars() ENT_DISALLOWED with entities and no double encode
+--FILE--
+<?php
+$tests = array(
+ "&#0;", //C0
+ "&#1;",
+ "&#x09;",
+ "&#x0A;",
+ "&#x0B;",
+ "&#x0C;",
+ "&#x0D;", //note that HTML5 is unique in that it forbids this entity, but allows a literal U+0D
+ "&#x0E;",
+ "&#x1F;",
+ "&#x20;", //allowed always
+ "&#x7F;", //DEL
+ "&#x80;", //C1
+ "&#x9F;",
+ "&#xA0;", //allowed always
+ "&#xD7FF;", //surrogates
+ "&#xD800;",
+ "&#xDFFF;",
+ "&#xE000;", //allowed always
+ "&#xFFFE;", //nonchar
+ "&#xFFFF;",
+ "&#xFDCF;", //allowed always
+ "&#xFDD0;", //nonchar
+ "&#xFDEF;",
+ "&#xFDF0;", //allowed always
+ "&#x2FFFE;", //nonchar
+ "&#x2FFFF;",
+ "&#x110000;", //bad reference
+);
+
+function test($flag, $flag2=ENT_DISALLOWED, $charset="UTF-8") {
+ global $tests;
+ $i = -1;
+ error_reporting(-1 & ~E_STRICT);
+ foreach ($tests as $test) {
+ $i++;
+ $a = htmlentities($test, $flag | $flag2, $charset, FALSE);
+ $b = htmlspecialchars($test, $flag | $flag2, $charset, FALSE);
+
+ if ($a == $b)
+ echo sprintf("%s\t%s", $test, $a==$test?"NOT CHANGED":"CHANGED"), "\n";
+ else
+ echo sprintf("%s\tCHANGED (%s, %s)", $test, $a, $b), "\n";
+ }
+ error_reporting(-1);
+}
+
+echo "*** Testing HTML 4.01 ***\n";
+
+test(ENT_HTML401);
+
+echo "\n*** Testing XHTML 1.0 ***\n";
+
+test(ENT_XHTML);
+
+echo "\n*** Testing HTML 5 ***\n";
+
+test(ENT_HTML5);
+
+echo "\n*** Testing XML 1.0 ***\n";
+
+test(ENT_XML1);
+
+echo "\n*** Testing 5 without the flag ***\n";
+
+test(ENT_HTML5, 0);
+
+echo "\n*** Testing HTML 5 with another single-byte encoding ***\n";
+
+test(ENT_HTML5, ENT_DISALLOWED, "Windows-1251");
+
+echo "\n*** Testing HTML 5 with another multibyte-byte encoding ***\n";
+
+test(ENT_HTML5, ENT_DISALLOWED, "SJIS");
+
+?>
+--EXPECT--
+*** Testing HTML 4.01 ***
+&#0; NOT CHANGED
+&#1; NOT CHANGED
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; NOT CHANGED
+&#x0C; NOT CHANGED
+&#x0D; NOT CHANGED
+&#x0E; NOT CHANGED
+&#x1F; NOT CHANGED
+&#x20; NOT CHANGED
+&#x7F; NOT CHANGED
+&#x80; NOT CHANGED
+&#x9F; NOT CHANGED
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; NOT CHANGED
+&#xDFFF; NOT CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; NOT CHANGED
+&#xFFFF; NOT CHANGED
+&#xFDCF; NOT CHANGED
+&#xFDD0; NOT CHANGED
+&#xFDEF; NOT CHANGED
+&#xFDF0; NOT CHANGED
+&#x2FFFE; NOT CHANGED
+&#x2FFFF; NOT CHANGED
+&#x110000; CHANGED
+
+*** Testing XHTML 1.0 ***
+&#0; CHANGED
+&#1; CHANGED
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; CHANGED
+&#x0C; CHANGED
+&#x0D; NOT CHANGED
+&#x0E; CHANGED
+&#x1F; CHANGED
+&#x20; NOT CHANGED
+&#x7F; NOT CHANGED
+&#x80; NOT CHANGED
+&#x9F; NOT CHANGED
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; CHANGED
+&#xDFFF; CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; CHANGED
+&#xFFFF; CHANGED
+&#xFDCF; NOT CHANGED
+&#xFDD0; NOT CHANGED
+&#xFDEF; NOT CHANGED
+&#xFDF0; NOT CHANGED
+&#x2FFFE; NOT CHANGED
+&#x2FFFF; NOT CHANGED
+&#x110000; CHANGED
+
+*** Testing HTML 5 ***
+&#0; CHANGED (&amp;&num;0&semi;, &amp;#0;)
+&#1; CHANGED (&amp;&num;1&semi;, &amp;#1;)
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; CHANGED (&amp;&num;x0B&semi;, &amp;#x0B;)
+&#x0C; NOT CHANGED
+&#x0D; CHANGED (&amp;&num;x0D&semi;, &amp;#x0D;)
+&#x0E; CHANGED (&amp;&num;x0E&semi;, &amp;#x0E;)
+&#x1F; CHANGED (&amp;&num;x1F&semi;, &amp;#x1F;)
+&#x20; NOT CHANGED
+&#x7F; CHANGED (&amp;&num;x7F&semi;, &amp;#x7F;)
+&#x80; CHANGED (&amp;&num;x80&semi;, &amp;#x80;)
+&#x9F; CHANGED (&amp;&num;x9F&semi;, &amp;#x9F;)
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; NOT CHANGED
+&#xDFFF; NOT CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; CHANGED (&amp;&num;xFFFE&semi;, &amp;#xFFFE;)
+&#xFFFF; CHANGED (&amp;&num;xFFFF&semi;, &amp;#xFFFF;)
+&#xFDCF; NOT CHANGED
+&#xFDD0; CHANGED (&amp;&num;xFDD0&semi;, &amp;#xFDD0;)
+&#xFDEF; CHANGED (&amp;&num;xFDEF&semi;, &amp;#xFDEF;)
+&#xFDF0; NOT CHANGED
+&#x2FFFE; CHANGED (&amp;&num;x2FFFE&semi;, &amp;#x2FFFE;)
+&#x2FFFF; CHANGED (&amp;&num;x2FFFF&semi;, &amp;#x2FFFF;)
+&#x110000; CHANGED (&amp;&num;x110000&semi;, &amp;#x110000;)
+
+*** Testing XML 1.0 ***
+&#0; CHANGED
+&#1; CHANGED
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; CHANGED
+&#x0C; CHANGED
+&#x0D; NOT CHANGED
+&#x0E; CHANGED
+&#x1F; CHANGED
+&#x20; NOT CHANGED
+&#x7F; NOT CHANGED
+&#x80; NOT CHANGED
+&#x9F; NOT CHANGED
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; CHANGED
+&#xDFFF; CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; CHANGED
+&#xFFFF; CHANGED
+&#xFDCF; NOT CHANGED
+&#xFDD0; NOT CHANGED
+&#xFDEF; NOT CHANGED
+&#xFDF0; NOT CHANGED
+&#x2FFFE; NOT CHANGED
+&#x2FFFF; NOT CHANGED
+&#x110000; CHANGED
+
+*** Testing 5 without the flag ***
+&#0; NOT CHANGED
+&#1; NOT CHANGED
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; NOT CHANGED
+&#x0C; NOT CHANGED
+&#x0D; NOT CHANGED
+&#x0E; NOT CHANGED
+&#x1F; NOT CHANGED
+&#x20; NOT CHANGED
+&#x7F; NOT CHANGED
+&#x80; NOT CHANGED
+&#x9F; NOT CHANGED
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; NOT CHANGED
+&#xDFFF; NOT CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; NOT CHANGED
+&#xFFFF; NOT CHANGED
+&#xFDCF; NOT CHANGED
+&#xFDD0; NOT CHANGED
+&#xFDEF; NOT CHANGED
+&#xFDF0; NOT CHANGED
+&#x2FFFE; NOT CHANGED
+&#x2FFFF; NOT CHANGED
+&#x110000; CHANGED (&amp;&num;x110000&semi;, &amp;#x110000;)
+
+*** Testing HTML 5 with another single-byte encoding ***
+&#0; CHANGED (&amp;&num;0&semi;, &amp;#0;)
+&#1; CHANGED (&amp;&num;1&semi;, &amp;#1;)
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; CHANGED (&amp;&num;x0B&semi;, &amp;#x0B;)
+&#x0C; NOT CHANGED
+&#x0D; CHANGED (&amp;&num;x0D&semi;, &amp;#x0D;)
+&#x0E; CHANGED (&amp;&num;x0E&semi;, &amp;#x0E;)
+&#x1F; CHANGED (&amp;&num;x1F&semi;, &amp;#x1F;)
+&#x20; NOT CHANGED
+&#x7F; CHANGED (&amp;&num;x7F&semi;, &amp;#x7F;)
+&#x80; CHANGED (&amp;&num;x80&semi;, &amp;#x80;)
+&#x9F; CHANGED (&amp;&num;x9F&semi;, &amp;#x9F;)
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; NOT CHANGED
+&#xDFFF; NOT CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; CHANGED (&amp;&num;xFFFE&semi;, &amp;#xFFFE;)
+&#xFFFF; CHANGED (&amp;&num;xFFFF&semi;, &amp;#xFFFF;)
+&#xFDCF; NOT CHANGED
+&#xFDD0; CHANGED (&amp;&num;xFDD0&semi;, &amp;#xFDD0;)
+&#xFDEF; CHANGED (&amp;&num;xFDEF&semi;, &amp;#xFDEF;)
+&#xFDF0; NOT CHANGED
+&#x2FFFE; CHANGED (&amp;&num;x2FFFE&semi;, &amp;#x2FFFE;)
+&#x2FFFF; CHANGED (&amp;&num;x2FFFF&semi;, &amp;#x2FFFF;)
+&#x110000; CHANGED (&amp;&num;x110000&semi;, &amp;#x110000;)
+
+*** Testing HTML 5 with another multibyte-byte encoding ***
+&#0; CHANGED
+&#1; CHANGED
+&#x09; NOT CHANGED
+&#x0A; NOT CHANGED
+&#x0B; CHANGED
+&#x0C; NOT CHANGED
+&#x0D; CHANGED
+&#x0E; CHANGED
+&#x1F; CHANGED
+&#x20; NOT CHANGED
+&#x7F; CHANGED
+&#x80; CHANGED
+&#x9F; CHANGED
+&#xA0; NOT CHANGED
+&#xD7FF; NOT CHANGED
+&#xD800; NOT CHANGED
+&#xDFFF; NOT CHANGED
+&#xE000; NOT CHANGED
+&#xFFFE; CHANGED
+&#xFFFF; CHANGED
+&#xFDCF; NOT CHANGED
+&#xFDD0; CHANGED
+&#xFDEF; CHANGED
+&#xFDF0; NOT CHANGED
+&#x2FFFE; CHANGED
+&#x2FFFF; CHANGED
+&#x110000; CHANGED
diff --git a/ext/standard/tests/strings/htmlentities23.phpt b/ext/standard/tests/strings/htmlentities23.phpt
new file mode 100644
index 0000000..bcfcd8d
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities23.phpt
@@ -0,0 +1,95 @@
+--TEST--
+htmlentities() / htmlspecialchars() ENT_SUBSTITUTE EUC-JP
+--FILE--
+<?php
+$tests = array(
+ "\x8F\xA1\xFF", //2 sub as 2nd is potentially valid as lead
+ "\x8F\xA1", //2 sub, as 2nd is potentially valid as lead
+ "\x8F", //1 sub
+ "\x8F\xA0", //1 sub, A0 is not valid as sole/first byte
+ "\x8F\xA1\x21", //2 sub, no consume last
+ "\x8F\x21", //1 sub, no consume last
+ "\x8E\xAE", //valid
+ "\x8E", //1 sub
+ "\x8E\x21", //1 sub, no consume last
+ "\xB2\xFF", //1 sub
+ "\xB2", //1 sub
+ "\xB2\x21", //1 sub, no consume last
+ "\xA0", //1 sub
+);
+
+foreach ($tests as $test) {
+ error_reporting(~E_STRICT);
+ $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP");
+ error_reporting(-1);
+ var_dump($a, bin2hex($a));
+ $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP");
+ var_dump($a, bin2hex($a));
+ echo "\n";
+}
+?>
+--EXPECT--
+string(16) "&#xFFFD;&#xFFFD;"
+string(32) "262378464646443b262378464646443b"
+string(16) "&#xFFFD;&#xFFFD;"
+string(32) "262378464646443b262378464646443b"
+
+string(16) "&#xFFFD;&#xFFFD;"
+string(32) "262378464646443b262378464646443b"
+string(16) "&#xFFFD;&#xFFFD;"
+string(32) "262378464646443b262378464646443b"
+
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+
+string(17) "&#xFFFD;&#xFFFD;!"
+string(34) "262378464646443b262378464646443b21"
+string(17) "&#xFFFD;&#xFFFD;!"
+string(34) "262378464646443b262378464646443b21"
+
+string(9) "&#xFFFD;!"
+string(18) "262378464646443b21"
+string(9) "&#xFFFD;!"
+string(18) "262378464646443b21"
+
+string(2) "Ž®"
+string(4) "8eae"
+string(2) "Ž®"
+string(4) "8eae"
+
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+
+string(9) "&#xFFFD;!"
+string(18) "262378464646443b21"
+string(9) "&#xFFFD;!"
+string(18) "262378464646443b21"
+
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+
+string(9) "&#xFFFD;!"
+string(18) "262378464646443b21"
+string(9) "&#xFFFD;!"
+string(18) "262378464646443b21"
+
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
+string(8) "&#xFFFD;"
+string(16) "262378464646443b"
diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt
new file mode 100644
index 0000000..3ffdd65
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities24.phpt
@@ -0,0 +1,331 @@
+--TEST--
+Test htmlentities() function
+--FILE--
+<?php
+/* Prototype: string htmlentities ( string $string [, int $quote_style [, string $charset]] );
+ Description: Convert all applicable characters to HTML entities
+*/
+
+/* retrieving htmlentities from the ANSI character table */
+echo "*** Retrieving htmlentities for 256 characters ***\n";
+for($i=0; $i<256; $i++)
+ var_dump( bin2hex( htmlentities(b"chr($i)")) );
+
+/* giving arguments as NULL */
+echo "\n*** Testing htmlentities() with NULL as first,second and third argument ***\n";
+var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", NULL, 'cp1252') );
+var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_QUOTES, NULL) ); /* UTF-8 assumed */
+var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_NOQUOTES, NULL) ); /* UTF-8 assumed */
+var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_COMPAT, NULL) ); /* UTF-8 assumed */
+var_dump( htmlentities(NULL, NULL, NULL) );
+
+/* giving long string to check for proper memory re-allocation */
+echo "\n*** Checking for proper memory allocation with long string ***\n";
+var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x86\x84\x80\x89\x85\x83\x86\x84\x80\x91\x83\x91\x86\x87\x85\x86\x88\x82\x89\x92\x91\x83", ENT_QUOTES, 'cp1252'));
+
+/* giving a normal string */
+echo "\n*** Testing a normal string with htmlentities() ***\n";
+var_dump( htmlentities("<html> This is a test! </html>") );
+
+/* checking behavior of quote */
+echo "\n*** Testing htmlentites() on a quote ***\n";
+$str = "A 'quote' is <b>bold</b>";
+var_dump( htmlentities($str) );
+var_dump( htmlentities($str, ENT_QUOTES) );
+var_dump( htmlentities($str, ENT_NOQUOTES) );
+var_dump( htmlentities($str, ENT_COMPAT) );
+
+echo "\n*** Testing error conditions ***\n";
+/* zero argument */
+var_dump( htmlentities() );
+/* arguments more than expected */
+var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") );
+
+echo "Done\n";
+?>
+
+--EXPECTF--
+*** Retrieving htmlentities for 256 characters ***
+string(12) "636872283029"
+string(12) "636872283129"
+string(12) "636872283229"
+string(12) "636872283329"
+string(12) "636872283429"
+string(12) "636872283529"
+string(12) "636872283629"
+string(12) "636872283729"
+string(12) "636872283829"
+string(12) "636872283929"
+string(14) "63687228313029"
+string(14) "63687228313129"
+string(14) "63687228313229"
+string(14) "63687228313329"
+string(14) "63687228313429"
+string(14) "63687228313529"
+string(14) "63687228313629"
+string(14) "63687228313729"
+string(14) "63687228313829"
+string(14) "63687228313929"
+string(14) "63687228323029"
+string(14) "63687228323129"
+string(14) "63687228323229"
+string(14) "63687228323329"
+string(14) "63687228323429"
+string(14) "63687228323529"
+string(14) "63687228323629"
+string(14) "63687228323729"
+string(14) "63687228323829"
+string(14) "63687228323929"
+string(14) "63687228333029"
+string(14) "63687228333129"
+string(14) "63687228333229"
+string(14) "63687228333329"
+string(14) "63687228333429"
+string(14) "63687228333529"
+string(14) "63687228333629"
+string(14) "63687228333729"
+string(14) "63687228333829"
+string(14) "63687228333929"
+string(14) "63687228343029"
+string(14) "63687228343129"
+string(14) "63687228343229"
+string(14) "63687228343329"
+string(14) "63687228343429"
+string(14) "63687228343529"
+string(14) "63687228343629"
+string(14) "63687228343729"
+string(14) "63687228343829"
+string(14) "63687228343929"
+string(14) "63687228353029"
+string(14) "63687228353129"
+string(14) "63687228353229"
+string(14) "63687228353329"
+string(14) "63687228353429"
+string(14) "63687228353529"
+string(14) "63687228353629"
+string(14) "63687228353729"
+string(14) "63687228353829"
+string(14) "63687228353929"
+string(14) "63687228363029"
+string(14) "63687228363129"
+string(14) "63687228363229"
+string(14) "63687228363329"
+string(14) "63687228363429"
+string(14) "63687228363529"
+string(14) "63687228363629"
+string(14) "63687228363729"
+string(14) "63687228363829"
+string(14) "63687228363929"
+string(14) "63687228373029"
+string(14) "63687228373129"
+string(14) "63687228373229"
+string(14) "63687228373329"
+string(14) "63687228373429"
+string(14) "63687228373529"
+string(14) "63687228373629"
+string(14) "63687228373729"
+string(14) "63687228373829"
+string(14) "63687228373929"
+string(14) "63687228383029"
+string(14) "63687228383129"
+string(14) "63687228383229"
+string(14) "63687228383329"
+string(14) "63687228383429"
+string(14) "63687228383529"
+string(14) "63687228383629"
+string(14) "63687228383729"
+string(14) "63687228383829"
+string(14) "63687228383929"
+string(14) "63687228393029"
+string(14) "63687228393129"
+string(14) "63687228393229"
+string(14) "63687228393329"
+string(14) "63687228393429"
+string(14) "63687228393529"
+string(14) "63687228393629"
+string(14) "63687228393729"
+string(14) "63687228393829"
+string(14) "63687228393929"
+string(16) "6368722831303029"
+string(16) "6368722831303129"
+string(16) "6368722831303229"
+string(16) "6368722831303329"
+string(16) "6368722831303429"
+string(16) "6368722831303529"
+string(16) "6368722831303629"
+string(16) "6368722831303729"
+string(16) "6368722831303829"
+string(16) "6368722831303929"
+string(16) "6368722831313029"
+string(16) "6368722831313129"
+string(16) "6368722831313229"
+string(16) "6368722831313329"
+string(16) "6368722831313429"
+string(16) "6368722831313529"
+string(16) "6368722831313629"
+string(16) "6368722831313729"
+string(16) "6368722831313829"
+string(16) "6368722831313929"
+string(16) "6368722831323029"
+string(16) "6368722831323129"
+string(16) "6368722831323229"
+string(16) "6368722831323329"
+string(16) "6368722831323429"
+string(16) "6368722831323529"
+string(16) "6368722831323629"
+string(16) "6368722831323729"
+string(16) "6368722831323829"
+string(16) "6368722831323929"
+string(16) "6368722831333029"
+string(16) "6368722831333129"
+string(16) "6368722831333229"
+string(16) "6368722831333329"
+string(16) "6368722831333429"
+string(16) "6368722831333529"
+string(16) "6368722831333629"
+string(16) "6368722831333729"
+string(16) "6368722831333829"
+string(16) "6368722831333929"
+string(16) "6368722831343029"
+string(16) "6368722831343129"
+string(16) "6368722831343229"
+string(16) "6368722831343329"
+string(16) "6368722831343429"
+string(16) "6368722831343529"
+string(16) "6368722831343629"
+string(16) "6368722831343729"
+string(16) "6368722831343829"
+string(16) "6368722831343929"
+string(16) "6368722831353029"
+string(16) "6368722831353129"
+string(16) "6368722831353229"
+string(16) "6368722831353329"
+string(16) "6368722831353429"
+string(16) "6368722831353529"
+string(16) "6368722831353629"
+string(16) "6368722831353729"
+string(16) "6368722831353829"
+string(16) "6368722831353929"
+string(16) "6368722831363029"
+string(16) "6368722831363129"
+string(16) "6368722831363229"
+string(16) "6368722831363329"
+string(16) "6368722831363429"
+string(16) "6368722831363529"
+string(16) "6368722831363629"
+string(16) "6368722831363729"
+string(16) "6368722831363829"
+string(16) "6368722831363929"
+string(16) "6368722831373029"
+string(16) "6368722831373129"
+string(16) "6368722831373229"
+string(16) "6368722831373329"
+string(16) "6368722831373429"
+string(16) "6368722831373529"
+string(16) "6368722831373629"
+string(16) "6368722831373729"
+string(16) "6368722831373829"
+string(16) "6368722831373929"
+string(16) "6368722831383029"
+string(16) "6368722831383129"
+string(16) "6368722831383229"
+string(16) "6368722831383329"
+string(16) "6368722831383429"
+string(16) "6368722831383529"
+string(16) "6368722831383629"
+string(16) "6368722831383729"
+string(16) "6368722831383829"
+string(16) "6368722831383929"
+string(16) "6368722831393029"
+string(16) "6368722831393129"
+string(16) "6368722831393229"
+string(16) "6368722831393329"
+string(16) "6368722831393429"
+string(16) "6368722831393529"
+string(16) "6368722831393629"
+string(16) "6368722831393729"
+string(16) "6368722831393829"
+string(16) "6368722831393929"
+string(16) "6368722832303029"
+string(16) "6368722832303129"
+string(16) "6368722832303229"
+string(16) "6368722832303329"
+string(16) "6368722832303429"
+string(16) "6368722832303529"
+string(16) "6368722832303629"
+string(16) "6368722832303729"
+string(16) "6368722832303829"
+string(16) "6368722832303929"
+string(16) "6368722832313029"
+string(16) "6368722832313129"
+string(16) "6368722832313229"
+string(16) "6368722832313329"
+string(16) "6368722832313429"
+string(16) "6368722832313529"
+string(16) "6368722832313629"
+string(16) "6368722832313729"
+string(16) "6368722832313829"
+string(16) "6368722832313929"
+string(16) "6368722832323029"
+string(16) "6368722832323129"
+string(16) "6368722832323229"
+string(16) "6368722832323329"
+string(16) "6368722832323429"
+string(16) "6368722832323529"
+string(16) "6368722832323629"
+string(16) "6368722832323729"
+string(16) "6368722832323829"
+string(16) "6368722832323929"
+string(16) "6368722832333029"
+string(16) "6368722832333129"
+string(16) "6368722832333229"
+string(16) "6368722832333329"
+string(16) "6368722832333429"
+string(16) "6368722832333529"
+string(16) "6368722832333629"
+string(16) "6368722832333729"
+string(16) "6368722832333829"
+string(16) "6368722832333929"
+string(16) "6368722832343029"
+string(16) "6368722832343129"
+string(16) "6368722832343229"
+string(16) "6368722832343329"
+string(16) "6368722832343429"
+string(16) "6368722832343529"
+string(16) "6368722832343629"
+string(16) "6368722832343729"
+string(16) "6368722832343829"
+string(16) "6368722832343929"
+string(16) "6368722832353029"
+string(16) "6368722832353129"
+string(16) "6368722832353229"
+string(16) "6368722832353329"
+string(16) "6368722832353429"
+string(16) "6368722832353529"
+
+*** Testing htmlentities() with NULL as first,second and third argument ***
+string(42) "&sbquo;&dagger;&trade;&Yuml;&euro;&sbquo;"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+
+*** Checking for proper memory allocation with long string ***
+string(198) "&sbquo;&dagger;&trade;&Yuml;&euro;&sbquo;&dagger;&bdquo;&euro;&permil;&hellip;&fnof;&dagger;&bdquo;&euro;&lsquo;&fnof;&lsquo;&dagger;&Dagger;&hellip;&dagger;&circ;&sbquo;&permil;&rsquo;&lsquo;&fnof;"
+
+*** Testing a normal string with htmlentities() ***
+string(42) "&lt;html&gt; This is a test! &lt;/html&gt;"
+
+*** Testing htmlentites() on a quote ***
+string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
+string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
+string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
+string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
+
+*** Testing error conditions ***
+
+Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+string(14) "&bdquo;&lsquo;"
+Done
+
diff --git a/ext/standard/tests/strings/htmlentities_html4.phpt b/ext/standard/tests/strings/htmlentities_html4.phpt
new file mode 100644
index 0000000..22b0305
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities_html4.phpt
@@ -0,0 +1,313 @@
+--TEST--
+htmlentities() conformance check (HTML 4)
+--FILE--
+<?php
+function utf32_utf8($k) {
+ if ($k < 0x80) {
+ $retval = pack('C', $k);
+ } else if ($k < 0x800) {
+ $retval = pack('C2',
+ 0xc0 | ($k >> 6),
+ 0x80 | ($k & 0x3f));
+ } else if ($k < 0x10000) {
+ $retval = pack('C3',
+ 0xe0 | ($k >> 12),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ } else if ($k < 0x200000) {
+ $retval = pack('C4',
+ 0xf0 | ($k >> 18),
+ 0x80 | (($k >> 12) & 0x3f),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ } else if ($k < 0x4000000) {
+ $retval = pack('C5',
+ 0xf8 | ($k >> 24),
+ 0x80 | (($k >> 18) & 0x3f),
+ 0x80 | (($k >> 12) & 0x3f),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ } else {
+ $retval = pack('C6',
+ 0xfc | ($k >> 30),
+ 0x80 | (($k >> 24) & 0x3f),
+ 0x80 | (($k >> 18) & 0x3f),
+ 0x80 | (($k >> 12) & 0x3f),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ }
+ return $retval;
+}
+
+$table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, 'UTF-8');
+
+for ($i = 0; $i < 0x2710; $i++) {
+ if ($i >= 0xd800 && $i < 0xe000)
+ continue;
+ $str = utf32_utf8($i);
+ if (isset($table[$str])) {
+ printf("%s\tU+%05X\n", $table[$str], $i);
+ unset($table[$str]);
+ }
+}
+
+if (!empty($table)) {
+ echo "Not matched entities: ";
+ var_dump($table);
+}
+
+?>
+--EXPECT--
+&quot; U+00022
+&amp; U+00026
+&#039; U+00027
+&lt; U+0003C
+&gt; U+0003E
+&nbsp; U+000A0
+&iexcl; U+000A1
+&cent; U+000A2
+&pound; U+000A3
+&curren; U+000A4
+&yen; U+000A5
+&brvbar; U+000A6
+&sect; U+000A7
+&uml; U+000A8
+&copy; U+000A9
+&ordf; U+000AA
+&laquo; U+000AB
+&not; U+000AC
+&shy; U+000AD
+&reg; U+000AE
+&macr; U+000AF
+&deg; U+000B0
+&plusmn; U+000B1
+&sup2; U+000B2
+&sup3; U+000B3
+&acute; U+000B4
+&micro; U+000B5
+&para; U+000B6
+&middot; U+000B7
+&cedil; U+000B8
+&sup1; U+000B9
+&ordm; U+000BA
+&raquo; U+000BB
+&frac14; U+000BC
+&frac12; U+000BD
+&frac34; U+000BE
+&iquest; U+000BF
+&Agrave; U+000C0
+&Aacute; U+000C1
+&Acirc; U+000C2
+&Atilde; U+000C3
+&Auml; U+000C4
+&Aring; U+000C5
+&AElig; U+000C6
+&Ccedil; U+000C7
+&Egrave; U+000C8
+&Eacute; U+000C9
+&Ecirc; U+000CA
+&Euml; U+000CB
+&Igrave; U+000CC
+&Iacute; U+000CD
+&Icirc; U+000CE
+&Iuml; U+000CF
+&ETH; U+000D0
+&Ntilde; U+000D1
+&Ograve; U+000D2
+&Oacute; U+000D3
+&Ocirc; U+000D4
+&Otilde; U+000D5
+&Ouml; U+000D6
+&times; U+000D7
+&Oslash; U+000D8
+&Ugrave; U+000D9
+&Uacute; U+000DA
+&Ucirc; U+000DB
+&Uuml; U+000DC
+&Yacute; U+000DD
+&THORN; U+000DE
+&szlig; U+000DF
+&agrave; U+000E0
+&aacute; U+000E1
+&acirc; U+000E2
+&atilde; U+000E3
+&auml; U+000E4
+&aring; U+000E5
+&aelig; U+000E6
+&ccedil; U+000E7
+&egrave; U+000E8
+&eacute; U+000E9
+&ecirc; U+000EA
+&euml; U+000EB
+&igrave; U+000EC
+&iacute; U+000ED
+&icirc; U+000EE
+&iuml; U+000EF
+&eth; U+000F0
+&ntilde; U+000F1
+&ograve; U+000F2
+&oacute; U+000F3
+&ocirc; U+000F4
+&otilde; U+000F5
+&ouml; U+000F6
+&divide; U+000F7
+&oslash; U+000F8
+&ugrave; U+000F9
+&uacute; U+000FA
+&ucirc; U+000FB
+&uuml; U+000FC
+&yacute; U+000FD
+&thorn; U+000FE
+&yuml; U+000FF
+&OElig; U+00152
+&oelig; U+00153
+&Scaron; U+00160
+&scaron; U+00161
+&Yuml; U+00178
+&fnof; U+00192
+&circ; U+002C6
+&tilde; U+002DC
+&Alpha; U+00391
+&Beta; U+00392
+&Gamma; U+00393
+&Delta; U+00394
+&Epsilon; U+00395
+&Zeta; U+00396
+&Eta; U+00397
+&Theta; U+00398
+&Iota; U+00399
+&Kappa; U+0039A
+&Lambda; U+0039B
+&Mu; U+0039C
+&Nu; U+0039D
+&Xi; U+0039E
+&Omicron; U+0039F
+&Pi; U+003A0
+&Rho; U+003A1
+&Sigma; U+003A3
+&Tau; U+003A4
+&Upsilon; U+003A5
+&Phi; U+003A6
+&Chi; U+003A7
+&Psi; U+003A8
+&Omega; U+003A9
+&alpha; U+003B1
+&beta; U+003B2
+&gamma; U+003B3
+&delta; U+003B4
+&epsilon; U+003B5
+&zeta; U+003B6
+&eta; U+003B7
+&theta; U+003B8
+&iota; U+003B9
+&kappa; U+003BA
+&lambda; U+003BB
+&mu; U+003BC
+&nu; U+003BD
+&xi; U+003BE
+&omicron; U+003BF
+&pi; U+003C0
+&rho; U+003C1
+&sigmaf; U+003C2
+&sigma; U+003C3
+&tau; U+003C4
+&upsilon; U+003C5
+&phi; U+003C6
+&chi; U+003C7
+&psi; U+003C8
+&omega; U+003C9
+&thetasym; U+003D1
+&upsih; U+003D2
+&piv; U+003D6
+&ensp; U+02002
+&emsp; U+02003
+&thinsp; U+02009
+&zwnj; U+0200C
+&zwj; U+0200D
+&lrm; U+0200E
+&rlm; U+0200F
+&ndash; U+02013
+&mdash; U+02014
+&lsquo; U+02018
+&rsquo; U+02019
+&sbquo; U+0201A
+&ldquo; U+0201C
+&rdquo; U+0201D
+&bdquo; U+0201E
+&dagger; U+02020
+&Dagger; U+02021
+&bull; U+02022
+&hellip; U+02026
+&permil; U+02030
+&prime; U+02032
+&Prime; U+02033
+&lsaquo; U+02039
+&rsaquo; U+0203A
+&oline; U+0203E
+&frasl; U+02044
+&euro; U+020AC
+&image; U+02111
+&weierp; U+02118
+&real; U+0211C
+&trade; U+02122
+&alefsym; U+02135
+&larr; U+02190
+&uarr; U+02191
+&rarr; U+02192
+&darr; U+02193
+&harr; U+02194
+&crarr; U+021B5
+&lArr; U+021D0
+&uArr; U+021D1
+&rArr; U+021D2
+&dArr; U+021D3
+&hArr; U+021D4
+&forall; U+02200
+&part; U+02202
+&exist; U+02203
+&empty; U+02205
+&nabla; U+02207
+&isin; U+02208
+&notin; U+02209
+&ni; U+0220B
+&prod; U+0220F
+&sum; U+02211
+&minus; U+02212
+&lowast; U+02217
+&radic; U+0221A
+&prop; U+0221D
+&infin; U+0221E
+&ang; U+02220
+&and; U+02227
+&or; U+02228
+&cap; U+02229
+&cup; U+0222A
+&int; U+0222B
+&there4; U+02234
+&sim; U+0223C
+&cong; U+02245
+&asymp; U+02248
+&ne; U+02260
+&equiv; U+02261
+&le; U+02264
+&ge; U+02265
+&sub; U+02282
+&sup; U+02283
+&nsub; U+02284
+&sube; U+02286
+&supe; U+02287
+&oplus; U+02295
+&otimes; U+02297
+&perp; U+022A5
+&sdot; U+022C5
+&lceil; U+02308
+&rceil; U+02309
+&lfloor; U+0230A
+&rfloor; U+0230B
+&lang; U+02329
+&rang; U+0232A
+&loz; U+025CA
+&spades; U+02660
+&clubs; U+02663
+&hearts; U+02665
+&diams; U+02666
diff --git a/ext/standard/tests/strings/htmlentities_html5.phpt b/ext/standard/tests/strings/htmlentities_html5.phpt
new file mode 100644
index 0000000..1f34097
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities_html5.phpt
@@ -0,0 +1,1623 @@
+--TEST--
+htmlentities() conformance check (HTML 5)
+--FILE--
+<?php
+function utf32_utf8($k) {
+ if ($k < 0x80) {
+ $retval = pack('C', $k);
+ } else if ($k < 0x800) {
+ $retval = pack('C2',
+ 0xc0 | ($k >> 6),
+ 0x80 | ($k & 0x3f));
+ } else if ($k < 0x10000) {
+ $retval = pack('C3',
+ 0xe0 | ($k >> 12),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ } else {
+ $retval = pack('C4',
+ 0xf0 | ($k >> 18),
+ 0x80 | (($k >> 12) & 0x3f),
+ 0x80 | (($k >> 6) & 0x3f),
+ 0x80 | ($k & 0x3f));
+ }
+ return $retval;
+}
+
+for ($i = 0; $i < 0x1DFFF; $i++) {
+ if ($i >= 0xd800 && $i < 0xe000) //surrogates
+ continue;
+ $str = utf32_utf8($i);
+ $result = htmlentities($str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
+ if ($str != $result) {
+ printf("%s\tU+%05X\n", $result, $i);
+ }
+}
+
+/* multicodepoint entities */
+$mpcent = array(
+array(0x0003C, 0x20D2),
+array(0x0003D, 0x20E5),
+array(0x0003E, 0x20D2),
+array(0x00066, 0x6A),
+array(0x0205F, 0x200A),
+array(0x0219D, 0x338),
+array(0x02202, 0x338),
+array(0x02220, 0x20D2),
+array(0x02229, 0xFE00),
+array(0x0222A, 0xFE00),
+array(0x0223C, 0x020D2),
+array(0x0223D, 0x00331),
+array(0x0223E, 0x00333),
+array(0x02242, 0x338),
+array(0x0224B, 0x338),
+array(0x0224D, 0x020D2),
+array(0x0224E, 0x338),
+array(0x0224F, 0x338),
+array(0x02250, 0x338),
+array(0x02261, 0x020E5),
+array(0x02264, 0x20D2),
+array(0x02265, 0x020D2),
+array(0x02266, 0x338),
+array(0x02267, 0x00338),
+array(0x02268, 0xFE00),
+array(0x02269, 0xFE00),
+array(0x0226A, 0x338),
+array(0x0226A, 0x20D2),
+array(0x0226B, 0x338),
+array(0x0226B, 0x20D2),
+array(0x0227F, 0x338),
+array(0x02282, 0x20D2),
+array(0x02283, 0x20D2),
+array(0x0228A, 0xFE00),
+array(0x0228B, 0xFE00),
+array(0x0228F, 0x338),
+array(0x02290, 0x338),
+array(0x02293, 0xFE00),
+array(0x02294, 0xFE00),
+array(0x022B4, 0x20D2),
+array(0x022B5, 0x20D2),
+array(0x022D8, 0x338),
+array(0x022D9, 0x338),
+array(0x022DA, 0xFE00),
+array(0x022DB, 0xFE00),
+array(0x022F5, 0x338),
+array(0x022F9, 0x338),
+array(0x02933, 0x338),
+array(0x029CF, 0x338),
+array(0x029D0, 0x338),
+array(0x02A6D, 0x338),
+array(0x02A70, 0x338),
+array(0x02A7D, 0x338),
+array(0x02A7E, 0x338),
+array(0x02AA1, 0x338),
+array(0x02AA2, 0x338),
+array(0x02AAC, 0xFE00),
+array(0x02AAD, 0xFE00),
+array(0x02AAF, 0x338),
+array(0x02AB0, 0x338),
+array(0x02AC5, 0x338),
+array(0x02AC6, 0x338),
+array(0x02ACB, 0xFE00),
+array(0x02ACC, 0xFE00),
+array(0x02AFD, 0xFE00),
+);
+
+foreach ($mpcent as $i) {
+ $str = utf32_utf8($i[0]);
+ $str .= utf32_utf8($i[1]);
+ $result = htmlentities($str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
+ printf("%s\tU+%05X U+%05X\n", $result, $i[0], $i[1]);
+}
+?>
+--EXPECT--
+&Tab; U+00009
+&NewLine; U+0000A
+&excl; U+00021
+&quot; U+00022
+&num; U+00023
+&dollar; U+00024
+&percnt; U+00025
+&amp; U+00026
+&apos; U+00027
+&lpar; U+00028
+&rpar; U+00029
+&ast; U+0002A
+&plus; U+0002B
+&comma; U+0002C
+&period; U+0002E
+&sol; U+0002F
+&colon; U+0003A
+&semi; U+0003B
+&lt; U+0003C
+&equals; U+0003D
+&gt; U+0003E
+&quest; U+0003F
+&commat; U+00040
+&lbrack; U+0005B
+&bsol; U+0005C
+&rsqb; U+0005D
+&Hat; U+0005E
+&lowbar; U+0005F
+&grave; U+00060
+&lbrace; U+0007B
+&vert; U+0007C
+&rcub; U+0007D
+&nbsp; U+000A0
+&iexcl; U+000A1
+&cent; U+000A2
+&pound; U+000A3
+&curren; U+000A4
+&yen; U+000A5
+&brvbar; U+000A6
+&sect; U+000A7
+&DoubleDot; U+000A8
+&copy; U+000A9
+&ordf; U+000AA
+&laquo; U+000AB
+&not; U+000AC
+&shy; U+000AD
+&reg; U+000AE
+&macr; U+000AF
+&deg; U+000B0
+&plusmn; U+000B1
+&sup2; U+000B2
+&sup3; U+000B3
+&DiacriticalAcute; U+000B4
+&micro; U+000B5
+&para; U+000B6
+&CenterDot; U+000B7
+&Cedilla; U+000B8
+&sup1; U+000B9
+&ordm; U+000BA
+&raquo; U+000BB
+&frac14; U+000BC
+&half; U+000BD
+&frac34; U+000BE
+&iquest; U+000BF
+&Agrave; U+000C0
+&Aacute; U+000C1
+&Acirc; U+000C2
+&Atilde; U+000C3
+&Auml; U+000C4
+&Aring; U+000C5
+&AElig; U+000C6
+&Ccedil; U+000C7
+&Egrave; U+000C8
+&Eacute; U+000C9
+&Ecirc; U+000CA
+&Euml; U+000CB
+&Igrave; U+000CC
+&Iacute; U+000CD
+&Icirc; U+000CE
+&Iuml; U+000CF
+&ETH; U+000D0
+&Ntilde; U+000D1
+&Ograve; U+000D2
+&Oacute; U+000D3
+&Ocirc; U+000D4
+&Otilde; U+000D5
+&Ouml; U+000D6
+&times; U+000D7
+&Oslash; U+000D8
+&Ugrave; U+000D9
+&Uacute; U+000DA
+&Ucirc; U+000DB
+&Uuml; U+000DC
+&Yacute; U+000DD
+&THORN; U+000DE
+&szlig; U+000DF
+&agrave; U+000E0
+&aacute; U+000E1
+&acirc; U+000E2
+&atilde; U+000E3
+&auml; U+000E4
+&aring; U+000E5
+&aelig; U+000E6
+&ccedil; U+000E7
+&egrave; U+000E8
+&eacute; U+000E9
+&ecirc; U+000EA
+&euml; U+000EB
+&igrave; U+000EC
+&iacute; U+000ED
+&icirc; U+000EE
+&iuml; U+000EF
+&eth; U+000F0
+&ntilde; U+000F1
+&ograve; U+000F2
+&oacute; U+000F3
+&ocirc; U+000F4
+&otilde; U+000F5
+&ouml; U+000F6
+&divide; U+000F7
+&oslash; U+000F8
+&ugrave; U+000F9
+&uacute; U+000FA
+&ucirc; U+000FB
+&uuml; U+000FC
+&yacute; U+000FD
+&thorn; U+000FE
+&yuml; U+000FF
+&Amacr; U+00100
+&amacr; U+00101
+&Abreve; U+00102
+&abreve; U+00103
+&Aogon; U+00104
+&aogon; U+00105
+&Cacute; U+00106
+&cacute; U+00107
+&Ccirc; U+00108
+&ccirc; U+00109
+&Cdot; U+0010A
+&cdot; U+0010B
+&Ccaron; U+0010C
+&ccaron; U+0010D
+&Dcaron; U+0010E
+&dcaron; U+0010F
+&Dstrok; U+00110
+&dstrok; U+00111
+&Emacr; U+00112
+&emacr; U+00113
+&Edot; U+00116
+&edot; U+00117
+&Eogon; U+00118
+&eogon; U+00119
+&Ecaron; U+0011A
+&ecaron; U+0011B
+&Gcirc; U+0011C
+&gcirc; U+0011D
+&Gbreve; U+0011E
+&gbreve; U+0011F
+&Gdot; U+00120
+&gdot; U+00121
+&Gcedil; U+00122
+&Hcirc; U+00124
+&hcirc; U+00125
+&Hstrok; U+00126
+&hstrok; U+00127
+&Itilde; U+00128
+&itilde; U+00129
+&Imacr; U+0012A
+&imacr; U+0012B
+&Iogon; U+0012E
+&iogon; U+0012F
+&Idot; U+00130
+&inodot; U+00131
+&IJlig; U+00132
+&ijlig; U+00133
+&Jcirc; U+00134
+&jcirc; U+00135
+&Kcedil; U+00136
+&kcedil; U+00137
+&kgreen; U+00138
+&Lacute; U+00139
+&lacute; U+0013A
+&Lcedil; U+0013B
+&lcedil; U+0013C
+&Lcaron; U+0013D
+&lcaron; U+0013E
+&Lmidot; U+0013F
+&lmidot; U+00140
+&Lstrok; U+00141
+&lstrok; U+00142
+&Nacute; U+00143
+&nacute; U+00144
+&Ncedil; U+00145
+&ncedil; U+00146
+&Ncaron; U+00147
+&ncaron; U+00148
+&napos; U+00149
+&ENG; U+0014A
+&eng; U+0014B
+&Omacr; U+0014C
+&omacr; U+0014D
+&Odblac; U+00150
+&odblac; U+00151
+&OElig; U+00152
+&oelig; U+00153
+&Racute; U+00154
+&racute; U+00155
+&Rcedil; U+00156
+&rcedil; U+00157
+&Rcaron; U+00158
+&rcaron; U+00159
+&Sacute; U+0015A
+&sacute; U+0015B
+&Scirc; U+0015C
+&scirc; U+0015D
+&Scedil; U+0015E
+&scedil; U+0015F
+&Scaron; U+00160
+&scaron; U+00161
+&Tcedil; U+00162
+&tcedil; U+00163
+&Tcaron; U+00164
+&tcaron; U+00165
+&Tstrok; U+00166
+&tstrok; U+00167
+&Utilde; U+00168
+&utilde; U+00169
+&Umacr; U+0016A
+&umacr; U+0016B
+&Ubreve; U+0016C
+&ubreve; U+0016D
+&Uring; U+0016E
+&uring; U+0016F
+&Udblac; U+00170
+&udblac; U+00171
+&Uogon; U+00172
+&uogon; U+00173
+&Wcirc; U+00174
+&wcirc; U+00175
+&Ycirc; U+00176
+&ycirc; U+00177
+&Yuml; U+00178
+&Zacute; U+00179
+&zacute; U+0017A
+&Zdot; U+0017B
+&zdot; U+0017C
+&Zcaron; U+0017D
+&zcaron; U+0017E
+&fnof; U+00192
+&imped; U+001B5
+&gacute; U+001F5
+&jmath; U+00237
+&circ; U+002C6
+&Hacek; U+002C7
+&Breve; U+002D8
+&dot; U+002D9
+&ring; U+002DA
+&ogon; U+002DB
+&DiacriticalTilde; U+002DC
+&DiacriticalDoubleAcute; U+002DD
+&DownBreve; U+00311
+&Alpha; U+00391
+&Beta; U+00392
+&Gamma; U+00393
+&Delta; U+00394
+&Epsilon; U+00395
+&Zeta; U+00396
+&Eta; U+00397
+&Theta; U+00398
+&Iota; U+00399
+&Kappa; U+0039A
+&Lambda; U+0039B
+&Mu; U+0039C
+&Nu; U+0039D
+&Xi; U+0039E
+&Omicron; U+0039F
+&Pi; U+003A0
+&Rho; U+003A1
+&Sigma; U+003A3
+&Tau; U+003A4
+&Upsilon; U+003A5
+&Phi; U+003A6
+&Chi; U+003A7
+&Psi; U+003A8
+&Omega; U+003A9
+&alpha; U+003B1
+&beta; U+003B2
+&gamma; U+003B3
+&delta; U+003B4
+&epsi; U+003B5
+&zeta; U+003B6
+&eta; U+003B7
+&theta; U+003B8
+&iota; U+003B9
+&kappa; U+003BA
+&lambda; U+003BB
+&mu; U+003BC
+&nu; U+003BD
+&xi; U+003BE
+&omicron; U+003BF
+&pi; U+003C0
+&rho; U+003C1
+&sigmav; U+003C2
+&sigma; U+003C3
+&tau; U+003C4
+&upsi; U+003C5
+&phi; U+003C6
+&chi; U+003C7
+&psi; U+003C8
+&omega; U+003C9
+&thetasym; U+003D1
+&upsih; U+003D2
+&straightphi; U+003D5
+&piv; U+003D6
+&Gammad; U+003DC
+&gammad; U+003DD
+&varkappa; U+003F0
+&rhov; U+003F1
+&straightepsilon; U+003F5
+&backepsilon; U+003F6
+&IOcy; U+00401
+&DJcy; U+00402
+&GJcy; U+00403
+&Jukcy; U+00404
+&DScy; U+00405
+&Iukcy; U+00406
+&YIcy; U+00407
+&Jsercy; U+00408
+&LJcy; U+00409
+&NJcy; U+0040A
+&TSHcy; U+0040B
+&KJcy; U+0040C
+&Ubrcy; U+0040E
+&DZcy; U+0040F
+&Acy; U+00410
+&Bcy; U+00411
+&Vcy; U+00412
+&Gcy; U+00413
+&Dcy; U+00414
+&IEcy; U+00415
+&ZHcy; U+00416
+&Zcy; U+00417
+&Icy; U+00418
+&Jcy; U+00419
+&Kcy; U+0041A
+&Lcy; U+0041B
+&Mcy; U+0041C
+&Ncy; U+0041D
+&Ocy; U+0041E
+&Pcy; U+0041F
+&Rcy; U+00420
+&Scy; U+00421
+&Tcy; U+00422
+&Ucy; U+00423
+&Fcy; U+00424
+&KHcy; U+00425
+&TScy; U+00426
+&CHcy; U+00427
+&SHcy; U+00428
+&SHCHcy; U+00429
+&HARDcy; U+0042A
+&Ycy; U+0042B
+&SOFTcy; U+0042C
+&Ecy; U+0042D
+&YUcy; U+0042E
+&YAcy; U+0042F
+&acy; U+00430
+&bcy; U+00431
+&vcy; U+00432
+&gcy; U+00433
+&dcy; U+00434
+&iecy; U+00435
+&zhcy; U+00436
+&zcy; U+00437
+&icy; U+00438
+&jcy; U+00439
+&kcy; U+0043A
+&lcy; U+0043B
+&mcy; U+0043C
+&ncy; U+0043D
+&ocy; U+0043E
+&pcy; U+0043F
+&rcy; U+00440
+&scy; U+00441
+&tcy; U+00442
+&ucy; U+00443
+&fcy; U+00444
+&khcy; U+00445
+&tscy; U+00446
+&chcy; U+00447
+&shcy; U+00448
+&shchcy; U+00449
+&hardcy; U+0044A
+&ycy; U+0044B
+&softcy; U+0044C
+&ecy; U+0044D
+&yucy; U+0044E
+&yacy; U+0044F
+&iocy; U+00451
+&djcy; U+00452
+&gjcy; U+00453
+&jukcy; U+00454
+&dscy; U+00455
+&iukcy; U+00456
+&yicy; U+00457
+&jsercy; U+00458
+&ljcy; U+00459
+&njcy; U+0045A
+&tshcy; U+0045B
+&kjcy; U+0045C
+&ubrcy; U+0045E
+&dzcy; U+0045F
+&ensp; U+02002
+&emsp; U+02003
+&emsp13; U+02004
+&emsp14; U+02005
+&numsp; U+02007
+&puncsp; U+02008
+&ThinSpace; U+02009
+&hairsp; U+0200A
+&ZeroWidthSpace; U+0200B
+&zwnj; U+0200C
+&zwj; U+0200D
+&lrm; U+0200E
+&rlm; U+0200F
+&hyphen; U+02010
+&ndash; U+02013
+&mdash; U+02014
+&horbar; U+02015
+&Verbar; U+02016
+&OpenCurlyQuote; U+02018
+&rsquo; U+02019
+&sbquo; U+0201A
+&OpenCurlyDoubleQuote; U+0201C
+&rdquo; U+0201D
+&bdquo; U+0201E
+&dagger; U+02020
+&Dagger; U+02021
+&bull; U+02022
+&nldr; U+02025
+&hellip; U+02026
+&permil; U+02030
+&pertenk; U+02031
+&prime; U+02032
+&Prime; U+02033
+&tprime; U+02034
+&backprime; U+02035
+&lsaquo; U+02039
+&rsaquo; U+0203A
+&oline; U+0203E
+&caret; U+02041
+&hybull; U+02043
+&frasl; U+02044
+&bsemi; U+0204F
+&qprime; U+02057
+&MediumSpace; U+0205F
+&NoBreak; U+02060
+&af; U+02061
+&InvisibleTimes; U+02062
+&ic; U+02063
+&euro; U+020AC
+&TripleDot; U+020DB
+&DotDot; U+020DC
+&complexes; U+02102
+&incare; U+02105
+&gscr; U+0210A
+&HilbertSpace; U+0210B
+&Hfr; U+0210C
+&Hopf; U+0210D
+&planckh; U+0210E
+&planck; U+0210F
+&imagline; U+02110
+&Ifr; U+02111
+&lagran; U+02112
+&ell; U+02113
+&naturals; U+02115
+&numero; U+02116
+&copysr; U+02117
+&wp; U+02118
+&primes; U+02119
+&rationals; U+0211A
+&realine; U+0211B
+&Rfr; U+0211C
+&Ropf; U+0211D
+&rx; U+0211E
+&trade; U+02122
+&Zopf; U+02124
+&mho; U+02127
+&Zfr; U+02128
+&iiota; U+02129
+&Bscr; U+0212C
+&Cfr; U+0212D
+&escr; U+0212F
+&expectation; U+02130
+&Fouriertrf; U+02131
+&Mellintrf; U+02133
+&orderof; U+02134
+&aleph; U+02135
+&beth; U+02136
+&gimel; U+02137
+&daleth; U+02138
+&CapitalDifferentialD; U+02145
+&DifferentialD; U+02146
+&exponentiale; U+02147
+&ImaginaryI; U+02148
+&frac13; U+02153
+&frac23; U+02154
+&frac15; U+02155
+&frac25; U+02156
+&frac35; U+02157
+&frac45; U+02158
+&frac16; U+02159
+&frac56; U+0215A
+&frac18; U+0215B
+&frac38; U+0215C
+&frac58; U+0215D
+&frac78; U+0215E
+&larr; U+02190
+&uarr; U+02191
+&srarr; U+02192
+&darr; U+02193
+&harr; U+02194
+&UpDownArrow; U+02195
+&nwarrow; U+02196
+&UpperRightArrow; U+02197
+&LowerRightArrow; U+02198
+&swarr; U+02199
+&nleftarrow; U+0219A
+&nrarr; U+0219B
+&rarrw; U+0219D
+&Larr; U+0219E
+&Uarr; U+0219F
+&twoheadrightarrow; U+021A0
+&Darr; U+021A1
+&larrtl; U+021A2
+&rarrtl; U+021A3
+&LeftTeeArrow; U+021A4
+&UpTeeArrow; U+021A5
+&map; U+021A6
+&DownTeeArrow; U+021A7
+&larrhk; U+021A9
+&rarrhk; U+021AA
+&larrlp; U+021AB
+&looparrowright; U+021AC
+&harrw; U+021AD
+&nleftrightarrow; U+021AE
+&Lsh; U+021B0
+&rsh; U+021B1
+&ldsh; U+021B2
+&rdsh; U+021B3
+&crarr; U+021B5
+&curvearrowleft; U+021B6
+&curarr; U+021B7
+&olarr; U+021BA
+&orarr; U+021BB
+&leftharpoonup; U+021BC
+&leftharpoondown; U+021BD
+&RightUpVector; U+021BE
+&uharl; U+021BF
+&rharu; U+021C0
+&rhard; U+021C1
+&RightDownVector; U+021C2
+&dharl; U+021C3
+&rightleftarrows; U+021C4
+&udarr; U+021C5
+&lrarr; U+021C6
+&llarr; U+021C7
+&upuparrows; U+021C8
+&rrarr; U+021C9
+&downdownarrows; U+021CA
+&leftrightharpoons; U+021CB
+&rightleftharpoons; U+021CC
+&nLeftarrow; U+021CD
+&nhArr; U+021CE
+&nrArr; U+021CF
+&DoubleLeftArrow; U+021D0
+&DoubleUpArrow; U+021D1
+&Implies; U+021D2
+&Downarrow; U+021D3
+&hArr; U+021D4
+&Updownarrow; U+021D5
+&nwArr; U+021D6
+&neArr; U+021D7
+&seArr; U+021D8
+&swArr; U+021D9
+&lAarr; U+021DA
+&rAarr; U+021DB
+&zigrarr; U+021DD
+&LeftArrowBar; U+021E4
+&RightArrowBar; U+021E5
+&DownArrowUpArrow; U+021F5
+&loarr; U+021FD
+&roarr; U+021FE
+&hoarr; U+021FF
+&forall; U+02200
+&comp; U+02201
+&part; U+02202
+&Exists; U+02203
+&nexist; U+02204
+&empty; U+02205
+&nabla; U+02207
+&isinv; U+02208
+&notin; U+02209
+&ReverseElement; U+0220B
+&notniva; U+0220C
+&prod; U+0220F
+&Coproduct; U+02210
+&sum; U+02211
+&minus; U+02212
+&MinusPlus; U+02213
+&plusdo; U+02214
+&ssetmn; U+02216
+&lowast; U+02217
+&compfn; U+02218
+&Sqrt; U+0221A
+&prop; U+0221D
+&infin; U+0221E
+&angrt; U+0221F
+&angle; U+02220
+&angmsd; U+02221
+&angsph; U+02222
+&mid; U+02223
+&nshortmid; U+02224
+&shortparallel; U+02225
+&nparallel; U+02226
+&and; U+02227
+&or; U+02228
+&cap; U+02229
+&cup; U+0222A
+&Integral; U+0222B
+&Int; U+0222C
+&tint; U+0222D
+&ContourIntegral; U+0222E
+&DoubleContourIntegral; U+0222F
+&Cconint; U+02230
+&cwint; U+02231
+&cwconint; U+02232
+&awconint; U+02233
+&there4; U+02234
+&Because; U+02235
+&ratio; U+02236
+&Colon; U+02237
+&minusd; U+02238
+&mDDot; U+0223A
+&homtht; U+0223B
+&sim; U+0223C
+&bsim; U+0223D
+&ac; U+0223E
+&acd; U+0223F
+&wr; U+02240
+&NotTilde; U+02241
+&esim; U+02242
+&simeq; U+02243
+&nsime; U+02244
+&TildeFullEqual; U+02245
+&simne; U+02246
+&ncong; U+02247
+&approx; U+02248
+&napprox; U+02249
+&ape; U+0224A
+&apid; U+0224B
+&bcong; U+0224C
+&CupCap; U+0224D
+&bump; U+0224E
+&HumpEqual; U+0224F
+&esdot; U+02250
+&doteqdot; U+02251
+&fallingdotseq; U+02252
+&risingdotseq; U+02253
+&coloneq; U+02254
+&eqcolon; U+02255
+&ecir; U+02256
+&circeq; U+02257
+&wedgeq; U+02259
+&veeeq; U+0225A
+&triangleq; U+0225C
+&equest; U+0225F
+&NotEqual; U+02260
+&Congruent; U+02261
+&NotCongruent; U+02262
+&leq; U+02264
+&ge; U+02265
+&lE; U+02266
+&geqq; U+02267
+&lneqq; U+02268
+&gneqq; U+02269
+&ll; U+0226A
+&gg; U+0226B
+&between; U+0226C
+&NotCupCap; U+0226D
+&NotLess; U+0226E
+&ngtr; U+0226F
+&NotLessEqual; U+02270
+&ngeq; U+02271
+&LessTilde; U+02272
+&GreaterTilde; U+02273
+&nlsim; U+02274
+&ngsim; U+02275
+&lessgtr; U+02276
+&gl; U+02277
+&ntlg; U+02278
+&NotGreaterLess; U+02279
+&prec; U+0227A
+&succ; U+0227B
+&PrecedesSlantEqual; U+0227C
+&succcurlyeq; U+0227D
+&precsim; U+0227E
+&SucceedsTilde; U+0227F
+&npr; U+02280
+&NotSucceeds; U+02281
+&sub; U+02282
+&sup; U+02283
+&nsub; U+02284
+&nsup; U+02285
+&SubsetEqual; U+02286
+&supe; U+02287
+&NotSubsetEqual; U+02288
+&NotSupersetEqual; U+02289
+&subsetneq; U+0228A
+&supsetneq; U+0228B
+&cupdot; U+0228D
+&UnionPlus; U+0228E
+&sqsub; U+0228F
+&sqsupset; U+02290
+&SquareSubsetEqual; U+02291
+&SquareSupersetEqual; U+02292
+&sqcap; U+02293
+&sqcup; U+02294
+&CirclePlus; U+02295
+&ominus; U+02296
+&CircleTimes; U+02297
+&osol; U+02298
+&CircleDot; U+02299
+&ocir; U+0229A
+&oast; U+0229B
+&odash; U+0229D
+&boxplus; U+0229E
+&boxminus; U+0229F
+&timesb; U+022A0
+&sdotb; U+022A1
+&vdash; U+022A2
+&dashv; U+022A3
+&DownTee; U+022A4
+&perp; U+022A5
+&models; U+022A7
+&DoubleRightTee; U+022A8
+&Vdash; U+022A9
+&Vvdash; U+022AA
+&VDash; U+022AB
+&nvdash; U+022AC
+&nvDash; U+022AD
+&nVdash; U+022AE
+&nVDash; U+022AF
+&prurel; U+022B0
+&vartriangleleft; U+022B2
+&vrtri; U+022B3
+&LeftTriangleEqual; U+022B4
+&RightTriangleEqual; U+022B5
+&origof; U+022B6
+&imof; U+022B7
+&mumap; U+022B8
+&hercon; U+022B9
+&intcal; U+022BA
+&veebar; U+022BB
+&barvee; U+022BD
+&angrtvb; U+022BE
+&lrtri; U+022BF
+&xwedge; U+022C0
+&xvee; U+022C1
+&bigcap; U+022C2
+&bigcup; U+022C3
+&diamond; U+022C4
+&sdot; U+022C5
+&Star; U+022C6
+&divonx; U+022C7
+&bowtie; U+022C8
+&ltimes; U+022C9
+&rtimes; U+022CA
+&lthree; U+022CB
+&rthree; U+022CC
+&backsimeq; U+022CD
+&curlyvee; U+022CE
+&curlywedge; U+022CF
+&Sub; U+022D0
+&Supset; U+022D1
+&Cap; U+022D2
+&Cup; U+022D3
+&pitchfork; U+022D4
+&epar; U+022D5
+&lessdot; U+022D6
+&gtrdot; U+022D7
+&Ll; U+022D8
+&Gg; U+022D9
+&lesseqgtr; U+022DA
+&gtreqless; U+022DB
+&curlyeqprec; U+022DE
+&cuesc; U+022DF
+&NotPrecedesSlantEqual; U+022E0
+&NotSucceedsSlantEqual; U+022E1
+&NotSquareSubsetEqual; U+022E2
+&NotSquareSupersetEqual; U+022E3
+&lnsim; U+022E6
+&gnsim; U+022E7
+&precnsim; U+022E8
+&scnsim; U+022E9
+&nltri; U+022EA
+&ntriangleright; U+022EB
+&nltrie; U+022EC
+&NotRightTriangleEqual; U+022ED
+&vellip; U+022EE
+&ctdot; U+022EF
+&utdot; U+022F0
+&dtdot; U+022F1
+&disin; U+022F2
+&isinsv; U+022F3
+&isins; U+022F4
+&isindot; U+022F5
+&notinvc; U+022F6
+&notinvb; U+022F7
+&isinE; U+022F9
+&nisd; U+022FA
+&xnis; U+022FB
+&nis; U+022FC
+&notnivc; U+022FD
+&notnivb; U+022FE
+&barwed; U+02305
+&doublebarwedge; U+02306
+&lceil; U+02308
+&RightCeiling; U+02309
+&LeftFloor; U+0230A
+&RightFloor; U+0230B
+&drcrop; U+0230C
+&dlcrop; U+0230D
+&urcrop; U+0230E
+&ulcrop; U+0230F
+&bnot; U+02310
+&profline; U+02312
+&profsurf; U+02313
+&telrec; U+02315
+&target; U+02316
+&ulcorner; U+0231C
+&urcorner; U+0231D
+&llcorner; U+0231E
+&drcorn; U+0231F
+&frown; U+02322
+&smile; U+02323
+&cylcty; U+0232D
+&profalar; U+0232E
+&topbot; U+02336
+&ovbar; U+0233D
+&solbar; U+0233F
+&angzarr; U+0237C
+&lmoust; U+023B0
+&rmoust; U+023B1
+&OverBracket; U+023B4
+&bbrk; U+023B5
+&bbrktbrk; U+023B6
+&OverParenthesis; U+023DC
+&UnderParenthesis; U+023DD
+&OverBrace; U+023DE
+&UnderBrace; U+023DF
+&trpezium; U+023E2
+&elinters; U+023E7
+&blank; U+02423
+&oS; U+024C8
+&HorizontalLine; U+02500
+&boxv; U+02502
+&boxdr; U+0250C
+&boxdl; U+02510
+&boxur; U+02514
+&boxul; U+02518
+&boxvr; U+0251C
+&boxvl; U+02524
+&boxhd; U+0252C
+&boxhu; U+02534
+&boxvh; U+0253C
+&boxH; U+02550
+&boxV; U+02551
+&boxdR; U+02552
+&boxDr; U+02553
+&boxDR; U+02554
+&boxdL; U+02555
+&boxDl; U+02556
+&boxDL; U+02557
+&boxuR; U+02558
+&boxUr; U+02559
+&boxUR; U+0255A
+&boxuL; U+0255B
+&boxUl; U+0255C
+&boxUL; U+0255D
+&boxvR; U+0255E
+&boxVr; U+0255F
+&boxVR; U+02560
+&boxvL; U+02561
+&boxVl; U+02562
+&boxVL; U+02563
+&boxHd; U+02564
+&boxhD; U+02565
+&boxHD; U+02566
+&boxHu; U+02567
+&boxhU; U+02568
+&boxHU; U+02569
+&boxvH; U+0256A
+&boxVh; U+0256B
+&boxVH; U+0256C
+&uhblk; U+02580
+&lhblk; U+02584
+&block; U+02588
+&blk14; U+02591
+&blk12; U+02592
+&blk34; U+02593
+&Square; U+025A1
+&squarf; U+025AA
+&EmptyVerySmallSquare; U+025AB
+&rect; U+025AD
+&marker; U+025AE
+&fltns; U+025B1
+&bigtriangleup; U+025B3
+&blacktriangle; U+025B4
+&triangle; U+025B5
+&blacktriangleright; U+025B8
+&rtri; U+025B9
+&bigtriangledown; U+025BD
+&blacktriangledown; U+025BE
+&triangledown; U+025BF
+&blacktriangleleft; U+025C2
+&ltri; U+025C3
+&lozenge; U+025CA
+&cir; U+025CB
+&tridot; U+025EC
+&bigcirc; U+025EF
+&ultri; U+025F8
+&urtri; U+025F9
+&lltri; U+025FA
+&EmptySmallSquare; U+025FB
+&FilledSmallSquare; U+025FC
+&starf; U+02605
+&star; U+02606
+&phone; U+0260E
+&female; U+02640
+&male; U+02642
+&spadesuit; U+02660
+&clubs; U+02663
+&hearts; U+02665
+&diamondsuit; U+02666
+&sung; U+0266A
+&flat; U+0266D
+&natur; U+0266E
+&sharp; U+0266F
+&check; U+02713
+&cross; U+02717
+&maltese; U+02720
+&sext; U+02736
+&VerticalSeparator; U+02758
+&lbbrk; U+02772
+&rbbrk; U+02773
+&bsolhsub; U+027C8
+&suphsol; U+027C9
+&LeftDoubleBracket; U+027E6
+&RightDoubleBracket; U+027E7
+&langle; U+027E8
+&RightAngleBracket; U+027E9
+&Lang; U+027EA
+&Rang; U+027EB
+&loang; U+027EC
+&roang; U+027ED
+&longleftarrow; U+027F5
+&LongRightArrow; U+027F6
+&LongLeftRightArrow; U+027F7
+&xlArr; U+027F8
+&DoubleLongRightArrow; U+027F9
+&xhArr; U+027FA
+&xmap; U+027FC
+&dzigrarr; U+027FF
+&nvlArr; U+02902
+&nvrArr; U+02903
+&nvHarr; U+02904
+&Map; U+02905
+&lbarr; U+0290C
+&bkarow; U+0290D
+&lBarr; U+0290E
+&dbkarow; U+0290F
+&drbkarow; U+02910
+&DDotrahd; U+02911
+&UpArrowBar; U+02912
+&DownArrowBar; U+02913
+&Rarrtl; U+02916
+&latail; U+02919
+&ratail; U+0291A
+&lAtail; U+0291B
+&rAtail; U+0291C
+&larrfs; U+0291D
+&rarrfs; U+0291E
+&larrbfs; U+0291F
+&rarrbfs; U+02920
+&nwarhk; U+02923
+&nearhk; U+02924
+&searhk; U+02925
+&swarhk; U+02926
+&nwnear; U+02927
+&toea; U+02928
+&seswar; U+02929
+&swnwar; U+0292A
+&rarrc; U+02933
+&cudarrr; U+02935
+&ldca; U+02936
+&rdca; U+02937
+&cudarrl; U+02938
+&larrpl; U+02939
+&curarrm; U+0293C
+&cularrp; U+0293D
+&rarrpl; U+02945
+&harrcir; U+02948
+&Uarrocir; U+02949
+&lurdshar; U+0294A
+&ldrushar; U+0294B
+&LeftRightVector; U+0294E
+&RightUpDownVector; U+0294F
+&DownLeftRightVector; U+02950
+&LeftUpDownVector; U+02951
+&LeftVectorBar; U+02952
+&RightVectorBar; U+02953
+&RightUpVectorBar; U+02954
+&RightDownVectorBar; U+02955
+&DownLeftVectorBar; U+02956
+&DownRightVectorBar; U+02957
+&LeftUpVectorBar; U+02958
+&LeftDownVectorBar; U+02959
+&LeftTeeVector; U+0295A
+&RightTeeVector; U+0295B
+&RightUpTeeVector; U+0295C
+&RightDownTeeVector; U+0295D
+&DownLeftTeeVector; U+0295E
+&DownRightTeeVector; U+0295F
+&LeftUpTeeVector; U+02960
+&LeftDownTeeVector; U+02961
+&lHar; U+02962
+&uHar; U+02963
+&rHar; U+02964
+&dHar; U+02965
+&luruhar; U+02966
+&ldrdhar; U+02967
+&ruluhar; U+02968
+&rdldhar; U+02969
+&lharul; U+0296A
+&llhard; U+0296B
+&rharul; U+0296C
+&lrhard; U+0296D
+&udhar; U+0296E
+&ReverseUpEquilibrium; U+0296F
+&RoundImplies; U+02970
+&erarr; U+02971
+&simrarr; U+02972
+&larrsim; U+02973
+&rarrsim; U+02974
+&rarrap; U+02975
+&ltlarr; U+02976
+&gtrarr; U+02978
+&subrarr; U+02979
+&suplarr; U+0297B
+&lfisht; U+0297C
+&rfisht; U+0297D
+&ufisht; U+0297E
+&dfisht; U+0297F
+&lopar; U+02985
+&ropar; U+02986
+&lbrke; U+0298B
+&rbrke; U+0298C
+&lbrkslu; U+0298D
+&rbrksld; U+0298E
+&lbrksld; U+0298F
+&rbrkslu; U+02990
+&langd; U+02991
+&rangd; U+02992
+&lparlt; U+02993
+&rpargt; U+02994
+&gtlPar; U+02995
+&ltrPar; U+02996
+&vzigzag; U+0299A
+&vangrt; U+0299C
+&angrtvbd; U+0299D
+&ange; U+029A4
+&range; U+029A5
+&dwangle; U+029A6
+&uwangle; U+029A7
+&angmsdaa; U+029A8
+&angmsdab; U+029A9
+&angmsdac; U+029AA
+&angmsdad; U+029AB
+&angmsdae; U+029AC
+&angmsdaf; U+029AD
+&angmsdag; U+029AE
+&angmsdah; U+029AF
+&bemptyv; U+029B0
+&demptyv; U+029B1
+&cemptyv; U+029B2
+&raemptyv; U+029B3
+&laemptyv; U+029B4
+&ohbar; U+029B5
+&omid; U+029B6
+&opar; U+029B7
+&operp; U+029B9
+&olcross; U+029BB
+&odsold; U+029BC
+&olcir; U+029BE
+&ofcir; U+029BF
+&olt; U+029C0
+&ogt; U+029C1
+&cirscir; U+029C2
+&cirE; U+029C3
+&solb; U+029C4
+&bsolb; U+029C5
+&boxbox; U+029C9
+&trisb; U+029CD
+&rtriltri; U+029CE
+&LeftTriangleBar; U+029CF
+&RightTriangleBar; U+029D0
+&iinfin; U+029DC
+&infintie; U+029DD
+&nvinfin; U+029DE
+&eparsl; U+029E3
+&smeparsl; U+029E4
+&eqvparsl; U+029E5
+&lozf; U+029EB
+&RuleDelayed; U+029F4
+&dsol; U+029F6
+&xodot; U+02A00
+&bigoplus; U+02A01
+&bigotimes; U+02A02
+&biguplus; U+02A04
+&bigsqcup; U+02A06
+&iiiint; U+02A0C
+&fpartint; U+02A0D
+&cirfnint; U+02A10
+&awint; U+02A11
+&rppolint; U+02A12
+&scpolint; U+02A13
+&npolint; U+02A14
+&pointint; U+02A15
+&quatint; U+02A16
+&intlarhk; U+02A17
+&pluscir; U+02A22
+&plusacir; U+02A23
+&simplus; U+02A24
+&plusdu; U+02A25
+&plussim; U+02A26
+&plustwo; U+02A27
+&mcomma; U+02A29
+&minusdu; U+02A2A
+&loplus; U+02A2D
+&roplus; U+02A2E
+&Cross; U+02A2F
+&timesd; U+02A30
+&timesbar; U+02A31
+&smashp; U+02A33
+&lotimes; U+02A34
+&rotimes; U+02A35
+&otimesas; U+02A36
+&Otimes; U+02A37
+&odiv; U+02A38
+&triplus; U+02A39
+&triminus; U+02A3A
+&tritime; U+02A3B
+&iprod; U+02A3C
+&amalg; U+02A3F
+&capdot; U+02A40
+&ncup; U+02A42
+&ncap; U+02A43
+&capand; U+02A44
+&cupor; U+02A45
+&cupcap; U+02A46
+&capcup; U+02A47
+&cupbrcap; U+02A48
+&capbrcup; U+02A49
+&cupcup; U+02A4A
+&capcap; U+02A4B
+&ccups; U+02A4C
+&ccaps; U+02A4D
+&ccupssm; U+02A50
+&And; U+02A53
+&Or; U+02A54
+&andand; U+02A55
+&oror; U+02A56
+&orslope; U+02A57
+&andslope; U+02A58
+&andv; U+02A5A
+&orv; U+02A5B
+&andd; U+02A5C
+&ord; U+02A5D
+&wedbar; U+02A5F
+&sdote; U+02A66
+&simdot; U+02A6A
+&congdot; U+02A6D
+&easter; U+02A6E
+&apacir; U+02A6F
+&apE; U+02A70
+&eplus; U+02A71
+&pluse; U+02A72
+&Esim; U+02A73
+&Colone; U+02A74
+&Equal; U+02A75
+&ddotseq; U+02A77
+&equivDD; U+02A78
+&ltcir; U+02A79
+&gtcir; U+02A7A
+&ltquest; U+02A7B
+&gtquest; U+02A7C
+&les; U+02A7D
+&ges; U+02A7E
+&lesdot; U+02A7F
+&gesdot; U+02A80
+&lesdoto; U+02A81
+&gesdoto; U+02A82
+&lesdotor; U+02A83
+&gesdotol; U+02A84
+&lap; U+02A85
+&gap; U+02A86
+&lne; U+02A87
+&gne; U+02A88
+&lnap; U+02A89
+&gnap; U+02A8A
+&lesseqqgtr; U+02A8B
+&gEl; U+02A8C
+&lsime; U+02A8D
+&gsime; U+02A8E
+&lsimg; U+02A8F
+&gsiml; U+02A90
+&lgE; U+02A91
+&glE; U+02A92
+&lesges; U+02A93
+&gesles; U+02A94
+&els; U+02A95
+&egs; U+02A96
+&elsdot; U+02A97
+&egsdot; U+02A98
+&el; U+02A99
+&eg; U+02A9A
+&siml; U+02A9D
+&simg; U+02A9E
+&simlE; U+02A9F
+&simgE; U+02AA0
+&LessLess; U+02AA1
+&GreaterGreater; U+02AA2
+&glj; U+02AA4
+&gla; U+02AA5
+&ltcc; U+02AA6
+&gtcc; U+02AA7
+&lescc; U+02AA8
+&gescc; U+02AA9
+&smt; U+02AAA
+&lat; U+02AAB
+&smte; U+02AAC
+&late; U+02AAD
+&bumpE; U+02AAE
+&preceq; U+02AAF
+&SucceedsEqual; U+02AB0
+&prE; U+02AB3
+&scE; U+02AB4
+&precneqq; U+02AB5
+&scnE; U+02AB6
+&precapprox; U+02AB7
+&succapprox; U+02AB8
+&precnapprox; U+02AB9
+&succnapprox; U+02ABA
+&Pr; U+02ABB
+&Sc; U+02ABC
+&subdot; U+02ABD
+&supdot; U+02ABE
+&subplus; U+02ABF
+&supplus; U+02AC0
+&submult; U+02AC1
+&supmult; U+02AC2
+&subedot; U+02AC3
+&supedot; U+02AC4
+&subE; U+02AC5
+&supseteqq; U+02AC6
+&subsim; U+02AC7
+&supsim; U+02AC8
+&subsetneqq; U+02ACB
+&supnE; U+02ACC
+&csub; U+02ACF
+&csup; U+02AD0
+&csube; U+02AD1
+&csupe; U+02AD2
+&subsup; U+02AD3
+&supsub; U+02AD4
+&subsub; U+02AD5
+&supsup; U+02AD6
+&suphsub; U+02AD7
+&supdsub; U+02AD8
+&forkv; U+02AD9
+&topfork; U+02ADA
+&mlcp; U+02ADB
+&Dashv; U+02AE4
+&Vdashl; U+02AE6
+&Barv; U+02AE7
+&vBar; U+02AE8
+&vBarv; U+02AE9
+&Vbar; U+02AEB
+&Not; U+02AEC
+&bNot; U+02AED
+&rnmid; U+02AEE
+&cirmid; U+02AEF
+&midcir; U+02AF0
+&topcir; U+02AF1
+&nhpar; U+02AF2
+&parsim; U+02AF3
+&fflig; U+0FB00
+&filig; U+0FB01
+&fllig; U+0FB02
+&ffilig; U+0FB03
+&ffllig; U+0FB04
+&Ascr; U+1D49C
+&Cscr; U+1D49E
+&Dscr; U+1D49F
+&Gscr; U+1D4A2
+&Jscr; U+1D4A5
+&Kscr; U+1D4A6
+&Nscr; U+1D4A9
+&Oscr; U+1D4AA
+&Pscr; U+1D4AB
+&Qscr; U+1D4AC
+&Sscr; U+1D4AE
+&Tscr; U+1D4AF
+&Uscr; U+1D4B0
+&Vscr; U+1D4B1
+&Wscr; U+1D4B2
+&Xscr; U+1D4B3
+&Yscr; U+1D4B4
+&Zscr; U+1D4B5
+&ascr; U+1D4B6
+&bscr; U+1D4B7
+&cscr; U+1D4B8
+&dscr; U+1D4B9
+&fscr; U+1D4BB
+&hscr; U+1D4BD
+&iscr; U+1D4BE
+&jscr; U+1D4BF
+&kscr; U+1D4C0
+&lscr; U+1D4C1
+&mscr; U+1D4C2
+&nscr; U+1D4C3
+&pscr; U+1D4C5
+&qscr; U+1D4C6
+&rscr; U+1D4C7
+&sscr; U+1D4C8
+&tscr; U+1D4C9
+&uscr; U+1D4CA
+&vscr; U+1D4CB
+&wscr; U+1D4CC
+&xscr; U+1D4CD
+&yscr; U+1D4CE
+&zscr; U+1D4CF
+&Afr; U+1D504
+&Bfr; U+1D505
+&Dfr; U+1D507
+&Efr; U+1D508
+&Ffr; U+1D509
+&Gfr; U+1D50A
+&Jfr; U+1D50D
+&Kfr; U+1D50E
+&Lfr; U+1D50F
+&Mfr; U+1D510
+&Nfr; U+1D511
+&Ofr; U+1D512
+&Pfr; U+1D513
+&Qfr; U+1D514
+&Sfr; U+1D516
+&Tfr; U+1D517
+&Ufr; U+1D518
+&Vfr; U+1D519
+&Wfr; U+1D51A
+&Xfr; U+1D51B
+&Yfr; U+1D51C
+&afr; U+1D51E
+&bfr; U+1D51F
+&cfr; U+1D520
+&dfr; U+1D521
+&efr; U+1D522
+&ffr; U+1D523
+&gfr; U+1D524
+&hfr; U+1D525
+&ifr; U+1D526
+&jfr; U+1D527
+&kfr; U+1D528
+&lfr; U+1D529
+&mfr; U+1D52A
+&nfr; U+1D52B
+&ofr; U+1D52C
+&pfr; U+1D52D
+&qfr; U+1D52E
+&rfr; U+1D52F
+&sfr; U+1D530
+&tfr; U+1D531
+&ufr; U+1D532
+&vfr; U+1D533
+&wfr; U+1D534
+&xfr; U+1D535
+&yfr; U+1D536
+&zfr; U+1D537
+&Aopf; U+1D538
+&Bopf; U+1D539
+&Dopf; U+1D53B
+&Eopf; U+1D53C
+&Fopf; U+1D53D
+&Gopf; U+1D53E
+&Iopf; U+1D540
+&Jopf; U+1D541
+&Kopf; U+1D542
+&Lopf; U+1D543
+&Mopf; U+1D544
+&Oopf; U+1D546
+&Sopf; U+1D54A
+&Topf; U+1D54B
+&Uopf; U+1D54C
+&Vopf; U+1D54D
+&Wopf; U+1D54E
+&Xopf; U+1D54F
+&Yopf; U+1D550
+&aopf; U+1D552
+&bopf; U+1D553
+&copf; U+1D554
+&dopf; U+1D555
+&eopf; U+1D556
+&fopf; U+1D557
+&gopf; U+1D558
+&hopf; U+1D559
+&iopf; U+1D55A
+&jopf; U+1D55B
+&kopf; U+1D55C
+&lopf; U+1D55D
+&mopf; U+1D55E
+&nopf; U+1D55F
+&oopf; U+1D560
+&popf; U+1D561
+&qopf; U+1D562
+&ropf; U+1D563
+&sopf; U+1D564
+&topf; U+1D565
+&uopf; U+1D566
+&vopf; U+1D567
+&wopf; U+1D568
+&xopf; U+1D569
+&yopf; U+1D56A
+&zopf; U+1D56B
+&nvlt; U+0003C U+020D2
+&bne; U+0003D U+020E5
+&nvgt; U+0003E U+020D2
+&fjlig; U+00066 U+0006A
+&ThickSpace; U+0205F U+0200A
+&nrarrw; U+0219D U+00338
+&npart; U+02202 U+00338
+&nang; U+02220 U+020D2
+&caps; U+02229 U+0FE00
+&cups; U+0222A U+0FE00
+&nvsim; U+0223C U+020D2
+&race; U+0223D U+00331
+&acE; U+0223E U+00333
+&nesim; U+02242 U+00338
+&napid; U+0224B U+00338
+&nvap; U+0224D U+020D2
+&nbump; U+0224E U+00338
+&nbumpe; U+0224F U+00338
+&nedot; U+02250 U+00338
+&bnequiv; U+02261 U+020E5
+&nvle; U+02264 U+020D2
+&nvge; U+02265 U+020D2
+&nlE; U+02266 U+00338
+&NotGreaterFullEqual; U+02267 U+00338
+&lvertneqq; U+02268 U+0FE00
+&gvertneqq; U+02269 U+0FE00
+&nLtv; U+0226A U+00338
+&nLt; U+0226A U+020D2
+&NotGreaterGreater; U+0226B U+00338
+&nGt; U+0226B U+020D2
+&NotSucceedsTilde; U+0227F U+00338
+&vnsub; U+02282 U+020D2
+&nsupset; U+02283 U+020D2
+&vsubne; U+0228A U+0FE00
+&vsupne; U+0228B U+0FE00
+&NotSquareSubset; U+0228F U+00338
+&NotSquareSuperset; U+02290 U+00338
+&sqcaps; U+02293 U+0FE00
+&sqcups; U+02294 U+0FE00
+&nvltrie; U+022B4 U+020D2
+&nvrtrie; U+022B5 U+020D2
+&nLl; U+022D8 U+00338
+&nGg; U+022D9 U+00338
+&lesg; U+022DA U+0FE00
+&gesl; U+022DB U+0FE00
+&notindot; U+022F5 U+00338
+&notinE; U+022F9 U+00338
+&nrarrc; U+02933 U+00338
+&NotLeftTriangleBar; U+029CF U+00338
+&NotRightTriangleBar; U+029D0 U+00338
+&ncongdot; U+02A6D U+00338
+&napE; U+02A70 U+00338
+&nles; U+02A7D U+00338
+&nges; U+02A7E U+00338
+&NotNestedLessLess; U+02AA1 U+00338
+&NotNestedGreaterGreater; U+02AA2 U+00338
+&smtes; U+02AAC U+0FE00
+&lates; U+02AAD U+0FE00
+&NotPrecedesEqual; U+02AAF U+00338
+&NotSucceedsEqual; U+02AB0 U+00338
+&nsubE; U+02AC5 U+00338
+&nsupseteqq; U+02AC6 U+00338
+&vsubnE; U+02ACB U+0FE00
+&varsupsetneqq; U+02ACC U+0FE00
+&varsupsetneqq; U+02AFD U+0FE00
diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt
new file mode 100644
index 0000000..5d741e5
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars.phpt
@@ -0,0 +1,331 @@
+--TEST--
+Test htmlspecialchars() function
+--FILE--
+<?php
+/* Prototype: string htmlspecialchars ( string $string [, int $quote_style [, string $charset]] );
+ Description: Convert special characters to HTML entities
+*/
+
+/* retrieving htmlspecialchars from the ANSI character table */
+echo "*** Retrieving htmlspecialchars for 256 characters ***\n";
+for($i=0; $i<256; $i++)
+var_dump( bin2hex( htmlspecialchars(b"chr($i)") ) );
+
+/* giving NULL as the argument */
+echo "\n*** Testing htmlspecialchars() with NULL as first, second and third argument ***\n";
+var_dump( htmlspecialchars("<br>", NULL, 'iso-8859-1') );
+var_dump( htmlspecialchars("<br>", ENT_NOQUOTES, NULL) );
+var_dump( htmlspecialchars("<br>", ENT_QUOTES, NULL) );
+var_dump( htmlspecialchars("<br>", ENT_COMPAT, NULL) );
+var_dump( htmlspecialchars(NULL, NULL, NULL) );
+
+/* giving long string to check for proper memory re-allocation */
+echo "\n*** Checking a long string for proper memory allocation ***\n";
+var_dump( htmlspecialchars("<br>Testing<p>New file.</p><p><br>File <b><i><u>WORKS!!!</i></u></b></p><br><p>End of file!!!</p>", ENT_QUOTES, 'iso-8859-1' ) );
+
+/* Giving a normal string */
+echo "\n*** Testing a normal string with htmlspecialchars() ***\n";
+var_dump( htmlspecialchars("<br>Testing<p>New file.</p> ", ENT_QUOTES, 'iso-8859-1' ) );
+
+/* checking behavior of quote */
+echo "\n*** Testing htmlspecialchars() on a quote...\n";
+$str = "A 'quote' is <b>bold</b>";
+var_dump( htmlspecialchars($str) );
+var_dump( htmlspecialchars($str, ENT_QUOTES) );
+var_dump( htmlspecialchars($str, ENT_NOQUOTES) );
+var_dump( htmlspecialchars($str, ENT_COMPAT) );
+
+echo "\n*** Testing error conditions ***\n";
+/* zero argument */
+var_dump( htmlspecialchars() );
+
+/* giving arguments more than expected */
+var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") );
+
+echo "Done\n"
+?>
+--EXPECTF--
+*** Retrieving htmlspecialchars for 256 characters ***
+string(12) "636872283029"
+string(12) "636872283129"
+string(12) "636872283229"
+string(12) "636872283329"
+string(12) "636872283429"
+string(12) "636872283529"
+string(12) "636872283629"
+string(12) "636872283729"
+string(12) "636872283829"
+string(12) "636872283929"
+string(14) "63687228313029"
+string(14) "63687228313129"
+string(14) "63687228313229"
+string(14) "63687228313329"
+string(14) "63687228313429"
+string(14) "63687228313529"
+string(14) "63687228313629"
+string(14) "63687228313729"
+string(14) "63687228313829"
+string(14) "63687228313929"
+string(14) "63687228323029"
+string(14) "63687228323129"
+string(14) "63687228323229"
+string(14) "63687228323329"
+string(14) "63687228323429"
+string(14) "63687228323529"
+string(14) "63687228323629"
+string(14) "63687228323729"
+string(14) "63687228323829"
+string(14) "63687228323929"
+string(14) "63687228333029"
+string(14) "63687228333129"
+string(14) "63687228333229"
+string(14) "63687228333329"
+string(14) "63687228333429"
+string(14) "63687228333529"
+string(14) "63687228333629"
+string(14) "63687228333729"
+string(14) "63687228333829"
+string(14) "63687228333929"
+string(14) "63687228343029"
+string(14) "63687228343129"
+string(14) "63687228343229"
+string(14) "63687228343329"
+string(14) "63687228343429"
+string(14) "63687228343529"
+string(14) "63687228343629"
+string(14) "63687228343729"
+string(14) "63687228343829"
+string(14) "63687228343929"
+string(14) "63687228353029"
+string(14) "63687228353129"
+string(14) "63687228353229"
+string(14) "63687228353329"
+string(14) "63687228353429"
+string(14) "63687228353529"
+string(14) "63687228353629"
+string(14) "63687228353729"
+string(14) "63687228353829"
+string(14) "63687228353929"
+string(14) "63687228363029"
+string(14) "63687228363129"
+string(14) "63687228363229"
+string(14) "63687228363329"
+string(14) "63687228363429"
+string(14) "63687228363529"
+string(14) "63687228363629"
+string(14) "63687228363729"
+string(14) "63687228363829"
+string(14) "63687228363929"
+string(14) "63687228373029"
+string(14) "63687228373129"
+string(14) "63687228373229"
+string(14) "63687228373329"
+string(14) "63687228373429"
+string(14) "63687228373529"
+string(14) "63687228373629"
+string(14) "63687228373729"
+string(14) "63687228373829"
+string(14) "63687228373929"
+string(14) "63687228383029"
+string(14) "63687228383129"
+string(14) "63687228383229"
+string(14) "63687228383329"
+string(14) "63687228383429"
+string(14) "63687228383529"
+string(14) "63687228383629"
+string(14) "63687228383729"
+string(14) "63687228383829"
+string(14) "63687228383929"
+string(14) "63687228393029"
+string(14) "63687228393129"
+string(14) "63687228393229"
+string(14) "63687228393329"
+string(14) "63687228393429"
+string(14) "63687228393529"
+string(14) "63687228393629"
+string(14) "63687228393729"
+string(14) "63687228393829"
+string(14) "63687228393929"
+string(16) "6368722831303029"
+string(16) "6368722831303129"
+string(16) "6368722831303229"
+string(16) "6368722831303329"
+string(16) "6368722831303429"
+string(16) "6368722831303529"
+string(16) "6368722831303629"
+string(16) "6368722831303729"
+string(16) "6368722831303829"
+string(16) "6368722831303929"
+string(16) "6368722831313029"
+string(16) "6368722831313129"
+string(16) "6368722831313229"
+string(16) "6368722831313329"
+string(16) "6368722831313429"
+string(16) "6368722831313529"
+string(16) "6368722831313629"
+string(16) "6368722831313729"
+string(16) "6368722831313829"
+string(16) "6368722831313929"
+string(16) "6368722831323029"
+string(16) "6368722831323129"
+string(16) "6368722831323229"
+string(16) "6368722831323329"
+string(16) "6368722831323429"
+string(16) "6368722831323529"
+string(16) "6368722831323629"
+string(16) "6368722831323729"
+string(16) "6368722831323829"
+string(16) "6368722831323929"
+string(16) "6368722831333029"
+string(16) "6368722831333129"
+string(16) "6368722831333229"
+string(16) "6368722831333329"
+string(16) "6368722831333429"
+string(16) "6368722831333529"
+string(16) "6368722831333629"
+string(16) "6368722831333729"
+string(16) "6368722831333829"
+string(16) "6368722831333929"
+string(16) "6368722831343029"
+string(16) "6368722831343129"
+string(16) "6368722831343229"
+string(16) "6368722831343329"
+string(16) "6368722831343429"
+string(16) "6368722831343529"
+string(16) "6368722831343629"
+string(16) "6368722831343729"
+string(16) "6368722831343829"
+string(16) "6368722831343929"
+string(16) "6368722831353029"
+string(16) "6368722831353129"
+string(16) "6368722831353229"
+string(16) "6368722831353329"
+string(16) "6368722831353429"
+string(16) "6368722831353529"
+string(16) "6368722831353629"
+string(16) "6368722831353729"
+string(16) "6368722831353829"
+string(16) "6368722831353929"
+string(16) "6368722831363029"
+string(16) "6368722831363129"
+string(16) "6368722831363229"
+string(16) "6368722831363329"
+string(16) "6368722831363429"
+string(16) "6368722831363529"
+string(16) "6368722831363629"
+string(16) "6368722831363729"
+string(16) "6368722831363829"
+string(16) "6368722831363929"
+string(16) "6368722831373029"
+string(16) "6368722831373129"
+string(16) "6368722831373229"
+string(16) "6368722831373329"
+string(16) "6368722831373429"
+string(16) "6368722831373529"
+string(16) "6368722831373629"
+string(16) "6368722831373729"
+string(16) "6368722831373829"
+string(16) "6368722831373929"
+string(16) "6368722831383029"
+string(16) "6368722831383129"
+string(16) "6368722831383229"
+string(16) "6368722831383329"
+string(16) "6368722831383429"
+string(16) "6368722831383529"
+string(16) "6368722831383629"
+string(16) "6368722831383729"
+string(16) "6368722831383829"
+string(16) "6368722831383929"
+string(16) "6368722831393029"
+string(16) "6368722831393129"
+string(16) "6368722831393229"
+string(16) "6368722831393329"
+string(16) "6368722831393429"
+string(16) "6368722831393529"
+string(16) "6368722831393629"
+string(16) "6368722831393729"
+string(16) "6368722831393829"
+string(16) "6368722831393929"
+string(16) "6368722832303029"
+string(16) "6368722832303129"
+string(16) "6368722832303229"
+string(16) "6368722832303329"
+string(16) "6368722832303429"
+string(16) "6368722832303529"
+string(16) "6368722832303629"
+string(16) "6368722832303729"
+string(16) "6368722832303829"
+string(16) "6368722832303929"
+string(16) "6368722832313029"
+string(16) "6368722832313129"
+string(16) "6368722832313229"
+string(16) "6368722832313329"
+string(16) "6368722832313429"
+string(16) "6368722832313529"
+string(16) "6368722832313629"
+string(16) "6368722832313729"
+string(16) "6368722832313829"
+string(16) "6368722832313929"
+string(16) "6368722832323029"
+string(16) "6368722832323129"
+string(16) "6368722832323229"
+string(16) "6368722832323329"
+string(16) "6368722832323429"
+string(16) "6368722832323529"
+string(16) "6368722832323629"
+string(16) "6368722832323729"
+string(16) "6368722832323829"
+string(16) "6368722832323929"
+string(16) "6368722832333029"
+string(16) "6368722832333129"
+string(16) "6368722832333229"
+string(16) "6368722832333329"
+string(16) "6368722832333429"
+string(16) "6368722832333529"
+string(16) "6368722832333629"
+string(16) "6368722832333729"
+string(16) "6368722832333829"
+string(16) "6368722832333929"
+string(16) "6368722832343029"
+string(16) "6368722832343129"
+string(16) "6368722832343229"
+string(16) "6368722832343329"
+string(16) "6368722832343429"
+string(16) "6368722832343529"
+string(16) "6368722832343629"
+string(16) "6368722832343729"
+string(16) "6368722832343829"
+string(16) "6368722832343929"
+string(16) "6368722832353029"
+string(16) "6368722832353129"
+string(16) "6368722832353229"
+string(16) "6368722832353329"
+string(16) "6368722832353429"
+string(16) "6368722832353529"
+
+*** Testing htmlspecialchars() with NULL as first, second and third argument ***
+string(10) "&lt;br&gt;"
+string(10) "&lt;br&gt;"
+string(10) "&lt;br&gt;"
+string(10) "&lt;br&gt;"
+string(0) ""
+
+*** Checking a long string for proper memory allocation ***
+string(187) "&lt;br&gt;Testing&lt;p&gt;New file.&lt;/p&gt;&lt;p&gt;&lt;br&gt;File &lt;b&gt;&lt;i&gt;&lt;u&gt;WORKS!!!&lt;/i&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;br&gt;&lt;p&gt;End of file!!!&lt;/p&gt;"
+
+*** Testing a normal string with htmlspecialchars() ***
+string(46) "&lt;br&gt;Testing&lt;p&gt;New file.&lt;/p&gt; "
+
+*** Testing htmlspecialchars() on a quote...
+string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
+string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
+string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
+string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
+
+*** Testing error conditions ***
+
+Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+string(10) "&lt;br&gt;"
+Done
+
diff --git a/ext/standard/tests/strings/htmlspecialchars_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_basic.phpt
new file mode 100644
index 0000000..3ef932a
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_basic.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test htmlspecialchars() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars ( string $string [, int $quote_style [, string $charset [, bool $double_encode ]]] )
+ * Description: Convert special characters to HTML entities
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing htmlspecialchars() : basic functionality ***\n";
+
+$s1 = "abc<>\"&\n";
+$s2 = "&&abc<>\"&\n";
+$s3 = "a>,\<bc<>\"&\n";
+$s4 = "a\'\'&bc<>\"&\n";
+$s5 = "&amp;&lt;\n";
+echo "Basic tests\n";
+echo "Test 1: " . htmlspecialchars ($s1);
+echo "Test 2: " . htmlspecialchars ($s2);
+echo "Test 3: " . htmlspecialchars ($s3);
+echo "Test 4: " . htmlspecialchars ($s4);
+echo "Test 5: " . htmlspecialchars ($s5);
+echo "Test 6: " . htmlspecialchars ($s1,ENT_NOQUOTES);
+echo "Test 7: " . htmlspecialchars ($s2,ENT_NOQUOTES);
+echo "Test 8: " . htmlspecialchars ($s3,ENT_NOQUOTES);
+echo "Test 9: " . htmlspecialchars ($s4,ENT_NOQUOTES);
+echo "Test 10: " . htmlspecialchars ($s5,ENT_NOQUOTES);
+echo "Test 11: " . htmlspecialchars ($s1,ENT_COMPAT);
+echo "Test 12: " . htmlspecialchars ($s2,ENT_COMPAT);
+echo "Test 13: " . htmlspecialchars ($s3,ENT_COMPAT);
+echo "Test 14: " . htmlspecialchars ($s4,ENT_COMPAT);
+echo "Test 15: " . htmlspecialchars ($s5,ENT_COMPAT);
+echo "Test 16: " . htmlspecialchars ($s1,ENT_QUOTES);
+echo "Test 17: " . htmlspecialchars ($s2,ENT_QUOTES);
+echo "Test 18: " . htmlspecialchars ($s3,ENT_QUOTES);
+echo "Test 19: " . htmlspecialchars ($s4,ENT_QUOTES);
+echo "Test 20: " . htmlspecialchars ($s5,ENT_QUOTES);
+
+echo "\nTry with char set option - specify default ISO-8859-1\n";
+echo "Test 21: " . htmlspecialchars ($s1,ENT_NOQUOTES, "ISO-8859-1");
+echo "Test 22: " . htmlspecialchars ($s2,ENT_COMPAT, "ISO-8859-1");
+echo "Test 23: " . htmlspecialchars ($s3,ENT_QUOTES, "ISO-8859-1");
+echo "Test 24: " . htmlspecialchars ($s5,ENT_QUOTES, "ISO-8859-1");
+
+echo "\nTry with double decode FALSE\n";
+$s1 = "&quot;&amp;xyz&gt;abc&quot;\n";
+$s2 = "&quot;&amp;123&lt;456&quot;\n";
+$s3 = "\"300 < 400\"\n";
+echo "Test 25: " . htmlspecialchars ($s1,ENT_NOQUOTES, "ISO-8859-1", false);
+echo "Test 26: " . htmlspecialchars ($s2,ENT_NOQUOTES, "ISO-8859-1", false);
+echo "Test 27: " . htmlspecialchars ($s3,ENT_NOQUOTES, "ISO-8859-1", false);
+
+echo "\nTry with double decode TRUE\n";
+echo "Test 28: " . htmlspecialchars ($s1, ENT_NOQUOTES, "ISO-8859-1", true);
+echo "Test 29: " . htmlspecialchars ($s2, ENT_NOQUOTES, "ISO-8859-1", true);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing htmlspecialchars() : basic functionality ***
+Basic tests
+Test 1: abc&lt;&gt;&quot;&amp;
+Test 2: &amp;&amp;abc&lt;&gt;&quot;&amp;
+Test 3: a&gt;,\&lt;bc&lt;&gt;&quot;&amp;
+Test 4: a\'\'&amp;bc&lt;&gt;&quot;&amp;
+Test 5: &amp;amp;&amp;lt;
+Test 6: abc&lt;&gt;"&amp;
+Test 7: &amp;&amp;abc&lt;&gt;"&amp;
+Test 8: a&gt;,\&lt;bc&lt;&gt;"&amp;
+Test 9: a\'\'&amp;bc&lt;&gt;"&amp;
+Test 10: &amp;amp;&amp;lt;
+Test 11: abc&lt;&gt;&quot;&amp;
+Test 12: &amp;&amp;abc&lt;&gt;&quot;&amp;
+Test 13: a&gt;,\&lt;bc&lt;&gt;&quot;&amp;
+Test 14: a\'\'&amp;bc&lt;&gt;&quot;&amp;
+Test 15: &amp;amp;&amp;lt;
+Test 16: abc&lt;&gt;&quot;&amp;
+Test 17: &amp;&amp;abc&lt;&gt;&quot;&amp;
+Test 18: a&gt;,\&lt;bc&lt;&gt;&quot;&amp;
+Test 19: a\&#039;\&#039;&amp;bc&lt;&gt;&quot;&amp;
+Test 20: &amp;amp;&amp;lt;
+
+Try with char set option - specify default ISO-8859-1
+Test 21: abc&lt;&gt;"&amp;
+Test 22: &amp;&amp;abc&lt;&gt;&quot;&amp;
+Test 23: a&gt;,\&lt;bc&lt;&gt;&quot;&amp;
+Test 24: &amp;amp;&amp;lt;
+
+Try with double decode FALSE
+Test 25: &quot;&amp;xyz&gt;abc&quot;
+Test 26: &quot;&amp;123&lt;456&quot;
+Test 27: "300 &lt; 400"
+
+Try with double decode TRUE
+Test 28: &amp;quot;&amp;amp;xyz&amp;gt;abc&amp;quot;
+Test 29: &amp;quot;&amp;amp;123&amp;lt;456&amp;quot;
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
new file mode 100644
index 0000000..dc02739
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test htmlspecialchars_decode() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing htmlspecialchars_decode() : basic functionality ***\n";
+
+
+// Initialise arguments
+//value initialized = Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. "double quoted string"
+$single_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
+$double_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
+
+// Calling htmlspecialchars_decode() with default arguments
+var_dump( htmlspecialchars_decode($single_quote_string) );
+var_dump( htmlspecialchars_decode($double_quote_string) );
+
+// Calling htmlspecialchars_decode() with optional 'quote_style' argument
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_COMPAT) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_COMPAT) );
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_NOQUOTES) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_NOQUOTES) );
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_QUOTES) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_QUOTES) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : basic functionality ***
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
+string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
+string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt
new file mode 100644
index 0000000..f4201d2
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test htmlspecialchars_decode() function : error conditions
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing htmlspecialchars_decode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing htmlspecialchars_decode() function with Zero arguments --\n";
+var_dump( htmlspecialchars_decode() );
+
+//Test htmlspecialchars_decode with one more than the expected number of arguments
+echo "\n-- Testing htmlspecialchars_decode() function with more than expected no. of arguments --\n";
+$string = "<html>hello &amp; &gt; &lt; &quot; &#039; world</html>";
+$quote_style = ENT_COMPAT;
+$extra_arg = 10;
+var_dump( htmlspecialchars_decode($string, $quote_style, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : error conditions ***
+
+-- Testing htmlspecialchars_decode() function with Zero arguments --
+
+Warning: htmlspecialchars_decode() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing htmlspecialchars_decode() function with more than expected no. of arguments --
+
+Warning: htmlspecialchars_decode() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt
new file mode 100644
index 0000000..2bbe274
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - unexpected values for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() with unexpected input values for $string argument
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+//get a class
+class classA
+{
+ function __toString() {
+ return "ClassAObject";
+ }
+}
+
+//get a resource variable
+$file_handle=fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource
+ $file_handle
+);
+
+// loop through each element of the array for string
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iterator $iterator --\n";
+ var_dump( htmlspecialchars_decode($value) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iterator 1 --
+string(1) "0"
+-- Iterator 2 --
+string(1) "1"
+-- Iterator 3 --
+string(5) "12345"
+-- Iterator 4 --
+string(5) "-2345"
+-- Iterator 5 --
+string(4) "10.5"
+-- Iterator 6 --
+string(5) "-10.5"
+-- Iterator 7 --
+string(12) "101234567000"
+-- Iterator 8 --
+string(13) "1.07654321E-9"
+-- Iterator 9 --
+string(3) "0.5"
+-- Iterator 10 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 11 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 12 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 13 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 14 --
+
+Warning: htmlspecialchars_decode() 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(12) "ClassAObject"
+-- Iterator 24 --
+string(0) ""
+-- Iterator 25 --
+string(0) ""
+-- Iterator 26 --
+
+Warning: htmlspecialchars_decode() 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/htmlspecialchars_decode_variation2.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt
new file mode 100644
index 0000000..0e26d09
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - unexpected values for 'quote_style' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() by giving unexpected input values for $quote_style argument
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+// Initialise function arguments
+// value initialized = Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "
+$string = "<html>Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 15. 1111 &amp; 0000 = 0000. &quot; double quote string &quot;</html>";
+
+//get a class
+class classA {
+ function __toString() {
+ return "Class A Object";
+ }
+}
+
+//get a resource variable
+$file_handle = fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e20,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource
+ $file_handle
+);
+
+// loop through each element of the array for quote_style
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( htmlspecialchars_decode($string, $value) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+
+-- Iteration 1 --
+string(104) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>"
+
+-- Iteration 2 --
+string(104) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>"
+
+-- Iteration 3 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 4 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 5 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 6 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 11 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 12 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 13 --
+string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 14 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 15 --
+string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 16 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 17 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, object given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+
+-- Iteration 22 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 23 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 24 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, resource given in %shtmlspecialchars_decode_variation2.php on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt
new file mode 100644
index 0000000..b153076
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - heredoc strings for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() with various heredoc strings as argument for $string
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+// empty heredoc string
+$empty_string = <<<EOT
+EOT;
+
+// Heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+<html>Roy&#039;s height &gt; Sam&#039;s height
+13 &lt; 25
+1111 &amp; 0000 = 0000
+&quot;This is a double quoted string&quot;
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+<html>Roy&#039;s height\r &gt; Sam\t&#039;s height
+1111\t\t &amp; 0000\v\v = \f0000
+&quot; heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces&quot;
+EOT;
+
+// heredoc with numeric values
+$numeric_string = <<<EOT
+<html>11 &lt; 12. 123 string 4567
+&quot;string&quot; 1111\t &amp; 0000\t = 0000\n;
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+<html>&lt; This's a string with quotes:
+"strings in double quote" &amp;
+'strings in single quote' &quot;
+this\line is &#039;single quoted&#039; /with\slashes </html>
+EOT;
+
+$res_heredoc_strings = array(
+ //heredoc strings
+ $empty_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// loop through $res_heredoc_strings array and check the working on htmlspecialchars_decode()
+$count = 1;
+for($index =0; $index < count($res_heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( htmlspecialchars_decode($res_heredoc_strings[$index]) );
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(103) "<html>Roy&#039;s height > Sam&#039;s height
+13 < 25
+1111 & 0000 = 0000
+"This is a double quoted string""
+-- Iteration 4 --
+string(130) "<html>Roy&#039;s height > Sam &#039;s height
+1111 & 0000 = 0000
+" heredoc
+double quoted string. with different white spaces""
+-- Iteration 5 --
+string(62) "<html>11 < 12. 123 string 4567
+"string" 1111 & 0000 = 0000
+;"
+-- Iteration 6 --
+string(153) "<html>< This's a string with quotes:
+"strings in double quote" &
+'strings in single quote' "
+this\line is &#039;single quoted&#039; /with\slashes </html>"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt
new file mode 100644
index 0000000..e51e904
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - single quoted strings for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * Testing htmlspecialchars_decode() with various single quoted strings as argument for $string
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+//single quoted strings
+$values = array (
+ 'Roy&#039s height &gt; Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;',
+ 'Roy&#039;s height &gt; Sam&#039;s height... \t\t 13 &lt; 15...\n\r &quot; double quote\f\v string &quot;',
+ '\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f',
+ '\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height',
+ '\n 1\t3 &\tgt; 11 but 11 &\tlt; 12',
+);
+
+// loop through each element of the values array to check htmlspecialchars_decode() function with all possible arguments
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( htmlspecialchars_decode($value) );
+ var_dump( htmlspecialchars_decode($value, ENT_COMPAT) );
+ var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) );
+ var_dump( htmlspecialchars_decode($value, ENT_QUOTES) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iteration 1 --
+string(90) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(90) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(100) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;"
+string(85) "Roy&#039s height > Sam's \$height... 1111 &ap; 0000 = 0000... " double quote string ""
+-- Iteration 2 --
+string(88) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r " double quote\f\v string ""
+string(88) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r " double quote\f\v string ""
+string(98) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r &quot; double quote\f\v string &quot;"
+string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
+-- Iteration 3 --
+string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
+string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
+string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
+string(38) "\nRoy's height &gt\t; Sam's\v height\f"
+-- Iteration 4 --
+string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
+string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
+string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
+string(38) "\r\tRoy's height &gt\r; Sam\t's height"
+-- Iteration 5 --
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt
new file mode 100644
index 0000000..307cfe6
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - double quoted strings for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() for various double quoted strings as argument for $string
+*/
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+//double quoted strings
+$strings = array (
+ "Roy&#039s height &gt; Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;",
+ "Roy&#039;s height &gt; Sam&#039;s height... \t\t 13 &lt; 15...\n\r &quot; double quote\f\v string &quot;",
+ "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f",
+ "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height",
+ "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12",
+);
+
+// loop through each element of the array to check htmlspecialchars_decode() function with all possible arguments
+$iterator = 1;
+foreach($strings as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( htmlspecialchars_decode($value) );
+ var_dump( htmlspecialchars_decode($value, ENT_COMPAT) );
+ var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) );
+ var_dump( htmlspecialchars_decode($value, ENT_QUOTES) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iteration 1 --
+string(89) "Roy&#039s height > Sam&#039;s $height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(89) "Roy&#039s height > Sam&#039;s $height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(99) "Roy&#039s height > Sam&#039;s $height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;"
+string(84) "Roy&#039s height > Sam's $height... 1111 &ap; 0000 = 0000... " double quote string ""
+-- Iteration 2 --
+string(82) "Roy&#039;s height > Sam&#039;s height... 13 < 15...
+ " double quote string ""
+string(82) "Roy&#039;s height > Sam&#039;s height... 13 < 15...
+ " double quote string ""
+string(92) "Roy&#039;s height > Sam&#039;s height... 13 < 15...
+ &quot; double quote string &quot;"
+string(72) "Roy's height > Sam's height... 13 < 15...
+ " double quote string ""
+-- Iteration 3 --
+string(44) "
+Roy&#039;s height &gt ; Sam&#039;s height "
+string(44) "
+Roy&#039;s height &gt ; Sam&#039;s height "
+string(44) "
+Roy&#039;s height &gt ; Sam&#039;s height "
+string(34) "
+Roy's height &gt ; Sam's height "
+-- Iteration 4 --
+string(44) " Roy&#039;s height &gt ; Sam &#039;s height"
+string(44) " Roy&#039;s height &gt ; Sam &#039;s height"
+string(44) " Roy&#039;s height &gt ; Sam &#039;s height"
+string(34) " Roy's height &gt ; Sam 's height"
+-- Iteration 5 --
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
new file mode 100644
index 0000000..fc3666f
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation7.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation7.phpt
new file mode 100644
index 0000000..20669b3
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation7.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - numerical entities for basic characters
+--FILE--
+<?php
+$tests = array(
+ "&quot;", "&#x22;", "&#34;",
+ "&apos;", "&#39;", "&#x27;",
+ "&amp;", "&#x26;", "&lt;",
+ "&gt;", "&#x3C;", "&#60;",
+ "&lt;", "&#x3E;", "&#62;",
+ "&#63;"
+);
+
+echo "*** HTML 4.01/ENT_QUOTES ***\n";
+
+foreach ($tests as $t) {
+ $dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_HTML401);
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** XHTML 1.0/ENT_QUOTES ***\n";
+
+foreach ($tests as $t) {
+ $dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_XHTML);
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** HTML5/ENT_QUOTES ***\n";
+
+foreach ($tests as $t) {
+ $dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_HTML5);
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** XML 1.0/ENT_QUOTES ***\n";
+
+foreach ($tests as $t) {
+ $dec = htmlspecialchars_decode($t, ENT_QUOTES | ENT_XML1);
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** HTML5/ENT_NOQUOTES ***\n";
+
+foreach ($tests as $t) {
+ $dec = htmlspecialchars_decode($t, ENT_NOQUOTES | ENT_HTML5);
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+echo "\n*** HTML5/ENT_COMPAT ***\n";
+
+foreach ($tests as $t) {
+ $dec = htmlspecialchars_decode($t, ENT_COMPAT | ENT_HTML5);
+ if ($t == $dec) {
+ echo "$t\tNOT DECODED\n";
+ } else {
+ echo "$t\tDECODED\n";
+ }
+}
+
+
+echo "\nDone.\n";
+?>
+--EXPECT--
+*** HTML 4.01/ENT_QUOTES ***
+&quot; DECODED
+&#x22; DECODED
+&#34; DECODED
+&apos; NOT DECODED
+&#39; DECODED
+&#x27; DECODED
+&amp; DECODED
+&#x26; DECODED
+&lt; DECODED
+&gt; DECODED
+&#x3C; DECODED
+&#60; DECODED
+&lt; DECODED
+&#x3E; DECODED
+&#62; DECODED
+&#63; NOT DECODED
+
+*** XHTML 1.0/ENT_QUOTES ***
+&quot; DECODED
+&#x22; DECODED
+&#34; DECODED
+&apos; DECODED
+&#39; DECODED
+&#x27; DECODED
+&amp; DECODED
+&#x26; DECODED
+&lt; DECODED
+&gt; DECODED
+&#x3C; DECODED
+&#60; DECODED
+&lt; DECODED
+&#x3E; DECODED
+&#62; DECODED
+&#63; NOT DECODED
+
+*** HTML5/ENT_QUOTES ***
+&quot; DECODED
+&#x22; DECODED
+&#34; DECODED
+&apos; DECODED
+&#39; DECODED
+&#x27; DECODED
+&amp; DECODED
+&#x26; DECODED
+&lt; DECODED
+&gt; DECODED
+&#x3C; DECODED
+&#60; DECODED
+&lt; DECODED
+&#x3E; DECODED
+&#62; DECODED
+&#63; NOT DECODED
+
+*** XML 1.0/ENT_QUOTES ***
+&quot; DECODED
+&#x22; DECODED
+&#34; DECODED
+&apos; DECODED
+&#39; DECODED
+&#x27; DECODED
+&amp; DECODED
+&#x26; DECODED
+&lt; DECODED
+&gt; DECODED
+&#x3C; DECODED
+&#60; DECODED
+&lt; DECODED
+&#x3E; DECODED
+&#62; DECODED
+&#63; NOT DECODED
+
+*** HTML5/ENT_NOQUOTES ***
+&quot; NOT DECODED
+&#x22; NOT DECODED
+&#34; NOT DECODED
+&apos; NOT DECODED
+&#39; NOT DECODED
+&#x27; NOT DECODED
+&amp; DECODED
+&#x26; DECODED
+&lt; DECODED
+&gt; DECODED
+&#x3C; DECODED
+&#60; DECODED
+&lt; DECODED
+&#x3E; DECODED
+&#62; DECODED
+&#63; NOT DECODED
+
+*** HTML5/ENT_COMPAT ***
+&quot; DECODED
+&#x22; DECODED
+&#34; DECODED
+&apos; NOT DECODED
+&#39; NOT DECODED
+&#x27; NOT DECODED
+&amp; DECODED
+&#x26; DECODED
+&lt; DECODED
+&gt; DECODED
+&#x3C; DECODED
+&#60; DECODED
+&lt; DECODED
+&#x3E; DECODED
+&#62; DECODED
+&#63; NOT DECODED
+
+Done.
diff --git a/ext/standard/tests/strings/http_build_query.phpt b/ext/standard/tests/strings/http_build_query.phpt
new file mode 100644
index 0000000..4ed7fda
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query.phpt
@@ -0,0 +1,15 @@
+--TEST--
+http_build_query() function
+--FILE--
+<?php
+
+$array = array("foo"=>"bar","baz"=>1,"test"=>"a ' \" ", "abc");
+var_dump(http_build_query($array));
+var_dump(http_build_query($array, 'foo'));
+var_dump(http_build_query($array, 'foo', ';'));
+
+?>
+--EXPECT--
+string(35) "foo=bar&baz=1&test=a+%27+%22+&0=abc"
+string(38) "foo=bar&baz=1&test=a+%27+%22+&foo0=abc"
+string(38) "foo=bar;baz=1;test=a+%27+%22+;foo0=abc"
diff --git a/ext/standard/tests/strings/http_build_query_error.phpt b/ext/standard/tests/strings/http_build_query_error.phpt
new file mode 100644
index 0000000..30155e6
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Testing error on null parameter 1 of http_build_query()
+--CREDITS--
+Pawel Krynicki <pawel.krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+
+$result = http_build_query(null);
+
+?>
+--EXPECTF--
+Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/strings/http_build_query_variation1.phpt b/ext/standard/tests/strings/http_build_query_variation1.phpt
new file mode 100644
index 0000000..56d81c9
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_variation1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test http_build_query() function: usage variations - first arguments as object
+--CREDITS--
+Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
+--FILE--
+<?php
+/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
+ * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
+ * Source code: ext/standard/http.c
+*/
+
+class UrlBuilder
+{
+ public $name = 'homepage';
+ public $page = 1;
+ protected $sort = 'desc,name';
+ private $access = 'admin';
+}
+
+$obj = new stdClass;
+$obj->name = 'homepage';
+$obj->page = 1;
+$obj->sort = 'desc,name';
+
+echo http_build_query($obj) . PHP_EOL;
+echo http_build_query(new UrlBuilder());
+?>
+--EXPECTF--
+name=homepage&page=1&sort=desc%2Cname
+name=homepage&page=1
diff --git a/ext/standard/tests/strings/http_build_query_variation2.phpt b/ext/standard/tests/strings/http_build_query_variation2.phpt
new file mode 100644
index 0000000..ca1d8f4
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_variation2.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test http_build_query() function: usage variations - first arguments as multidimensional array and second argument present/not present
+--CREDITS--
+Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
+--FILE--
+<?php
+/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
+ * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
+ * Source code: ext/standard/http.c
+*/
+
+$mDimensional = array(
+ 20,
+ 5 => 13,
+ "9" => array(
+ 1 => "val1",
+ 3 => "val2",
+ "string" => "string"
+ ),
+ "name" => "homepage",
+ "page" => 10,
+ "sort" => array(
+ "desc",
+ "admin" => array(
+ "admin1",
+ "admin2" => array(
+ "who" => "admin2",
+ 2 => "test"
+ )
+ )
+ )
+);
+
+echo http_build_query($mDimensional) . PHP_EOL;
+echo http_build_query($mDimensional, 'prefix_');
+?>
+--EXPECTF--
+0=20&5=13&9%5B1%5D=val1&9%5B3%5D=val2&9%5Bstring%5D=string&name=homepage&page=10&sort%5B0%5D=desc&sort%5Badmin%5D%5B0%5D=admin1&sort%5Badmin%5D%5Badmin2%5D%5Bwho%5D=admin2&sort%5Badmin%5D%5Badmin2%5D%5B2%5D=test
+prefix_0=20&prefix_5=13&prefix_9%5B1%5D=val1&prefix_9%5B3%5D=val2&prefix_9%5Bstring%5D=string&name=homepage&page=10&sort%5B0%5D=desc&sort%5Badmin%5D%5B0%5D=admin1&sort%5Badmin%5D%5Badmin2%5D%5Bwho%5D=admin2&sort%5Badmin%5D%5Badmin2%5D%5B2%5D=test
diff --git a/ext/standard/tests/strings/http_build_query_variation3.phpt b/ext/standard/tests/strings/http_build_query_variation3.phpt
new file mode 100644
index 0000000..107120e
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_variation3.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test http_build_query() function: usage variations - testing four parameter added in PHP 5.4.0
+--CREDITS--
+Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
+--SKIPIF--
+<?php
+ if (version_compare(PHP_VERSION, '5.4.0', '<')) die("skip this test if PHP_VERSION is less than 5.4.0");
+?>
+--FILE--
+<?php
+/* Prototype : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
+ * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
+ * Source code: ext/standard/http.c
+*/
+
+$oDimensional = array(
+ "name" => "main page",
+ "sort" => "desc,admin",
+ "equation" => "10 + 10 - 5"
+);
+
+echo http_build_query($oDimensional, '', ini_get('arg_separator.output'), PHP_QUERY_RFC1738) . PHP_EOL;
+echo http_build_query($oDimensional, '', ini_get('arg_separator.output'), PHP_QUERY_RFC3986);
+?>
+--EXPECTF--
+name=main+page&sort=desc%2Cadmin&equation=10+%2B+10+-+5
+name=main%20page&sort=desc%2Cadmin&equation=10%20%2B%2010%20-%205
diff --git a/ext/standard/tests/strings/implode.phpt b/ext/standard/tests/strings/implode.phpt
new file mode 100644
index 0000000..36be0f3
--- /dev/null
+++ b/ext/standard/tests/strings/implode.phpt
@@ -0,0 +1,23 @@
+--TEST--
+implode() function
+--INI--
+error_reporting=2047
+log_errors=0
+display_errors=0
+track_errors=1
+--FILE--
+<?php
+echo implode(array())."\n";
+echo implode('nothing', array())."\n";
+echo implode(array('foo', 'bar', 'baz'))."\n";
+echo implode(':', array('foo', 'bar', 'baz'))."\n";
+echo implode(':', array('foo', array('bar', 'baz'), 'burp'))."\n";
+echo $php_errormsg."\n";
+?>
+--EXPECTF--
+
+
+foobarbaz
+foo:bar:baz
+foo:Array:burp
+Array to string conversion
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
new file mode 100644
index 0000000..4d3502f
--- /dev/null
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_basic.phpt b/ext/standard/tests/strings/join_basic.phpt
new file mode 100644
index 0000000..164c461
--- /dev/null
+++ b/ext/standard/tests/strings/join_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test join() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+echo "*** Testing join() : basic functionality ***\n";
+
+// Initialize all required variables
+$glue = ',';
+$pieces = array(1, 2, 3, 4);
+
+// pieces as arry with numeric values
+var_dump( join($glue, $pieces) );
+
+// pieces as array with strings values
+$glue = ", "; // multiple car as glue
+$pieces = array("Red", "Green", "Blue", "Black", "White");
+var_dump( join($glue, $pieces) );
+
+// pices as associative array (numeric values)
+$pieces = array("Hour" => 10, "Minute" => 20, "Second" => 40);
+$glue = ':';
+var_dump( join($glue, $pieces) );
+
+// pices as associative array (string/numeric values)
+$pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007);
+$glue = '/';
+var_dump( join($glue, $pieces) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : basic functionality ***
+string(7) "1,2,3,4"
+string(30) "Red, Green, Blue, Black, White"
+string(8) "10:20:40"
+string(21) "Friday/September/2007"
+Done
diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt
new file mode 100644
index 0000000..b283bf4
--- /dev/null
+++ b/ext/standard/tests/strings/join_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test join() function: error conditions
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+echo "*** Testing join() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing join() function with Zero arguments --\n";
+var_dump( join() );
+
+// More than expected number of arguments
+echo "\n-- Testing join() function with more than expected no. of arguments --\n";
+$glue = 'string_val';
+$pieces = array(1, 2);
+$extra_arg = 10;
+
+var_dump( join($glue, $pieces, $extra_arg) );
+
+// Less than expected number of arguments
+echo "\n-- Testing join() with less than expected no. of arguments --\n";
+$glue = 'string_val';
+
+var_dump( join($glue));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : error conditions ***
+
+-- Testing join() function with Zero arguments --
+
+Warning: join() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing join() function with more than expected no. of arguments --
+
+Warning: join() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing join() with less than expected no. of arguments --
+
+Warning: join(): Argument must be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt
new file mode 100644
index 0000000..02bcf34
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation1.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test join() function : usage variations - unexpected values for 'glue' argument
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * testing join() by passing different unexpected value for glue argument
+*/
+
+echo "*** Testing join() : usage variations ***\n";
+// initialize all required variables
+$pieces = array("element1", "element2");
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// define a class
+class test
+{
+ var $t = 10;
+ function __toString() {
+ return "testObject";
+ }
+}
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new test(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource variable
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of join()
+// when $glue arugment is supplied with different values
+echo "\n--- Testing join() by supplying different values for 'glue' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $glue = $values [$index];
+
+ var_dump( join($glue, $pieces) );
+
+ $counter ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : usage variations ***
+
+--- Testing join() by supplying different values for 'glue' argument ---
+-- Iteration 1 --
+string(17) "element10element2"
+-- Iteration 2 --
+string(17) "element11element2"
+-- Iteration 3 --
+string(21) "element112345element2"
+-- Iteration 4 --
+string(21) "element1-2345element2"
+-- Iteration 5 --
+string(20) "element110.5element2"
+-- Iteration 6 --
+string(21) "element1-10.5element2"
+-- Iteration 7 --
+string(28) "element1101234567000element2"
+-- Iteration 8 --
+string(29) "element11.07654321E-9element2"
+-- Iteration 9 --
+string(19) "element10.5element2"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(0) ""
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "0"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "1"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(7) "1Array2"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(11) "redArraypen"
+-- Iteration 15 --
+string(17) "element11element2"
+-- Iteration 16 --
+string(16) "element1element2"
+-- Iteration 17 --
+string(17) "element11element2"
+-- Iteration 18 --
+string(16) "element1element2"
+-- Iteration 19 --
+string(26) "element1testObjectelement2"
+-- Iteration 20 --
+string(16) "element1element2"
+-- Iteration 21 --
+string(16) "element1element2"
+-- Iteration 22 --
+string(16) "element1element2"
+-- Iteration 23 --
+string(16) "element1element2"
+-- Iteration 24 --
+string(%d) "element1Resource id #%delement2"
+-- Iteration 25 --
+string(16) "element1element2"
+-- Iteration 26 --
+string(16) "element1element2"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt
new file mode 100644
index 0000000..50395f1
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation2.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test join() function : usage variations - unexpected values for 'pieces' argument(Bug#42789)
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * test join() by passing different unexpected value for pieces argument
+*/
+
+echo "*** Testing join() : usage variations ***\n";
+// initialize all required variables
+$glue = '::';
+
+// get an unset variable
+$unset_var = array(1, 2);
+unset($unset_var);
+
+// get a resouce variable
+$fp = fopen(__FILE__, "r");
+
+// define a class
+class test
+{
+ var $t = 10;
+ var $p = 10;
+ function __toString() {
+ return "testObject";
+ }
+}
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new test(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource variable
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of join()
+// when $pieces arugment is supplied with different values
+echo "\n--- Testing join() by supplying different values for 'pieces' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $pieces = $values [$index];
+
+ var_dump( join($glue, $pieces) );
+
+ $counter ++;
+}
+
+// close the resources used
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : usage variations ***
+
+--- Testing join() by supplying different values for 'pieces' argument ---
+-- Iteration 1 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/join_variation3.phpt b/ext/standard/tests/strings/join_variation3.phpt
new file mode 100644
index 0000000..5b0ad5a
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation3.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test join() function : usage variations - different values for 'pieces' argument
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * test join() by giving different pieces values
+*/
+
+echo "*** Testing join() : usage variations ***\n";
+
+$pieces_arrays = array (
+ array(1, 2), // array with default keys and numrice values
+ array(1.1, 2.2), // array with default keys & float values
+ array( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+ 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
+ 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
+ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// a multichar glue value
+$glue = "], [";
+
+// loop through each $pieces_arrays element and call join()
+$iteration = 1;
+for($index = 0; $index < count($pieces_arrays); $index ++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( join($glue, $pieces_arrays[$index]) );
+ $iteration ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : usage variations ***
+-- Iteration 1 --
+string(6) "1], [2"
+-- Iteration 2 --
+string(10) "1.1], [2.2"
+-- Iteration 3 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(14) "Array], [Array"
+-- Iteration 4 --
+string(5) "], [1"
+-- Iteration 5 --
+string(0) ""
+-- Iteration 6 --
+string(0) ""
+-- Iteration 7 --
+string(36) "a], [aaaa], [b], [bbbb], [c], [ccccc"
+-- Iteration 8 --
+string(19) "one], [two], [three"
+-- Iteration 9 --
+string(11) "1], [2], [3"
+-- Iteration 10 --
+string(20) "10], [20], [40], [30"
+-- Iteration 11 --
+string(23) "ten], [twenty], [thirty"
+-- Iteration 12 --
+string(16) "1], [two], [four"
+-- Iteration 13 --
+string(12) "null], [], ["
+-- Iteration 14 --
+string(22) "true], [false], [], [1"
+-- Iteration 15 --
+string(14) "emptys], [], ["
+-- Iteration 16 --
+string(21) "], [], [], [], [], [1"
+-- Iteration 17 --
+string(11) "4], [5], [6"
+-- Iteration 18 --
+string(13) "10], [20], [3"
+Done
diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt
new file mode 100644
index 0000000..b4c4b05
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_variation5.phpt b/ext/standard/tests/strings/join_variation5.phpt
new file mode 100644
index 0000000..a02efd7
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation5.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test join() function : usage variations - sub array as argument
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * test join() by passing pieces as array containing sub array(s)
+*/
+
+echo "*** Testing implode() : usage variations - sub arrays ***\n";
+$sub_array = array(array(1,2,3,4), array(1 => "one", 2 => "two"), "PHP", 50);
+
+// pieces as array containing sub array
+var_dump( join("TEST", $sub_array) );
+
+// glue as array & pieces as array containing sub array
+var_dump( join(array(1, 2, 3, 4), $sub_array) );
+
+// numeric value as glue, pieces as array containg sub array
+var_dump( join(2, $sub_array) );
+
+// using directly the sub_array as pieces
+var_dump( join(", ", $sub_array[0]) );
+var_dump( join(", ", $sub_array[1]) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing implode() : usage variations - sub arrays ***
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(27) "ArrayTESTArrayTESTPHPTEST50"
+
+Notice: Array to string conversion in %s on line %d
+string(19) "1Array2Array3Array4"
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(18) "Array2Array2PHP250"
+string(10) "1, 2, 3, 4"
+string(8) "one, two"
+Done
diff --git a/ext/standard/tests/strings/join_variation6.phpt b/ext/standard/tests/strings/join_variation6.phpt
new file mode 100644
index 0000000..a627d77
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
new file mode 100644
index 0000000..4c5bec8
--- /dev/null
+++ b/ext/standard/tests/strings/lcfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt
new file mode 100644
index 0000000..249b532
--- /dev/null
+++ b/ext/standard/tests/strings/levenshtein.phpt
@@ -0,0 +1,86 @@
+--TEST--
+levenshtein() function test
+--FILE--
+<?php
+
+function test_me($title,$expect,$text1,$text2,$cost1="",$cost2="",$cost3="") {
+
+ if ($cost1=="") {
+ $result=levenshtein($text1,$text2);
+ }
+ elseif ($cost2=="") {
+ $result=levenshtein($text1,$text2,$cost1);
+ }
+ else {
+ $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
+ }
+ if($result==$expect) return 0;
+
+ echo "$title: result is $result instead of $expect ";
+ echo "for '$text1'/'$text2' ";
+ if($cost1) echo "($cost1:$cost2:$cost3)";
+ echo "\n";
+
+ return 1;
+}
+
+$n=0;
+
+$n += test_me("equal" , 0, "12345", "12345");
+$n += test_me("1st empty" , 3, "", "xzy");
+$n += test_me("2nd empty" , 3, "xzy", "");
+$n += test_me("both empty" , 0, "", "");
+$n += test_me("1 char" , 1, "1", "2");
+$n += test_me("2 char swap", 2, "12", "21");
+
+$n += test_me("inexpensive delete", 2, "2121", "11", 2, 1, 1);
+$n += test_me("expensive delete" , 10, "2121", "11", 2, 1, 5);
+$n += test_me("inexpensive insert", 2, "11", "2121", 1, 1, 1);
+$n += test_me("expensive insert" , 10, "11", "2121", 5, 1, 1);
+
+$n += test_me("expensive replace" , 3, "111", "121", 2, 3, 2);
+$n += test_me("very expensive replace", 4, "111", "121", 2, 9, 2);
+
+$n += test_me("bug #7368", 2, "13458", "12345");
+$n += test_me("bug #7368", 2, "1345", "1234");
+
+$n += test_me("bug #6562", 1, "debugg", "debug");
+$n += test_me("bug #6562", 1, "ddebug", "debug");
+$n += test_me("bug #6562", 2, "debbbug", "debug");
+$n += test_me("bug #6562", 1, "debugging", "debuging");
+
+$n += test_me("bug #16473", 2, "a", "bc");
+$n += test_me("bug #16473", 2, "xa", "xbc");
+$n += test_me("bug #16473", 2, "xax", "xbcx");
+$n += test_me("bug #16473", 2, "ax", "bcx");
+
+$n += test_me("custom", -1, "111", "121", "my_levcode");
+$n += test_me("lt maxlength1", 254, "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsu", "A");
+$n += test_me("gt maxlength1", -1, "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuv", "A");
+
+$n += test_me("lt maxlength2", 254, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsu");
+$n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuv");
+
+echo ($n==0)?"all passed\n":"$n failed\n";
+
+var_dump(levenshtein(array(), array()));
+var_dump(levenshtein("", "", -1, -1, -1));
+var_dump(levenshtein("", "", 10, 10, 10));
+var_dump(levenshtein(""));
+
+?>
+--EXPECTF--
+Warning: levenshtein(): The general Levenshtein support is not there yet in %s on line %d
+
+Warning: levenshtein(): Argument string(s) too long in %s on line %d
+
+Warning: levenshtein(): Argument string(s) too long in %s on line %d
+all passed
+
+Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d
+NULL
+int(0)
+int(0)
+
+Warning: Wrong parameter count for levenshtein() in %s on line %d
+NULL
diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt
new file mode 100644
index 0000000..cddce24
--- /dev/null
+++ b/ext/standard/tests/strings/ltrim.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test ltrim() function
+--FILE--
+<?php
+
+/* Testing for Error conditions */
+
+/* Invalid Number of Arguments */
+
+ echo "\n *** Output for Error Conditions ***\n";
+
+ echo "\n *** Output for zero argument ***\n";
+ var_dump( ltrim() );
+
+ echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n";
+ var_dump( ltrim("", " ", 1) );
+
+/* heredoc string */
+$str = <<<EOD
+us
+ing heredoc string
+EOD;
+
+echo "\n *** Using heredoc string ***\n";
+var_dump( ltrim($str, "\nusi") );
+
+/* Testing the Normal behaviour of ltrim() function */
+
+ echo "\n *** Output for Normal Behaviour ***\n";
+ var_dump ( ltrim(" \t\0 ltrim test") ); /* without second Argument */
+ var_dump ( ltrim(" ltrim test" , "") ); /* no characters in second Argument */
+ var_dump ( ltrim(" ltrim test", NULL) ); /* with NULL as second Argument */
+ var_dump ( ltrim(" ltrim test", true) ); /* with boolean value as second Argument */
+ var_dump ( ltrim(" ltrim test", " ") ); /* with single space as second Argument */
+ var_dump ( ltrim("\t\n\r\0\x0B ltrim test", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
+ var_dump ( ltrim("ABCXYZltrim test", "A..Z") ); /* with characters range as second Argument */
+ var_dump ( ltrim("0123456789ltrim test", "0..9") ); /* with numbers range as second Argument */
+ var_dump ( ltrim("@$#ltrim test", "#@$") ); /* with some special characters as second Argument */
+
+
+ echo "\n *** Output for scalar argument) ***\n";
+ var_dump( ltrim( 12345 ) ); /* Scalar argument */
+
+ echo "\n *** Output for NULL argument) ***\n";
+ var_dump( ltrim(NULL) ); /* NULL Argument */
+
+echo "\nDone\n";
+
+?>
+--EXPECTF--
+*** Output for Error Conditions ***
+
+ *** Output for zero argument ***
+
+Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+ *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***
+
+Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+ *** Using heredoc string ***
+string(17) "ng heredoc string"
+
+ *** Output for Normal Behaviour ***
+string(10) "ltrim test"
+string(13) " ltrim test"
+string(18) " ltrim test"
+string(18) " ltrim test"
+string(10) "ltrim test"
+string(11) " ltrim test"
+string(10) "ltrim test"
+string(10) "ltrim test"
+string(10) "ltrim test"
+
+ *** Output for scalar argument) ***
+string(5) "12345"
+
+ *** Output for NULL argument) ***
+string(0) ""
+
+Done
diff --git a/ext/standard/tests/strings/ltrim_basic.phpt b/ext/standard/tests/strings/ltrim_basic.phpt
new file mode 100644
index 0000000..74769ca
--- /dev/null
+++ b/ext/standard/tests/strings/ltrim_basic.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test ltrim() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string ltrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the beginning of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ltrim() : basic functionality ***\n";
+
+$text = " \t\r\n\0\x0B ---These are a few words--- ";
+$hello = "!===Hello World===!";
+$binary = "\x09\x0AExample string";
+$alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+echo "\n-- Trim string with all white space characters --\n";
+var_dump(ltrim($text));
+
+echo "\n-- Trim non-whitespace from a string --\n";
+var_dump(ltrim($hello, "=!"));
+
+echo "\n-- Trim some non-white space characters from a string --\n";
+var_dump(ltrim($hello, "!oleH="));
+
+echo "\n-- Trim some non-white space characters from a string suing a character range --\n";
+var_dump(ltrim($alpha, "A..Z"));
+
+
+echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
+var_dump(ltrim($binary, "\x00..\x1F"));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ltrim() : basic functionality ***
+
+-- Trim string with all white space characters --
+string(29) "---These are a few words--- "
+
+-- Trim non-whitespace from a string --
+string(15) "Hello World===!"
+
+-- Trim some non-white space characters from a string --
+string(10) " World===!"
+
+-- Trim some non-white space characters from a string suing a character range --
+string(10) "0123456789"
+
+-- Trim the ASCII control characters at the beginning of a string --
+string(14) "Example string"
+===DONE===
diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt
new file mode 100644
index 0000000..eb4f938
--- /dev/null
+++ b/ext/standard/tests/strings/ltrim_error.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test ltrim() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string ltrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the beginning of a string.
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing ltrim() : error conditions ***\n";
+
+echo "\n-- Testing ltrim() function with no arguments --\n";
+var_dump( ltrim() );
+
+echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( ltrim("Hello World", "Heo", $extra_arg) );
+
+
+$hello = " Hello World\n";
+echo "\n-- Test ltrim function with various invalid charlists\n";
+var_dump(ltrim($hello, "..a"));
+var_dump(ltrim($hello, "a.."));
+var_dump(ltrim($hello, "z..a"));
+var_dump(ltrim($hello, "a..b..c"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ltrim() : error conditions ***
+
+-- Testing ltrim() function with no arguments --
+
+Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ltrim() function with more than expected no. of arguments --
+
+Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Test ltrim function with various invalid charlists
+
+Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
+string(14) " Hello World
+"
+
+Warning: ltrim(): Invalid '..'-range, no character to the right of '..' in %s on line %d
+string(14) " Hello World
+"
+
+Warning: ltrim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
+string(14) " Hello World
+"
+
+Warning: ltrim(): 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/ltrim_variation1.phpt b/ext/standard/tests/strings/ltrim_variation1.phpt
new file mode 100644
index 0000000..5e88526
--- /dev/null
+++ b/ext/standard/tests/strings/ltrim_variation1.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test ltrim() function : usage variations - test values for $str argument
+--FILE--
+<?php
+
+/* Prototype : string ltrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the beginning of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ltrim() function: with unexpected inputs for 'str' argument ***\n";
+
+//get an unset variable
+$unset_var = ' string_val ';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return " sample object ";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test ltrim() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // strip white space and any "minus" signs
+ var_dump( ltrim($input, " \t-") );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ltrim() 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: ltrim() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: ltrim() 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(15) "sample object "
+-- Iteration 20 --
+
+Warning: ltrim() 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/ltrim_variation2.phpt b/ext/standard/tests/strings/ltrim_variation2.phpt
new file mode 100644
index 0000000..194acd1
--- /dev/null
+++ b/ext/standard/tests/strings/ltrim_variation2.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test ltrim() function : usage variations - test values for $charlist argument
+--FILE--
+<?php
+
+/* Prototype : string ltrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the beginning of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ltrim() function: with unexpected inputs for 'charlist' argument ***\n";
+
+//get an unset variable
+$unset_var = ' string_val ';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return " sample object ";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test ltrim() function
+$count = 1;
+foreach($inputs as $charlist) {
+ echo "-- Iteration $count --\n";
+ // strip white space and any "minus" signs
+ var_dump( ltrim("!---Hello World---!", $charlist) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ltrim() 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: ltrim() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: ltrim() 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: ltrim() 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/md5.phpt b/ext/standard/tests/strings/md5.phpt
new file mode 100644
index 0000000..32dba03
--- /dev/null
+++ b/ext/standard/tests/strings/md5.phpt
@@ -0,0 +1,20 @@
+--TEST--
+md5() with ASCII output
+--FILE--
+<?php
+echo md5("")."\n";
+echo md5("a")."\n";
+echo md5("abc")."\n";
+echo md5("message digest")."\n";
+echo md5("abcdefghijklmnopqrstuvwxyz")."\n";
+echo md5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")."\n";
+echo md5("12345678901234567890123456789012345678901234567890123456789012345678901234567890")."\n";
+?>
+--EXPECT--
+d41d8cd98f00b204e9800998ecf8427e
+0cc175b9c0f1b6a831c399e269772661
+900150983cd24fb0d6963f7d28e17f72
+f96b697d7cb7938d525a2f31aaf161d0
+c3fcd3d76192e4007dfb496cca67e13b
+d174ab98d277d9f5a5611c2c9f419d9f
+57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/strings/md5_basic1.phpt b/ext/standard/tests/strings/md5_basic1.phpt
new file mode 100644
index 0000000..eda414b
--- /dev/null
+++ b/ext/standard/tests/strings/md5_basic1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test md5() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : basic functionality ***\n";
+var_dump(md5(b"apple"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing md5() : basic functionality ***
+string(32) "1f3870be274f6c49b3e31a0c6728957f"
+===DONE===
diff --git a/ext/standard/tests/strings/md5_basic2.phpt b/ext/standard/tests/strings/md5_basic2.phpt
new file mode 100644
index 0000000..1f89ba8
--- /dev/null
+++ b/ext/standard/tests/strings/md5_basic2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test md5() function : basic functionality - with raw output
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : basic functionality - with raw output***\n";
+$str = b"Hello World";
+$md5_raw = md5($str, true);
+var_dump(bin2hex($md5_raw));
+
+$md5 = md5($str, false);
+
+if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+ var_dump($md5_raw, $md5);
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing md5() : basic functionality - with raw output***
+string(32) "b10a8db164e0754105b7a99be72e3fe5"
+TEST PASSED
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/md5_error.phpt b/ext/standard/tests/strings/md5_error.phpt
new file mode 100644
index 0000000..190b09c
--- /dev/null
+++ b/ext/standard/tests/strings/md5_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test md5() function : error conditions
+--FILE--
+<?php
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )
+ * Description: Calculate the md5 hash of a string
+ * Source code: ext/standard/md5.c
+*/
+
+echo "*** Testing md5() : error conditions ***\n";
+
+echo "\n-- Testing md5() function with no arguments --\n";
+var_dump( md5());
+
+echo "\n-- Testing md5() function with more than expected no. of arguments --\n";
+$str = "Hello World";
+$raw_output = true;
+$extra_arg = 10;
+
+var_dump(md5($str, $raw_output, $extra_arg));
+?>
+===DONE==
+--EXPECTF--
+*** Testing md5() : error conditions ***
+
+-- Testing md5() function with no arguments --
+
+Warning: md5() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing md5() function with more than expected no. of arguments --
+
+Warning: md5() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+===DONE== \ No newline at end of file
diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt
new file mode 100644
index 0000000..7771409
--- /dev/null
+++ b/ext/standard/tests/strings/md5_file.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/md5raw.phpt b/ext/standard/tests/strings/md5raw.phpt
new file mode 100644
index 0000000..8f71ea6
--- /dev/null
+++ b/ext/standard/tests/strings/md5raw.phpt
@@ -0,0 +1,20 @@
+--TEST--
+md5() with RAW output
+--FILE--
+<?php
+echo bin2hex(md5("", TRUE))."\n";
+echo bin2hex(md5("a", TRUE))."\n";
+echo bin2hex(md5("abc", TRUE))."\n";
+echo bin2hex(md5("message digest", TRUE))."\n";
+echo bin2hex(md5("abcdefghijklmnopqrstuvwxyz", TRUE))."\n";
+echo bin2hex(md5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", TRUE))."\n";
+echo bin2hex(md5("12345678901234567890123456789012345678901234567890123456789012345678901234567890", TRUE))."\n";
+?>
+--EXPECT--
+d41d8cd98f00b204e9800998ecf8427e
+0cc175b9c0f1b6a831c399e269772661
+900150983cd24fb0d6963f7d28e17f72
+f96b697d7cb7938d525a2f31aaf161d0
+c3fcd3d76192e4007dfb496cca67e13b
+d174ab98d277d9f5a5611c2c9f419d9f
+57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt
new file mode 100644
index 0000000..d1aa9af
--- /dev/null
+++ b/ext/standard/tests/strings/metaphone.phpt
@@ -0,0 +1,41 @@
+--TEST--
+metaphone() tests
+--FILE--
+<?php
+
+var_dump(metaphone());
+var_dump(metaphone(""));
+var_dump(metaphone(-1));
+var_dump(metaphone(-1, -1));
+
+var_dump(metaphone("valid phrase", -1));
+var_dump(metaphone("valid phrase", 0));
+var_dump(metaphone("valid phrase", 10000));
+
+$array = array(
+"They fell forward, grovelling heedlessly on the cold earth.",
+"But the shadow of horror wheeled and returned, passing lower now, right above them, sweeping the fen-reek with its ghastly wings.",
+"And then it was gone, flying back to Mordor with the speed of the wrath of Sauron; and behind it the wind roared away, leaving the Dead Marshes bare and bleak.",
+"The naked waste, as far as the eye could pierce, even to the distant menace of the mountains, was dappled with the fitful moonlight."
+);
+
+foreach($array as $str) {
+ var_dump(metaphone($str));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+string(0) ""
+string(0) ""
+bool(false)
+bool(false)
+string(6) "FLTFRS"
+string(6) "FLTFRS"
+string(26) "0FLFRWRTKRFLNKHTLSLN0KLTR0"
+string(56) "BT0XTFHRRHLTNTRTRNTPSNKLWRNRFTBF0MSWPNK0FNRKW0TSFSTLWNKS"
+string(69) "ANT0NTWSKNFLYNKBKTMRTRW00SPTF0R0FSRNNTBHNTT0WNTRRTWLFNK0TTMRXSBRNTBLK"
+string(56) "0NKTWSTSFRS0YKLTPRSFNT0TSTNTMNSF0MNTNSWSTPLTW00FTFLMNLFT"
+Done
diff --git a/ext/standard/tests/strings/money_format_basic1.phpt b/ext/standard/tests/strings/money_format_basic1.phpt
new file mode 100644
index 0000000..70b5ca5
--- /dev/null
+++ b/ext/standard/tests/strings/money_format_basic1.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test money_format() function : basic functionality using national currency symbols
+--SKIPIF--
+<?php
+ if (!function_exists('money_format')) {
+ die("SKIP money_format - not supported\n");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : string money_format ( string $format , float $number )
+ * Description: Formats a number as a currency string
+ * Source code: ext/standard/string.c
+*/
+
+// ===========================================================================================
+// = We do not test for exact return-values, as those might be different between OS-versions =
+// ===========================================================================================
+
+echo "*** Testing money_format() : basic functionality***\n";
+
+$value = 1234.5678;
+$negative_value = -1234.5678;
+
+// Format with 14 positions of width, 8 digits of
+// left precision, 2 of right precision using national
+// format for en_US
+echo "Format values with 14 positions, 8 digits to left, 2 to right using national format\n";
+echo gettype(money_format('%14#8.2n', $value))."\n";
+echo gettype(money_format('%14#8.2n', $negative_value))."\n";
+
+// Same again but use '(' for negative values
+echo "Format again but with ( for negative values\n";
+echo gettype(money_format('%(14#8.2n', $value))."\n";
+echo gettype(money_format('%(14#8.2n', $negative_value))."\n";
+
+// Same again but use a '0' for padding character
+echo "Format with 0 for padding character\n";
+echo gettype(money_format('%=014#8.2n', $value))."\n";
+echo gettype(money_format('%=014#8.2n', $negative_value))."\n";
+
+// Same again but use a '*' for padding character
+echo "Format again with * for padding character\n";
+echo gettype(money_format('%=*14#8.2n', $value))."\n";
+echo gettype(money_format('%=*14#8.2n', $negative_value))."\n";
+
+// Same again but disable grouping character
+echo "Format again but disable grouping character\n";
+echo gettype(money_format('%=*^14#8.2n', $value))."\n";
+echo gettype(money_format('%=*^14#8.2n', $negative_value))."\n";
+
+// Same again but suppress currency symbol
+echo "Format again suppress currency symbol\n";
+echo gettype(money_format('%=*!14#8.2n', $value))."\n";
+echo gettype(money_format('%=*!14#8.2n', $negative_value))."\n";
+
+?>
+===DONE===
+--EXPECT--
+*** Testing money_format() : basic functionality***
+Format values with 14 positions, 8 digits to left, 2 to right using national format
+string
+string
+Format again but with ( for negative values
+string
+string
+Format with 0 for padding character
+string
+string
+Format again with * for padding character
+string
+string
+Format again but disable grouping character
+string
+string
+Format again suppress currency symbol
+string
+string
+===DONE===
+
diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt
new file mode 100644
index 0000000..cf110b4
--- /dev/null
+++ b/ext/standard/tests/strings/money_format_error.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test money_format() function : error conditions
+--SKIPIF--
+<?php
+ if (!function_exists('money_format')) {
+ die("SKIP money_format - not supported\n");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : string money_format ( string $format , float $number )
+ * Description: Formats a number as a currency string
+ * Source code: ext/standard/string.c
+*/
+
+// ===========================================================================================
+// = We do not test for exact return-values, as those might be different between OS-versions =
+// ===========================================================================================
+
+$string = '%14#8.2n';
+$value = 1234.56;
+$extra_arg = 10;
+
+echo "*** Testing money_format() : error conditions ***\n";
+
+echo "\n-- Testing money_format() function with no arguments --\n";
+var_dump( money_format() );
+
+echo "\n-- Testing money_format() function with insufficient arguments --\n";
+var_dump( money_format($string) );
+
+echo "\n-- Testing money_format() function with more than expected no. of arguments --\n";
+
+var_dump( money_format($string, $value, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing money_format() : error conditions ***
+
+-- Testing money_format() function with no arguments --
+
+Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing money_format() function with insufficient arguments --
+
+Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+-- Testing money_format() function with more than expected no. of arguments --
+
+Warning: money_format() 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/money_format_variation1.phpt b/ext/standard/tests/strings/money_format_variation1.phpt
new file mode 100644
index 0000000..d4fa687
--- /dev/null
+++ b/ext/standard/tests/strings/money_format_variation1.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test money_format() function : usage variations - test values for $format argument
+--SKIPIF--
+<?php
+ if (!function_exists('money_format')) {
+ die("SKIP money_format - not supported\n");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : string money_format ( string $format , float $number )
+ * Description: Formats a number as a currency string
+ * Source code: ext/standard/string.c
+*/
+
+// ===========================================================================================
+// = We do not test for exact return-values, as those might be different between OS-versions =
+// ===========================================================================================
+
+echo "*** Testing money_format() function: with unexpected inputs for 'format' argument ***\n";
+
+//get an unset variable
+$unset_var = ' string_val ';
+unset($unset_var);
+
+//defining a couple of sample classes
+class class_no_tostring {
+}
+
+class class_with_tostring {
+ public function __toString() {
+ return " sample object ";
+ }
+}
+
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$formats = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // string values
+/*19*/ "abcd",
+ 'abcd',
+ "0x12f",
+ "%=*!14#8.2nabcd",
+
+ // objects
+/*23*/ new class_no_tostring(),
+ new class_with_tostring(),
+
+ // resource
+/*25*/ $file_handle,
+
+ // undefined variable
+/*26*/ @$undefined_var,
+
+ // unset variable
+/*27*/ @$unset_var
+);
+
+// loop through with each element of the $formats array to test money_format() function
+$count = 1;
+$value = 1234.56;
+
+foreach($formats as $format) {
+ echo "-- Iteration $count --\n";
+ echo gettype(money_format($format, $value))."\n";
+ $count ++;
+}
+
+// close the file handle
+fclose($file_handle);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing money_format() function: with unexpected inputs for 'format' argument ***
+-- Iteration 1 --
+string
+-- Iteration 2 --
+string
+-- Iteration 3 --
+string
+-- Iteration 4 --
+string
+-- Iteration 5 --
+string
+-- Iteration 6 --
+string
+-- Iteration 7 --
+string
+-- Iteration 8 --
+string
+-- Iteration 9 --
+string
+-- Iteration 10 --
+
+Warning: money_format() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: money_format() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: money_format() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string
+-- Iteration 14 --
+string
+-- Iteration 15 --
+string
+-- Iteration 16 --
+string
+-- Iteration 17 --
+string
+-- Iteration 18 --
+string
+-- Iteration 19 --
+string
+-- Iteration 20 --
+string
+-- Iteration 21 --
+string
+-- Iteration 22 --
+string
+-- Iteration 23 --
+
+Warning: money_format() expects parameter 1 to be string, object given in %s on line %d
+NULL
+-- Iteration 24 --
+string
+-- Iteration 25 --
+
+Warning: money_format() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 26 --
+string
+-- Iteration 27 --
+string
+===Done===
diff --git a/ext/standard/tests/strings/money_format_variation2.phpt b/ext/standard/tests/strings/money_format_variation2.phpt
new file mode 100644
index 0000000..8ac4cb9
--- /dev/null
+++ b/ext/standard/tests/strings/money_format_variation2.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test money_format() function : usage variations - test values for $number argument
+--SKIPIF--
+<?php
+ if (!function_exists('money_format')) {
+ die("SKIP money_format - not supported\n");
+ }
+?>
+--FILE--
+<?php
+/* Prototype : string money_format ( string $format , float $number )
+ * Description: Formats a number as a currency string
+ * Source code: ext/standard/string.c
+*/
+
+// ===========================================================================================
+// = We do not test for exact return-values, as those might be different between OS-versions =
+// ===========================================================================================
+
+echo "*** Testing money_format() function: with unexpected inputs for 'number' argument ***\n";
+
+//get an unset variable
+$unset_var = ' string_val ';
+unset($unset_var);
+
+//defining a couple of sample classes
+class class_no_tostring {
+}
+
+class class_with_tostring {
+ public function __toString() {
+ return " sample object ";
+ }
+}
+
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $number
+$numbers = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // string values
+/*19*/ "abcd",
+ 'abcd',
+ "0x12f",
+ "%=*!14#8.2nabcd",
+
+ // objects
+/*23*/ new class_no_tostring(),
+ new class_with_tostring(),
+
+ // resource
+/*25*/ $file_handle,
+
+ // undefined variable
+/*26*/ @$undefined_var,
+
+ // unset variable
+/*27*/ @$unset_var
+);
+
+// loop through with each element of the $numbers array to test money_format() function
+$count = 1;
+$format = '%14#8.2i';
+
+foreach($numbers as $number) {
+ echo "-- Iteration $count --\n";
+ echo gettype(money_format($format, $number))."\n";
+ $count ++;
+}
+
+// close the file handle
+fclose($file_handle);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing money_format() function: with unexpected inputs for 'number' argument ***
+-- Iteration 1 --
+string
+-- Iteration 2 --
+string
+-- Iteration 3 --
+string
+-- Iteration 4 --
+string
+-- Iteration 5 --
+string
+-- Iteration 6 --
+string
+-- Iteration 7 --
+string
+-- Iteration 8 --
+string
+-- Iteration 9 --
+string
+-- Iteration 10 --
+
+Warning: money_format() expects parameter 2 to be double, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: money_format() expects parameter 2 to be double, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: money_format() expects parameter 2 to be double, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string
+-- Iteration 14 --
+string
+-- Iteration 15 --
+string
+-- Iteration 16 --
+string
+-- Iteration 17 --
+string
+-- Iteration 18 --
+string
+-- Iteration 19 --
+
+Warning: money_format() expects parameter 2 to be double, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: money_format() expects parameter 2 to be double, string given in %s on line %d
+NULL
+-- Iteration 21 --
+string
+-- Iteration 22 --
+
+Warning: money_format() expects parameter 2 to be double, string given in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: money_format() expects parameter 2 to be double, object given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: money_format() expects parameter 2 to be double, object given in %s on line %d
+NULL
+-- Iteration 25 --
+
+Warning: money_format() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+-- Iteration 26 --
+string
+-- Iteration 27 --
+string
+===Done===
diff --git a/ext/standard/tests/strings/moneyformat.phpt b/ext/standard/tests/strings/moneyformat.phpt
new file mode 100644
index 0000000..db6c48c
--- /dev/null
+++ b/ext/standard/tests/strings/moneyformat.phpt
@@ -0,0 +1,23 @@
+--TEST--
+money_format test
+--SKIPIF--
+<?php
+ if (!function_exists('money_format') || !function_exists('setlocale')) {
+ die("SKIP money_format - not supported\n");
+ }
+
+if (setlocale(LC_MONETARY, 'en_US') === false) {
+ die('skip en_US locale not available');
+}
+?>
+--FILE--
+<?php
+setlocale(LC_MONETARY, 'en_US');
+var_dump( money_format("X%nY", 3.1415));
+var_dump(money_format("AAAAA%n%n%n%n", NULL));
+?>
+--EXPECTF--
+string(7) "X$3.14Y"
+
+Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/nl2br.phpt b/ext/standard/tests/strings/nl2br.phpt
new file mode 100644
index 0000000..6a3b940
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br.phpt
@@ -0,0 +1,45 @@
+--TEST--
+nl2br() function
+--FILE--
+<?php
+ var_dump(nl2br("test"));
+ var_dump(nl2br(""));
+ var_dump(nl2br(NULL));
+ var_dump(nl2br("\r\n"));
+ var_dump(nl2br("\n"));
+ var_dump(nl2br("\r"));
+ var_dump(nl2br("\n\r"));
+
+ var_dump(nl2br("\n\r\r\n\r\r\r\r"));
+ var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n"));
+ var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r"));
+
+?>
+--EXPECT--
+string(4) "test"
+string(0) ""
+string(0) ""
+string(8) "<br />
+"
+string(7) "<br />
+"
+string(7) "<br /> "
+string(8) "<br />
+ "
+string(44) "<br />
+ <br />
+<br /> <br /> <br /> <br /> "
+string(47) "<br />
+ <br />
+<br />
+ <br />
+ <br />
+<br />
+"
+string(66) "<br />
+ <br />
+<br />
+<br />
+<br />
+ <br /> <br /> <br />
+<br /> "
diff --git a/ext/standard/tests/strings/nl2br_error.phpt b/ext/standard/tests/strings/nl2br_error.phpt
new file mode 100644
index 0000000..dbf4227
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test nl2br() function : error conditions
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str)
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing nl2br() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing nl2br() function with Zero arguments --";
+var_dump( nl2br() );
+
+//Test nl2br with one more than the expected number of arguments
+echo "\n-- Testing nl2br() function with more than expected no. of arguments --";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( nl2br($str, true, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : error conditions ***
+
+-- Testing nl2br() function with Zero arguments --
+Warning: nl2br() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing nl2br() function with more than expected no. of arguments --
+Warning: nl2br() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation1.phpt b/ext/standard/tests/strings/nl2br_variation1.phpt
new file mode 100644
index 0000000..ab15ca1
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation1.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test nl2br() function : usage variations - double quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str);
+ * Description: Inserts HTML line breaks before all newlines in a string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test nl2br() function by passing double quoted strings containing various
+ * combinations of new line chars to 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+
+$strings = array(
+ //new line chars embedded in strings
+ "Hello\nWorld",
+ "\nHello\nWorld\n",
+ "Hello\rWorld",
+ "\rHello\rWorld\r",
+ "Hello\r\nWorld",
+ "\r\nHello\r\nWorld\r\n",
+
+ //one blank line
+ "
+",
+
+ //two blank lines
+ "
+
+",
+
+ //inserted new line in a string
+ "Hello
+World"
+);
+
+//loop through $strings array to test nl2br() function with each element
+$count = 1;
+foreach( $strings as $str ){
+ echo "-- Iteration $count --\n";
+ var_dump(nl2br($str) );
+ $count ++ ;
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+-- Iteration 1 --
+string(17) "Hello<br />
+World"
+-- Iteration 2 --
+string(31) "<br />
+Hello<br />
+World<br />
+"
+-- Iteration 3 --
+string(17) "Hello<br /> World"
+-- Iteration 4 --
+string(31) "<br /> Hello<br /> World<br /> "
+-- Iteration 5 --
+string(18) "Hello<br />
+World"
+-- Iteration 6 --
+string(34) "<br />
+Hello<br />
+World<br />
+"
+-- Iteration 7 --
+string(7) "<br />
+"
+-- Iteration 8 --
+string(14) "<br />
+<br />
+"
+-- Iteration 9 --
+string(17) "Hello<br />
+World"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation2.phpt b/ext/standard/tests/strings/nl2br_variation2.phpt
new file mode 100644
index 0000000..a4423df
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation2.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test nl2br() function : usage variations - single quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str);
+ * Description: Inserts HTML line breaks before all newlines in a string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test nl2br() function by passing single quoted strings containing various
+ * combinations of new line chars to 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+$strings = array(
+ '\n',
+ '\r',
+ '\r\n',
+ 'Hello\nWorld',
+ 'Hello\rWorld',
+ 'Hello\r\nWorld',
+
+ //one blank line
+ '
+',
+
+ //two blank lines
+ '
+
+',
+
+ //inserted new line
+ 'Hello
+World'
+);
+
+//loop through $strings array to test nl2br() function with each element
+$count = 1;
+foreach( $strings as $str ){
+ echo "-- Iteration $count --\n";
+ var_dump(nl2br($str) );
+ $count ++ ;
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+-- Iteration 1 --
+string(2) "\n"
+-- Iteration 2 --
+string(2) "\r"
+-- Iteration 3 --
+string(4) "\r\n"
+-- Iteration 4 --
+string(12) "Hello\nWorld"
+-- Iteration 5 --
+string(12) "Hello\rWorld"
+-- Iteration 6 --
+string(14) "Hello\r\nWorld"
+-- Iteration 7 --
+string(7) "<br />
+"
+-- Iteration 8 --
+string(14) "<br />
+<br />
+"
+-- Iteration 9 --
+string(17) "Hello<br />
+World"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation3.phpt b/ext/standard/tests/strings/nl2br_variation3.phpt
new file mode 100644
index 0000000..b1341d1
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation3.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test nl2br() function : usage variations - heredoc strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str);
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test nl2br() function by passing heredoc strings containing various
+ * combinations of new line chars to 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+//heredoc string containing new line chars(\n, \r and combinations of \r & \n) and new lines
+$heredoc_str1 = <<<EOD
+\n
+\r
+\r\n
+\nnn\n\n\nn
+\rrr\r\r\rr
+\n\r\n\r\r\n\nr\rn
+EOD;
+
+//heredoc string containing embedded 'new line chars'/'new lines' in the string
+$heredoc_str2 = <<<EOD
+Hello\nWorld\r
+This is \tes\t for \n \new lines
+like \n \r\n \r \n\r and etc
+EOD;
+
+var_dump(nl2br($heredoc_str1) );
+var_dump(nl2br($heredoc_str2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+string(147) "<br />
+<br />
+ <br />
+ <br />
+<br />
+<br />
+nn<br />
+<br />
+<br />
+n<br />
+ rr<br /> <br /> <br /> r<br />
+<br />
+ <br />
+ <br />
+<br />
+r<br /> n"
+string(118) "Hello<br />
+World<br />
+This is es for <br />
+ <br />
+ew lines<br />
+like <br />
+ <br />
+ <br /> <br />
+ and etc"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation4.phpt b/ext/standard/tests/strings/nl2br_variation4.phpt
new file mode 100644
index 0000000..63931af
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation4.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test nl2br() function : usage variations - html values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str)
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+* Test nl2br() function by passing html string inputs containing line breaks and
+* new line chars for 'str'
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+
+//array of html strings
+$strings = array(
+ "<html>Hello<br />world</html>",
+ "<html><br /></html>",
+ "<html>\nHello\r\nworld\r</html>",
+ "<html>\n \r\n \r</html>",
+);
+
+//loop through $strings array to test nl2br() function with each element
+foreach( $strings as $str ){
+ var_dump(nl2br($str) );
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+string(29) "<html>Hello<br />world</html>"
+string(19) "<html><br /></html>"
+string(45) "<html><br />
+Hello<br />
+world<br /> </html>"
+string(37) "<html><br />
+ <br />
+ <br /> </html>"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation5.phpt b/ext/standard/tests/strings/nl2br_variation5.phpt
new file mode 100644
index 0000000..beebe03
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation5.phpt
@@ -0,0 +1,152 @@
+--TEST--
+Test nl2br() function : usage variations - unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str)
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+* Test nl2br() function by passing different types of values other than
+* expected type for 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//getting resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining class
+class Sample {
+ public function __toString() {
+ return "My String";
+ }
+}
+
+//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,
+
+ //resource
+ $file_handle,
+
+ // object data
+ new Sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through $values array to test nl2br() function with each element
+$count = 1;
+foreach($values as $value) {
+ echo "-- Iteration $count --\n";
+ var_dump( nl2br($value) );
+ $count ++ ;
+};
+
+//closing the file handle
+fclose( $file_handle );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : 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) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: nl2br() 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 --
+
+Warning: nl2br() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 22 --
+string(9) "My String"
+-- Iteration 23 --
+string(0) ""
+-- Iteration 24 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/nl_langinfo_basic.phpt b/ext/standard/tests/strings/nl_langinfo_basic.phpt
new file mode 100644
index 0000000..370177b
--- /dev/null
+++ b/ext/standard/tests/strings/nl_langinfo_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test nl_langinfo() function : basic functionality
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN'){
+ die('skip Not for Windows');
+}
+?>
+--FILE--
+<?php
+
+/* Prototype : string nl_langinfo ( int $item )
+ * Description: Query language and locale information
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing nl_langinfo() : basic functionality ***\n";
+
+$original = setlocale(LC_ALL, 'C');
+
+var_dump(nl_langinfo(ABDAY_2));
+var_dump(nl_langinfo(DAY_4));
+var_dump(nl_langinfo(ABMON_7));
+var_dump(nl_langinfo(MON_4));
+var_dump(nl_langinfo(RADIXCHAR));
+
+setlocale(LC_ALL, $original);
+?>
+===DONE===
+--EXPECTF--
+*** Testing nl_langinfo() : basic functionality ***
+string(3) "Mon"
+string(9) "Wednesday"
+string(3) "Jul"
+string(5) "April"
+string(1) "."
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/nl_langinfo_error1.phpt b/ext/standard/tests/strings/nl_langinfo_error1.phpt
new file mode 100644
index 0000000..7702b01
--- /dev/null
+++ b/ext/standard/tests/strings/nl_langinfo_error1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test nl_langinfo() function : error conditions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN'){
+ die('skip Not for Windows');
+}
+?>
+--FILE--
+<?php
+
+/* Prototype : string nl_langinfo ( int $item )
+ * Description: Query language and locale information
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing nl_langinfo() : error conditions ***\n";
+
+echo "\n-- Testing nl_langinfo() function with no arguments --\n";
+var_dump( nl_langinfo() );
+
+echo "\n-- Testing nl_langinfo() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( nl_langinfo(ABDAY_2, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing nl_langinfo() : error conditions ***
+
+-- Testing nl_langinfo() function with no arguments --
+
+Warning: nl_langinfo() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing nl_langinfo() function with more than expected no. of arguments --
+
+Warning: nl_langinfo() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/nl_langinfo_variation1.phpt b/ext/standard/tests/strings/nl_langinfo_variation1.phpt
new file mode 100644
index 0000000..98edb1b
--- /dev/null
+++ b/ext/standard/tests/strings/nl_langinfo_variation1.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test nl_langinfo() function : unexpected inputs for '$tem' argument
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN'){
+ die('skip Not for Windows');
+}
+?>
+--FILE--
+<?php
+
+/* Prototype : string nl_langinfo ( int $item )
+ * Description: Query language and locale information
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing nl_langinfo() : with unexpected inputs for 'item' argument ***\n";
+
+$original = setlocale(LC_ALL, 'C');
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$items = array (
+ // integer values
+/*1*/ 2147483647,
+ -2147483648,
+ -20,
+
+ // array values
+/*4*/ array(),
+ array(0),
+ array(1, 2),
+
+ // objects
+/*7*/ new sample(),
+
+ // resource
+/*8*/ $file_handle,
+ );
+
+//defining '$input' argument
+$input = "Test string";
+
+// loop through with each element of the $items array to test nl_langinfo() function
+$count = 1;
+foreach($items as $item) {
+ echo "-- Iteration $count --\n";
+ var_dump( nl_langinfo($item) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+setlocale(LC_ALL, $original);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing nl_langinfo() : with unexpected inputs for 'item' argument ***
+-- Iteration 1 --
+
+Warning: nl_langinfo(): Item '2147483647' is not valid in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: nl_langinfo(): Item '-2147483648' is not valid in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: nl_langinfo(): Item '-20' is not valid in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: nl_langinfo() expects parameter 1 to be long, object given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: nl_langinfo() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt
new file mode 100644
index 0000000..94b8482
--- /dev/null
+++ b/ext/standard/tests/strings/number_format_basic.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test number_format() - basic function test number_format()
+--FILE--
+<?php
+/* Prototype : string number_format ( float $number [, int $decimals ] )
+ * string number_format ( float $number , int $decimals , string $dec_point , string $thousands_sep )
+ * Description: Format a number with grouped thousands
+ * Source code: ext/standard/string.c
+ */
+
+echo "*** Testing number_format() : basic functionality ***\n";
+
+$values = array(1234.5678,
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
+
+echo "\n-- number_format tests.....default --\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i]);
+ var_dump($res);
+}
+
+echo "\n-- number_format tests.....with two dp --\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2);
+ var_dump($res);
+}
+
+echo "\n-- number_format tests.....English format --\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '.', ' ');
+ var_dump($res);
+}
+
+echo "\n-- number_format tests.....French format --\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, ',' , ' ');
+ var_dump($res);
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing number_format() : basic functionality ***
+
+-- number_format tests.....default --
+string(5) "1,235"
+string(6) "-1,235"
+string(10) "12,346,578"
+string(11) "-12,345,679"
+string(11) "305,450,479"
+string(11) "402,653,183"
+string(11) "123,456,789"
+string(3) "123"
+string(3) "123"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+
+-- number_format tests.....with two dp --
+string(8) "1,234.57"
+string(9) "-1,234.57"
+string(13) "12,346,578.00"
+string(14) "-12,345,678.90"
+string(14) "305,450,479.00"
+string(14) "402,653,183.00"
+string(14) "123,456,789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+-- number_format tests.....English format --
+string(8) "1 234.57"
+string(9) "-1 234.57"
+string(13) "12 346 578.00"
+string(14) "-12 345 678.90"
+string(14) "305 450 479.00"
+string(14) "402 653 183.00"
+string(14) "123 456 789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+-- number_format tests.....French format --
+string(8) "1 234,57"
+string(9) "-1 234,57"
+string(13) "12 346 578,00"
+string(14) "-12 345 678,90"
+string(14) "305 450 479,00"
+string(14) "402 653 183,00"
+string(14) "123 456 789,00"
+string(6) "123,46"
+string(6) "123,46"
+string(4) "0,00"
+string(4) "1,00"
+string(4) "0,00"
+===DONE===
diff --git a/ext/standard/tests/strings/number_format_error.phpt b/ext/standard/tests/strings/number_format_error.phpt
new file mode 100644
index 0000000..334b63e
--- /dev/null
+++ b/ext/standard/tests/strings/number_format_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test number_format() - wrong params test number_format()
+--FILE--
+<?php
+/* Prototype : string number_format ( float $number [, int $decimals ] )
+ * string number_format ( float $number , int $decimals , string $dec_point , string $thousands_sep )
+ * Description: Format a number with grouped thousands
+ * Source code: ext/standard/string.c
+ */
+
+echo "*** Testing number_format() : error conditions ***\n";
+
+echo "\n-- Testing number_format() function with less than expected no. of arguments --\n";
+number_format();
+
+echo "\n-- Testing number_format() function with 3 arguments --\n";
+number_format(23,2,true);
+
+echo "\n-- Testing number_format() function with more than 4 arguments --\n";
+number_format(23,2,true,false,36);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing number_format() : error conditions ***
+
+-- Testing number_format() function with less than expected no. of arguments --
+
+Warning: number_format() expects at least 1 parameter, 0 given in %s on line %d
+
+-- Testing number_format() function with 3 arguments --
+
+Warning: Wrong parameter count for number_format() in %s on line %d
+
+-- Testing number_format() function with more than 4 arguments --
+
+Warning: number_format() expects at most 4 parameters, 5 given in %s on line %d
+===DONE===
diff --git a/ext/standard/tests/strings/ord_basic.phpt b/ext/standard/tests/strings/ord_basic.phpt
new file mode 100644
index 0000000..19f3ea2
--- /dev/null
+++ b/ext/standard/tests/strings/ord_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test ord() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : int ord ( string $string )
+ * Description: Return ASCII value of character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ord() : basic functionality ***\n";
+
+var_dump(ord("a"));
+var_dump(ord("z"));
+var_dump(ord("0"));
+var_dump(ord("9"));
+var_dump(ord("!"));
+var_dump(ord("*"));
+var_dump(ord("@"));
+var_dump(ord("\n"));
+var_dump(ord("\x0A"));
+var_dump(ord("\xFF"));
+var_dump(ord("Hello"));
+
+// Make sure all valid ascii chars round trip
+for ($i = 0; $i < 255; $i++) {
+ if (ord(chr($i)) != $i) {
+ exit("TEST FAILED: $i does not round trip\n");
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ord() : basic functionality ***
+int(97)
+int(122)
+int(48)
+int(57)
+int(33)
+int(42)
+int(64)
+int(10)
+int(10)
+int(255)
+int(72)
+===DONE===
diff --git a/ext/standard/tests/strings/ord_error.phpt b/ext/standard/tests/strings/ord_error.phpt
new file mode 100644
index 0000000..455fb38
--- /dev/null
+++ b/ext/standard/tests/strings/ord_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test ord() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : int ord ( string $string )
+ * Description: Return ASCII value of character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ord() : error conditions ***\n";
+
+echo "\n-- Testing ord() function with no arguments --\n";
+var_dump( ord() );
+
+echo "\n-- Testing ord() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( ord(72, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ord() : error conditions ***
+
+-- Testing ord() function with no arguments --
+
+Warning: ord() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ord() function with more than expected no. of arguments --
+
+Warning: ord() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/ord_variation1.phpt b/ext/standard/tests/strings/ord_variation1.phpt
new file mode 100644
index 0000000..06d9364
--- /dev/null
+++ b/ext/standard/tests/strings/ord_variation1.phpt
@@ -0,0 +1,136 @@
+--TEST--
+Test ord() function : usage variations - test values for $string argument
+--FILE--
+<?php
+
+/* Prototype : int ord ( string $string )
+ * Description: Return ASCII value of character
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ord() function: with unexpected inputs for 'string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $string array to test ord() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( ord($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ord() function: with unexpected inputs for 'string' argument ***
+-- Iteration 1 --
+int(48)
+-- Iteration 2 --
+int(49)
+-- Iteration 3 --
+int(50)
+-- Iteration 4 --
+int(50)
+-- Iteration 5 --
+int(50)
+-- Iteration 6 --
+int(45)
+-- Iteration 7 --
+int(49)
+-- Iteration 8 --
+int(45)
+-- Iteration 9 --
+int(49)
+-- Iteration 10 --
+
+Warning: ord() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: ord() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: ord() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+int(49)
+-- Iteration 14 --
+int(0)
+-- Iteration 15 --
+int(49)
+-- Iteration 16 --
+int(0)
+-- Iteration 17 --
+int(0)
+-- Iteration 18 --
+int(0)
+-- Iteration 19 --
+int(115)
+-- Iteration 20 --
+
+Warning: ord() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+int(0)
+-- Iteration 22 --
+int(0)
+===DONE===
diff --git a/ext/standard/tests/strings/pack.phpt b/ext/standard/tests/strings/pack.phpt
new file mode 100644
index 0000000..449451c
--- /dev/null
+++ b/ext/standard/tests/strings/pack.phpt
@@ -0,0 +1,385 @@
+--TEST--
+Generic pack()/unpack() tests
+--SKIPIF--
+<?php
+if (PHP_INT_MAX > 2147483647) {
+ die("skip 32bit test only");
+}
+?>
+--FILE--
+<?php
+print_r(unpack("A", pack("A", "hello world")));
+print_r(unpack("A*", pack("A*", "hello world")));
+echo '"'.pack("A9", "hello").'"';
+echo "\n";
+
+print_r(unpack("C", pack("C", -127)));
+print_r(unpack("C", pack("C", 127)));
+print_r(unpack("C", pack("C", 255)));
+print_r(unpack("C", pack("C", -129)));
+
+print_r(unpack("H", pack("H", 0x04)));
+
+print_r(unpack("I", pack("I", 65534)));
+print_r(unpack("I", pack("I", 0)));
+print_r(unpack("I", pack("I", -1000)));
+print_r(unpack("I", pack("I", -64434)));
+print_r(unpack("I", pack("I", 4294967296)));
+print_r(unpack("I", pack("I", -4294967296)));
+
+print_r(unpack("L", pack("L", 65534)));
+print_r(unpack("L", pack("L", 0)));
+print_r(unpack("L", pack("L", 2147483650)));
+print_r(unpack("L", pack("L", 4294967295)));
+print_r(unpack("L", pack("L", -2147483648)));
+
+print_r(unpack("N", pack("N", 65534)));
+print_r(unpack("N", pack("N", 0)));
+print_r(unpack("N", pack("N", 2147483650)));
+print_r(unpack("N", pack("N", 4294967296)));
+print_r(unpack("N", pack("N", -2147483648)));
+print_r(unpack("N", pack("N", -30000)));
+
+print_r(unpack("S", pack("S", 65534)));
+print_r(unpack("S", pack("S", 65537)));
+print_r(unpack("S", pack("S", 0)));
+print_r(unpack("S", pack("S", -1000)));
+print_r(unpack("S", pack("S", -64434)));
+print_r(unpack("S", pack("S", -65535)));
+
+print_r(unpack("V", pack("V", 65534)));
+print_r(unpack("V", pack("V", 0)));
+print_r(unpack("V", pack("V", 2147483650)));
+print_r(unpack("V", pack("V", 4294967296)));
+print_r(unpack("V", pack("V", -2147483648)));
+
+print_r(unpack("a", pack("a", "hello world")));
+print_r(unpack("a*", pack("a*", "hello world")));
+
+print_r(unpack("c", pack("c", -127)));
+print_r(unpack("c", pack("c", 127)));
+print_r(unpack("c", pack("c", 255)));
+print_r(unpack("c", pack("c", -129)));
+
+print_r(unpack("h", pack("h", 3000000)));
+
+print_r(unpack("i", pack("i", 65534)));
+print_r(unpack("i", pack("i", 0)));
+print_r(unpack("i", pack("i", -1000)));
+print_r(unpack("i", pack("i", -64434)));
+print_r(unpack("i", pack("i", -65535)));
+print_r(unpack("i", pack("i", -2147483647)));
+
+print_r(unpack("l", pack("l", 65534)));
+print_r(unpack("l", pack("l", 0)));
+print_r(unpack("l", pack("l", 2147483650)));
+print_r(unpack("l", pack("l", 4294967296)));
+print_r(unpack("l", pack("l", -2147483648)));
+
+print_r(unpack("n", pack("n", 65534)));
+print_r(unpack("n", pack("n", 65537)));
+print_r(unpack("n", pack("n", 0)));
+print_r(unpack("n", pack("n", -1000)));
+print_r(unpack("n", pack("n", -64434)));
+print_r(unpack("n", pack("n", -65535)));
+
+print_r(unpack("s", pack("s", 32767)));
+print_r(unpack("s", pack("s", 65535)));
+print_r(unpack("s", pack("s", 0)));
+print_r(unpack("s", pack("s", -1000)));
+print_r(unpack("s", pack("s", -64434)));
+print_r(unpack("s", pack("s", -65535)));
+
+print_r(unpack("v", pack("v", 65534)));
+print_r(unpack("v", pack("v", 65537)));
+print_r(unpack("v", pack("v", 0)));
+print_r(unpack("v", pack("v", -1000)));
+print_r(unpack("v", pack("v", -64434)));
+print_r(unpack("v", pack("v", -65535)));
+?>
+--EXPECTF--
+Array
+(
+ [1] => h
+)
+Array
+(
+ [1] => hello world
+)
+"hello "
+Array
+(
+ [1] => 129
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => 255
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => 4
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -1000
+)
+Array
+(
+ [1] => -64434
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => -30000
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 64536
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => h
+)
+Array
+(
+ [1] => hello world
+)
+Array
+(
+ [1] => -127
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => 127
+)
+Array
+(
+ [1] => 3
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -1000
+)
+Array
+(
+ [1] => -64434
+)
+Array
+(
+ [1] => -65535
+)
+Array
+(
+ [1] => -2147483647
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483646
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -2147483648
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 64536
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 32767
+)
+Array
+(
+ [1] => -1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => -1000
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 65534
+)
+Array
+(
+ [1] => 1
+)
+Array
+(
+ [1] => 0
+)
+Array
+(
+ [1] => 64536
+)
+Array
+(
+ [1] => 1102
+)
+Array
+(
+ [1] => 1
+)
diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt
new file mode 100644
index 0000000..7a8fda8
--- /dev/null
+++ b/ext/standard/tests/strings/parse_str_basic1.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test parse_str() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : void parse_str ( string $str [, array &$arr ] )
+ * Description: Parses the string into variables
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing parse_str() : basic functionality ***\n";
+
+echo "Basic test WITHOUT result arg\n";
+$s1 = "first=val1&second=val2&third=val3";
+var_dump(parse_str($s1));
+var_dump($first, $second, $third);
+
+echo "\nBasic test WITH undefined var for result arg\n";
+$s1 = "first=val1&second=val2&third=val3";
+var_dump(parse_str($s1, $res1));
+var_dump($res1);
+
+echo "\nBasic test WITH existing non-array var for result arg\n";
+$res2 =99;
+$s1 = "first=val1&second=val2&third=val3";
+var_dump(parse_str($s1, $res2));
+var_dump($res2);
+
+echo "\nBasic test with an existing array as results array\n";
+$res3_array = array(1,2,3,4);
+var_dump(parse_str($s1, $res3_array));
+var_dump($res3_array);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing parse_str() : basic functionality ***
+Basic test WITHOUT result arg
+NULL
+string(4) "val1"
+string(4) "val2"
+string(4) "val3"
+
+Basic test WITH undefined var for result arg
+NULL
+array(3) {
+ ["first"]=>
+ string(4) "val1"
+ ["second"]=>
+ string(4) "val2"
+ ["third"]=>
+ string(4) "val3"
+}
+
+Basic test WITH existing non-array var for result arg
+NULL
+array(3) {
+ ["first"]=>
+ string(4) "val1"
+ ["second"]=>
+ string(4) "val2"
+ ["third"]=>
+ string(4) "val3"
+}
+
+Basic test with an existing array as results array
+NULL
+array(3) {
+ ["first"]=>
+ string(4) "val1"
+ ["second"]=>
+ string(4) "val2"
+ ["third"]=>
+ string(4) "val3"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/parse_str_basic2.phpt b/ext/standard/tests/strings/parse_str_basic2.phpt
new file mode 100644
index 0000000..e42c9ca
--- /dev/null
+++ b/ext/standard/tests/strings/parse_str_basic2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test parse_str() function : non-default arg_separator.input specified
+--INI--
+arg_separator.input = "/"
+--FILE--
+<?php
+/* Prototype : void parse_str ( string $str [, array &$arr ] )
+ * Description: Parses the string into variables
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing parse_str() : non-default arg_separator.input specified ***\n";
+
+$s1 = "first=val1/second=val2/third=val3";
+var_dump(parse_str($s1));
+var_dump($first, $second, $third);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing parse_str() : non-default arg_separator.input specified ***
+NULL
+string(4) "val1"
+string(4) "val2"
+string(4) "val3"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt
new file mode 100644
index 0000000..619b147
--- /dev/null
+++ b/ext/standard/tests/strings/parse_str_basic3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/parse_str_basic4.phpt b/ext/standard/tests/strings/parse_str_basic4.phpt
new file mode 100644
index 0000000..894dbf0
--- /dev/null
+++ b/ext/standard/tests/strings/parse_str_basic4.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Test parse_str() function : test with badly formed strings
+--FILE--
+<?php
+/* Prototype : void parse_str ( string $str [, array &$arr ] )
+ * Description: Parses the string into variables
+ * Source code: ext/standard/string.c
+*/
+
+echo "\nTest string with badly formed strings\n";
+$str = "arr[1=sid&arr[4][2=fred";
+var_dump(parse_str($str, $res));
+var_dump($res);
+
+$str = "arr1]=sid&arr[4]2]=fred";
+var_dump(parse_str($str, $res));
+var_dump($res);
+
+$str = "arr[one=sid&arr[4][two=fred";
+var_dump(parse_str($str, $res));
+var_dump($res);
+
+echo "\nTest string with badly formed % numbers\n";
+$str = "first=%41&second=%a&third=%b";
+var_dump(parse_str($str));
+var_dump($first, $second, $third);
+
+echo "\nTest string with non-binary safe name\n";
+$str = "arr.test[1]=sid&arr test[4][two]=fred";
+var_dump(parse_str($str, $res));
+var_dump($res);
+?>
+===DONE===
+--EXPECTF--
+Test string with badly formed strings
+NULL
+array(2) {
+ ["arr_1"]=>
+ string(3) "sid"
+ ["arr"]=>
+ array(1) {
+ [4]=>
+ string(4) "fred"
+ }
+}
+NULL
+array(2) {
+ ["arr1]"]=>
+ string(3) "sid"
+ ["arr"]=>
+ array(1) {
+ [4]=>
+ string(4) "fred"
+ }
+}
+NULL
+array(2) {
+ ["arr_one"]=>
+ string(3) "sid"
+ ["arr"]=>
+ array(1) {
+ [4]=>
+ string(4) "fred"
+ }
+}
+
+Test string with badly formed % numbers
+NULL
+string(1) "A"
+string(2) "%a"
+string(2) "%b"
+
+Test string with non-binary safe name
+NULL
+array(1) {
+ ["arr_test"]=>
+ array(2) {
+ [1]=>
+ string(3) "sid"
+ [4]=>
+ array(1) {
+ ["two"]=>
+ string(4) "fred"
+ }
+ }
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/parse_str_error1.phpt b/ext/standard/tests/strings/parse_str_error1.phpt
new file mode 100644
index 0000000..a9c902e
--- /dev/null
+++ b/ext/standard/tests/strings/parse_str_error1.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test parse_str() function : non-default arg_separator.input specified
+--INI--
+arg_separator.input = "/"
+--FILE--
+<?php
+/* Prototype : void parse_str ( string $str [, array &$arr ] )
+ * Description: Parses the string into variables
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing parse_str() : error conditions ***\n";
+
+echo "\n-- Testing htmlentities() function with less than expected no. of arguments --\n";
+parse_str();
+echo "\n-- Testing htmlentities() function with more than expected no. of arguments --\n";
+$s1 = "first=val1&second=val2&third=val3";
+parse_str($s1, $res_array, true);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing parse_str() : error conditions ***
+
+-- Testing htmlentities() function with less than expected no. of arguments --
+
+Warning: parse_str() expects at least 1 parameter, 0 given in %s on line %d
+
+-- Testing htmlentities() function with more than expected no. of arguments --
+
+Warning: parse_str() expects at most 2 parameters, 3 given in %s on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt
new file mode 100644
index 0000000..d9c3a2e
--- /dev/null
+++ b/ext/standard/tests/strings/pathinfo.phpt
@@ -0,0 +1,108 @@
+--TEST--
+pathinfo() tests
+--FILE--
+<?php
+
+var_dump(pathinfo());
+var_dump(pathinfo(""));
+var_dump(pathinfo("."));
+var_dump(pathinfo(".."));
+var_dump(pathinfo("/"));
+var_dump(pathinfo("./"));
+var_dump(pathinfo("/."));
+var_dump(pathinfo(".cvsignore"));
+var_dump(pathinfo(__FILE__, PATHINFO_BASENAME));
+var_dump(pathinfo(__FILE__, PATHINFO_FILENAME));
+var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION));
+var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME));
+var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_DIRNAME));
+var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_BASENAME));
+var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_FILENAME));
+var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_BASENAME));
+var_dump(pathinfo(__FILE__, PATHINFO_FILENAME|PATHINFO_DIRNAME));
+var_dump(pathinfo(__FILE__, PATHINFO_FILENAME|PATHINFO_BASENAME));
+var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_EXTENSION));
+var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+array(2) {
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(2) ".."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(1) "."
+}
+array(3) {
+ ["dirname"]=>
+ string(1) "%e"
+ ["basename"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "%e"
+ ["basename"]=>
+ string(1) "."
+ ["extension"]=>
+ string(0) ""
+ ["filename"]=>
+ string(0) ""
+}
+array(4) {
+ ["dirname"]=>
+ string(1) "."
+ ["basename"]=>
+ string(10) ".cvsignore"
+ ["extension"]=>
+ string(9) "cvsignore"
+ ["filename"]=>
+ string(0) ""
+}
+string(12) "pathinfo.php"
+string(8) "pathinfo"
+string(3) "php"
+string(%d) "%s%estrings"
+string(%d) "%s%estrings"
+string(12) "pathinfo.php"
+string(3) "php"
+string(12) "pathinfo.php"
+string(%d) "%s%estrings"
+string(12) "pathinfo.php"
+string(%d) "%s%estrings"
+string(%d) "%s%estrings"
+Done
diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt
new file mode 100644
index 0000000..4f7ef90
--- /dev/null
+++ b/ext/standard/tests/strings/php_strip_whitespace.phpt
@@ -0,0 +1,52 @@
+--TEST--
+php_strip_whitespace() tests
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/php_strip_whitespace.dat";
+
+var_dump(php_strip_whitespace());
+var_dump(php_strip_whitespace($filename));
+
+$data = '/* test comment */';
+file_put_contents($filename, $data);
+var_dump(php_strip_whitespace($filename));
+
+$data = '<?php /* test comment */ ?>';
+file_put_contents($filename, $data);
+var_dump(php_strip_whitespace($filename));
+
+$data = '<?php
+/* test class */
+class test {
+
+ /* function foo () */
+
+ function foo () /* {{{ */
+ {
+
+
+ echo $var; //does not exist
+ }
+ /* }}} */
+
+}
+?>';
+
+file_put_contents($filename, $data);
+var_dump(php_strip_whitespace($filename));
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d
+string(0) ""
+string(18) "/* test comment */"
+string(9) "<?php ?>"
+string(55) "<?php
+ class test { function foo () { echo $var; } } ?>"
+Done
diff --git a/ext/standard/tests/strings/print_basic.phpt b/ext/standard/tests/strings/print_basic.phpt
new file mode 100644
index 0000000..a4bc8c2
--- /dev/null
+++ b/ext/standard/tests/strings/print_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test print() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : int print ( string $arg )
+ * Description: Output a string
+ * Source code: n/a, print is a language construct not an extension function
+ * Test based on php.net manual example.
+*/
+
+echo "*** Testing print() : basic functionality ***\n";
+
+echo "\n-- Iteration 1 --\n";
+print("Hello World");
+
+echo "\n-- Iteration 2 --\n";
+print "print() also works without parentheses.";
+
+echo "\n-- Iteration 3 --\n";
+print "This spans
+multiple lines. The newlines will be
+output as well";
+
+echo "\n-- Iteration 4 --\n";
+print "This also spans\nmultiple lines. The newlines will be\noutput as well.";
+
+echo "\n-- Iteration 5 --\n";
+print "escaping characters is done \"Like this\".";
+
+// You can use variables inside of a print statement
+$foo = "foobar";
+$bar = "barbaz";
+
+echo "\n-- Iteration 6 --\n";
+print "foo is $foo"; // foo is foobar
+
+// You can also use arrays
+$bar = array("value" => "foo");
+
+echo "\n-- Iteration 7 --\n";
+print "this is {$bar['value']} !"; // this is foo !
+
+// Using single quotes will print the variable name, not the value
+echo "\n-- Iteration 8 --\n";
+print 'foo is $foo'; // foo is $foo
+
+// If you are not using any other characters, you can just print variables
+echo "\n-- Iteration 9 --\n";
+print $foo; // foobar
+
+echo "\n-- Iteration 10 --\n";
+$variable = "VARIABLE";
+print <<<END
+This uses the "here document" syntax to output
+multiple lines with $variable interpolation. Note
+that the here document terminator must appear on a
+line with just a semicolon no extra whitespace!\n
+END;
+?>
+===DONE===
+--EXPECT--
+*** Testing print() : basic functionality ***
+
+-- Iteration 1 --
+Hello World
+-- Iteration 2 --
+print() also works without parentheses.
+-- Iteration 3 --
+This spans
+multiple lines. The newlines will be
+output as well
+-- Iteration 4 --
+This also spans
+multiple lines. The newlines will be
+output as well.
+-- Iteration 5 --
+escaping characters is done "Like this".
+-- Iteration 6 --
+foo is foobar
+-- Iteration 7 --
+this is foo !
+-- Iteration 8 --
+foo is $foo
+-- Iteration 9 --
+foobar
+-- Iteration 10 --
+This uses the "here document" syntax to output
+multiple lines with VARIABLE interpolation. Note
+that the here document terminator must appear on a
+line with just a semicolon no extra whitespace!
+===DONE===
diff --git a/ext/standard/tests/strings/print_variation1.phpt b/ext/standard/tests/strings/print_variation1.phpt
new file mode 100644
index 0000000..7c499f1
--- /dev/null
+++ b/ext/standard/tests/strings/print_variation1.phpt
@@ -0,0 +1,156 @@
+--TEST--
+Test print() function : usage variations
+--FILE--
+<?php
+
+/* Prototype : int print ( string $arg )
+ * Description: Output a string
+ * Source code: n/a, print is a language construct not an extension function
+ * Test based on php.net manual example.
+*/
+
+echo "*** Testing print() function: with unexpected inputs for 'arg' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // 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 $inputs array to test print() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ $res = print($input);
+ echo "\n";
+ var_dump($res);
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing print() function: with unexpected inputs for 'arg' argument ***
+-- Iteration 1 --
+0
+int(1)
+-- Iteration 2 --
+1
+int(1)
+-- Iteration 3 --
+-2
+int(1)
+-- Iteration 4 --
+2147483647
+int(1)
+-- Iteration 5 --
+-2147483648
+int(1)
+-- Iteration 6 --
+10.5
+int(1)
+-- Iteration 7 --
+-20.5
+int(1)
+-- Iteration 8 --
+101234567000
+int(1)
+-- Iteration 9 --
+
+Notice: Array to string conversion in %sprint_variation1.php on line %d
+Array
+int(1)
+-- Iteration 10 --
+
+Notice: Array to string conversion in %sprint_variation1.php on line %d
+Array
+int(1)
+-- Iteration 11 --
+
+Notice: Array to string conversion in %sprint_variation1.php on line %d
+Array
+int(1)
+-- Iteration 12 --
+1
+int(1)
+-- Iteration 13 --
+
+int(1)
+-- Iteration 14 --
+1
+int(1)
+-- Iteration 15 --
+
+int(1)
+-- Iteration 16 --
+
+int(1)
+-- Iteration 17 --
+
+int(1)
+-- Iteration 18 --
+sample object
+int(1)
+-- Iteration 19 --
+Resource id #%d
+int(1)
+-- Iteration 20 --
+
+int(1)
+-- Iteration 21 --
+
+int(1)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt
new file mode 100644
index 0000000..d989d6a
--- /dev/null
+++ b/ext/standard/tests/strings/printf.phpt
@@ -0,0 +1,699 @@
+--TEST--
+Test printf() function (32bit)
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_MAX > 2147483647) {
+ die("skip 32bit test only");
+}
+?>
+--FILE--
+<?php
+
+/* Various input arrays for different format types */
+
+$float_variation = array( "%f", "%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07.2f", "%'#7.2f" );
+$float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54, 1.2345678e99, -1.2345678e99 );
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+$char_variation = array( 'a', "a", 67, -67, 99 );
+
+$string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" );
+$strings = array( NULL, "abc", 'aaa' );
+
+/* Checking warning messages */
+
+/* Zero argument */
+echo "\n*** Output for zero argument ***\n";
+printf();
+
+/* Number of arguments not matching as specified in format field */
+echo "\n*** Output for insufficient number of arguments ***\n";
+$string = "dingy%sflem%dwombat";
+$nbr = 5;
+$name = "voudras";
+printf("%d $string %s", $nbr, $name);
+
+
+/* Scalar argument */
+echo "\n*** Output for scalar argument ***\n";
+printf(3);
+
+/* NULL argument */
+echo "\n*** Output for NULL as argument ***\n";
+printf(NULL);
+
+
+/* Float type variations */
+
+$counter = 1;
+echo "\n\n*** Output for float type ***\n";
+echo "\n Input Float numbers variation array is:\n";
+print_r($float_numbers);
+
+foreach( $float_variation as $float_var )
+{
+ echo "\n\nFloat Iteration $counter";
+ foreach( $float_numbers as $float_num )
+ {
+ echo "\n";
+ printf( $float_var, $float_num );
+ }
+ $counter++;
+}
+
+
+/* Integer type variations */
+
+$counter = 1;
+echo "\n\n*** Output for integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_variation as $int_var )
+{
+ echo "\n\nInteger Iteration $counter";
+ foreach( $int_numbers as $int_num )
+ {
+ echo "\n";
+ printf( $int_var, $int_num );
+ }
+ $counter++;
+}
+
+
+/* Binary type variations */
+
+echo "\n\n*** Output for binary type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+ foreach( $int_numbers as $bin_num )
+ {
+ echo "\n";
+ printf( "%b", $bin_num );
+ }
+
+
+/* Chararter type variations */
+echo "\n\n*** Output for char type ***\n";
+echo "\n Input Characters variation array is:\n";
+print_r($char_variation);
+
+foreach( $char_variation as $char )
+{
+ echo "\n";
+ printf( "%c", $char );
+}
+
+/* Scientific type variations */
+echo "\n\n*** Output for scientific type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $num )
+{
+ echo "\n";
+ printf( "%e", $num );
+}
+
+/* Unsigned Integer type variation */
+echo "\n\n*** Output for unsigned integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $unsig_num )
+{
+ echo "\n";
+ printf( "%u", $unsig_num );
+}
+
+/* Octal type variations */
+echo "\n\n*** Output for octal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $octal_num )
+{
+ echo "\n";
+ printf( "%o", $octal_num );
+}
+
+/* Hexadecimal type variations */
+echo "\n\n*** Output for hexadecimal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $hexa_num )
+{
+ echo "\n";
+ printf( "%x", $hexa_num );
+}
+
+/* String type variations */
+echo "\n\n*** Output for string type ***\n";
+echo "\n Input Strings format variation array is:\n";
+print_r($string_variation);
+echo "\n Input strings variation array is:\n";
+print_r($strings);
+
+foreach( $string_variation as $string_var )
+{
+ foreach( $strings as $str )
+ {
+ echo "\n";
+ printf( $string_var, $str );
+ }
+}
+
+
+/* variations of %g type */
+$format_g = array("%g", "%.0g", "%+g", "%-g", "%-1.2g", "%+1.2g", "%G", "%.0G", "%+G", "%-G", "%-1.2G", "%+1.2G");
+
+echo "\n\n*** Output for '%g' type ***\n";
+echo "\n Input format variation array is:\n";
+print_r($format_g);
+
+foreach( $format_g as $formatg )
+{
+ printf("\n$formatg",123456);
+ printf("\n$formatg",-123456);
+}
+
+
+/* Some more typical cases */
+
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n\n*** Output for '%%%.2f' as the format parameter ***\n";
+printf("%%%.2f",1.23456789e10);
+
+echo"\n\n*** Output for '%%' as the format parameter ***\n";
+printf("%%",1.23456789e10);
+
+echo"\n\n*** Output for precision value more than maximum ***\n";
+printf("%.988f",1.23456789e10);
+
+echo"\n\n*** Output for invalid width(-15) specifier ***\n";
+printf("%030.-15s", $tempstring);
+
+echo"\n\n*** Output for '%F' as the format parameter ***\n";
+printf("%F",1.23456789e10);
+
+echo"\n\n*** Output for '%X' as the format parameter ***\n";
+printf("%X",12);
+
+echo"\n\n*** Output with no format parameter ***\n";
+printf($tempnum);
+
+echo"\n\n*** Output for multiple format parameters ***\n";
+printf("%d %s %d\n", $tempnum, $tempstring, $tempnum);
+
+echo"\n\n*** Output for excess of mixed type arguments ***\n";
+printf("%s", $tempstring, $tempstring, $tempstring);
+
+echo"\n\n*** Output for string format parameter and integer type argument ***\n";
+printf("%s", $tempnum);
+
+echo"\n\n*** Output for integer format parameter and string type argument ***\n";
+printf("%d", $tempstring);
+
+
+?>
+--EXPECTF--
+*** Output for zero argument ***
+
+Warning: printf() expects at least %d parameter, %d given in %s on line %d
+
+*** Output for insufficient number of arguments ***
+
+Warning: printf(): Too few arguments in %s on line %d
+
+*** Output for scalar argument ***
+3
+*** Output for NULL as argument ***
+
+
+*** Output for float type ***
+
+ Input Float numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 0.32
+ [4] => -0.32
+ [5] => 3.4-3.4
+ [6] => 2.54
+ [7] => -2.54
+ [8] => 1.2345678E+99
+ [9] => -1.2345678E+99
+)
+
+
+Float Iteration 1
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567%d.000000
+-1234567%d.000000
+
+Float Iteration 2
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567%d.000000
+-1234567%d.000000
+
+Float Iteration 3
++0.000000
++1.000000
+-1.000000
++0.320000
+-0.320000
++3.400000
++2.540000
+-2.540000
++1234567%d.000000
+-1234567%d.000000
+
+Float Iteration 4
+ 0.00
+ 1.00
+ -1.00
+ 0.32
+ -0.32
+ 3.40
+ 2.54
+ -2.54
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 5
+0.00
+1.00
+-1.00
+0.32
+-0.32
+3.40
+2.54
+-2.54
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 6
+0000.00
+0001.00
+-001.00
+0000.32
+-000.32
+0003.40
+0002.54
+-002.54
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 7
+0.00000
+1.00000
+-1.0000
+0.32000
+-0.3200
+3.40000
+2.54000
+-2.5400
+1234567%d.00
+-1234567%d.00
+
+Float Iteration 8
+###0.00
+###1.00
+##-1.00
+###0.32
+##-0.32
+###3.40
+###2.54
+##-2.54
+1234567%d.00
+-1234567%d.00
+
+*** Output for integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+
+Integer Iteration 1
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 2
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 3
++0
++1
+-1
++2
+-2
++23333333
+-23333333
++1234
+
+Integer Iteration 4
+ 0
+ 1
+ -1
+ 2
+ -2
+23333333
+-23333333
+ 1234
+
+Integer Iteration 5
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 6
+0000000
+0000001
+-000001
+0000002
+-000002
+23333333
+-23333333
+0001234
+
+Integer Iteration 7
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 8
+######0
+######1
+#####-1
+######2
+#####-2
+23333333
+-23333333
+###1234
+
+*** Output for binary type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+11111111111111111111111111111111
+10
+11111111111111111111111111111110
+1011001000000100111010101
+11111110100110111111011000101011
+10011010010
+
+*** Output for char type ***
+
+ Input Characters variation array is:
+Array
+(
+ [0] => a
+ [1] => a
+ [2] => 67
+ [3] => -67
+ [4] => 99
+)
+
+
+
+C
+c
+
+*** Output for scientific type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0.000000e+0
+1.000000e+0
+-1.000000e+0
+2.700000e+0
+-2.700000e+0
+2.333333e+7
+-2.333333e+7
+1.234000e+3
+
+*** Output for unsigned integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+4294967295
+2
+4294967294
+23333333
+4271633963
+1234
+
+*** Output for octal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+37777777777
+2
+37777777776
+131004725
+37646773053
+2322
+
+*** Output for hexadecimal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+ffffffff
+2
+fffffffe
+16409d5
+fe9bf62b
+4d2
+
+*** Output for string type ***
+
+ Input Strings format variation array is:
+Array
+(
+ [0] => %5s
+ [1] => %-5s
+ [2] => %05s
+ [3] => %'#5s
+)
+
+ Input strings variation array is:
+Array
+(
+ [0] =>
+ [1] => abc
+ [2] => aaa
+)
+
+
+ abc
+ aaa
+
+abc
+aaa
+00000
+00abc
+00aaa
+#####
+##abc
+##aaa
+
+*** Output for '%g' type ***
+
+ Input format variation array is:
+Array
+(
+ [0] => %g
+ [1] => %.0g
+ [2] => %+g
+ [3] => %-g
+ [4] => %-1.2g
+ [5] => %+1.2g
+ [6] => %G
+ [7] => %.0G
+ [8] => %+G
+ [9] => %-G
+ [10] => %-1.2G
+ [11] => %+1.2G
+)
+
+123456
+-123456
+1.0e+5
+-1.0e+5
++123456
+-123456
+123456
+-123456
+1.2e+5
+-1.2e+5
++1.2e+5
+-1.2e+5
+123456
+-123456
+1.0E+5
+-1.0E+5
++123456
+-123456
+123456
+-123456
+1.2E+5
+-1.2E+5
++1.2E+5
+-1.2E+5
+
+*** Output for '%%%.2f' as the format parameter ***
+%12345678900.00
+
+*** Output for '%%' as the format parameter ***
+%
+
+*** Output for precision value more than maximum ***
+
+Notice: printf(): Requested precision of 988 digits was truncated to PHP maximum of 53 digits in %s on line %d
+12345678900.00000000000000000000000000000000000000000000000000000
+
+*** Output for invalid width(-15) specifier ***
+15s
+
+*** Output for '%F' as the format parameter ***
+12345678900.000000
+
+*** Output for '%X' as the format parameter ***
+C
+
+*** Output with no format parameter ***
+12345
+
+*** Output for multiple format parameters ***
+12345 abcdefghjklmnpqrstuvwxyz 12345
+
+
+*** Output for excess of mixed type arguments ***
+abcdefghjklmnpqrstuvwxyz
+
+*** Output for string format parameter and integer type argument ***
+12345
+
+*** Output for integer format parameter and string type argument ***
+0
diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt
new file mode 100644
index 0000000..d0b7aaf
--- /dev/null
+++ b/ext/standard/tests/strings/printf_64bit.phpt
@@ -0,0 +1,699 @@
+--TEST--
+Test printf() function (64bit)
+--SKIPIF--
+<?php
+if (!(PHP_INT_MAX > 2147483647)) {
+ die("skip 64bit test only");
+}
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+/* Various input arrays for different format types */
+
+$float_variation = array( "%f", "%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07.2f", "%'#7.2f" );
+$float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54, 1.2345678e99, -1.2345678e99 );
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+$char_variation = array( 'a', "a", 67, -67, 99 );
+
+$string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" );
+$strings = array( NULL, "abc", 'aaa' );
+
+/* Checking warning messages */
+
+/* Zero argument */
+echo "\n*** Output for zero argument ***\n";
+printf();
+
+/* Number of arguments not matching as specified in format field */
+echo "\n*** Output for insufficient number of arguments ***\n";
+$string = "dingy%sflem%dwombat";
+$nbr = 5;
+$name = "voudras";
+printf("%d $string %s", $nbr, $name);
+
+
+/* Scalar argument */
+echo "\n*** Output for scalar argument ***\n";
+printf(3);
+
+/* NULL argument */
+echo "\n*** Output for NULL as argument ***\n";
+printf(NULL);
+
+
+/* Float type variations */
+
+$counter = 1;
+echo "\n\n*** Output for float type ***\n";
+echo "\n Input Float numbers variation array is:\n";
+print_r($float_numbers);
+
+foreach( $float_variation as $float_var )
+{
+ echo "\n\nFloat Iteration $counter";
+ foreach( $float_numbers as $float_num )
+ {
+ echo "\n";
+ printf( $float_var, $float_num );
+ }
+ $counter++;
+}
+
+
+/* Integer type variations */
+
+$counter = 1;
+echo "\n\n*** Output for integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_variation as $int_var )
+{
+ echo "\n\nInteger Iteration $counter";
+ foreach( $int_numbers as $int_num )
+ {
+ echo "\n";
+ printf( $int_var, $int_num );
+ }
+ $counter++;
+}
+
+
+/* Binary type variations */
+
+echo "\n\n*** Output for binary type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+ foreach( $int_numbers as $bin_num )
+ {
+ echo "\n";
+ printf( "%b", $bin_num );
+ }
+
+
+/* Chararter type variations */
+echo "\n\n*** Output for char type ***\n";
+echo "\n Input Characters variation array is:\n";
+print_r($char_variation);
+
+foreach( $char_variation as $char )
+{
+ echo "\n";
+ printf( "%c", $char );
+}
+
+/* Scientific type variations */
+echo "\n\n*** Output for scientific type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $num )
+{
+ echo "\n";
+ printf( "%e", $num );
+}
+
+/* Unsigned Integer type variation */
+echo "\n\n*** Output for unsigned integer type ***\n";
+echo "\n Input Integer numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $unsig_num )
+{
+ echo "\n";
+ printf( "%u", $unsig_num );
+}
+
+/* Octal type variations */
+echo "\n\n*** Output for octal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $octal_num )
+{
+ echo "\n";
+ printf( "%o", $octal_num );
+}
+
+/* Hexadecimal type variations */
+echo "\n\n*** Output for hexadecimal type ***\n";
+echo "\n Input numbers variation array is:\n";
+print_r($int_numbers);
+
+foreach( $int_numbers as $hexa_num )
+{
+ echo "\n";
+ printf( "%x", $hexa_num );
+}
+
+/* String type variations */
+echo "\n\n*** Output for string type ***\n";
+echo "\n Input Strings format variation array is:\n";
+print_r($string_variation);
+echo "\n Input strings variation array is:\n";
+print_r($strings);
+
+foreach( $string_variation as $string_var )
+{
+ foreach( $strings as $str )
+ {
+ echo "\n";
+ printf( $string_var, $str );
+ }
+}
+
+
+/* variations of %g type */
+$format_g = array("%g", "%.0g", "%+g", "%-g", "%-1.2g", "%+1.2g", "%G", "%.0G", "%+G", "%-G", "%-1.2G", "%+1.2G");
+
+echo "\n\n*** Output for '%g' type ***\n";
+echo "\n Input format variation array is:\n";
+print_r($format_g);
+
+foreach( $format_g as $formatg )
+{
+ printf("\n$formatg",123456);
+ printf("\n$formatg",-123456);
+}
+
+
+/* Some more typical cases */
+
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n\n*** Output for '%%%.2f' as the format parameter ***\n";
+printf("%%%.2f",1.23456789e10);
+
+echo"\n\n*** Output for '%%' as the format parameter ***\n";
+printf("%%",1.23456789e10);
+
+echo"\n\n*** Output for precision value more than maximum ***\n";
+printf("%.988f",1.23456789e10);
+
+echo"\n\n*** Output for invalid width(-15) specifier ***\n";
+printf("%030.-15s", $tempstring);
+
+echo"\n\n*** Output for '%F' as the format parameter ***\n";
+printf("%F",1.23456789e10);
+
+echo"\n\n*** Output for '%X' as the format parameter ***\n";
+printf("%X",12);
+
+echo"\n\n*** Output with no format parameter ***\n";
+printf($tempnum);
+
+echo"\n\n*** Output for multiple format parameters ***\n";
+printf("%d %s %d\n", $tempnum, $tempstring, $tempnum);
+
+echo"\n\n*** Output for excess of mixed type arguments ***\n";
+printf("%s", $tempstring, $tempstring, $tempstring);
+
+echo"\n\n*** Output for string format parameter and integer type argument ***\n";
+printf("%s", $tempnum);
+
+echo"\n\n*** Output for integer format parameter and string type argument ***\n";
+printf("%d", $tempstring);
+
+
+?>
+--EXPECTF--
+*** Output for zero argument ***
+
+Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
+
+*** Output for insufficient number of arguments ***
+
+Warning: printf(): Too few arguments in %s on line %d
+
+*** Output for scalar argument ***
+3
+*** Output for NULL as argument ***
+
+
+*** Output for float type ***
+
+ Input Float numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 0.32
+ [4] => -0.32
+ [5] => 3.4-3.4
+ [6] => 2.54
+ [7] => -2.54
+ [8] => 1.2345678E+99
+ [9] => -1.2345678E+99
+)
+
+
+Float Iteration 1
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+
+Float Iteration 2
+0.000000
+1.000000
+-1.000000
+0.320000
+-0.320000
+3.400000
+2.540000
+-2.540000
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+
+Float Iteration 3
++0.000000
++1.000000
+-1.000000
++0.320000
+-0.320000
++3.400000
++2.540000
+-2.540000
++1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000
+
+Float Iteration 4
+ 0.00
+ 1.00
+ -1.00
+ 0.32
+ -0.32
+ 3.40
+ 2.54
+ -2.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 5
+0.00
+1.00
+-1.00
+0.32
+-0.32
+3.40
+2.54
+-2.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 6
+0000.00
+0001.00
+-001.00
+0000.32
+-000.32
+0003.40
+0002.54
+-002.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 7
+0.00000
+1.00000
+-1.0000
+0.32000
+-0.3200
+3.40000
+2.54000
+-2.5400
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+Float Iteration 8
+###0.00
+###1.00
+##-1.00
+###0.32
+##-0.32
+###3.40
+###2.54
+##-2.54
+1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00
+
+*** Output for integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+
+Integer Iteration 1
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 2
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 3
++0
++1
+-1
++2
+-2
++23333333
+-23333333
++1234
+
+Integer Iteration 4
+ 0
+ 1
+ -1
+ 2
+ -2
+23333333
+-23333333
+ 1234
+
+Integer Iteration 5
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 6
+0000000
+0000001
+-000001
+0000002
+-000002
+23333333
+-23333333
+0001234
+
+Integer Iteration 7
+0
+1
+-1
+2
+-2
+23333333
+-23333333
+1234
+
+Integer Iteration 8
+######0
+######1
+#####-1
+######2
+#####-2
+23333333
+-23333333
+###1234
+
+*** Output for binary type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+1111111111111111111111111111111111111111111111111111111111111111
+10
+1111111111111111111111111111111111111111111111111111111111111110
+1011001000000100111010101
+1111111111111111111111111111111111111110100110111111011000101011
+10011010010
+
+*** Output for char type ***
+
+ Input Characters variation array is:
+Array
+(
+ [0] => a
+ [1] => a
+ [2] => 67
+ [3] => -67
+ [4] => 99
+)
+
+
+
+C
+c
+
+*** Output for scientific type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0.000000e+0
+1.000000e+0
+-1.000000e+0
+2.700000e+0
+-2.700000e+0
+2.333333e+7
+-2.333333e+7
+1.234000e+3
+
+*** Output for unsigned integer type ***
+
+ Input Integer numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+18446744073709551615
+2
+18446744073709551614
+23333333
+18446744073686218283
+1234
+
+*** Output for octal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+1777777777777777777777
+2
+1777777777777777777776
+131004725
+1777777777777646773053
+2322
+
+*** Output for hexadecimal type ***
+
+ Input numbers variation array is:
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => -1
+ [3] => 2.7
+ [4] => -2.7
+ [5] => 23333333
+ [6] => -23333333
+ [7] => 1234
+)
+
+0
+1
+ffffffffffffffff
+2
+fffffffffffffffe
+16409d5
+fffffffffe9bf62b
+4d2
+
+*** Output for string type ***
+
+ Input Strings format variation array is:
+Array
+(
+ [0] => %5s
+ [1] => %-5s
+ [2] => %05s
+ [3] => %'#5s
+)
+
+ Input strings variation array is:
+Array
+(
+ [0] =>
+ [1] => abc
+ [2] => aaa
+)
+
+
+ abc
+ aaa
+
+abc
+aaa
+00000
+00abc
+00aaa
+#####
+##abc
+##aaa
+
+*** Output for '%g' type ***
+
+ Input format variation array is:
+Array
+(
+ [0] => %g
+ [1] => %.0g
+ [2] => %+g
+ [3] => %-g
+ [4] => %-1.2g
+ [5] => %+1.2g
+ [6] => %G
+ [7] => %.0G
+ [8] => %+G
+ [9] => %-G
+ [10] => %-1.2G
+ [11] => %+1.2G
+)
+
+123456
+-123456
+1.0e+5
+-1.0e+5
++123456
+-123456
+123456
+-123456
+1.2e+5
+-1.2e+5
++1.2e+5
+-1.2e+5
+123456
+-123456
+1.0E+5
+-1.0E+5
++123456
+-123456
+123456
+-123456
+1.2E+5
+-1.2E+5
++1.2E+5
+-1.2E+5
+
+*** Output for '%%%.2f' as the format parameter ***
+%12345678900.00
+
+*** Output for '%%' as the format parameter ***
+%
+
+*** Output for precision value more than maximum ***
+
+Notice: printf(): Requested precision of 988 digits was truncated to PHP maximum of %d digits in %s on line %d
+12345678900.0000000000%d
+
+*** Output for invalid width(-15) specifier ***
+15s
+
+*** Output for '%F' as the format parameter ***
+12345678900.000000
+
+*** Output for '%X' as the format parameter ***
+C
+
+*** Output with no format parameter ***
+12345
+
+*** Output for multiple format parameters ***
+12345 abcdefghjklmnpqrstuvwxyz 12345
+
+
+*** Output for excess of mixed type arguments ***
+abcdefghjklmnpqrstuvwxyz
+
+*** Output for string format parameter and integer type argument ***
+12345
+
+*** Output for integer format parameter and string type argument ***
+0
diff --git a/ext/standard/tests/strings/printf_basic1.phpt b/ext/standard/tests/strings/printf_basic1.phpt
new file mode 100644
index 0000000..e6fd1d9
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic1.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test printf() function : basic functionality - string format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = "arg1 argument";
+$arg2 = "arg2 argument";
+$arg3 = "arg3 argument";
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments --\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments --\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+
+echo "\n-- Calling printf() with string three arguments --\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using string format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments --
+arg1 argument
+int(13)
+
+-- Calling printf() with two arguments --
+arg1 argument arg2 argument
+int(27)
+
+-- Calling printf() with string three arguments --
+arg1 argument arg2 argument arg3 argument
+int(41)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_basic2.phpt b/ext/standard/tests/strings/printf_basic2.phpt
new file mode 100644
index 0000000..195f7cb
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic2.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test printf() function : basic functionality - integer format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using integer format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = 111;
+$arg2 = 222;
+$arg3 = 333;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments--\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments--\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments--\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using integer format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments--
+111
+int(3)
+
+-- Calling printf() with two arguments--
+111 222
+int(7)
+
+-- Calling printf() with three arguments--
+111 222 333
+int(11)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_basic3.phpt b/ext/standard/tests/strings/printf_basic3.phpt
new file mode 100644
index 0000000..1e51d41
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic3.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test printf() function : basic functionality - float format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using float format ***\n";
+
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = 11.11;
+$arg2 = 22.22;
+$arg3 = 33.33;
+
+echo "\n-- Calling printf() with no arguments--\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments--\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+$result = printf($format11, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments--\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+$result = printf($format22, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments--\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+$result = printf($format33, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using float format ***
+
+-- Calling printf() with no arguments--
+format
+int(6)
+
+-- Calling printf() with one arguments--
+11.110000
+int(9)
+11.110000
+int(9)
+
+-- Calling printf() with two arguments--
+11.110000 22.220000
+int(19)
+11.110000 22.220000
+int(19)
+
+-- Calling printf() with three arguments--
+11.110000 22.220000 33.330000
+int(29)
+11.110000 22.220000 33.330000
+int(29)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/printf_basic4.phpt b/ext/standard/tests/strings/printf_basic4.phpt
new file mode 100644
index 0000000..9de0497
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic4.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test printf() function : basic functionality - bool format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using bool format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = TRUE;
+$arg2 = FALSE;
+$arg3 = true;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments--\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments--\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments--\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using bool format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments--
+1
+int(1)
+
+-- Calling printf() with two arguments--
+1 0
+int(3)
+
+-- Calling printf() with three arguments--
+1 0 1
+int(5)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_basic5.phpt b/ext/standard/tests/strings/printf_basic5.phpt
new file mode 100644
index 0000000..57b17d4
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic5.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test printf() function : basic functionality - char format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using char format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = 65;
+$arg2 = 66;
+$arg3 = 67;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments --\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments --\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments --\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using char format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments --
+A
+int(1)
+
+-- Calling printf() with two arguments --
+A B
+int(3)
+
+-- Calling printf() with three arguments --
+A B C
+int(5)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/printf_basic6.phpt b/ext/standard/tests/strings/printf_basic6.phpt
new file mode 100644
index 0000000..95b9d4a
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic6.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test printf() function : basic functionality - exponential format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%E %e";
+$format3 = "%e %E %e";
+$arg1 = 1000;
+$arg2 = 2e3;
+$arg3 = +3e3;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one argument --\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments --\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments --\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using exponential format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one argument --
+1.000000e+3
+int(11)
+
+-- Calling printf() with two arguments --
+1.000000E+3 2.000000e+3
+int(23)
+
+-- Calling printf() with three arguments --
+1.000000e+3 2.000000E+3 3.000000e+3
+int(35)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_basic7.phpt b/ext/standard/tests/strings/printf_basic7.phpt
new file mode 100644
index 0000000..a43fcf2
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic7.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test printf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using unsigned format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = -1111;
+$arg2 = -1234567;
+$arg3 = +2345432;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments --\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments --\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments --\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using unsigned format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments --
+4294966185
+int(10)
+
+-- Calling printf() with two arguments --
+4294966185 4293732729
+int(21)
+
+-- Calling printf() with three arguments --
+4294966185 4293732729 2345432
+int(29)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_basic8.phpt b/ext/standard/tests/strings/printf_basic8.phpt
new file mode 100644
index 0000000..0e028ea
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic8.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test printf() function : basic functionality - octal format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = 021;
+$arg2 = -0347;
+$arg3 = 05678;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments --\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments --\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments --\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using octal format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments --
+21
+int(2)
+
+-- Calling printf() with two arguments --
+21 37777777431
+int(14)
+
+-- Calling printf() with three arguments --
+21 37777777431 567
+int(18)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_basic9.phpt b/ext/standard/tests/strings/printf_basic9.phpt
new file mode 100644
index 0000000..9b441b2
--- /dev/null
+++ b/ext/standard/tests/strings/printf_basic9.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test printf() function : basic functionality - hexadecimal format
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialise all required variables
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = 11;
+$arg2 = 132;
+$arg3 = 177;
+
+echo "\n-- Calling printf() with no arguments --\n";
+$result = printf($format);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with one arguments --\n";
+$result = printf($format1, $arg1);
+echo "\n";
+var_dump($result);
+$result = printf($format11, $arg1);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with two arguments --\n";
+$result = printf($format2, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+$result = printf($format22, $arg1, $arg2);
+echo "\n";
+var_dump($result);
+
+echo "\n-- Calling printf() with three arguments --\n";
+$result = printf($format3, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+$result = printf($format33, $arg1, $arg2, $arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : basic functionality - using hexadecimal format ***
+
+-- Calling printf() with no arguments --
+format
+int(6)
+
+-- Calling printf() with one arguments --
+b
+int(1)
+B
+int(1)
+
+-- Calling printf() with two arguments --
+b 84
+int(4)
+B 84
+int(4)
+
+-- Calling printf() with three arguments --
+b 84 b1
+int(7)
+B 84 B1
+int(7)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt
new file mode 100644
index 0000000..6645613
--- /dev/null
+++ b/ext/standard/tests/strings/printf_error.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test printf() function : error conditions
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing printf() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing printf() function with Zero arguments --\n";
+var_dump( printf() );
+
+echo "\n-- Testing printf() function with less than expected no. of arguments --\n";
+$format1 = '%s';
+$format2 = '%s%s';
+$format3 = '%s%s%s';
+$arg1 = 'one';
+$arg2 = 'two';
+
+echo "\n-- Call printf with one argument less than expected --\n";
+var_dump( printf($format1) );
+var_dump( printf($format2,$arg1) );
+var_dump( printf($format3,$arg1,$arg2) );
+
+echo "\n-- Call printf with two argument less than expected --\n";
+var_dump( printf($format2) );
+var_dump( printf($format3,$arg1) );
+
+echo "\n-- Call printf with three argument less than expected --\n";
+var_dump( printf($format3) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : error conditions ***
+
+-- Testing printf() function with Zero arguments --
+
+Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing printf() function with less than expected no. of arguments --
+
+-- Call printf with one argument less than expected --
+
+Warning: printf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: printf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: printf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Call printf with two argument less than expected --
+
+Warning: printf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: printf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Call printf with three argument less than expected --
+
+Warning: printf(): Too few arguments in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/printf_variation1.phpt b/ext/standard/tests/strings/printf_variation1.phpt
new file mode 100644
index 0000000..e71e564
--- /dev/null
+++ b/ext/standard/tests/strings/printf_variation1.phpt
@@ -0,0 +1,354 @@
+--TEST--
+Test printf() function : usage variations - unexpected values for format argument
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+/*
+* Testing printf() : with different unexpected values for format argument other than the strings
+*/
+
+echo "*** Testing printf() : with unexpected values for format argument ***\n";
+
+// initialing required variables
+$arg1 = "second arg";
+$arg2 = "third arg";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // 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
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with default argument
+ $result = printf($value);
+ echo "\n";
+ var_dump($result);
+
+ // with two arguments
+ $result = printf($value, $arg1);
+ echo "\n";
+ var_dump($result);
+
+ // with three arguments
+ $result = printf($value, $arg1, $arg2);
+ echo "\n";
+ var_dump($result);
+
+ $count++;
+};
+
+// close the resource
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : with unexpected values for format argument ***
+
+-- Iteration 1 --
+0
+int(1)
+0
+int(1)
+0
+int(1)
+
+-- Iteration 2 --
+1
+int(1)
+1
+int(1)
+1
+int(1)
+
+-- Iteration 3 --
+12345
+int(5)
+12345
+int(5)
+12345
+int(5)
+
+-- Iteration 4 --
+-2345
+int(5)
+-2345
+int(5)
+-2345
+int(5)
+
+-- Iteration 5 --
+10.5
+int(4)
+10.5
+int(4)
+10.5
+int(4)
+
+-- Iteration 6 --
+-10.5
+int(5)
+-10.5
+int(5)
+-10.5
+int(5)
+
+-- Iteration 7 --
+101234567000
+int(12)
+101234567000
+int(12)
+101234567000
+int(12)
+
+-- Iteration 8 --
+1.07654321E-9
+int(13)
+1.07654321E-9
+int(13)
+1.07654321E-9
+int(13)
+
+-- Iteration 9 --
+0.5
+int(3)
+0.5
+int(3)
+0.5
+int(3)
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+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)
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+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)
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+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)
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+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)
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+Notice: Array to string conversion in %s on line %d
+Array
+int(5)
+
+-- Iteration 15 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 16 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 17 --
+1
+int(1)
+1
+int(1)
+1
+int(1)
+
+-- Iteration 18 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 19 --
+1
+int(1)
+1
+int(1)
+1
+int(1)
+
+-- Iteration 20 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 21 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 22 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 23 --
+Object
+int(6)
+Object
+int(6)
+Object
+int(6)
+
+-- Iteration 24 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 25 --
+
+int(0)
+
+int(0)
+
+int(0)
+
+-- Iteration 26 --
+Resource id #%d
+int(%d)
+Resource id #%d
+int(%d)
+Resource id #%d
+int(%d)
+===DONE===
diff --git a/ext/standard/tests/strings/printf_variation2.phpt b/ext/standard/tests/strings/printf_variation2.phpt
new file mode 100644
index 0000000..be66ad8
--- /dev/null
+++ b/ext/standard/tests/strings/printf_variation2.phpt
@@ -0,0 +1,281 @@
+--TEST--
+Test printf() function : usage variations - with all types of values for arg1 argument
+--FILE--
+<?php
+/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
+ * Description: Produces output according to format .
+ * Source code: ext/standard/formatted_print.c
+ */
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+echo "*** Testing printf() : with different types of values passed for arg1 argument ***\n";
+
+// initialing required variables
+$format = '%s';
+$arg2 = 'third argument';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+
+ // object data
+/*25*/ new sample(),
+
+ // undefined data
+/*26*/ @$undefined_var,
+
+ // unset data
+/*27*/ @$unset_var,
+
+ // resource data
+/*28*/ $file_handle
+);
+
+// loop through each element of the array for arg1
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with two arguments
+ $result = printf($format, $value);
+ echo "\n";
+ var_dump($result);
+
+ // with three arguments
+ $result = printf($format, $value, $arg2);
+ echo "\n";
+ var_dump($result);
+
+ $count++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing printf() : with different types of values passed for arg1 argument ***
+
+-- Iteration 1 --
+0
+int(1)
+0
+int(1)
+
+-- Iteration 2 --
+1
+int(1)
+1
+int(1)
+
+-- Iteration 3 --
+12345
+int(5)
+12345
+int(5)
+
+-- Iteration 4 --
+-2345
+int(5)
+-2345
+int(5)
+
+-- Iteration 5 --
+10.5
+int(4)
+10.5
+int(4)
+
+-- Iteration 6 --
+-10.5
+int(5)
+-10.5
+int(5)
+
+-- Iteration 7 --
+101234567000
+int(12)
+101234567000
+int(12)
+
+-- Iteration 8 --
+1.07654321E-9
+int(13)
+1.07654321E-9
+int(13)
+
+-- Iteration 9 --
+0.5
+int(3)
+0.5
+int(3)
+
+-- Iteration 10 --
+Array
+int(5)
+Array
+int(5)
+
+-- Iteration 11 --
+Array
+int(5)
+Array
+int(5)
+
+-- Iteration 12 --
+Array
+int(5)
+Array
+int(5)
+
+-- Iteration 13 --
+Array
+int(5)
+Array
+int(5)
+
+-- Iteration 14 --
+Array
+int(5)
+Array
+int(5)
+
+-- Iteration 15 --
+
+int(0)
+
+int(0)
+
+-- Iteration 16 --
+
+int(0)
+
+int(0)
+
+-- Iteration 17 --
+1
+int(1)
+1
+int(1)
+
+-- Iteration 18 --
+
+int(0)
+
+int(0)
+
+-- Iteration 19 --
+1
+int(1)
+1
+int(1)
+
+-- Iteration 20 --
+
+int(0)
+
+int(0)
+
+-- Iteration 21 --
+
+int(0)
+
+int(0)
+
+-- Iteration 22 --
+
+int(0)
+
+int(0)
+
+-- Iteration 23 --
+string
+int(6)
+string
+int(6)
+
+-- Iteration 24 --
+string
+int(6)
+string
+int(6)
+
+-- Iteration 25 --
+Object
+int(6)
+Object
+int(6)
+
+-- Iteration 26 --
+
+int(0)
+
+int(0)
+
+-- Iteration 27 --
+
+int(0)
+
+int(0)
+
+-- Iteration 28 --
+Resource id #%d
+int(%d)
+Resource id #%d
+int(%d)
+===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_decode_basic.phpt b/ext/standard/tests/strings/quoted_printable_decode_basic.phpt
new file mode 100644
index 0000000..5b15388
--- /dev/null
+++ b/ext/standard/tests/strings/quoted_printable_decode_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test quoted_printable_decode() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string quoted_printable_decode ( string $str )
+ * Description: Convert a quoted-printable string to an 8 bit string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing quoted_printable_decode() : basic functionality ***\n";
+
+$str = "=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=cf=D2=C7=CF=D7=D9=C5=
+=20=
+=D0=
+=D2=CF=C5=CB=D4=D9";
+
+var_dump(bin2hex(quoted_printable_decode($str)));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing quoted_printable_decode() : basic functionality ***
+string(76) "fa776f772d666163746f72c1d0d5ddc5ceced9c50a20d4cfd2c7cfd7d9c520d0d2cfc5cbd4d9"
+===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_decode_error.phpt b/ext/standard/tests/strings/quoted_printable_decode_error.phpt
new file mode 100644
index 0000000..5018837
--- /dev/null
+++ b/ext/standard/tests/strings/quoted_printable_decode_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test quoted_printable_decode() function : error conditions
+--FILE--
+<?php
+/* Prototype : string quoted_printable_decode ( string $str )
+ * Description: Convert a quoted-printable string to an 8 bit string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing quoted_printable_decode() : error conditions ***\n";
+
+echo "\n-- Testing quoted_printable_decode() function with no arguments --\n";
+var_dump( quoted_printable_decode() );
+
+echo "\n-- Testing quoted_printable_decode() function with more than expected no. of arguments --\n";
+$str = b"=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=cf=D2=C7=CF=D7=D9=C5=
+=20=
+=D0=
+=D2=CF=C5=CB=D4=D9";
+$extra_arg = 10;
+var_dump( quoted_printable_decode($str, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing quoted_printable_decode() : error conditions ***
+
+-- Testing quoted_printable_decode() function with no arguments --
+
+Warning: quoted_printable_decode() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing quoted_printable_decode() function with more than expected no. of arguments --
+
+Warning: quoted_printable_decode() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt b/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt
new file mode 100644
index 0000000..ce35cea
--- /dev/null
+++ b/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test quoted_printable_decode() function : usage variations - unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string quoted_printable_decode ( string $str )
+ * Description: Convert a quoted-printable string to an 8 bit string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+* Testing quoted_printable_decode() : with different unexpected values for format argument other than the strings
+*/
+
+echo "*** Testing quoted_printable_decode() : with unexpected values for 'str' argument ***\n";
+
+// initialing required variables
+$arg1 = "second arg";
+$arg2 = "third arg";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // 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 'str'
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump(bin2hex(quoted_printable_decode($value)));
+ $count++;
+};
+
+// close the resource
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing quoted_printable_decode() : with unexpected values for 'str' argument ***
+
+-- Iteration 1 --
+string(2) "30"
+
+-- Iteration 2 --
+string(2) "31"
+
+-- Iteration 3 --
+string(10) "3132333435"
+
+-- Iteration 4 --
+string(10) "2d32333435"
+
+-- Iteration 5 --
+string(8) "31302e35"
+
+-- Iteration 6 --
+string(10) "2d31302e35"
+
+-- Iteration 7 --
+string(24) "313031323334353637303030"
+
+-- Iteration 8 --
+string(26) "312e3037363534333231452d39"
+
+-- Iteration 9 --
+string(6) "302e35"
+
+-- Iteration 10 --
+
+Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+
+-- Iteration 11 --
+
+Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+
+-- Iteration 12 --
+
+Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+
+-- Iteration 13 --
+
+Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+
+-- Iteration 14 --
+
+Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d
+string(0) ""
+
+-- Iteration 15 --
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(2) "31"
+
+-- Iteration 18 --
+string(0) ""
+
+-- Iteration 19 --
+string(2) "31"
+
+-- Iteration 20 --
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+
+-- Iteration 23 --
+string(12) "4f626a656374"
+
+-- Iteration 24 --
+string(0) ""
+
+-- Iteration 25 --
+string(0) ""
+
+-- Iteration 26 --
+
+Warning: quoted_printable_decode() expects parameter 1 to be string, resource given in %s on line %d
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
new file mode 100644
index 0000000..6a22da8
--- /dev/null
+++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+quoted_printable_encode() tests - 1
+--FILE--
+<?php
+
+var_dump(quoted_printable_encode());
+var_dump(quoted_printable_encode(""));
+var_dump(quoted_printable_encode("test"));
+var_dump(quoted_printable_encode("test", "more"));
+
+$a = array("str");
+var_dump(quoted_printable_encode($a));
+var_dump(quoted_printable_encode(1));
+var_dump(quoted_printable_encode(NULL));
+var_dump(quoted_printable_encode(false));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+string(0) ""
+string(4) "test"
+
+Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+string(1) "1"
+string(0) ""
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
new file mode 100644
index 0000000..aaf5608
--- /dev/null
+++ b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/quotemeta_basic.phpt b/ext/standard/tests/strings/quotemeta_basic.phpt
new file mode 100644
index 0000000..9a2f23c
--- /dev/null
+++ b/ext/standard/tests/strings/quotemeta_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test quotemeta() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string quotemeta ( string $str )
+ * Description: Quote meta characters
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing quotemeta() : basic functionality ***\n";
+
+var_dump(quotemeta("Hello how are you ?"));
+var_dump(quotemeta("(100 + 50) * 10"));
+var_dump(quotemeta("\+*?[^]($)"));
+?>
+===DONE===
+--EXPECTF--
+*** Testing quotemeta() : basic functionality ***
+string(20) "Hello how are you \?"
+string(19) "\(100 \+ 50\) \* 10"
+string(20) "\\\+\*\?\[\^\]\(\$\)"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/quotemeta_error.phpt b/ext/standard/tests/strings/quotemeta_error.phpt
new file mode 100644
index 0000000..76efe08
--- /dev/null
+++ b/ext/standard/tests/strings/quotemeta_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test quotemeta() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string quotemeta ( string $str )
+ * Description: Quote meta characters
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing quotemeta() : error conditions ***\n";
+
+echo "\n-- Testing quotemeta() function with no arguments --\n";
+var_dump( quotemeta());
+
+echo "\n-- Testing quotemeta() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump(quotemeta("How are you ?", $extra_arg));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing quotemeta() : error conditions ***
+
+-- Testing quotemeta() function with no arguments --
+
+Warning: quotemeta() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing quotemeta() function with more than expected no. of arguments --
+
+Warning: quotemeta() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt
new file mode 100644
index 0000000..5f57b0e
--- /dev/null
+++ b/ext/standard/tests/strings/rtrim.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/rtrim_basic.phpt b/ext/standard/tests/strings/rtrim_basic.phpt
new file mode 100644
index 0000000..7193b59
--- /dev/null
+++ b/ext/standard/tests/strings/rtrim_basic.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test rtrim() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string rtrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing rtrim() : basic functionality ***\n";
+
+$text = "---These are a few words--- \t\r\n\0\x0B ";
+$hello = "!===Hello World===!";
+$alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+$binary = "Example string\x0A\x0D";
+
+
+
+echo "\n-- Trim string with all white space characters --\n";
+var_dump(rtrim($text));
+
+echo "\n-- Trim non-whitespace from a string --\n";
+var_dump(rtrim($hello, "=!"));
+
+echo "\n-- Trim some non-white space characters from a string --\n";
+var_dump(rtrim($hello, "!dlWro="));
+
+echo "\n-- Trim some non-white space characters from a string using a character range --\n";
+var_dump(rtrim($alpha, "A..Z"));
+
+echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
+var_dump(rtrim($binary, "\x00..\x1F"));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing rtrim() : basic functionality ***
+
+-- Trim string with all white space characters --
+string(27) "---These are a few words---"
+
+-- Trim non-whitespace from a string --
+string(15) "!===Hello World"
+
+-- Trim some non-white space characters from a string --
+string(10) "!===Hello "
+
+-- Trim some non-white space characters from a string using a character range --
+string(10) "0123456789"
+
+-- Trim the ASCII control characters at the beginning of a string --
+string(14) "Example string"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt
new file mode 100644
index 0000000..3cdfb91
--- /dev/null
+++ b/ext/standard/tests/strings/rtrim_error.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test rtrim() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string rtrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing rtrim() : error conditions ***\n";
+
+echo "\n-- Testing rtrim() function with no arguments --\n";
+var_dump( rtrim() );
+
+echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( rtrim("Hello World", "Heo", $extra_arg) );
+
+
+$hello = " Hello World\n";
+echo "\n-- Test rtrim function with various invalid charlists\n";
+var_dump(rtrim($hello, "..a"));
+var_dump(rtrim($hello, "a.."));
+var_dump(rtrim($hello, "z..a"));
+var_dump(rtrim($hello, "a..b..c"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rtrim() : error conditions ***
+
+-- Testing rtrim() function with no arguments --
+
+Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing rtrim() function with more than expected no. of arguments --
+
+Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Test rtrim function with various invalid charlists
+
+Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
+string(14) " Hello World
+"
+
+Warning: rtrim(): Invalid '..'-range, no character to the right of '..' in %s on line %d
+string(14) " Hello World
+"
+
+Warning: rtrim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
+string(14) " Hello World
+"
+
+Warning: rtrim(): Invalid '..'-range in %s on line %d
+string(14) " Hello World
+"
+===DONE===
diff --git a/ext/standard/tests/strings/rtrim_variation1.phpt b/ext/standard/tests/strings/rtrim_variation1.phpt
new file mode 100644
index 0000000..68c7bb9
--- /dev/null
+++ b/ext/standard/tests/strings/rtrim_variation1.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test rtrim() function : usage variations - test values for $str argument
+--FILE--
+<?php
+
+/* Prototype : string rtrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing rtrim() function: with unexpected inputs for 'str' argument ***\n";
+
+//get an unset variable
+$unset_var = ' !--string_val--! ';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return " !---sample object---! ";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test rtrim() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // strip white space and any "minus" signs
+ var_dump( rtrim($input, " !-") );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rtrim() 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(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(12) "101234567000"
+-- Iteration 10 --
+
+Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: rtrim() 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(19) " !---sample object"
+-- Iteration 20 --
+
+Warning: rtrim() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/strings/rtrim_variation2.phpt b/ext/standard/tests/strings/rtrim_variation2.phpt
new file mode 100644
index 0000000..9e3943d
--- /dev/null
+++ b/ext/standard/tests/strings/rtrim_variation2.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test rtrim() function : usage variations - test values for $charlist argument
+--FILE--
+<?php
+
+/* Prototype : string rtrim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing rtrim() function: with unexpected inputs for 'charlist' argument ***\n";
+
+//get an unset variable
+$unset_var = ' string_val ';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return " sample object ";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test rtrim() function
+$count = 1;
+foreach($inputs as $charlist) {
+ echo "-- Iteration $count --\n";
+ // strip white space and any "minus" signs
+ var_dump( rtrim("!---Hello World---!", $charlist) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing rtrim() 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: rtrim() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: rtrim() 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: rtrim() 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===
diff --git a/ext/standard/tests/strings/setlocale_basic1.phpt b/ext/standard/tests/strings/setlocale_basic1.phpt
new file mode 100644
index 0000000..957357f
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_basic1.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test setlocale() function : basic functionality - setting system locale to a specific
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL, "en_US.utf8", "en_AU.utf8", "ko_KR.utf8", "zh_CN.utf8", "de_DE.utf8", "es_EC.utf8", "fr_FR.utf8", "ja_JP.utf8", "el_GR.utf8", "nl_NL.utf8") === false) {
+ die('skip available locales not usable');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale ,
+ * or FALSE if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* test setlocale by specifying a specific locale as input */
+
+/* Prototype : array list_system_locales( void )
+ Description: To get the currently installed locle in this platform
+ Arguments : Nil
+ Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and set one among them,
+ Check the currency settings in the new locale */
+echo "*** Testing setlocale() : basic functionality - set to a specific locale ***\n";
+
+//set of locales to be used
+$common_locales = array(
+ "english_US"=> "en_US.utf8",
+ "english_AU" => "en_AU.utf8",
+ "korean_KR" => "ko_KR.utf8",
+ "Chinese_zh" => "zh_CN.utf8",
+ "germen_DE" => "de_DE.utf8",
+ "spanish_es" => "es_EC.utf8",
+ "french_FR" => "fr_FR.utf8",
+ "japanees_JP" => "ja_JP.utf8",
+ "greek_GR" => "el_GR.utf8",
+ "dutch_NL" => "nl_NL.utf8"
+);
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// set the system locale to a locale, choose the right locale by
+// finding a common locale in commonly used locale stored in
+// $common_locales & locales that are available in the system, stored
+// in $all_system_locales.
+echo "Setting system locale(LC_ALL) to ";
+foreach($common_locales as $value) {
+ // check if a commonly used locale is installed in the system
+ if(in_array($value, $all_system_locales)){
+ echo "$value\n"; // print, this is found
+ // set the found locale as current locale
+ var_dump(setlocale(LC_ALL, $value ));
+ // stop here
+ break;
+ }
+ else{
+ // continue to check if next commonly locale is installed in the system
+ continue;
+ }
+}
+
+// check that new locale setting is effective
+// use localeconv() to get the details of currently set locale
+$locale_info = localeconv();
+
+//checking currency settings in the new locale to see if the setlocale() was effective
+$new_currency = trim($locale_info['int_curr_symbol']);
+echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$value].", Found: ".$new_currency."\n";
+echo "Test ";
+if(trim($currency_symbol[$value]) == $new_currency){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : basic functionality - set to a specific locale ***
+Setting system locale(LC_ALL) to %s
+string(%d) %s
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_basic2.phpt b/ext/standard/tests/strings/setlocale_basic2.phpt
new file mode 100644
index 0000000..fe61b9b
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_basic2.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test setlocale() function : basic functionality - set locale using an array
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL, "en_US.utf8", "en_AU.utf8", "ko_KR.utf8", "zh_CN.utf8", "de_DE.utf8", "es_EC.utf8", "fr_FR.utf8", "ja_JP.utf8", "el_GR.utf8", "nl_NL.utf8") === false) {
+ die('skip available locales not usable');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test the setlocale() when an array is provided as input containing list of locales */
+
+/* Prototype : array list_system_locales( void )
+ * Description: To get the currently installed locle in this platform
+ * Arguments : Nil
+ * Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and prepare a list of locales that can be used as
+ input to setlocale() */
+
+echo "*** Testing setlocale() with an array containing list of locales ***\n";
+
+//set of locales to be used
+$common_locales = array(
+ "english_US"=> "en_US.utf8",
+ "english_AU" => "en_AU.utf8",
+ "korean_KR" => "ko_KR.utf8",
+ "Chinese_zh" => "zh_CN.utf8",
+ "germen_DE" => "de_DE.utf8",
+ "spanish_es" => "es_EC.utf8",
+ "french_FR" => "fr_FR.utf8",
+ "japanees_JP" => "ja_JP.utf8",
+ "greek_GR" => "el_GR.utf8",
+ "dutch_NL" => "nl_NL.utf8"
+);
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// prepare the list of locales based on list of locales found in the system
+// and those known to this script ( as stored $common_locales) which can be
+// given as input to setlocale(), later verify the new locale setting by
+// checking the currency setting of the system(use localconv())
+$list_of_locales = array();
+foreach($common_locales as $value) {
+ if( in_array($value, $all_system_locales) ) {
+ $list_of_locales[] = $value;
+ }
+}
+
+// Now $list_of_locales array contains the locales that can be passed to
+// setlocale() function.
+echo "-- Testing setlocale() : 'category' argument as LC_ALL & 'locale' argument as an array --\n";
+if ( count($list_of_locales) > 0 ) {
+ // set locale to $list_of_locales
+ $new_locale = setlocale(LC_ALL, $list_of_locales);
+
+ // dump the current locale
+ var_dump($new_locale);
+
+ // check that new locale setting is effective
+ // use localeconv() to get the details of currently set locale
+ $locale_info = localeconv();
+ $new_currency = trim($locale_info['int_curr_symbol']);
+
+ echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n";
+ echo "Test ";
+
+ if(trim($currency_symbol[$new_locale]) == $new_currency){
+ echo "PASSED.\n";
+ } else {
+ echo "FAILED.\n";
+ }
+} else {
+ echo "Test FAILED.\n";
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() with an array containing list of locales ***
+-- Testing setlocale() : 'category' argument as LC_ALL & 'locale' argument as an array --
+string(%d) "%s"
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_basic3.phpt b/ext/standard/tests/strings/setlocale_basic3.phpt
new file mode 100644
index 0000000..47917e3
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_basic3.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test setlocale() function : basic functionality - passing multiple locales as argument
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL, "en_US.utf8", "Ko_KR.utf8", "zh_CN.utf8") === false) {
+ die('skip en_US.utf8/Ko_KR.utf8/zh_CN.utf8 locales not available');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test the setlocale() when multiple locales are provided as argument */
+
+/* Prototype : array list_system_locales( void )
+ Description: To get the currently installed locle in this platform
+ Arguments : Nil
+ Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and get three locales that can be use to
+ pass as argument to setlocale() */
+echo "*** Testing setlocale() by passing multiple locales as argument ***\n";
+
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// Now check for three locales that is present in the system and use that as argument to setlocale()
+if( in_array("en_US.utf8",$all_system_locales) ||
+ in_array("Ko_KR.utf8",$all_system_locales) ||
+ in_array("zh_CN.utf8",$all_system_locales) ) {
+ echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --\n";
+
+ // call setlocale()
+ $new_locale = setlocale(LC_ALL, "en_US.utf8", "Ko_KR.utf8", "zh_CN.utf8");
+
+ // dump the name of the new locale set by setlocale()
+ var_dump($new_locale);
+
+ // check that new locale setting is effective
+ // use localeconv() to get the details of currently set locale
+ $locale_info = localeconv();
+ $new_currency = trim($locale_info['int_curr_symbol']);
+
+ echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n";
+ echo "Test ";
+ if( trim($currency_symbol[$new_locale]) == $new_currency) {
+ echo "PASSED.\n";
+ } else {
+ echo "FAILED.\n";
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() by passing multiple locales as argument ***
+-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --
+string(%d) "%s"
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt
new file mode 100644
index 0000000..e3f3765
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_error.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test setlocale() function : error condition
+--INI--
+error_reporting=14335
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing setlocale() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing setlocale() function with Zero arguments --";
+var_dump( setlocale());
+
+// One argument
+echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --";
+var_dump( setlocale(LC_ALL) );
+
+echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n";
+//Invalid array of locales
+$invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid");
+var_dump( setlocale(LC_ALL,$invalid_locales) );
+
+echo "\n-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --\n";
+//Invalid array of locales
+var_dump( setlocale(LC_ALL,"en_US.invalid", "en_AU.invalid", "ko_KR.invalid") );
+
+echo "\n-- Testing setlocale() function with invalid category --\n";
+//invalid $category
+$invalid_category = "TEST";
+var_dump( setlocale($invalid_category,"en_US.utf8") );
+
+echo "\nDone";
+?>
+--EXPECTF--
+*** Testing setlocale() : error conditions ***
+
+-- Testing setlocale() function with Zero arguments --
+Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing setlocale() function with One argument, 'category' = LC_ALL --
+Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --
+bool(false)
+
+-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --
+bool(false)
+
+-- Testing setlocale() function with invalid category --
+
+Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in %s on line %d
+
+Warning: setlocale(): Invalid locale category name TEST, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME in %s on line %d
+bool(false)
+
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation1.phpt b/ext/standard/tests/strings/setlocale_variation1.phpt
new file mode 100644
index 0000000..5e21d0b
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation1.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test setlocale() function : usage variations - passing multiple valid/invlaid locales as argument
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL, "en_US.utf8", "Ko_KR.utf8", "zh_CN.utf8") === false) {
+ die('skip en_US.utf8/Ko_KR.utf8/zh_CN.utf8 locales not available');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test the setlocale() when multiple valid/invalid locales are provided as argument */
+
+/* Prototype : array list_system_locales( void )
+ Description: To get the currently installed locle in this platform
+ Arguments : Nil
+ Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and get 2 valid locales that can be use to
+ pass as argument to setlocale(), pass 2 invalid arguments along with two valid arguments*/
+echo "*** Testing setlocale() by passing multiple valid/invalid locales as argument ***\n";
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// Now check for three locales that is present in the system and use that as argument to setlocale()
+if( in_array("en_US.utf8",$all_system_locales) ||
+ in_array("Ko_KR.utf8",$all_system_locales) ||
+ in_array("zh_CN.utf8",$all_system_locales) ) {
+ echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) --\n";
+
+ // call setlocale()
+ $new_locale = setlocale(LC_ALL, "en_US.invalid", "en_US.utf8", "Ko_KR.utf8", "KO_KR.invalid", "zh_CN.utf8");
+
+ // dump the name of the new locale set by setlocale()
+ var_dump($new_locale);
+
+ // check that new locale setting is effective
+ // use localeconv() to get the details of currently set locale
+ $locale_info = localeconv();
+ $new_currency = trim($locale_info['int_curr_symbol']);
+
+ echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n";
+ echo "Test ";
+ if( trim($currency_symbol[$new_locale]) == $new_currency) {
+ echo "PASSED.\n";
+ } else {
+ echo "FAILED.\n";
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() by passing multiple valid/invalid locales as argument ***
+-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) --
+string(%d) "%s"
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt
new file mode 100644
index 0000000..af8739a
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation2.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test setlocale() function : usage variations - Setting all available locales in the platform
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* setlocale() to set all available locales in the system and check the success count */
+echo "*** Testing setlocale() : usage variations ***\n";
+
+function good_locale($locale) {
+ return $locale !== 'tt_RU@iqtelif.UTF-8';
+}
+
+/* Prototype : array list_system_locales( void )
+ * Description: To get the currently installed locle in this platform
+ * Arguments : Nil
+ * Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system, except for broken one
+ return array_filter($system_locales, 'good_locale');
+}
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+//try different locale names
+$failure_locale = array();
+$success_count = 0;
+
+echo "-- Test setlocale() with all available locale in the system --\n";
+// gather all locales installed in the system(stored $all_system_locales),
+// try n set each locale using setlocale() and keep track failures, if any
+foreach($all_system_locales as $value){
+ //set locale to $value, if success, count increments
+ if(setlocale(LC_ALL,$value )){
+ $success_count++;
+ }
+ else{
+ //failure values are put in to an array $failure_locale
+ $failure_locale[] = $value;
+ }
+}
+
+echo "No of locales found on the machine = ".count($all_system_locales)."\n";
+echo "No of setlocale() success = ".$success_count."\n";
+echo "Expected no of failures = 0\n";
+echo "Test ";
+// check if there were any failure of setlocale() function earlier, if any
+// failure then dump the list of failing locales
+if($success_count != count($all_system_locales)){
+ echo "FAILED\n";
+ echo "Names of locale() for which setlocale() failed ...\n";
+ var_dump($failure_locale);
+}
+else{
+ echo "PASSED\n";
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations ***
+-- Test setlocale() with all available locale in the system --
+No of locales found on the machine = %d
+No of setlocale() success = %d
+Expected no of failures = 0
+Test PASSED
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation3.phpt b/ext/standard/tests/strings/setlocale_variation3.phpt
new file mode 100644
index 0000000..09d6c11
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation3.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test setlocale() function : usage variations - setting system locale = 0
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL,'en_US.utf8') === false) {
+ die('skip en_US.utf8 locale not available');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ * : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ * if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* If locale is "0", the locale setting is not affected, only the current setting is returned */
+
+echo "*** Testing setlocale() : usage variations - setting system locale = 0 ***\n";
+$locale_info_before = array();
+$locale_info_after = array();
+
+//initially giving the locale
+setlocale(LC_ALL,"en_US.utf8");
+
+echo "Locale info, before setting the locale\n";
+//returns current locale,before executing setlocale().
+$locale_info_before = localeconv();
+
+var_dump($locale_info_before);
+
+//Testing setlocale() by giving locale = 0
+echo "Setting system locale, category = LC_ALL and locale = 0\n";
+setlocale(LC_ALL, 0);
+
+echo "Locale info, after setting the locale\n";
+//returns current locale,after executing setlocale().
+$locale_info_after = localeconv();
+
+var_dump($locale_info_after);
+
+echo "Checking locale in the system, Expected : no change in the existing locale\n";
+echo "Test ";
+if($locale_info_before == $locale_info_after){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations - setting system locale = 0 ***
+Locale info, before setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Setting system locale, category = LC_ALL and locale = 0
+Locale info, after setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Checking locale in the system, Expected : no change in the existing locale
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation4.phpt b/ext/standard/tests/strings/setlocale_variation4.phpt
new file mode 100644
index 0000000..4ab1db7
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation4.phpt
@@ -0,0 +1,157 @@
+--TEST--
+Test setlocale() function : usage variations - setting system locale as null
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL,'en_US.utf8') === false || setlocale(LC_ALL,'en_AU.utf8') === false) {
+ die('skip en_US.utf8/en_AU.utf8 locales not available');
+}
+?>
+--ENV--
+LC_ALL=en_US.utf8;
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ * : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ * if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/*If locale is NULL, the locale names will be set from the values of environment variables with the same names as the above ENV settings */
+
+echo "*** Testing setlocale() : usage variations - Setting system locale = null ***\n";
+
+//initially setting the locale
+setlocale(LC_ALL,"en_AU.utf8");
+
+echo "Locale info, before setting the locale\n";
+//returns current locale,before executing setlocale() .
+$locale_info_before = localeconv();
+var_dump($locale_info_before);
+
+//Testing setlocale() by giving locale = null
+echo "Setting system locale, category = LC_ALL and locale = null\n";
+setlocale(LC_ALL, null);
+
+echo "Locale info, after setting the locale\n";
+//Returns Current locale,after executing setlocale().
+$locale_info_after = localeconv();
+var_dump($locale_info_after);
+
+echo "Checking new locale in the system, Expected : the locale names will be set from the values of environment variables\n";
+echo "Test ";
+if($locale_info_before != $locale_info_after){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations - Setting system locale = null ***
+Locale info, before setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "AUD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Setting system locale, category = LC_ALL and locale = null
+Locale info, after setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Checking new locale in the system, Expected : the locale names will be set from the values of environment variables
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation5.phpt b/ext/standard/tests/strings/setlocale_variation5.phpt
new file mode 100644
index 0000000..c8e947b
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation5.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test setlocale() function : usage variations - Setting system locale as empty string
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+if (setlocale(LC_ALL,'en_AU.utf8') === false || setlocale(LC_ALL,'en_US.utf8') === false) {
+ die('skip en_AU.utf8/en_US.utf8 locales not available');
+}
+?>
+--ENV--
+LC_ALL=en_US.utf8;
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ * : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ * if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* If locale is empty string "", the locale names will be set from the values of environment variables with the same names as from ENV */
+
+echo "*** Testing setlocale() : usage variations - setting system locale = \"\" ***\n";
+
+//initially setting the locale
+setlocale(LC_ALL,'en_AU.utf8');
+
+echo "Locale info, before setting the locale\n";
+
+//returns current locale,before executing setlocale() .
+$locale_info_before = localeconv();
+
+var_dump($locale_info_before);
+
+//Testing setlocale() by giving locale = null
+echo "Setting system locale, category = LC_ALL and locale = \"\"\n";
+setlocale(LC_ALL, "");
+
+echo "Locale info, after setting the locale\n";
+
+//Returns Current locale,after executing setlocale().
+$locale_info_after = localeconv();
+
+var_dump($locale_info_after);
+
+echo "Checking new locale in the system, Expected : the locale names will be set from the values of environment variables\n";
+echo "Test ";
+if($locale_info_before != $locale_info_after){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations - setting system locale = "" ***
+Locale info, before setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "AUD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Setting system locale, category = LC_ALL and locale = ""
+Locale info, after setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Checking new locale in the system, Expected : the locale names will be set from the values of environment variables
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt
new file mode 100644
index 0000000..68a8a08
--- /dev/null
+++ b/ext/standard/tests/strings/sha1.phpt
@@ -0,0 +1,51 @@
+--TEST--
+sha1() with ASCII output
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/sha1.dat";
+$a = array(
+ "abc",
+ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "a",
+ "0123456701234567012345670123456701234567012345670123456701234567",
+ ""
+);
+
+foreach ($a as $str) {
+ var_dump($val1 = sha1($str));
+ file_put_contents($filename, $str);
+ var_dump($val2 = sha1_file($filename));
+ var_dump($val1 === $val2);
+}
+
+var_dump(sha1($str, true));
+var_dump(sha1_file($filename, true));
+
+@unlink($filename);
+
+sha1_file($filename);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+bool(true)
+string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1"
+string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1"
+bool(true)
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+bool(true)
+string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83"
+string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83"
+bool(true)
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+bool(true)
+string(20) "%a"
+string(20) "%a"
+
+Warning: sha1_file(%ssha1.dat): failed to open stream: No such file or directory in %s on line %d
+Done
diff --git a/ext/standard/tests/strings/sha1_basic.phpt b/ext/standard/tests/strings/sha1_basic.phpt
new file mode 100644
index 0000000..00b764f
--- /dev/null
+++ b/ext/standard/tests/strings/sha1_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+sha1() with ASCII output.
+--FILE--
+<?php
+
+/* Prototype: string sha1 ( string $str [, bool $raw_output ] )
+ * Description: Calculate the sha1 hash of a string
+ */
+
+echo "*** Testing sha1() : basic functionality ***\n";
+
+echo "\n-- Without raw argument --\n";
+var_dump(sha1(""));
+var_dump(sha1("a"));
+var_dump(sha1("abc"));
+var_dump(sha1("message digest"));
+var_dump(sha1("abcdefghijklmnopqrstuvwxyz"));
+var_dump(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
+var_dump(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890"));
+
+echo "\n-- With raw == false --\n";
+var_dump(sha1("", false));
+var_dump(sha1("a", false));
+var_dump(sha1("abc", false));
+var_dump(sha1("message digest", false));
+var_dump(sha1("abcdefghijklmnopqrstuvwxyz", false));
+var_dump(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", false));
+var_dump(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", false));
+
+echo "\n-- With raw == true --\n";
+var_dump(bin2hex(sha1("", true)));
+var_dump(bin2hex(sha1("a", true)));
+var_dump(bin2hex(sha1("abc", true)));
+var_dump(bin2hex(sha1("message digest", true)));
+var_dump(bin2hex(sha1("abcdefghijklmnopqrstuvwxyz", true)));
+var_dump(bin2hex(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", true)));
+var_dump(bin2hex(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", true)));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sha1() : basic functionality ***
+
+-- Without raw argument --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
+string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
+string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
+string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
+
+-- With raw == false --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
+string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
+string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
+string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
+
+-- With raw == true --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
+string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
+string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
+string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
+string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
+string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/sha1_error.phpt b/ext/standard/tests/strings/sha1_error.phpt
new file mode 100644
index 0000000..bfc3e44
--- /dev/null
+++ b/ext/standard/tests/strings/sha1_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test sha1() function : error conditions
+--FILE--
+<?php
+
+
+/* Prototype: string sha1 ( string $str [, bool $raw_output ] )
+ * Description: Calculate the sha1 hash of a string
+ */
+
+echo "*** Testing sha1() : error conditions ***\n";
+
+echo "\n-- Testing sha1() function with no arguments --\n";
+var_dump( sha1() );
+
+echo "\n-- Testing sha1() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( sha1("Hello World", true, $extra_arg) );
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sha1() : error conditions ***
+
+-- Testing sha1() function with no arguments --
+
+Warning: sha1() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing sha1() function with more than expected no. of arguments --
+
+Warning: sha1() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt
new file mode 100644
index 0000000..fafe106
--- /dev/null
+++ b/ext/standard/tests/strings/sha1_file.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test sha1_file() function with ASCII output and raw binary output. Based on ext/standard/tests/strings/md5_file.phpt
+--FILE--
+<?php
+
+/* Prototype: string sha1_file( string filename[, bool raw_output] )
+ * Description: Calculate the sha1 hash of a file
+ */
+
+echo "*** Testing sha1_file() : basic functionality ***\n";
+
+/* Creating an empty file */
+if (($handle = fopen( "EmptyFile.txt", "w+")) == FALSE)
+return false;
+
+/* Creating a data file */
+if (($handle2 = fopen( "DataFile.txt", "w+")) == FALSE)
+return false;
+
+/* Writing into file */
+$filename = "DataFile.txt";
+$content = b"Add this to the file\n";
+if (is_writable($filename)) {
+ if (fwrite($handle2, $content) === FALSE) {
+ echo "Cannot write to file ($filename)";
+ exit;
+ }
+}
+
+// close the files
+fclose($handle);
+fclose($handle2);
+
+/* Testing error conditions */
+echo "\n*** Testing for error conditions ***\n";
+
+echo "\n-- No filename --\n";
+var_dump( sha1_file("") );
+
+echo "\n-- invalid filename --\n";
+var_dump( sha1_file("rewncwYcn89q") );
+
+echo "\n-- Scalar value as filename --\n";
+var_dump( sha1_file(12) );
+
+echo "\n-- NULL as filename --\n";
+var_dump( sha1_file(NULL) );
+
+echo "\n-- Zero arguments --\n";
+ var_dump ( sha1_file() );
+
+echo "\n-- More than valid number of arguments ( valid is 2) --\n";
+var_dump ( sha1_file("EmptyFile.txt", true, NULL) );
+
+echo "\n-- Hexadecimal Output for Empty file as Argument --\n";
+var_dump( sha1_file("EmptyFile.txt") );
+
+echo "\n-- Raw Binary Output for Empty file as Argument --\n";
+var_dump( bin2hex(sha1_file("EmptyFile.txt", true)));
+
+echo "\n-- Hexadecimal Output for a valid file with some contents --\n";
+var_dump( sha1_file("DataFile.txt") );
+
+echo "\n-- Raw Binary Output for a valid file with some contents --\n";
+var_dump ( bin2hex(sha1_file("DataFile.txt", true)));
+
+// remove temp files
+unlink("DataFile.txt");
+unlink("EmptyFile.txt");
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sha1_file() : basic functionality ***
+
+*** Testing for error conditions ***
+
+-- No filename --
+
+Warning: sha1_file(): Filename cannot be empty in %s on line %d
+bool(false)
+
+-- invalid filename --
+
+Warning: sha1_file(rewncwYcn89q): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- Scalar value as filename --
+
+Warning: sha1_file(12): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+-- NULL as filename --
+
+Warning: sha1_file(): Filename cannot be empty in %s on line %d
+bool(false)
+
+-- Zero arguments --
+
+Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- More than valid number of arguments ( valid is 2) --
+
+Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Hexadecimal Output for Empty file as Argument --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+
+-- Raw Binary Output for Empty file as Argument --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+
+-- Hexadecimal Output for a valid file with some contents --
+string(40) "d16a568ab98233deff7ec8b1668eb4b3d9e53fee"
+
+-- Raw Binary Output for a valid file with some contents --
+string(40) "d16a568ab98233deff7ec8b1668eb4b3d9e53fee"
+===DONE===
diff --git a/ext/standard/tests/strings/sha1_variation1.phpt b/ext/standard/tests/strings/sha1_variation1.phpt
new file mode 100644
index 0000000..044be46
--- /dev/null
+++ b/ext/standard/tests/strings/sha1_variation1.phpt
@@ -0,0 +1,157 @@
+--TEST--
+Test sha1() function : usage variations - unexpected values for 'str' argument
+--FILE--
+<?php
+
+/* Prototype: string sha1 ( string $str [, bool $raw_output ] )
+ * Description: Calculate the sha1 hash of a string
+ */
+
+echo "*** Testing sha1() : unexpected values for 'str' ***\n";
+
+$raw = false;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'str' argument
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.1234567E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // object data
+/*23*/ new MyClass(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ //resource data
+/*26*/ $fp
+);
+
+// loop through each element of $values for 'str' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( sha1($values[$count], $raw) );
+}
+
+//closing resource
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sha1() : unexpected values for 'str' ***
+-- Iteration 1 --
+string(40) "b6589fc6ab0dc82cf12099d1c2d40ab994e8410c"
+-- Iteration 2 --
+string(40) "356a192b7913b04c54574d18c28d46e6395428ab"
+-- Iteration 3 --
+string(40) "8cb2237d0679ca88db6464eac60da96345513964"
+-- Iteration 4 --
+string(40) "bc97c643aba3b6c6abe253222f439d4002a87528"
+-- Iteration 5 --
+string(40) "1287384bc5ef3ab84a36a5ef1d888df2763567f4"
+-- Iteration 6 --
+string(40) "c9d6e1b691f17c8ae6d458984a5f56f80e62a60b"
+-- Iteration 7 --
+string(40) "39493e1e645578a655f532e1f9bcff67991f2c2f"
+-- Iteration 8 --
+string(40) "681b45cae882ad795afd54ccc2a04ad58e056b83"
+-- Iteration 9 --
+string(40) "1b390cd54a0c0d4f27fa7adf23e3c45536e9f37c"
+-- Iteration 10 --
+
+Warning: sha1() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: sha1() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: sha1() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: sha1() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: sha1() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 16 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 17 --
+string(40) "356a192b7913b04c54574d18c28d46e6395428ab"
+-- Iteration 18 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 19 --
+string(40) "356a192b7913b04c54574d18c28d46e6395428ab"
+-- Iteration 20 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 21 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 22 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 23 --
+string(40) "1615307cc4523f183e777df67f168c86908e8007"
+-- Iteration 24 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 25 --
+string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+-- Iteration 26 --
+
+Warning: sha1() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/sha1_variation2.phpt b/ext/standard/tests/strings/sha1_variation2.phpt
new file mode 100644
index 0000000..a5bf5f8
--- /dev/null
+++ b/ext/standard/tests/strings/sha1_variation2.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test sha1() function : usage variations - unexpected values for 'raw' argument
+--FILE--
+<?php
+
+/* Prototype: string sha1 ( string $str [, bool $raw_output ] )
+ * Description: Calculate the sha1 hash of a string
+ */
+
+echo "*** Testing sha1() : unexpected values for 'raw' ***\n";
+
+$string = "Hello World";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'str' argument
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.1234567E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // string data
+/*17*/ "ABC",
+ 'abc',
+ "0abc",
+ "123abc",
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // object data
+/*23*/ new MyClass(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ //resource data
+/*26*/ $fp
+);
+
+// loop through each element of $values for 'raw' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ // use bin2hex to catch those cases were raw is true
+ var_dump( bin2hex(sha1($string, $values[$count])) );
+}
+
+//closing resource
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sha1() : unexpected values for 'raw' ***
+-- Iteration 1 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 2 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 3 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 4 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 5 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 6 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 7 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 8 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 9 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 10 --
+
+Warning: sha1() expects parameter 2 to be boolean, array given in %s on line %d
+string(0) ""
+-- Iteration 11 --
+
+Warning: sha1() expects parameter 2 to be boolean, array given in %s on line %d
+string(0) ""
+-- Iteration 12 --
+
+Warning: sha1() expects parameter 2 to be boolean, array given in %s on line %d
+string(0) ""
+-- Iteration 13 --
+
+Warning: sha1() expects parameter 2 to be boolean, array given in %s on line %d
+string(0) ""
+-- Iteration 14 --
+
+Warning: sha1() expects parameter 2 to be boolean, array given in %s on line %d
+string(0) ""
+-- Iteration 15 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 16 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 17 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 18 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 19 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 20 --
+string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0"
+-- Iteration 21 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 22 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 23 --
+
+Warning: sha1() expects parameter 2 to be boolean, object given in %s on line %d
+string(0) ""
+-- Iteration 24 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 25 --
+string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430"
+-- Iteration 26 --
+
+Warning: sha1() expects parameter 2 to be boolean, resource given in %s on line %d
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/strings/sha1raw.phpt b/ext/standard/tests/strings/sha1raw.phpt
new file mode 100644
index 0000000..6777cab
--- /dev/null
+++ b/ext/standard/tests/strings/sha1raw.phpt
@@ -0,0 +1,14 @@
+--TEST--
+sha1() with RAW output
+--FILE--
+<?php
+echo bin2hex(sha1("abc", TRUE))."\n";
+echo bin2hex(sha1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", TRUE))."\n";
+echo bin2hex(sha1("a", TRUE))."\n";
+echo bin2hex(sha1("0123456701234567012345670123456701234567012345670123456701234567", TRUE))."\n";
+?>
+--EXPECT--
+a9993e364706816aba3e25717850c26c9cd0d89d
+84983e441c3bd26ebaae4aa1f95129e5e54670f1
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
+e0c094e867ef46c350ef54a7f59dd60bed92ae83
diff --git a/ext/standard/tests/strings/show_source_basic.phpt b/ext/standard/tests/strings/show_source_basic.phpt
new file mode 100644
index 0000000..cfd998f
--- /dev/null
+++ b/ext/standard/tests/strings/show_source_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function show_source() by calling it with its expected arguments, more test for highlight_file()
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+echo "*** Test by calling method or function with its expected arguments ***\n";
+$foo = 'bar';
+$baz = "something ".$foo."\n";
+
+if ( $foo == 'bar' )
+{
+ $baz = 'baz';
+}
+
+ /* some code here */
+
+show_source(__FILE__);
+
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments ***
+<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"***&nbsp;Test&nbsp;by&nbsp;calling&nbsp;method&nbsp;or&nbsp;function&nbsp;with&nbsp;its&nbsp;expected&nbsp;arguments&nbsp;***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"something&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />if&nbsp;(&nbsp;</span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'bar'&nbsp;</span><span style="color: #007700">)&nbsp;<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'baz'</span><span style="color: #007700">;<br />}<br /><br />&nbsp;</span><span style="color: #FF8000">/*&nbsp;some&nbsp;code&nbsp;here&nbsp;*/<br />&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;<br /></span>
+</span>
+</code>
diff --git a/ext/standard/tests/strings/show_source_variation1.phpt b/ext/standard/tests/strings/show_source_variation1.phpt
new file mode 100644
index 0000000..a9993ed
--- /dev/null
+++ b/ext/standard/tests/strings/show_source_variation1.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test function show_source() by calling it with its expected arguments and php output, more test for highlight_file()
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+echo "*** Test by calling method or function with its expected arguments and php output ***\n";
+$foo = 'bar';
+$baz = "something ".$foo."\n";
+
+if ( $foo == 'bar' )
+{
+ $baz = "baz\n";
+}
+
+ /* some code here */
+echo $baz;
+show_source(__FILE__);
+echo $foo;
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments and php output ***
+baz
+<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"***&nbsp;Test&nbsp;by&nbsp;calling&nbsp;method&nbsp;or&nbsp;function&nbsp;with&nbsp;its&nbsp;expected&nbsp;arguments&nbsp;and&nbsp;php&nbsp;output&nbsp;***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"something&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />if&nbsp;(&nbsp;</span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'bar'&nbsp;</span><span style="color: #007700">)&nbsp;<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"baz\n"</span><span style="color: #007700">;<br />}<br /><br />&nbsp;</span><span style="color: #FF8000">/*&nbsp;some&nbsp;code&nbsp;here&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$baz</span><span style="color: #007700">;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$foo</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>
+</span>
+</code>bar
diff --git a/ext/standard/tests/strings/show_source_variation2.phpt b/ext/standard/tests/strings/show_source_variation2.phpt
new file mode 100644
index 0000000..06ef66c
--- /dev/null
+++ b/ext/standard/tests/strings/show_source_variation2.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function show_source() by calling it with its expected arguments and output to variable, more test for highlight_file()
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+echo "*** Test by calling method or function with its expected arguments and output to variable ***\n";
+$foo = 'bar';
+$baz = "something ".$foo."\n";
+
+if ( $foo == 'bar' )
+{
+ $baz = "baz\n";
+}
+
+ /* some code here */
+$source = show_source(__FILE__, true);
+
+var_dump($source);
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments and output to variable ***
+string(1987) "<code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"***&nbsp;Test&nbsp;by&nbsp;calling&nbsp;method&nbsp;or&nbsp;function&nbsp;with&nbsp;its&nbsp;expected&nbsp;arguments&nbsp;and&nbsp;output&nbsp;to&nbsp;variable&nbsp;***\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"something&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$foo</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />if&nbsp;(&nbsp;</span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'bar'&nbsp;</span><span style="color: #007700">)&nbsp;<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"baz\n"</span><span style="color: #007700">;<br />}<br /><br />&nbsp;</span><span style="color: #FF8000">/*&nbsp;some&nbsp;code&nbsp;here&nbsp;*/&nbsp;<br /></span><span style="color: #0000BB">$source&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">show_source</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$source</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>
+</span>
+</code>"
diff --git a/ext/standard/tests/strings/similar_text_basic.phpt b/ext/standard/tests/strings/similar_text_basic.phpt
new file mode 100644
index 0000000..37b6527
--- /dev/null
+++ b/ext/standard/tests/strings/similar_text_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+similar_text(), basic tests
+--CREDITS--
+Mats Lindh <mats at lindh.no>
+#Testfest php.no
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : proto int similar_text(string str1, string str2 [, float percent])
+* Description: Calculates the similarity between two strings
+* Source code: ext/standard/string.c
+*/
+var_dump(similar_text("abcdefgh", "efg"));
+var_dump(similar_text("abcdefgh", "mno"));
+var_dump(similar_text("abcdefghcc", "c"));
+var_dump(similar_text("abcdefghabcdef", "zzzzabcdefggg"));
+
+$percent = 0;
+similar_text("abcdefgh", "efg", $percent);
+var_dump($percent);
+similar_text("abcdefgh", "mno", $percent);
+var_dump($percent);
+similar_text("abcdefghcc", "c", $percent);
+var_dump($percent);
+similar_text("abcdefghabcdef", "zzzzabcdefggg", $percent);
+var_dump($percent);
+?>
+===DONE===
+--EXPECTF--
+int(3)
+int(0)
+int(1)
+int(7)
+float(54.545454545455)
+float(0)
+float(18.181818181818)
+float(51.851851851852)
+===DONE===
diff --git a/ext/standard/tests/strings/similar_text_error.phpt b/ext/standard/tests/strings/similar_text_error.phpt
new file mode 100644
index 0000000..a5e9501
--- /dev/null
+++ b/ext/standard/tests/strings/similar_text_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+similar_text(), error tests for missing parameters
+--CREDITS--
+Mats Lindh <mats at lindh.no>
+#Testfest php.no
+--FILE--
+<?php
+/* Prototype : proto int similar_text(string str1, string str2 [, float percent])
+* Description: Calculates the similarity between two strings
+* Source code: ext/standard/string.c
+*/
+
+$extra_arg = 10;
+echo "\n-- Testing similar_text() function with more than expected no. of arguments --\n";
+similar_text("abc", "def", $percent, $extra_arg);
+
+echo "\n-- Testing similar_text() function with less than expected no. of arguments --\n";
+similar_text("abc");
+?>
+===DONE===
+--EXPECTF--
+-- Testing similar_text() function with more than expected no. of arguments --
+
+Warning: similar_text() expects at most 3 parameters, 4 given in %s on line %d
+
+-- Testing similar_text() function with less than expected no. of arguments --
+
+Warning: similar_text() expects at least 2 parameters, 1 given in %s on line %d
+===DONE===
diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt
new file mode 100644
index 0000000..55769ad
--- /dev/null
+++ b/ext/standard/tests/strings/soundex.phpt
@@ -0,0 +1,55 @@
+--TEST--
+soundex() tests
+--FILE--
+<?php
+
+var_dump(soundex(""));
+var_dump(soundex(-1));
+var_dump(soundex(array()));
+
+$array = array(
+"From",
+"that",
+"time",
+"on",
+"Sam",
+"thought",
+"that",
+"he",
+"sensed",
+"a",
+"change",
+"in",
+"Gollum",
+"again.",
+"He was more fawning and would-be friendly; but Sam surprised some strange looks in his eyes at times, especially towards Frodo."
+);
+
+foreach ($array as $str) {
+ var_dump(soundex($str));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+string(4) "0000"
+
+Warning: soundex() expects parameter 1 to be string, array given in %s on line %d
+NULL
+string(4) "F650"
+string(4) "T300"
+string(4) "T500"
+string(4) "O500"
+string(4) "S500"
+string(4) "T230"
+string(4) "T300"
+string(4) "H000"
+string(4) "S523"
+string(4) "A000"
+string(4) "C520"
+string(4) "I500"
+string(4) "G450"
+string(4) "A250"
+string(4) "H256"
+Done
diff --git a/ext/standard/tests/strings/soundex_basic.phpt b/ext/standard/tests/strings/soundex_basic.phpt
new file mode 100644
index 0000000..65bcb64
--- /dev/null
+++ b/ext/standard/tests/strings/soundex_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test soundex() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string soundex ( string $str )
+ * Description: Calculate the soundex key of a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing soundex() : basic functionality ***\n";
+
+var_dump(soundex("Euler"));
+var_dump(soundex("Gauss"));
+var_dump(soundex("Hilbert"));
+var_dump(soundex("Knuth"));
+var_dump(soundex("Lloyd"));
+var_dump(soundex("Lukasiewicz"));
+
+var_dump(soundex("Euler") == soundex("Ellery")); // E460
+var_dump(soundex("Gauss") == soundex("Ghosh")); // G200
+var_dump(soundex("Hilbert") == soundex("Heilbronn")); // H416
+var_dump(soundex("Knuth") == soundex("Kant")); // K530
+var_dump(soundex("Lloyd") == soundex("Ladd")); // L300
+var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
+
+var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
+var_dump(soundex("Hilbert") == soundex("Ladd"));
+?>
+===DONE===
+--EXPECT--
+*** Testing soundex() : basic functionality ***
+string(4) "E460"
+string(4) "G200"
+string(4) "H416"
+string(4) "K530"
+string(4) "L300"
+string(4) "L222"
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+===DONE===
diff --git a/ext/standard/tests/strings/soundex_error.phpt b/ext/standard/tests/strings/soundex_error.phpt
new file mode 100644
index 0000000..a81b9d2
--- /dev/null
+++ b/ext/standard/tests/strings/soundex_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test soundex() function : error conditions
+--FILE--
+<?php
+/* Prototype : string soundex ( string $str )
+ * Description: Calculate the soundex key of a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "\n*** Testing soundex error conditions ***";
+
+echo "-- Testing soundex() function with Zero arguments --\n";
+var_dump( soundex() );
+
+echo "\n\n-- Testing soundex() function with more than expected no. of arguments --\n";
+$str = "Euler";
+$extra_arg = 10;
+var_dump( soundex( $str, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments --
+
+Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+
+-- Testing soundex() function with more than expected no. of arguments --
+
+Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_basic1.phpt b/ext/standard/tests/strings/sprintf_basic1.phpt
new file mode 100644
index 0000000..b1c6194
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - string format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = "arg1 argument";
+$arg2 = "arg2 argument";
+$arg3 = "arg3 argument";
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using string format ***
+string(6) "format"
+string(13) "arg1 argument"
+string(27) "arg1 argument arg2 argument"
+string(41) "arg1 argument arg2 argument arg3 argument"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic2.phpt b/ext/standard/tests/strings/sprintf_basic2.phpt
new file mode 100644
index 0000000..94b177f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - integer format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using integer format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = 111;
+$arg2 = 222;
+$arg3 = 333;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using integer format ***
+string(6) "format"
+string(3) "111"
+string(7) "111 222"
+string(11) "111 222 333"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic3.phpt b/ext/standard/tests/strings/sprintf_basic3.phpt
new file mode 100644
index 0000000..52582ab
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test sprintf() function : basic functionality - float format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using float format ***\n";
+
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = 11.11;
+$arg2 = 22.22;
+$arg3 = 33.33;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+var_dump( sprintf($format11, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+var_dump( sprintf($format22, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using float format ***
+string(6) "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/sprintf_basic4.phpt b/ext/standard/tests/strings/sprintf_basic4.phpt
new file mode 100644
index 0000000..ee0a4b5
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic4.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - bool format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using bool format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = TRUE;
+$arg2 = FALSE;
+$arg3 = true;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using bool format ***
+string(6) "format"
+string(1) "1"
+string(3) "1 0"
+string(5) "1 0 1"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic5.phpt b/ext/standard/tests/strings/sprintf_basic5.phpt
new file mode 100644
index 0000000..7f06cbe
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic5.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - char format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using char format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = 65;
+$arg2 = 66;
+$arg3 = 67;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using char format ***
+string(6) "format"
+string(1) "A"
+string(3) "A B"
+string(5) "A B C"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic6.phpt b/ext/standard/tests/strings/sprintf_basic6.phpt
new file mode 100644
index 0000000..c6d691c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic6.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - exponential format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%E %e";
+$format3 = "%e %E %e";
+$arg1 = 1000;
+$arg2 = 2e3;
+$arg3 = +3e3;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using exponential format ***
+string(6) "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/sprintf_basic7.phpt b/ext/standard/tests/strings/sprintf_basic7.phpt
new file mode 100644
index 0000000..56bae8b
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic7.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test sprintf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = -1111;
+$arg2 = -1234567;
+$arg3 = +2345432;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using unsigned format ***
+string(6) "format"
+string(10) "4294966185"
+string(21) "4294966185 4293732729"
+string(29) "4294966185 4293732729 2345432"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic7_64bit.phpt b/ext/standard/tests/strings/sprintf_basic7_64bit.phpt
new file mode 100644
index 0000000..035661d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic7_64bit.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sprintf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = -1111;
+$arg2 = -1234567;
+$arg3 = +2345432;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using unsigned format ***
+string(6) "format"
+string(20) "18446744073709550505"
+string(41) "18446744073709550505 18446744073708317049"
+string(49) "18446744073709550505 18446744073708317049 2345432"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic8.phpt b/ext/standard/tests/strings/sprintf_basic8.phpt
new file mode 100644
index 0000000..bb9ecd1
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic8.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test sprintf() function : basic functionality - octal format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = 021;
+$arg2 = -0347;
+$arg3 = 05678;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using octal format ***
+string(6) "format"
+string(2) "21"
+string(14) "21 37777777431"
+string(18) "21 37777777431 567"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic8_64bit.phpt b/ext/standard/tests/strings/sprintf_basic8_64bit.phpt
new file mode 100644
index 0000000..76d8f05
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic8_64bit.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test sprintf() function : basic functionality - octal format
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = 021;
+$arg2 = -0347;
+$arg3 = 05678;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using octal format ***
+string(6) "format"
+string(2) "21"
+string(25) "21 1777777777777777777431"
+string(29) "21 1777777777777777777431 567"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic9.phpt b/ext/standard/tests/strings/sprintf_basic9.phpt
new file mode 100644
index 0000000..1e16bf8
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic9.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test sprintf() function : basic functionality - hexadecimal format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialise all required variables
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = 11;
+$arg2 = 132;
+$arg3 = 177;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+var_dump( sprintf($format11, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+var_dump( sprintf($format22, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using hexadecimal format ***
+string(6) "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/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt
new file mode 100644
index 0000000..f7f9e37
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_error.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test sprintf() function : error conditions
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing sprintf() function with Zero arguments --\n";
+var_dump( sprintf() );
+
+echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n";
+$format1 = '%s';
+$format2 = '%s%s';
+$format3 = '%s%s%s';
+$arg1 = 'one';
+$arg2 = 'two';
+
+// with one argument less than expected
+var_dump( sprintf($format1) );
+var_dump( sprintf($format2,$arg1) );
+var_dump( sprintf($format3,$arg1,$arg2) );
+
+// with two argument less than expected
+var_dump( sprintf($format2) );
+var_dump( sprintf($format3,$arg1) );
+
+// with three argument less than expected
+var_dump( sprintf($format3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : error conditions ***
+
+-- Testing sprintf() function with Zero arguments --
+
+Warning: sprintf() expects at least %d parameter, %d given in %s on line %d
+bool(false)
+
+-- Testing sprintf() function with less than expected no. of arguments --
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/sprintf_f.phpt b/ext/standard/tests/strings/sprintf_f.phpt
new file mode 100644
index 0000000..6cba6d1
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_f.phpt
@@ -0,0 +1,40 @@
+--TEST--
+sprintf %f
+--FILE--
+<?php
+
+var_dump(sprintf("%3.2f", 1.2));
+var_dump(sprintf("%-3.2f", 1.2));
+var_dump(sprintf("%03.2f", 1.2));
+var_dump(sprintf("%-03.2f", 1.2));
+echo "\n";
+var_dump(sprintf("%5.2f", 3.4));
+var_dump(sprintf("%-5.2f", 3.4));
+var_dump(sprintf("%05.2f", 3.4));
+var_dump(sprintf("%-05.2f", 3.4));
+echo "\n";
+var_dump(sprintf("%7.2f", -5.6));
+var_dump(sprintf("%-7.2f", -5.6));
+var_dump(sprintf("%07.2f", -5.6));
+var_dump(sprintf("%-07.2f", -5.6));
+echo "\n";
+var_dump(sprintf("%3.4f", 1.2345678e99));
+
+?>
+--EXPECTF--
+string(4) "1.20"
+string(4) "1.20"
+string(4) "1.20"
+string(4) "1.20"
+
+string(5) " 3.40"
+string(5) "3.40 "
+string(5) "03.40"
+string(5) "3.400"
+
+string(7) " -5.60"
+string(7) "-5.60 "
+string(7) "-005.60"
+string(7) "-5.6000"
+
+string(105) "1234567%d.0000"
diff --git a/ext/standard/tests/strings/sprintf_f_2.phpt b/ext/standard/tests/strings/sprintf_f_2.phpt
new file mode 100644
index 0000000..1c7cc7f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_f_2.phpt
@@ -0,0 +1,116 @@
+--TEST--
+sprintf %f #2
+--INI--
+precision=14
+--FILE--
+<?php
+var_dump(sprintf("%.3F", 100.426));
+var_dump(sprintf("%.2F", 100.426));
+var_dump(sprintf("%d", 100.426));
+var_dump(sprintf("%d", 100.9));
+var_dump(sprintf("%o", 100.426));
+var_dump(sprintf("%o", 100.9));
+
+/* copy & paste from the docs */
+
+/* example#1: Argument swapping */
+$num = 100.1;
+$location = "world";
+
+$format = 'There are %d monkeys in the %s';
+var_dump(sprintf($format, $num, $location));
+
+/* example#2: Argument swapping */
+$format = 'The %s contains %d monkeys';
+var_dump(sprintf($format, $num, $location));
+
+/* example#3: Argument swapping */
+$format = 'The %2$s contains %1$d monkeys';
+var_dump(sprintf($format, $num, $location));
+
+/* example#4: Argument swapping */
+$format = 'The %2$s contains %1$d monkeys.
+ That\'s a nice %2$s full of %1$d monkeys.';
+var_dump(sprintf($format, $num, $location));
+
+/* example#5: various examples */
+$n = 43951789;
+$u = -43951789;
+$c = 65; // ASCII 65 is 'A'
+
+// notice the double %%, this prints a literal '%' character
+var_dump(sprintf("%%b = '%b'", $n)); // binary representation
+var_dump(sprintf("%%c = '%c'", $c)); // print the ascii character, same as chr() function
+var_dump(sprintf("%%d = '%d'", $n)); // standard integer representation
+var_dump(sprintf("%%e = '%e'", $n)); // scientific notation
+var_dump(sprintf("%%u = '%u'", $n)); // unsigned integer representation of a positive integer
+var_dump(sprintf("%%u = '%u'", $u)); // unsigned integer representation of a negative integer
+var_dump(sprintf("%%f = '%f'", $n)); // floating point representation
+var_dump(sprintf("%%o = '%o'", $n)); // octal representation
+var_dump(sprintf("%%s = '%s'", $n)); // string representation
+var_dump(sprintf("%%x = '%x'", $n)); // hexadecimal representation (lower-case)
+var_dump(sprintf("%%X = '%X'", $n)); // hexadecimal representation (upper-case)
+
+var_dump(sprintf("%%+d = '%+d'", $n)); // sign specifier on a positive integer
+var_dump(sprintf("%%+d = '%+d'", $u)); // sign specifier on a negative integer
+
+
+/* example#6: string specifiers */
+$s = 'monkey';
+$t = 'many monkeys';
+
+var_dump(sprintf("[%s]", $s)); // standard string output
+var_dump(sprintf("[%10s]", $s)); // right-justification with spaces
+var_dump(sprintf("[%-10s]", $s)); // left-justification with spaces
+var_dump(sprintf("[%010s]", $s)); // zero-padding works on strings too
+var_dump(sprintf("[%'#10s]", $s)); // use the custom padding character '#'
+var_dump(sprintf("[%10.10s]", $t)); // left-justification but with a cutoff of 10 characters
+
+/* example#7: zero-padded integers */
+var_dump(sprintf("%04d-%02d-%02d", 2006, 12, 18));
+
+/* example#8: formatting currency */
+$money1 = 68.75;
+$money2 = 54.35;
+$money = $money1 + $money2;
+var_dump(sprintf("%01.2f", $money)); // output "123.10"
+
+/* example#9: scientific notation */
+$number = 362525200;
+
+var_dump(sprintf("%.3e", $number)); // outputs 3.63e+8
+?>
+--EXPECTREGEX--
+string\(7\) \"100\.426\"
+string\(6\) \"100\.43\"
+string\(3\) \"100\"
+string\(3\) \"100\"
+string\(3\) \"144\"
+string\(3\) \"144\"
+string\(34\) \"There are 100 monkeys in the world\"
+string\(28\) \"The 100\.1 contains 0 monkeys\"
+string\(30\) \"The world contains 100 monkeys\"
+string\(76\) \"The world contains 100 monkeys.
+ That's a nice world full of 100 monkeys\.\"
+string\(33\) \"%b = '10100111101010011010101101'\"
+string\(8\) \"%c = 'A'\"
+string\(15\) \"%d = '43951789'\"
+string\(18\) \"%e = '4\.395179e\+7'\"
+string\(15\) \"%u = '43951789'\"
+(string\(17\) \"%u = '4251015507'\"|string\(27\) \"%u = '18446744073665599827'\")
+string\(22\) \"%f = '43951789\.000000'\"
+string\(16\) \"%o = '247523255'\"
+string\(15\) \"%s = '43951789'\"
+string\(14\) \"%x = '29ea6ad'\"
+string\(14\) \"%X = '29EA6AD'\"
+string\(17\) \"%\+d = '\+43951789'\"
+string\(17\) \"%\+d = '-43951789'\"
+string\(8\) \"\[monkey\]\"
+string\(12\) \"\[ monkey\]\"
+string\(12\) \"\[monkey \]\"
+string\(12\) \"\[0000monkey\]\"
+string\(12\) \"\[####monkey\]\"
+string\(12\) \"\[many monke\]\"
+string\(10\) \"2006-12-18\"
+string\(6\) \"123\.10\"
+string\(8\) \"3\.625e\+8\"
diff --git a/ext/standard/tests/strings/sprintf_f_3.phpt b/ext/standard/tests/strings/sprintf_f_3.phpt
new file mode 100644
index 0000000..0cf1239
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_f_3.phpt
@@ -0,0 +1,23 @@
+--TEST--
+sprintf %f #3
+--SKIPIF--
+<?php if(false == setlocale(LC_NUMERIC, "is_IS", "is_IS.UTF-8")) print "skip icelandic locale not supported"; ?>
+--FILE--
+<?php
+setlocale(LC_NUMERIC, "is_IS", "is_IS.UTF-8");
+var_dump(sprintf("%.3f", 100.426));
+var_dump(sprintf("%.2f", 100.426));
+var_dump(sprintf("%f'", 100.426));
+
+$money1 = 68.75;
+$money2 = 54.35;
+$money = $money1 + $money2;
+var_dump(sprintf("%01.2f", $money));
+var_dump(sprintf("%.3e", $money));
+?>
+--EXPECT--
+string(7) "100,426"
+string(6) "100,43"
+string(11) "100,426000'"
+string(6) "123,10"
+string(8) "1.231e+2"
diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt
new file mode 100644
index 0000000..2a5bdfd
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation1.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test sprintf() function : usage variations - unexpected values for format argument
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+* Testing sprintf() : with different unexpected values for format argument other than the strings
+*/
+
+echo "*** Testing sprintf() : with unexpected values for format argument ***\n";
+
+// initialing required variables
+$arg1 = "second arg";
+$arg2 = "third arg";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for format
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with default argument
+ var_dump( sprintf($value) );
+
+ // with two arguments
+ var_dump( sprintf($value, $arg1) );
+
+ // with three arguments
+ var_dump( sprintf($value, $arg1, $arg2) );
+
+ $count++;
+};
+
+// close the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with unexpected values for format argument ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "101234567000"
+string(12) "101234567000"
+string(12) "101234567000"
+
+-- Iteration 8 --
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+string(3) "0.5"
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+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"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+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"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+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"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+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"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 15 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 19 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 23 --
+string(6) "Object"
+string(6) "Object"
+string(6) "Object"
+
+-- Iteration 24 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 25 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 26 --
+string(%d) "Resource id #%d"
+string(%d) "Resource id #%d"
+string(%d) "Resource id #%d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation10.phpt b/ext/standard/tests/strings/sprintf_variation10.phpt
new file mode 100644
index 0000000..702dc34
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation10.phpt
@@ -0,0 +1,327 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with integer values ***\n";
+
+// array of int type values
+$integer_values = array (
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($integer_values as $int_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $int_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with integer values ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(9) "-1.000000"
+string(1) "f"
+string(9) "-1.000000"
+string(1) "f"
+string(10) " -1.000000"
+string(10) "-1.000000 "
+string(10) " -1.000000"
+string(10) "
+-1.000000"
+string(9) "-1.000000"
+string(30) " -1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(18) "-2147483647.000000"
+string(1) "f"
+string(18) "-2147483647.000000"
+string(1) "f"
+string(19) " -2147483647.000000"
+string(19) "-2147483647.000000 "
+string(19) " -2147483647.000000"
+string(19) "
+-2147483647.000000"
+string(18) "-2147483647.000000"
+string(30) " -2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(17) "2147483640.000000"
+string(1) "f"
+string(17) "2147483640.000000"
+string(1) "f"
+string(18) " 2147483640.000000"
+string(18) "2147483640.000000 "
+string(18) " 2147483640.000000"
+string(18) "
+2147483640.000000"
+string(17) "2147483640.000000"
+string(30) " 2147483640.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(11) "4667.000000"
+string(1) "f"
+string(11) "4667.000000"
+string(1) "f"
+string(12) " 4667.000000"
+string(12) "4667.000000 "
+string(12) " 4667.000000"
+string(12) "
+4667.000000"
+string(11) "4667.000000"
+string(30) " 4667.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(11) "4779.000000"
+string(1) "f"
+string(11) "4779.000000"
+string(1) "f"
+string(12) " 4779.000000"
+string(12) "4779.000000 "
+string(12) " 4779.000000"
+string(12) "
+4779.000000"
+string(11) "4779.000000"
+string(30) " 4779.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(11) "4095.000000"
+string(1) "f"
+string(11) "4095.000000"
+string(1) "f"
+string(12) " 4095.000000"
+string(12) "4095.000000 "
+string(12) " 4095.000000"
+string(12) "
+4095.000000"
+string(11) "4095.000000"
+string(30) " 4095.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(10) "250.000000"
+string(1) "f"
+string(10) "250.000000"
+string(1) "f"
+string(11) " 250.000000"
+string(11) "250.000000 "
+string(11) " 250.000000"
+string(11) "
+250.000000"
+string(10) "250.000000"
+string(30) " 250.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(9) "83.000000"
+string(1) "f"
+string(9) "83.000000"
+string(1) "f"
+string(10) " 83.000000"
+string(10) "83.000000 "
+string(10) " 83.000000"
+string(10) "
+83.000000"
+string(9) "83.000000"
+string(30) " 83.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation11.phpt b/ext/standard/tests/strings/sprintf_variation11.phpt
new file mode 100644
index 0000000..21e0188
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation11.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) " %d.000000"
+string(%d) "%d.000000 "
+string(%d) " %d.000000"
+string(%d) "
+%d.000000"
+string(%d) "%d.000000"
+string(30) "%s%d.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) " %d.000000"
+string(%d) "%d.000000 "
+string(%d) " %d.000000"
+string(%d) "
+%d.000000"
+string(%d) "%d.000000"
+string(30) "%s%d.000000"
+string(4) "0-9]"
+string(1) "f"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation12.phpt b/ext/standard/tests/strings/sprintf_variation12.phpt
new file mode 100644
index 0000000..b1b186c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation12.phpt
@@ -0,0 +1,263 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with arrays
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with arrays ***\n";
+
+// array of array types
+$array_values = array (
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array("123.456abc"),
+ array('123.456abc'),
+ array(1 => "One", "two" => 2)
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with arrays ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation13.phpt b/ext/standard/tests/strings/sprintf_variation13.phpt
new file mode 100644
index 0000000..60ae89c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation13.phpt
@@ -0,0 +1,358 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with strings ***\n";
+
+// array of string type values
+$string_values = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+ "123.456abc",
+ "+123.456abc"
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with strings ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 19 --
+string(10) "123.456000"
+string(1) "f"
+string(10) "123.456000"
+string(1) "f"
+string(11) " 123.456000"
+string(11) "123.456000 "
+string(11) " 123.456000"
+string(11) "
+123.456000"
+string(10) "123.456000"
+string(30) " 123.456000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 20 --
+string(10) "123.456000"
+string(1) "f"
+string(10) "123.456000"
+string(1) "f"
+string(11) " 123.456000"
+string(11) "123.456000 "
+string(11) " 123.456000"
+string(11) "
+123.456000"
+string(10) "123.456000"
+string(30) " 123.456000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation14.phpt b/ext/standard/tests/strings/sprintf_variation14.phpt
new file mode 100644
index 0000000..40704d2
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation14.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with boolean values ***\n";
+
+// array of boolean type values
+$boolean_values = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with boolean values ***
+
+-- Iteration 1 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation15.phpt b/ext/standard/tests/strings/sprintf_variation15.phpt
new file mode 100644
index 0000000..3769ae9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation15.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation16.phpt b/ext/standard/tests/strings/sprintf_variation16.phpt
new file mode 100644
index 0000000..5796531
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation16.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e3,
+ -1e2,
+ 1.23456E8,
+ -1.234567E9,
+ 10.0000000000000000005,
+ 10.123e+5
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with float values ***
+
+-- Iteration 1 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(10) "2147483648"
+string(1) "s"
+string(10) "2147483648"
+string(1) "s"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(11) "34359738369"
+string(1) "s"
+string(11) "34359738369"
+string(1) "s"
+string(12) " 34359738369"
+string(12) "34359738369 "
+string(12) " 34359738369"
+string(12) "
+34359738369"
+string(11) "34359738369"
+string(30) " 34359738369"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(10) "2147483649"
+string(1) "s"
+string(10) "2147483649"
+string(1) "s"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(1) "0"
+string(1) "s"
+string(1) "0"
+string(1) "s"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(4) "-0.1"
+string(1) "s"
+string(4) "-0.1"
+string(1) "s"
+string(5) " -0.1"
+string(5) "-0.1 "
+string(5) " -0.1"
+string(5) "
+-0.1"
+string(4) "-0.1"
+string(30) " -0.1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(4) "1000"
+string(1) "s"
+string(4) "1000"
+string(1) "s"
+string(5) " 1000"
+string(5) "1000 "
+string(5) " 1000"
+string(5) "
+1000"
+string(4) "1000"
+string(30) " 1000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(4) "-100"
+string(1) "s"
+string(4) "-100"
+string(1) "s"
+string(5) " -100"
+string(5) "-100 "
+string(5) " -100"
+string(5) "
+-100"
+string(4) "-100"
+string(30) " -100"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(9) "123456000"
+string(1) "s"
+string(9) "123456000"
+string(1) "s"
+string(10) " 123456000"
+string(10) "123456000 "
+string(10) " 123456000"
+string(10) "
+123456000"
+string(9) "123456000"
+string(30) " 123456000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 13 --
+string(11) "-1234567000"
+string(1) "s"
+string(11) "-1234567000"
+string(1) "s"
+string(12) " -1234567000"
+string(12) "-1234567000 "
+string(12) " -1234567000"
+string(12) "
+-1234567000"
+string(11) "-1234567000"
+string(30) " -1234567000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 14 --
+string(2) "10"
+string(1) "s"
+string(2) "10"
+string(1) "s"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 15 --
+string(7) "1012300"
+string(1) "s"
+string(7) "1012300"
+string(1) "s"
+string(8) " 1012300"
+string(8) "1012300 "
+string(8) " 1012300"
+string(8) "
+1012300"
+string(7) "1012300"
+string(30) " 1012300"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation17.phpt b/ext/standard/tests/strings/sprintf_variation17.phpt
new file mode 100644
index 0000000..8ba5507
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation17.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource values
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) " Resource id #%d"
+string(%d) "Resource id #%d "
+string(%d) " Resource id #%d"
+string(%d) "
+Resource id #%d"
+string(%d) "Resource id #%d"
+string(30) "%sResource id #%d"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) " Resource id #%d"
+string(%d) "Resource id #%d "
+string(%d) " Resource id #%d"
+string(%d) "
+Resource id #%d"
+string(%d) "Resource id #%d"
+string(30) "%sResource id #%d"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation18.phpt b/ext/standard/tests/strings/sprintf_variation18.phpt
new file mode 100644
index 0000000..960bcd0
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation18.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+echo "*** Testing sprintf() : string formats with array values ***\n";
+
+// different arrays used to test he function
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with array values ***
+
+-- Iteration 1 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation19.phpt b/ext/standard/tests/strings/sprintf_variation19.phpt
new file mode 100644
index 0000000..ae7b910
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation19.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "s"
+string(1) "0"
+string(1) "s"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(2) "-1"
+string(1) "s"
+string(2) "-1"
+string(1) "s"
+string(3) " -1"
+string(3) "-1 "
+string(3) " -1"
+string(3) "
+-1"
+string(4) " -1"
+string(30) " -1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(11) "-2147483647"
+string(1) "s"
+string(11) "-2147483647"
+string(1) "s"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "s"
+string(10) "2147483640"
+string(1) "s"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "s"
+string(4) "4667"
+string(1) "s"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "s"
+string(4) "4779"
+string(1) "s"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "s"
+string(4) "4095"
+string(1) "s"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "s"
+string(3) "250"
+string(1) "s"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "s"
+string(2) "83"
+string(1) "s"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 17 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt
new file mode 100644
index 0000000..a663df4
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation2.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test sprintf() function : usage variations - with all types of values for arg1 argument
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+echo "*** Testing sprintf() : with different types of values passed for arg1 argument ***\n";
+
+// initialing required variables
+$format = '%s';
+$arg2 = 'third argument';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for arg1
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with two arguments
+ var_dump( sprintf($format, $value) );
+
+ // with three arguments
+ var_dump( sprintf($format, $value, $arg2) );
+
+ $count++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with different types of values passed for arg1 argument ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "101234567000"
+string(12) "101234567000"
+
+-- Iteration 8 --
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+
+-- Iteration 10 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 11 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 12 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 13 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 14 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 15 --
+string(0) ""
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+
+-- Iteration 19 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+
+-- Iteration 23 --
+string(6) "string"
+string(6) "string"
+
+-- Iteration 24 --
+string(6) "string"
+string(6) "string"
+
+-- Iteration 25 --
+string(6) "Object"
+string(6) "Object"
+
+-- Iteration 26 --
+string(0) ""
+string(0) ""
+
+-- Iteration 27 --
+string(0) ""
+string(0) ""
+
+-- Iteration 28 --
+string(%d) "Resource id #%d"
+string(%d) "Resource id #%d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation20.phpt b/ext/standard/tests/strings/sprintf_variation20.phpt
new file mode 100644
index 0000000..fc82fef
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation20.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(0) ""
+string(1) "s"
+string(0) ""
+string(1) "s"
+string(1) " "
+string(1) " "
+string(1) " "
+string(1) "
+"
+string(4) " "
+string(30) " "
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(0) ""
+string(1) "s"
+string(0) ""
+string(1) "s"
+string(1) " "
+string(1) " "
+string(1) " "
+string(1) "
+"
+string(4) " "
+string(30) " "
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation21.phpt b/ext/standard/tests/strings/sprintf_variation21.phpt
new file mode 100644
index 0000000..afedfca
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation21.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation22.phpt b/ext/standard/tests/strings/sprintf_variation22.phpt
new file mode 100644
index 0000000..8684765
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation22.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation23.phpt b/ext/standard/tests/strings/sprintf_variation23.phpt
new file mode 100644
index 0000000..09e5b9f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation23.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - char formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : char formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of char formats
+$char_formats = array(
+ "%c", "%hc", "%lc",
+ "%Lc", " %c", "%c ",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-bA-B@#$&]", "%*c"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($char_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sprintf() : char formats with resource values ***
+
+-- Iteration 1 --
+string(1) "%a"
+string(1) "c"
+string(1) "%a"
+string(1) "c"
+string(2) " %a"
+string(2) "%a "
+string(2) " %a"
+string(2) "
+%a"
+string(1) "%a"
+string(1) "%a"
+string(11) "a-bA-B@#$&]"
+string(1) "c"
+
+-- Iteration 2 --
+string(1) "%a"
+string(1) "%a"
+string(1) "%a"
+string(1) "c"
+string(2) " %a"
+string(2) "%a "
+string(2) " %a"
+string(2) "
+%a"
+string(1) "%a"
+string(1) "%a"
+string(11) "a-bA-B@#$&]"
+string(1) "c"
+===DONE===
diff --git a/ext/standard/tests/strings/sprintf_variation24.phpt b/ext/standard/tests/strings/sprintf_variation24.phpt
new file mode 100644
index 0000000..6bb3e0e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation24.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation25.phpt b/ext/standard/tests/strings/sprintf_variation25.phpt
new file mode 100644
index 0000000..456344c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation25.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation26.phpt b/ext/standard/tests/strings/sprintf_variation26.phpt
new file mode 100644
index 0000000..b5881ea
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation26.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation27.phpt b/ext/standard/tests/strings/sprintf_variation27.phpt
new file mode 100644
index 0000000..88602db
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation27.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation28.phpt b/ext/standard/tests/strings/sprintf_variation28.phpt
new file mode 100644
index 0000000..8fad68b
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation28.phpt
@@ -0,0 +1,332 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(11) "37777777777"
+string(1) "o"
+string(11) "37777777777"
+string(1) "o"
+string(12) " 37777777777"
+string(12) "37777777777 "
+string(12) " 37777777777"
+string(12) "
+37777777777"
+string(11) "37777777777"
+string(30) " 37777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(11) "20000000001"
+string(1) "o"
+string(11) "20000000001"
+string(1) "o"
+string(12) " 20000000001"
+string(12) "20000000001 "
+string(12) " 20000000001"
+string(12) "
+20000000001"
+string(11) "20000000001"
+string(30) " 20000000001"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "17777777770"
+string(1) "o"
+string(11) "17777777770"
+string(1) "o"
+string(12) " 17777777770"
+string(12) "17777777770 "
+string(12) " 17777777770"
+string(12) "
+17777777770"
+string(11) "17777777770"
+string(30) " 17777777770"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(5) "11073"
+string(1) "o"
+string(5) "11073"
+string(1) "o"
+string(6) " 11073"
+string(6) "11073 "
+string(6) " 11073"
+string(6) "
+11073"
+string(5) "11073"
+string(30) " 11073"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(5) "11253"
+string(1) "o"
+string(5) "11253"
+string(1) "o"
+string(6) " 11253"
+string(6) "11253 "
+string(6) " 11253"
+string(6) "
+11253"
+string(5) "11253"
+string(30) " 11253"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(4) "7777"
+string(1) "o"
+string(4) "7777"
+string(1) "o"
+string(5) " 7777"
+string(5) "7777 "
+string(5) " 7777"
+string(5) "
+7777"
+string(4) "7777"
+string(30) " 7777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(3) "372"
+string(1) "o"
+string(3) "372"
+string(1) "o"
+string(4) " 372"
+string(4) "372 "
+string(4) " 372"
+string(4) "
+372"
+string(4) " 372"
+string(30) " 372"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(3) "123"
+string(1) "o"
+string(3) "123"
+string(1) "o"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation28_64bit.phpt b/ext/standard/tests/strings/sprintf_variation28_64bit.phpt
new file mode 100644
index 0000000..cd83093
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation28_64bit.phpt
@@ -0,0 +1,328 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with integer values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(22) "1777777777777777777777"
+string(1) "o"
+string(22) "1777777777777777777777"
+string(1) "o"
+string(23) " 1777777777777777777777"
+string(23) "1777777777777777777777 "
+string(23) " 1777777777777777777777"
+string(23) "
+1777777777777777777777"
+string(22) "1777777777777777777777"
+string(30) " 1777777777777777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(22) "1777777777760000000000"
+string(1) "o"
+string(22) "1777777777760000000000"
+string(1) "o"
+string(23) " 1777777777760000000000"
+string(23) "1777777777760000000000 "
+string(23) " 1777777777760000000000"
+string(23) "
+1777777777760000000000"
+string(22) "1777777777760000000000"
+string(30) " 1777777777760000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(22) "1777777777760000000001"
+string(1) "o"
+string(22) "1777777777760000000001"
+string(1) "o"
+string(23) " 1777777777760000000001"
+string(23) "1777777777760000000001 "
+string(23) " 1777777777760000000001"
+string(23) "
+1777777777760000000001"
+string(22) "1777777777760000000001"
+string(30) " 1777777777760000000001"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "17777777770"
+string(1) "o"
+string(11) "17777777770"
+string(1) "o"
+string(12) " 17777777770"
+string(12) "17777777770 "
+string(12) " 17777777770"
+string(12) "
+17777777770"
+string(11) "17777777770"
+string(30) " 17777777770"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(5) "11073"
+string(1) "o"
+string(5) "11073"
+string(1) "o"
+string(6) " 11073"
+string(6) "11073 "
+string(6) " 11073"
+string(6) "
+11073"
+string(5) "11073"
+string(30) " 11073"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(5) "11253"
+string(1) "o"
+string(5) "11253"
+string(1) "o"
+string(6) " 11253"
+string(6) "11253 "
+string(6) " 11253"
+string(6) "
+11253"
+string(5) "11253"
+string(30) " 11253"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(4) "7777"
+string(1) "o"
+string(4) "7777"
+string(1) "o"
+string(5) " 7777"
+string(5) "7777 "
+string(5) " 7777"
+string(5) "
+7777"
+string(4) "7777"
+string(30) " 7777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(3) "372"
+string(1) "o"
+string(3) "372"
+string(1) "o"
+string(4) " 372"
+string(4) "372 "
+string(4) " 372"
+string(4) "
+372"
+string(4) " 372"
+string(30) " 372"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(22) "1777777777760000000000"
+string(1) "o"
+string(22) "1777777777760000000000"
+string(1) "o"
+string(23) " 1777777777760000000000"
+string(23) "1777777777760000000000 "
+string(23) " 1777777777760000000000"
+string(23) "
+1777777777760000000000"
+string(22) "1777777777760000000000"
+string(30) " 1777777777760000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(3) "123"
+string(1) "o"
+string(3) "123"
+string(1) "o"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(22) "1777777777760000000000"
+string(1) "o"
+string(22) "1777777777760000000000"
+string(1) "o"
+string(23) " 1777777777760000000000"
+string(23) "1777777777760000000000 "
+string(23) " 1777777777760000000000"
+string(23) "
+1777777777760000000000"
+string(22) "1777777777760000000000"
+string(30) " 1777777777760000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation29.phpt b/ext/standard/tests/strings/sprintf_variation29.phpt
new file mode 100644
index 0000000..87ee835
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation29.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.5e+5
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with float values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(6) "303240"
+string(1) "o"
+string(6) "303240"
+string(1) "o"
+string(7) " 303240"
+string(7) "303240 "
+string(7) " 303240"
+string(7) "
+303240"
+string(6) "303240"
+string(30) " 303240"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(11) "37774136700"
+string(1) "o"
+string(11) "37774136700"
+string(1) "o"
+string(12) " 37774136700"
+string(12) "37774136700 "
+string(12) " 37774136700"
+string(12) "
+37774136700"
+string(11) "37774136700"
+string(30) " 37774136700"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(9) "575360400"
+string(1) "o"
+string(9) "575360400"
+string(1) "o"
+string(10) " 575360400"
+string(10) "575360400 "
+string(10) " 575360400"
+string(10) "
+575360400"
+string(9) "575360400"
+string(30) " 575360400"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "30431233000"
+string(1) "o"
+string(11) "30431233000"
+string(1) "o"
+string(12) " 30431233000"
+string(12) "30431233000 "
+string(12) " 30431233000"
+string(12) "
+30431233000"
+string(11) "30431233000"
+string(30) " 30431233000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(7) "4002620"
+string(1) "o"
+string(7) "4002620"
+string(1) "o"
+string(8) " 4002620"
+string(8) "4002620 "
+string(8) " 4002620"
+string(8) "
+4002620"
+string(7) "4002620"
+string(30) " 4002620"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation29_64bit.phpt b/ext/standard/tests/strings/sprintf_variation29_64bit.phpt
new file mode 100644
index 0000000..53b4561
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation29_64bit.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with float values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.5e+5
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with float values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(6) "303240"
+string(1) "o"
+string(6) "303240"
+string(1) "o"
+string(7) " 303240"
+string(7) "303240 "
+string(7) " 303240"
+string(7) "
+303240"
+string(6) "303240"
+string(30) " 303240"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(22) "1777777777777774136700"
+string(1) "o"
+string(22) "1777777777777774136700"
+string(1) "o"
+string(23) " 1777777777777774136700"
+string(23) "1777777777777774136700 "
+string(23) " 1777777777777774136700"
+string(23) "
+1777777777777774136700"
+string(22) "1777777777777774136700"
+string(30) " 1777777777777774136700"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(9) "575360400"
+string(1) "o"
+string(9) "575360400"
+string(1) "o"
+string(10) " 575360400"
+string(10) "575360400 "
+string(10) " 575360400"
+string(10) "
+575360400"
+string(9) "575360400"
+string(30) " 575360400"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(22) "1777777777770431233000"
+string(1) "o"
+string(22) "1777777777770431233000"
+string(1) "o"
+string(23) " 1777777777770431233000"
+string(23) "1777777777770431233000 "
+string(23) " 1777777777770431233000"
+string(23) "
+1777777777770431233000"
+string(22) "1777777777770431233000"
+string(30) " 1777777777770431233000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(7) "4002620"
+string(1) "o"
+string(7) "4002620"
+string(1) "o"
+string(8) " 4002620"
+string(8) "4002620 "
+string(8) " 4002620"
+string(8) "
+4002620"
+string(7) "4002620"
+string(30) " 4002620"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation3.phpt b/ext/standard/tests/strings/sprintf_variation3.phpt
new file mode 100644
index 0000000..51a89ea
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation3.phpt
@@ -0,0 +1,325 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with int values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with integer values ***\n";
+
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($valid_ints as $int_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $int_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(2) "-1"
+string(1) "d"
+string(2) "-1"
+string(1) "d"
+string(3) " -1"
+string(3) "-1 "
+string(3) " -1"
+string(3) "
+-1"
+string(4) " -1"
+string(30) " -1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(11) "-2147483647"
+string(1) "d"
+string(11) "-2147483647"
+string(1) "d"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "d"
+string(10) "2147483640"
+string(1) "d"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "d"
+string(4) "4667"
+string(1) "d"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "d"
+string(4) "4779"
+string(1) "d"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "d"
+string(4) "4095"
+string(1) "d"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "d"
+string(3) "250"
+string(1) "d"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "d"
+string(2) "83"
+string(1) "d"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 17 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation30.phpt b/ext/standard/tests/strings/sprintf_variation30.phpt
new file mode 100644
index 0000000..78d8e13
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation30.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "o"
+string(%d) "%d"
+string(1) "o"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(4) "%s%d"
+string(30) "%s%d"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "o"
+string(%d) "%d"
+string(1) "o"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(4) "%s%d"
+string(30) "%s%d"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation31.phpt b/ext/standard/tests/strings/sprintf_variation31.phpt
new file mode 100644
index 0000000..a081273
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation31.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with array values ***\n";
+
+// different arrays used to test the function
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(0123),
+ array(1 => "One", "two" => 2)
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation32.phpt b/ext/standard/tests/strings/sprintf_variation32.phpt
new file mode 100644
index 0000000..6caf8ee
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation32.phpt
@@ -0,0 +1,342 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "0123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(3) "173"
+string(1) "o"
+string(3) "173"
+string(1) "o"
+string(4) " 173"
+string(4) "173 "
+string(4) " 173"
+string(4) "
+173"
+string(4) " 173"
+string(30) " 173"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation33.phpt b/ext/standard/tests/strings/sprintf_variation33.phpt
new file mode 100644
index 0000000..e903108
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation33.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation34.phpt b/ext/standard/tests/strings/sprintf_variation34.phpt
new file mode 100644
index 0000000..c6186b6
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation34.phpt
@@ -0,0 +1,332 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "ffffffff"
+string(9) "ffffffffx"
+string(8) "ffffffff"
+string(1) "x"
+string(9) " ffffffff"
+string(9) "ffffffff "
+string(9) " ffffffff"
+string(9) "
+ffffffff"
+string(8) "ffffffff"
+string(30) " ffffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(8) "7ffffff8"
+string(9) "7ffffff8x"
+string(8) "7ffffff8"
+string(1) "x"
+string(9) " 7ffffff8"
+string(9) "7ffffff8 "
+string(9) " 7ffffff8"
+string(9) "
+7ffffff8"
+string(8) "7ffffff8"
+string(30) " 7ffffff8"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(4) "123b"
+string(5) "123bx"
+string(4) "123b"
+string(1) "x"
+string(5) " 123b"
+string(5) "123b "
+string(5) " 123b"
+string(5) "
+123b"
+string(4) "123b"
+string(30) " 123b"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(4) "12ab"
+string(5) "12abx"
+string(4) "12ab"
+string(1) "x"
+string(5) " 12ab"
+string(5) "12ab "
+string(5) " 12ab"
+string(5) "
+12ab"
+string(4) "12ab"
+string(30) " 12ab"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(3) "fff"
+string(4) "fffx"
+string(3) "fff"
+string(1) "x"
+string(4) " fff"
+string(4) "fff "
+string(4) " fff"
+string(4) "
+fff"
+string(4) " fff"
+string(30) " fff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(2) "fa"
+string(3) "fax"
+string(2) "fa"
+string(1) "x"
+string(3) " fa"
+string(3) "fa "
+string(3) " fa"
+string(3) "
+fa"
+string(4) " fa"
+string(30) " fa"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(2) "53"
+string(3) "53x"
+string(2) "53"
+string(1) "x"
+string(3) " 53"
+string(3) "53 "
+string(3) " 53"
+string(3) "
+53"
+string(4) " 53"
+string(30) " 53"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation34_64bit.phpt b/ext/standard/tests/strings/sprintf_variation34_64bit.phpt
new file mode 100644
index 0000000..f9a7805
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation34_64bit.phpt
@@ -0,0 +1,328 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with integer values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(16) "ffffffffffffffff"
+string(17) "ffffffffffffffffx"
+string(16) "ffffffffffffffff"
+string(1) "x"
+string(17) " ffffffffffffffff"
+string(17) "ffffffffffffffff "
+string(17) " ffffffffffffffff"
+string(17) "
+ffffffffffffffff"
+string(16) "ffffffffffffffff"
+string(30) " ffffffffffffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(16) "ffffffff80000000"
+string(17) "ffffffff80000000x"
+string(16) "ffffffff80000000"
+string(1) "x"
+string(17) " ffffffff80000000"
+string(17) "ffffffff80000000 "
+string(17) " ffffffff80000000"
+string(17) "
+ffffffff80000000"
+string(16) "ffffffff80000000"
+string(30) " ffffffff80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(16) "ffffffff80000001"
+string(17) "ffffffff80000001x"
+string(16) "ffffffff80000001"
+string(1) "x"
+string(17) " ffffffff80000001"
+string(17) "ffffffff80000001 "
+string(17) " ffffffff80000001"
+string(17) "
+ffffffff80000001"
+string(16) "ffffffff80000001"
+string(30) " ffffffff80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(8) "7ffffff8"
+string(9) "7ffffff8x"
+string(8) "7ffffff8"
+string(1) "x"
+string(9) " 7ffffff8"
+string(9) "7ffffff8 "
+string(9) " 7ffffff8"
+string(9) "
+7ffffff8"
+string(8) "7ffffff8"
+string(30) " 7ffffff8"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(4) "123b"
+string(5) "123bx"
+string(4) "123b"
+string(1) "x"
+string(5) " 123b"
+string(5) "123b "
+string(5) " 123b"
+string(5) "
+123b"
+string(4) "123b"
+string(30) " 123b"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(4) "12ab"
+string(5) "12abx"
+string(4) "12ab"
+string(1) "x"
+string(5) " 12ab"
+string(5) "12ab "
+string(5) " 12ab"
+string(5) "
+12ab"
+string(4) "12ab"
+string(30) " 12ab"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(3) "fff"
+string(4) "fffx"
+string(3) "fff"
+string(1) "x"
+string(4) " fff"
+string(4) "fff "
+string(4) " fff"
+string(4) "
+fff"
+string(4) " fff"
+string(30) " fff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(2) "fa"
+string(3) "fax"
+string(2) "fa"
+string(1) "x"
+string(3) " fa"
+string(3) "fa "
+string(3) " fa"
+string(3) "
+fa"
+string(4) " fa"
+string(30) " fa"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(16) "ffffffff80000000"
+string(17) "ffffffff80000000x"
+string(16) "ffffffff80000000"
+string(1) "x"
+string(17) " ffffffff80000000"
+string(17) "ffffffff80000000 "
+string(17) " ffffffff80000000"
+string(17) "
+ffffffff80000000"
+string(16) "ffffffff80000000"
+string(30) " ffffffff80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(2) "53"
+string(3) "53x"
+string(2) "53"
+string(1) "x"
+string(3) " 53"
+string(3) "53 "
+string(3) " 53"
+string(3) "
+53"
+string(4) " 53"
+string(30) " 53"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(16) "ffffffff80000000"
+string(17) "ffffffff80000000x"
+string(16) "ffffffff80000000"
+string(1) "x"
+string(17) " ffffffff80000000"
+string(17) "ffffffff80000000 "
+string(17) " ffffffff80000000"
+string(17) "
+ffffffff80000000"
+string(16) "ffffffff80000000"
+string(30) " ffffffff80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation35.phpt b/ext/standard/tests/strings/sprintf_variation35.phpt
new file mode 100644
index 0000000..ca6ba89
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation35.phpt
@@ -0,0 +1,237 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with float values ***
+
+-- Iteration 1 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(5) "186a0"
+string(6) "186a0x"
+string(5) "186a0"
+string(1) "x"
+string(6) " 186a0"
+string(6) "186a0 "
+string(6) " 186a0"
+string(6) "
+186a0"
+string(5) "186a0"
+string(30) " 186a0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(8) "fff0bdc0"
+string(9) "fff0bdc0x"
+string(8) "fff0bdc0"
+string(1) "x"
+string(9) " fff0bdc0"
+string(9) "fff0bdc0 "
+string(9) " fff0bdc0"
+string(9) "
+fff0bdc0"
+string(8) "fff0bdc0"
+string(30) " fff0bdc0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(7) "5f5e100"
+string(8) "5f5e100x"
+string(7) "5f5e100"
+string(1) "x"
+string(8) " 5f5e100"
+string(8) "5f5e100 "
+string(8) " 5f5e100"
+string(8) "
+5f5e100"
+string(7) "5f5e100"
+string(30) " 5f5e100"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(8) "c4653600"
+string(9) "c4653600x"
+string(8) "c4653600"
+string(1) "x"
+string(9) " c4653600"
+string(9) "c4653600 "
+string(9) " c4653600"
+string(9) "
+c4653600"
+string(8) "c4653600"
+string(30) " c4653600"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "a"
+string(2) "ax"
+string(1) "a"
+string(1) "x"
+string(2) " a"
+string(2) "a "
+string(2) " a"
+string(2) "
+a"
+string(4) " a"
+string(30) " a"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(6) "100590"
+string(7) "100590x"
+string(6) "100590"
+string(1) "x"
+string(7) " 100590"
+string(7) "100590 "
+string(7) " 100590"
+string(7) "
+100590"
+string(6) "100590"
+string(30) " 100590"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation35_64bit.phpt b/ext/standard/tests/strings/sprintf_variation35_64bit.phpt
new file mode 100644
index 0000000..09ae504
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation35_64bit.phpt
@@ -0,0 +1,233 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with float values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with float values ***
+
+-- Iteration 1 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(9) "800000001"
+string(10) "800000001x"
+string(9) "800000001"
+string(1) "x"
+string(10) " 800000001"
+string(10) "800000001 "
+string(10) " 800000001"
+string(10) "
+800000001"
+string(9) "800000001"
+string(30) " 800000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(5) "186a0"
+string(6) "186a0x"
+string(5) "186a0"
+string(1) "x"
+string(6) " 186a0"
+string(6) "186a0 "
+string(6) " 186a0"
+string(6) "
+186a0"
+string(5) "186a0"
+string(30) " 186a0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(16) "fffffffffff0bdc0"
+string(17) "fffffffffff0bdc0x"
+string(16) "fffffffffff0bdc0"
+string(1) "x"
+string(17) " fffffffffff0bdc0"
+string(17) "fffffffffff0bdc0 "
+string(17) " fffffffffff0bdc0"
+string(17) "
+fffffffffff0bdc0"
+string(16) "fffffffffff0bdc0"
+string(30) " fffffffffff0bdc0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(7) "5f5e100"
+string(8) "5f5e100x"
+string(7) "5f5e100"
+string(1) "x"
+string(8) " 5f5e100"
+string(8) "5f5e100 "
+string(8) " 5f5e100"
+string(8) "
+5f5e100"
+string(7) "5f5e100"
+string(30) " 5f5e100"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(16) "ffffffffc4653600"
+string(17) "ffffffffc4653600x"
+string(16) "ffffffffc4653600"
+string(1) "x"
+string(17) " ffffffffc4653600"
+string(17) "ffffffffc4653600 "
+string(17) " ffffffffc4653600"
+string(17) "
+ffffffffc4653600"
+string(16) "ffffffffc4653600"
+string(30) " ffffffffc4653600"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "a"
+string(2) "ax"
+string(1) "a"
+string(1) "x"
+string(2) " a"
+string(2) "a "
+string(2) " a"
+string(2) "
+a"
+string(4) " a"
+string(30) " a"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(6) "100590"
+string(7) "100590x"
+string(6) "100590"
+string(1) "x"
+string(7) " 100590"
+string(7) "100590 "
+string(7) " 100590"
+string(7) "
+100590"
+string(6) "100590"
+string(30) " 100590"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation36.phpt b/ext/standard/tests/strings/sprintf_variation36.phpt
new file mode 100644
index 0000000..d7d6999
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation36.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sprintf() : hexa formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%a"
+string(%d) "%ax"
+string(%d) "%a"
+string(1) "x"
+string(%d) " %a"
+string(%d) "%a "
+string(%d) " %a"
+string(%d) "
+%a"
+string(4) "%a"
+string(30) "%a"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(%d) "%a"
+string(%d) "%ax"
+string(%d) "%a"
+string(1) "x"
+string(%d) " %a"
+string(%d) "%a "
+string(%d) " %a"
+string(%d) "
+%a"
+string(4) "%a"
+string(30) "%a"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+===DONE===
diff --git a/ext/standard/tests/strings/sprintf_variation37.phpt b/ext/standard/tests/strings/sprintf_variation37.phpt
new file mode 100644
index 0000000..d1ecbfc
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation37.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation38.phpt b/ext/standard/tests/strings/sprintf_variation38.phpt
new file mode 100644
index 0000000..f9b4a7f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation38.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation39.phpt b/ext/standard/tests/strings/sprintf_variation39.phpt
new file mode 100644
index 0000000..dac4346
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation39.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation4.phpt b/ext/standard/tests/strings/sprintf_variation4.phpt
new file mode 100644
index 0000000..7fc66f9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation4.phpt
@@ -0,0 +1,237 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with float values ***\n";
+
+// array of float type values
+
+$float_values = array (
+ 2147483648,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with float values ***
+
+-- Iteration 1 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(11) "-2147483647"
+string(1) "d"
+string(11) "-2147483647"
+string(1) "d"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "d"
+string(6) "100000"
+string(1) "d"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(8) "-1000000"
+string(1) "d"
+string(8) "-1000000"
+string(1) "d"
+string(9) " -1000000"
+string(9) "-1000000 "
+string(9) " -1000000"
+string(9) "
+-1000000"
+string(8) "-1000000"
+string(30) " -1000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(9) "100000000"
+string(1) "d"
+string(9) "100000000"
+string(1) "d"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(11) "-1000000000"
+string(1) "d"
+string(11) "-1000000000"
+string(1) "d"
+string(12) " -1000000000"
+string(12) "-1000000000 "
+string(12) " -1000000000"
+string(12) "
+-1000000000"
+string(11) "-1000000000"
+string(30) " -1000000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(2) "10"
+string(1) "d"
+string(2) "10"
+string(1) "d"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(7) "1050000"
+string(1) "d"
+string(7) "1050000"
+string(1) "d"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation40.phpt b/ext/standard/tests/strings/sprintf_variation40.phpt
new file mode 100644
index 0000000..0da6a10
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation40.phpt
@@ -0,0 +1,333 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ +2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "4294967295"
+string(1) "u"
+string(10) "4294967295"
+string(1) "u"
+string(11) " 4294967295"
+string(11) "4294967295 "
+string(11) " 4294967295"
+string(11) "
+4294967295"
+string(10) "4294967295"
+string(30) " 4294967295"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "u"
+string(10) "2147483640"
+string(1) "u"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "u"
+string(4) "4667"
+string(1) "u"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "u"
+string(4) "4779"
+string(1) "u"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "u"
+string(4) "4095"
+string(1) "u"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "u"
+string(3) "250"
+string(1) "u"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "u"
+string(2) "83"
+string(1) "u"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation40_64bit.phpt b/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
new file mode 100644
index 0000000..da6f37a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
@@ -0,0 +1,329 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with integer values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ +2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(20) "18446744073709551615"
+string(1) "u"
+string(20) "18446744073709551615"
+string(1) "u"
+string(21) " 18446744073709551615"
+string(21) "18446744073709551615 "
+string(21) " 18446744073709551615"
+string(21) "
+18446744073709551615"
+string(20) "18446744073709551615"
+string(30) " 18446744073709551615"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(20) "18446744071562067968"
+string(1) "u"
+string(20) "18446744071562067968"
+string(1) "u"
+string(21) " 18446744071562067968"
+string(21) "18446744071562067968 "
+string(21) " 18446744071562067968"
+string(21) "
+18446744071562067968"
+string(20) "18446744071562067968"
+string(30) " 18446744071562067968"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(20) "18446744071562067969"
+string(1) "u"
+string(20) "18446744071562067969"
+string(1) "u"
+string(21) " 18446744071562067969"
+string(21) "18446744071562067969 "
+string(21) " 18446744071562067969"
+string(21) "
+18446744071562067969"
+string(20) "18446744071562067969"
+string(30) " 18446744071562067969"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "u"
+string(10) "2147483640"
+string(1) "u"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "u"
+string(4) "4667"
+string(1) "u"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "u"
+string(4) "4779"
+string(1) "u"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "u"
+string(4) "4095"
+string(1) "u"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "u"
+string(3) "250"
+string(1) "u"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(20) "18446744071562067968"
+string(1) "u"
+string(20) "18446744071562067968"
+string(1) "u"
+string(21) " 18446744071562067968"
+string(21) "18446744071562067968 "
+string(21) " 18446744071562067968"
+string(21) "
+18446744071562067968"
+string(20) "18446744071562067968"
+string(30) " 18446744071562067968"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "u"
+string(2) "83"
+string(1) "u"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(20) "18446744071562067968"
+string(1) "u"
+string(20) "18446744071562067968"
+string(1) "u"
+string(21) " 18446744071562067968"
+string(21) "18446744071562067968 "
+string(21) " 18446744071562067968"
+string(21) "
+18446744071562067968"
+string(20) "18446744071562067968"
+string(30) " 18446744071562067968"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation41.phpt b/ext/standard/tests/strings/sprintf_variation41.phpt
new file mode 100644
index 0000000..219ea0f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation41.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ +1e5,
+ +5e+5,
+ +0e-5,
+ -1e5,
+ -1e+5,
+ -1e-2,
+ 1e5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with float values ***
+
+-- Iteration 1 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(6) "500000"
+string(1) "u"
+string(6) "500000"
+string(1) "u"
+string(7) " 500000"
+string(7) "500000 "
+string(7) " 500000"
+string(7) "
+500000"
+string(6) "500000"
+string(30) " 500000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(10) "4294867296"
+string(1) "u"
+string(10) "4294867296"
+string(1) "u"
+string(11) " 4294867296"
+string(11) "4294867296 "
+string(11) " 4294867296"
+string(11) "
+4294867296"
+string(10) "4294867296"
+string(30) " 4294867296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(10) "4294867296"
+string(1) "u"
+string(10) "4294867296"
+string(1) "u"
+string(11) " 4294867296"
+string(11) "4294867296 "
+string(11) " 4294867296"
+string(11) "
+4294867296"
+string(10) "4294867296"
+string(30) " 4294867296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(9) "100000000"
+string(1) "u"
+string(9) "100000000"
+string(1) "u"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(10) "3294967296"
+string(1) "u"
+string(10) "3294967296"
+string(1) "u"
+string(11) " 3294967296"
+string(11) "3294967296 "
+string(11) " 3294967296"
+string(11) "
+3294967296"
+string(10) "3294967296"
+string(30) " 3294967296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(2) "10"
+string(1) "u"
+string(2) "10"
+string(1) "u"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(7) "1050000"
+string(1) "u"
+string(7) "1050000"
+string(1) "u"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation41_64bit.phpt b/ext/standard/tests/strings/sprintf_variation41_64bit.phpt
new file mode 100644
index 0000000..1435d02
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation41_64bit.phpt
@@ -0,0 +1,312 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with float values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ +1e5,
+ +5e+5,
+ +0e-5,
+ -1e5,
+ -1e+5,
+ -1e-2,
+ 1e5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with float values ***
+
+-- Iteration 1 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(11) "34359738369"
+string(1) "u"
+string(11) "34359738369"
+string(1) "u"
+string(12) " 34359738369"
+string(12) "34359738369 "
+string(12) " 34359738369"
+string(12) "
+34359738369"
+string(11) "34359738369"
+string(30) " 34359738369"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(6) "500000"
+string(1) "u"
+string(6) "500000"
+string(1) "u"
+string(7) " 500000"
+string(7) "500000 "
+string(7) " 500000"
+string(7) "
+500000"
+string(6) "500000"
+string(30) " 500000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(20) "18446744073709451616"
+string(1) "u"
+string(20) "18446744073709451616"
+string(1) "u"
+string(21) " 18446744073709451616"
+string(21) "18446744073709451616 "
+string(21) " 18446744073709451616"
+string(21) "
+18446744073709451616"
+string(20) "18446744073709451616"
+string(30) " 18446744073709451616"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(20) "18446744073709451616"
+string(1) "u"
+string(20) "18446744073709451616"
+string(1) "u"
+string(21) " 18446744073709451616"
+string(21) "18446744073709451616 "
+string(21) " 18446744073709451616"
+string(21) "
+18446744073709451616"
+string(20) "18446744073709451616"
+string(30) " 18446744073709451616"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(9) "100000000"
+string(1) "u"
+string(9) "100000000"
+string(1) "u"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(20) "18446744072709551616"
+string(1) "u"
+string(20) "18446744072709551616"
+string(1) "u"
+string(21) " 18446744072709551616"
+string(21) "18446744072709551616 "
+string(21) " 18446744072709551616"
+string(21) "
+18446744072709551616"
+string(20) "18446744072709551616"
+string(30) " 18446744072709551616"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(2) "10"
+string(1) "u"
+string(2) "10"
+string(1) "u"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(7) "1050000"
+string(1) "u"
+string(7) "1050000"
+string(1) "u"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation42.phpt b/ext/standard/tests/strings/sprintf_variation42.phpt
new file mode 100644
index 0000000..f9f7dd6
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation42.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "u"
+string(%d) "%d"
+string(1) "u"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(4) "%s%d"
+string(30) "%s%d"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "u"
+string(%d) "%d"
+string(1) "u"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(4) "%s%d"
+string(30) "%s%d"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation43.phpt b/ext/standard/tests/strings/sprintf_variation43.phpt
new file mode 100644
index 0000000..86527a5
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation43.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(-12345),
+ array(+12345),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation44.phpt b/ext/standard/tests/strings/sprintf_variation44.phpt
new file mode 100644
index 0000000..fd4e0bc
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation44.phpt
@@ -0,0 +1,365 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with string values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "-123",
+ "+123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "4294967173"
+string(1) "u"
+string(10) "4294967173"
+string(1) "u"
+string(11) " 4294967173"
+string(11) "4294967173 "
+string(11) " 4294967173"
+string(11) "
+4294967173"
+string(10) "4294967173"
+string(30) " 4294967173"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(3) "123"
+string(1) "u"
+string(3) "123"
+string(1) "u"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 20 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation44_64bit.phpt b/ext/standard/tests/strings/sprintf_variation44_64bit.phpt
new file mode 100644
index 0000000..096e7e6
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation44_64bit.phpt
@@ -0,0 +1,361 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with string values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "-123",
+ "+123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(20) "18446744073709551493"
+string(1) "u"
+string(20) "18446744073709551493"
+string(1) "u"
+string(21) " 18446744073709551493"
+string(21) "18446744073709551493 "
+string(21) " 18446744073709551493"
+string(21) "
+18446744073709551493"
+string(20) "18446744073709551493"
+string(30) " 18446744073709551493"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(3) "123"
+string(1) "u"
+string(3) "123"
+string(1) "u"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 20 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation45.phpt b/ext/standard/tests/strings/sprintf_variation45.phpt
new file mode 100644
index 0000000..e8219fc
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation45.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation46.phpt b/ext/standard/tests/strings/sprintf_variation46.phpt
new file mode 100644
index 0000000..36aef14
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation46.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with integer values ***\n";
+
+// array of integer values
+$integer_values = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777 // max positive integer as octal
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with integer values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(12) "-1.000000e+0"
+string(1) "e"
+string(12) "-1.000000e+0"
+string(1) "e"
+string(13) " -1.000000e+0"
+string(13) "-1.000000e+0 "
+string(13) " -1.000000e+0"
+string(13) "
+-1.000000e+0"
+string(12) "-1.000000e+0"
+string(30) " -1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "4.667000e+3"
+string(1) "e"
+string(11) "4.667000e+3"
+string(1) "e"
+string(12) " 4.667000e+3"
+string(12) "4.667000e+3 "
+string(12) " 4.667000e+3"
+string(12) "
+4.667000e+3"
+string(11) "4.667000e+3"
+string(30) " 4.667000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "4.779000e+3"
+string(1) "e"
+string(11) "4.779000e+3"
+string(1) "e"
+string(12) " 4.779000e+3"
+string(12) "4.779000e+3 "
+string(12) " 4.779000e+3"
+string(12) "
+4.779000e+3"
+string(11) "4.779000e+3"
+string(30) " 4.779000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "4.095000e+3"
+string(1) "e"
+string(11) "4.095000e+3"
+string(1) "e"
+string(12) " 4.095000e+3"
+string(12) "4.095000e+3 "
+string(12) " 4.095000e+3"
+string(12) "
+4.095000e+3"
+string(11) "4.095000e+3"
+string(30) " 4.095000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "2.500000e+2"
+string(1) "e"
+string(11) "2.500000e+2"
+string(1) "e"
+string(12) " 2.500000e+2"
+string(12) "2.500000e+2 "
+string(12) " 2.500000e+2"
+string(12) "
+2.500000e+2"
+string(11) "2.500000e+2"
+string(30) " 2.500000e+2"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "8.300000e+1"
+string(1) "e"
+string(11) "8.300000e+1"
+string(1) "e"
+string(12) " 8.300000e+1"
+string(12) "8.300000e+1 "
+string(12) " 8.300000e+1"
+string(12) "
+8.300000e+1"
+string(11) "8.300000e+1"
+string(30) " 8.300000e+1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation47.phpt b/ext/standard/tests/strings/sprintf_variation47.phpt
new file mode 100644
index 0000000..4a100ef
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation47.phpt
@@ -0,0 +1,343 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ -2147483649,
+ 2147483648,
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e5,
+ -1e5,
+ +1e5,
+ 1e+5,
+ -1e-5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with float values ***
+
+-- Iteration 1 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(12) "3.435974e+10"
+string(1) "e"
+string(12) "3.435974e+10"
+string(1) "e"
+string(13) " 3.435974e+10"
+string(13) "3.435974e+10 "
+string(13) " 3.435974e+10"
+string(13) "
+3.435974e+10"
+string(12) "3.435974e+10"
+string(30) " 3.435974e+10"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(12) "-1.000000e-1"
+string(1) "e"
+string(12) "-1.000000e-1"
+string(1) "e"
+string(13) " -1.000000e-1"
+string(13) "-1.000000e-1 "
+string(13) " -1.000000e-1"
+string(13) "
+-1.000000e-1"
+string(12) "-1.000000e-1"
+string(30) " -1.000000e-1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(12) "-1.000000e+5"
+string(1) "e"
+string(12) "-1.000000e+5"
+string(1) "e"
+string(13) " -1.000000e+5"
+string(13) "-1.000000e+5 "
+string(13) " -1.000000e+5"
+string(13) "
+-1.000000e+5"
+string(12) "-1.000000e+5"
+string(30) " -1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(12) "-1.000000e+5"
+string(1) "e"
+string(12) "-1.000000e+5"
+string(1) "e"
+string(13) " -1.000000e+5"
+string(13) "-1.000000e+5 "
+string(13) " -1.000000e+5"
+string(13) "
+-1.000000e+5"
+string(12) "-1.000000e+5"
+string(30) " -1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(12) "-1.000000e-5"
+string(1) "e"
+string(12) "-1.000000e-5"
+string(1) "e"
+string(13) " -1.000000e-5"
+string(13) "-1.000000e-5 "
+string(13) " -1.000000e-5"
+string(13) "
+-1.000000e-5"
+string(12) "-1.000000e-5"
+string(30) " -1.000000e-5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "1.000000e+8"
+string(1) "e"
+string(11) "1.000000e+8"
+string(1) "e"
+string(12) " 1.000000e+8"
+string(12) "1.000000e+8 "
+string(12) " 1.000000e+8"
+string(12) "
+1.000000e+8"
+string(11) "1.000000e+8"
+string(30) " 1.000000e+8"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(12) "-1.000000e+9"
+string(1) "e"
+string(12) "-1.000000e+9"
+string(1) "e"
+string(13) " -1.000000e+9"
+string(13) "-1.000000e+9 "
+string(13) " -1.000000e+9"
+string(13) "
+-1.000000e+9"
+string(12) "-1.000000e+9"
+string(30) " -1.000000e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "1.000000e+1"
+string(1) "e"
+string(11) "1.000000e+1"
+string(1) "e"
+string(12) " 1.000000e+1"
+string(12) "1.000000e+1 "
+string(12) " 1.000000e+1"
+string(12) "
+1.000000e+1"
+string(11) "1.000000e+1"
+string(30) " 1.000000e+1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 19 --
+string(11) "1.050000e+6"
+string(1) "e"
+string(11) "1.050000e+6"
+string(1) "e"
+string(12) " 1.050000e+6"
+string(12) "1.050000e+6 "
+string(12) " 1.050000e+6"
+string(12) "
+1.050000e+6"
+string(11) "1.050000e+6"
+string(30) " 1.050000e+6"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation48.phpt b/ext/standard/tests/strings/sprintf_variation48.phpt
new file mode 100644
index 0000000..758b705
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation48.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sprintf() : scientific formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%f"
+string(1) "e"
+string(%d) "%f"
+string(1) "e"
+string(%d) " %f"
+string(%d) "%f "
+string(%d) " %f"
+string(%d) "
+%f"
+string(%d) "%f"
+string(30) "%s%f"
+string(%d) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(%d) "%f"
+string(1) "e"
+string(%d) "%f"
+string(1) "e"
+string(%d) " %f"
+string(%d) "%f "
+string(%d) " %f"
+string(%d) "
+%f"
+string(%d) "%f"
+string(30) "%s%f"
+string(%d) "0-1]"
+string(1) "e"
+===DONE===
diff --git a/ext/standard/tests/strings/sprintf_variation49.phpt b/ext/standard/tests/strings/sprintf_variation49.phpt
new file mode 100644
index 0000000..554b43a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation49.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(100000000000),
+ array(.0000001),
+ array(10e2),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with array values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation4_64bit.phpt b/ext/standard/tests/strings/sprintf_variation4_64bit.phpt
new file mode 100644
index 0000000..21bb391
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation4_64bit.phpt
@@ -0,0 +1,233 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with float values
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with float values ***\n";
+
+// array of float type values
+
+$float_values = array (
+ 2147483648,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with float values ***
+
+-- Iteration 1 --
+string(10) "2147483648"
+string(1) "d"
+string(10) "2147483648"
+string(1) "d"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(11) "34359738369"
+string(1) "d"
+string(11) "34359738369"
+string(1) "d"
+string(12) " 34359738369"
+string(12) "34359738369 "
+string(12) " 34359738369"
+string(12) "
+34359738369"
+string(11) "34359738369"
+string(30) " 34359738369"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(10) "2147483649"
+string(1) "d"
+string(10) "2147483649"
+string(1) "d"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "d"
+string(6) "100000"
+string(1) "d"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(8) "-1000000"
+string(1) "d"
+string(8) "-1000000"
+string(1) "d"
+string(9) " -1000000"
+string(9) "-1000000 "
+string(9) " -1000000"
+string(9) "
+-1000000"
+string(8) "-1000000"
+string(30) " -1000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(9) "100000000"
+string(1) "d"
+string(9) "100000000"
+string(1) "d"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(11) "-1000000000"
+string(1) "d"
+string(11) "-1000000000"
+string(1) "d"
+string(12) " -1000000000"
+string(12) "-1000000000 "
+string(12) " -1000000000"
+string(12) "
+-1000000000"
+string(11) "-1000000000"
+string(30) " -1000000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(2) "10"
+string(1) "d"
+string(2) "10"
+string(1) "d"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(7) "1050000"
+string(1) "d"
+string(7) "1050000"
+string(1) "d"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation5.phpt b/ext/standard/tests/strings/sprintf_variation5.phpt
new file mode 100644
index 0000000..ee13d3d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation5.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+$fp_copy = $fp;
+$dfp_copy = $dfp;
+
+// array of resource types
+$resource_types = array (
+ $fp_copy,
+ $dfp_copy
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%Ld", " %d",
+ "\t%d", "\n%d", "%4d",
+ "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($resource_types as $res) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $res) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+closedir($dfp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "d"
+string(%d) " %d"
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) "%s%d"
+string(%d) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "d"
+string(%d) " %d"
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) "%s%d"
+string(%d) "0-9]"
+string(1) "d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation50.phpt b/ext/standard/tests/strings/sprintf_variation50.phpt
new file mode 100644
index 0000000..62bae0e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation50.phpt
@@ -0,0 +1,343 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+ "333333333333333333333333333333"
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with string values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 19 --
+string(12) "3.333333e+29"
+string(1) "e"
+string(12) "3.333333e+29"
+string(1) "e"
+string(13) " 3.333333e+29"
+string(13) "3.333333e+29 "
+string(13) " 3.333333e+29"
+string(13) "
+3.333333e+29"
+string(12) "3.333333e+29"
+string(30) " 3.333333e+29"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation51.phpt b/ext/standard/tests/strings/sprintf_variation51.phpt
new file mode 100644
index 0000000..d988aa7
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation51.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with boolean values ***
+
+-- Iteration 1 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation52.phpt b/ext/standard/tests/strings/sprintf_variation52.phpt
new file mode 100644
index 0000000..996434f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation52.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test sprintf() function : usage variations - typical format strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with typical format strings ***\n";
+
+// initialising required variables
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n-- Testing for '%%%.2f' as the format parameter --\n";
+var_dump(sprintf("%%%.2f", 1.23456789e10));
+
+echo"\n-- Testing for '%%' as the format parameter --\n";
+var_dump(sprintf("%%", 1.23456789e10));
+
+echo"\n-- Testing for precision value more than maximum --\n";
+var_dump(sprintf("%.988f", 1.23456789e10));
+
+echo"\n-- Testing for invalid width(-15) specifier --\n";
+var_dump(sprintf("%030.-15s", $tempstring));
+
+echo"\n-- Testing for '%X' as the format parameter --\n";
+var_dump(sprintf("%X", 12));
+
+echo"\n-- Testing for multiple format parameters --\n";
+var_dump(sprintf("%d %s %d\n", $tempnum, $tempstring, $tempnum));
+
+echo"\n-- Testing for excess of mixed type arguments --\n";
+var_dump(sprintf("%s", $tempstring, $tempstring, $tempstring));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with typical format strings ***
+
+-- Testing for '%%%.2f' as the format parameter --
+string(15) "%12345678900.00"
+
+-- Testing for '%%' as the format parameter --
+string(1) "%"
+
+-- Testing for precision value more than maximum --
+
+Notice: sprintf(): Requested precision of 988 digits was truncated to PHP maximum of %d digits in %s on line %d
+string(65) "12345678900.00000000000000000000000000000000000000000000000000000"
+
+-- Testing for invalid width(-15) specifier --
+string(3) "15s"
+
+-- Testing for '%X' as the format parameter --
+string(1) "C"
+
+-- Testing for multiple format parameters --
+string(39) "12345 abcdefghjklmnpqrstuvwxyz 12345
+"
+
+-- Testing for excess of mixed type arguments --
+string(24) "abcdefghjklmnpqrstuvwxyz"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation53.phpt b/ext/standard/tests/strings/sprintf_variation53.phpt
new file mode 100644
index 0000000..427d0d9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation53.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test sprintf() function : usage variations - with whitespaces in format strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d", "% d", "% d",
+ "% f", "% f", "% f",
+ "% F", "% F", "% F",
+ "% b", "% b", "% b",
+ "% c", "% c", "% c",
+ "% e", "% e", "% e",
+ "% u", "% u", "% u",
+ "% o", "% o", "% o",
+ "% x", "% x", "% x",
+ "% X", "% X", "% X",
+ "% E", "% E", "% E"
+);
+
+// initializing the args array
+
+foreach($formats as $format) {
+ var_dump( sprintf($format, 1234) );
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with white spaces in format strings ***
+string(4) "1234"
+string(4) "1234"
+string(4) "1234"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "10011010010"
+string(11) "10011010010"
+string(11) "10011010010"
+string(1) "Ò"
+string(1) "Ò"
+string(1) "Ò"
+string(11) "1.234000e+3"
+string(11) "1.234000e+3"
+string(11) "1.234000e+3"
+string(4) "1234"
+string(4) "1234"
+string(4) "1234"
+string(4) "2322"
+string(4) "2322"
+string(4) "2322"
+string(3) "4d2"
+string(3) "4d2"
+string(3) "4d2"
+string(3) "4D2"
+string(3) "4D2"
+string(3) "4D2"
+string(11) "1.234000E+3"
+string(11) "1.234000E+3"
+string(11) "1.234000E+3"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation6.phpt b/ext/standard/tests/strings/sprintf_variation6.phpt
new file mode 100644
index 0000000..362c90d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation6.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with arrays
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with arrays ***\n";
+
+// different arrays used to test the function
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(-123),
+ array("123"),
+ array("-123"),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($array_types as $arr) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $arr) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with arrays ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation7.phpt b/ext/standard/tests/strings/sprintf_variation7.phpt
new file mode 100644
index 0000000..30e9aa5
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation7.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with boolean values ***\n";
+
+// array of boolean type values
+$boolean_values = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation8.phpt b/ext/standard/tests/strings/sprintf_variation8.phpt
new file mode 100644
index 0000000..9bec938
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation8.phpt
@@ -0,0 +1,374 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with string values ***\n";
+
+// array of strings used to test the function
+$string_values = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "-123abc",
+ "123abc",
+ "+123abc",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(4) "-123"
+string(1) "d"
+string(4) "-123"
+string(1) "d"
+string(5) " -123"
+string(5) "-123 "
+string(5) " -123"
+string(5) "
+-123"
+string(4) "-123"
+string(30) " -123"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(3) "123"
+string(1) "d"
+string(3) "123"
+string(1) "d"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(3) "123"
+string(1) "d"
+string(3) "123"
+string(1) "d"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 20 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 21 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation9.phpt b/ext/standard/tests/strings/sprintf_variation9.phpt
new file mode 100644
index 0000000..6511d1a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation9.phpt
@@ -0,0 +1,519 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with float values ***\n";
+
+// array of float type values
+
+$float_values = array (
+-2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f",
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with float values ***
+
+-- Iteration 1 --
+string(18) "-2147483649.000000"
+string(1) "f"
+string(18) "-2147483649.000000"
+string(1) "f"
+string(19) " -2147483649.000000"
+string(19) "-2147483649.000000 "
+string(19) " -2147483649.000000"
+string(19) "
+-2147483649.000000"
+string(18) "-2147483649.000000"
+string(30) " -2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(17) "2147483648.000000"
+string(1) "f"
+string(17) "2147483648.000000"
+string(1) "f"
+string(18) " 2147483648.000000"
+string(18) "2147483648.000000 "
+string(18) " 2147483648.000000"
+string(18) "
+2147483648.000000"
+string(17) "2147483648.000000"
+string(30) " 2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(18) "-2147483649.000000"
+string(1) "f"
+string(18) "-2147483649.000000"
+string(1) "f"
+string(19) " -2147483649.000000"
+string(19) "-2147483649.000000 "
+string(19) " -2147483649.000000"
+string(19) "
+-2147483649.000000"
+string(18) "-2147483649.000000"
+string(30) " -2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(18) "34359738369.000000"
+string(1) "f"
+string(18) "34359738369.000000"
+string(1) "f"
+string(19) " 34359738369.000000"
+string(19) "34359738369.000000 "
+string(19) " 34359738369.000000"
+string(19) "
+34359738369.000000"
+string(18) "34359738369.000000"
+string(30) " 34359738369.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(17) "2147483649.000000"
+string(1) "f"
+string(17) "2147483649.000000"
+string(1) "f"
+string(18) " 2147483649.000000"
+string(18) "2147483649.000000 "
+string(18) " 2147483649.000000"
+string(18) "
+2147483649.000000"
+string(17) "2147483649.000000"
+string(30) " 2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(18) "-2147483649.000000"
+string(1) "f"
+string(18) "-2147483649.000000"
+string(1) "f"
+string(19) " -2147483649.000000"
+string(19) "-2147483649.000000 "
+string(19) " -2147483649.000000"
+string(19) "
+-2147483649.000000"
+string(18) "-2147483649.000000"
+string(30) " -2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(9) "-0.100000"
+string(1) "f"
+string(9) "-0.100000"
+string(1) "f"
+string(10) " -0.100000"
+string(10) "-0.100000 "
+string(10) " -0.100000"
+string(10) "
+-0.100000"
+string(9) "-0.100000"
+string(30) " -0.100000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(9) "10.000000"
+string(1) "f"
+string(9) "10.000000"
+string(1) "f"
+string(10) " 10.000000"
+string(10) "10.000000 "
+string(10) " 10.000000"
+string(10) "
+10.000000"
+string(9) "10.000000"
+string(30) " 10.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(14) "1050000.000000"
+string(1) "f"
+string(14) "1050000.000000"
+string(1) "f"
+string(15) " 1050000.000000"
+string(15) "1050000.000000 "
+string(15) " 1050000.000000"
+string(15) "
+1050000.000000"
+string(14) "1050000.000000"
+string(30) " 1050000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "0.000010"
+string(1) "f"
+string(8) "0.000010"
+string(1) "f"
+string(9) " 0.000010"
+string(9) "0.000010 "
+string(9) " 0.000010"
+string(9) "
+0.000010"
+string(8) "0.000010"
+string(30) " 0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(9) "-0.000010"
+string(1) "f"
+string(9) "-0.000010"
+string(1) "f"
+string(10) " -0.000010"
+string(10) "-0.000010 "
+string(10) " -0.000010"
+string(10) "
+-0.000010"
+string(9) "-0.000010"
+string(30) " -0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 19 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 20 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 21 --
+string(8) "0.000010"
+string(1) "f"
+string(8) "0.000010"
+string(1) "f"
+string(9) " 0.000010"
+string(9) "0.000010 "
+string(9) " 0.000010"
+string(9) "
+0.000010"
+string(8) "0.000010"
+string(30) " 0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 22 --
+string(9) "-0.000010"
+string(1) "f"
+string(9) "-0.000010"
+string(1) "f"
+string(10) " -0.000010"
+string(10) "-0.000010 "
+string(10) " -0.000010"
+string(10) "
+-0.000010"
+string(9) "-0.000010"
+string(30) " -0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 23 --
+string(14) "5000000.000000"
+string(1) "f"
+string(14) "5000000.000000"
+string(1) "f"
+string(15) " 5000000.000000"
+string(15) "5000000.000000 "
+string(15) " 5000000.000000"
+string(15) "
+5000000.000000"
+string(14) "5000000.000000"
+string(30) " 5000000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 24 --
+string(15) "-5000000.000000"
+string(1) "f"
+string(15) "-5000000.000000"
+string(1) "f"
+string(16) " -5000000.000000"
+string(16) "-5000000.000000 "
+string(16) " -5000000.000000"
+string(16) "
+-5000000.000000"
+string(15) "-5000000.000000"
+string(30) " -5000000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 25 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 26 --
+string(9) "-0.000000"
+string(1) "f"
+string(9) "-0.000000"
+string(1) "f"
+string(10) " -0.000000"
+string(10) "-0.000000 "
+string(10) " -0.000000"
+string(10) "
+-0.000000"
+string(9) "-0.000000"
+string(30) " -0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 27 --
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(51) " 5000000000000000069686058479707049565356032.000000"
+string(51) "5000000000000000069686058479707049565356032.000000 "
+string(51) " 5000000000000000069686058479707049565356032.000000"
+string(51) "
+5000000000000000069686058479707049565356032.000000"
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 28 --
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(52) " -5000000000000000069686058479707049565356032.000000"
+string(52) "-5000000000000000069686058479707049565356032.000000 "
+string(52) " -5000000000000000069686058479707049565356032.000000"
+string(52) "
+-5000000000000000069686058479707049565356032.000000"
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 29 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 30 --
+string(9) "-0.000000"
+string(1) "f"
+string(9) "-0.000000"
+string(1) "f"
+string(10) " -0.000000"
+string(10) "-0.000000 "
+string(10) " -0.000000"
+string(10) "
+-0.000000"
+string(9) "-0.000000"
+string(30) " -0.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sscanf_basic1.phpt b/ext/standard/tests/strings/sscanf_basic1.phpt
new file mode 100644
index 0000000..dadafbd
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic1.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sscanf() function : basic functionality - string format
+--FILE--
+<?php
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing sscanf() : basic functionality
+*/
+
+echo "*** Testing sscanf() : basic functionality - using string format ***\n";
+
+$str = "Part: Widget Serial Number: 1234789 Stock: 25";
+$format = "Part: %s Serial Number: %s Stock: %s";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($part, $number, $stock) = sscanf($str, $format);
+var_dump($part, $number, $stock);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format, $part, $number, $stock);
+var_dump($res, $part, $number, $stock);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality - using string format ***
+
+-- Try sccanf() WITHOUT optional args --
+string(6) "Widget"
+string(7) "1234789"
+string(2) "25"
+
+-- Try sccanf() WITH optional args --
+int(3)
+string(6) "Widget"
+string(7) "1234789"
+string(2) "25"
+===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic2.phpt b/ext/standard/tests/strings/sscanf_basic2.phpt
new file mode 100644
index 0000000..693a307
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic2.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sscanf() function : basic functionality - integer format
+--FILE--
+<?php
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing sscanf() : basic functionality
+*/
+
+echo "*** Testing sscanf() : basic functionality - using integer format ***\n";
+
+$str = "Part: Widget Serial Number: 1234789 Stock: 25";
+$format = "Part: %s Serial Number: %d Stock: %d";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($part, $number, $stock) = sscanf($str, $format);
+var_dump($part, $number, $stock);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format, $part, $number, $stock);
+var_dump($res, $part, $number, $stock);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality - using integer format ***
+
+-- Try sccanf() WITHOUT optional args --
+string(6) "Widget"
+int(1234789)
+int(25)
+
+-- Try sccanf() WITH optional args --
+int(3)
+string(6) "Widget"
+int(1234789)
+int(25)
+===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic3.phpt b/ext/standard/tests/strings/sscanf_basic3.phpt
new file mode 100644
index 0000000..de910ef
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test sscanf() function : basic functionality - float format
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() : basic functionality -- using float format ***\n";
+
+$str = "Part: Widget Length: 111.53 Width: 22.345 Depth: 12.4";
+$format = "Part: %s Length: %f Width: %f Depth: %f";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($part, $length, $width, $depth) = sscanf($str, $format);
+var_dump($part, $length, $width, $depth);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format, $part, $length, $width, $depth);
+var_dump($res, $part, $length, $width, $depth);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality -- using float format ***
+
+-- Try sccanf() WITHOUT optional args --
+string(6) "Widget"
+float(111.53)
+float(22.345)
+float(12.4)
+
+-- Try sccanf() WITH optional args --
+int(4)
+string(6) "Widget"
+float(111.53)
+float(22.345)
+float(12.4)
+===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic4.phpt b/ext/standard/tests/strings/sscanf_basic4.phpt
new file mode 100644
index 0000000..8ce44ff
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic4.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test sscanf() function : basic functionality - char format
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() : basic functionality - using char format ***\n";
+
+$str = "X = A + B - C";
+$format = "%c = %c + %c - %c";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($arg1, $arg2, $arg3, $arg4) = sscanf($str, $format);
+var_dump($arg1, $arg2, $arg3, $arg4);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4);
+var_dump($res, $arg1, $arg2, $arg3, $arg4);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality - using char format ***
+
+-- Try sccanf() WITHOUT optional args --
+string(1) "X"
+string(1) "A"
+string(1) "B"
+string(1) "C"
+
+-- Try sccanf() WITH optional args --
+int(4)
+string(1) "X"
+string(1) "A"
+string(1) "B"
+string(1) "C"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/sscanf_basic5.phpt b/ext/standard/tests/strings/sscanf_basic5.phpt
new file mode 100644
index 0000000..5dbbf44
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic5.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test sscanf() function : basic functionality - exponential format
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() : basic functionality -using exponential format ***\n";
+
+$str = "10.12345 10.12345E3 10.12345e3 -10.12345e4" ;
+$format1 = "%e %e %e %e";
+$format2 = "%E %E %E %E";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($arg1, $arg2, $arg3, $arg4) = sscanf($str, $format1);
+var_dump($arg1, $arg2, $arg3, $arg4);
+list($arg1, $arg2, $arg3, $arg4) = sscanf($str, $format2);
+var_dump($arg1, $arg2, $arg3, $arg4);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format1, $arg1, $arg2, $arg3, $arg4);
+var_dump($res, $arg1, $arg2, $arg3, $arg4);
+$res = sscanf($str, $format2,$arg1, $arg2, $arg3, $arg4);
+var_dump($res, $arg1, $arg2, $arg3, $arg4);
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality -using exponential format ***
+
+-- Try sccanf() WITHOUT optional args --
+float(10.12345)
+float(10123.45)
+float(10123.45)
+float(-101234.5)
+float(10.12345)
+float(10123.45)
+float(10123.45)
+float(-101234.5)
+
+-- Try sccanf() WITH optional args --
+int(4)
+float(10.12345)
+float(10123.45)
+float(10123.45)
+float(-101234.5)
+int(4)
+float(10.12345)
+float(10123.45)
+float(10123.45)
+float(-101234.5)
+===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic6.phpt b/ext/standard/tests/strings/sscanf_basic6.phpt
new file mode 100644
index 0000000..6efdd0b
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic6.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test sscanf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() : basic functionality - using unsigned format ***\n";
+
+$str = "-11 +11 11 -11.234 +11.234 11.234";
+$format = "%u %u %u %u %u %u";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format);
+var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality - using unsigned format ***
+
+-- Try sccanf() WITHOUT optional args --
+string(10) "4294967285"
+int(11)
+int(11)
+string(10) "4294967285"
+NULL
+NULL
+
+-- Try sccanf() WITH optional args --
+int(4)
+string(10) "4294967285"
+int(11)
+int(11)
+string(10) "4294967285"
+NULL
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic7.phpt b/ext/standard/tests/strings/sscanf_basic7.phpt
new file mode 100644
index 0000000..1d54054
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic7.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test sscanf() function : basic functionality - octal format
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() : basic functionality - using octal format ***\n";
+
+$str = "0123 -0123 +0123 0129 -0129 +0129";
+$format = "%o %o %o %o %o %o";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format);
+var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality - using octal format ***
+
+-- Try sccanf() WITHOUT optional args --
+int(83)
+int(-83)
+int(83)
+int(10)
+NULL
+NULL
+
+-- Try sccanf() WITH optional args --
+int(4)
+int(83)
+int(-83)
+int(83)
+int(10)
+NULL
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic8.phpt b/ext/standard/tests/strings/sscanf_basic8.phpt
new file mode 100644
index 0000000..4773f02
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_basic8.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test sscanf() function : basic functionality - hexadecimal format
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() : basic functionality - - using hexadecimal format ***\n";
+
+$str = "129 12F 123B -123B 01ABC 1G";
+$format1 = "%x %x %x %x %x %x";
+$format2 = "%X %X %X %X %X %X";
+
+echo "\n-- Try sccanf() WITHOUT optional args --\n";
+// extract details using short format
+list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format1);
+var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format2);
+var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+
+echo "\n-- Try sccanf() WITH optional args --\n";
+// extract details using long format
+$res = sscanf($str, $format1, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+$res = sscanf($str, $format2, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing sscanf() : basic functionality - - using hexadecimal format ***
+
+-- Try sccanf() WITHOUT optional args --
+int(297)
+int(303)
+int(4667)
+int(-4667)
+int(6844)
+int(1)
+int(297)
+int(303)
+int(4667)
+int(-4667)
+int(6844)
+int(1)
+
+-- Try sccanf() WITH optional args --
+int(6)
+int(297)
+int(303)
+int(4667)
+int(-4667)
+int(6844)
+int(1)
+int(6)
+int(297)
+int(303)
+int(4667)
+int(-4667)
+int(6844)
+int(1)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt
new file mode 100644
index 0000000..8d883a1
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sscanf() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing sscanf() : error conditions ***\n";
+
+$str = "Hello World";
+$format = "%s %s";
+
+echo "\n-- Testing sscanf() function with no arguments --\n";
+var_dump( sscanf() );
+
+echo "\n-- Testing sscanf() function with one argument --\n";
+var_dump( sscanf($str) );
+
+echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n";
+
+var_dump( sscanf($str, $format, $str1, $str2, $extra_str) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sscanf() : error conditions ***
+
+-- Testing sscanf() function with no arguments --
+
+Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing sscanf() function with one argument --
+
+Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+-- Testing sscanf() function with more than expected no. of arguments --
+
+Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
+int(-1)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/sscanf_variation1.phpt b/ext/standard/tests/strings/sscanf_variation1.phpt
new file mode 100644
index 0000000..9bbf2c8
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_variation1.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test sscanf() function : usage variations - unexpected inputs for '$str' argument
+--FILE--
+<?php
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() function: with unexpected inputs for 'str' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*16*/ NULL,
+ null,
+
+ // objects
+/*18*/ new sample(),
+
+ // resource
+/*19*/ $file_handle,
+
+ // undefined variable
+/*20*/ @$undefined_var,
+
+ // unset variable
+/*21*/ @$unset_var
+);
+
+//defining '$pad_length' argument
+$format = "%s";
+
+// loop through with each element of the $inputs array to test sscanf() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( sscanf($input, $format) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sscanf() function: with unexpected inputs for 'str' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(2) "-2"
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(10) "2147483647"
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(11) "-2147483648"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(5) "-20.5"
+}
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(12) "101234567000"
+}
+-- Iteration 9 --
+
+Warning: sscanf() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: sscanf() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: sscanf() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 13 --
+NULL
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 15 --
+NULL
+-- Iteration 16 --
+NULL
+-- Iteration 17 --
+NULL
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(6) "sample"
+}
+-- Iteration 19 --
+
+Warning: sscanf() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 20 --
+NULL
+-- Iteration 21 --
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/sscanf_variation2.phpt b/ext/standard/tests/strings/sscanf_variation2.phpt
new file mode 100644
index 0000000..ee3a41a
--- /dev/null
+++ b/ext/standard/tests/strings/sscanf_variation2.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test sscanf() function : usage variations - unexpected inputs for '$format' argument
+--FILE--
+<?php
+/* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
+ * Description: Parses input from a string according to a format
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing sscanf() function: with unexpected inputs for 'format' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*16*/ NULL,
+ null,
+
+ // objects
+/*18*/ new sample(),
+
+ // resource
+/*19*/ $file_handle,
+
+ // undefined variable
+/*20*/ @$undefined_var,
+
+ // unset variable
+/*21*/ @$unset_var
+);
+
+//defining '$pad_length' argument
+$str = "Hello World";
+
+// loop through with each element of the $inputs array to test sscanf() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( sscanf($str, $input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sscanf() function: with unexpected inputs for 'format' argument ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(0) {
+}
+-- Iteration 3 --
+array(0) {
+}
+-- Iteration 4 --
+array(0) {
+}
+-- Iteration 5 --
+array(0) {
+}
+-- Iteration 6 --
+array(0) {
+}
+-- Iteration 7 --
+array(0) {
+}
+-- Iteration 8 --
+array(0) {
+}
+-- Iteration 9 --
+
+Warning: sscanf() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: sscanf() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: sscanf() expects parameter 2 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+array(0) {
+}
+-- Iteration 13 --
+array(0) {
+}
+-- Iteration 14 --
+array(0) {
+}
+-- Iteration 15 --
+array(0) {
+}
+-- Iteration 16 --
+array(0) {
+}
+-- Iteration 17 --
+array(0) {
+}
+-- Iteration 18 --
+array(0) {
+}
+-- Iteration 19 --
+
+Warning: sscanf() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+-- Iteration 20 --
+array(0) {
+}
+-- Iteration 21 --
+array(0) {
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_getcsv_001.phpt b/ext/standard/tests/strings/str_getcsv_001.phpt
new file mode 100644
index 0000000..23c6faf
--- /dev/null
+++ b/ext/standard/tests/strings/str_getcsv_001.phpt
@@ -0,0 +1,115 @@
+--TEST--
+str_getcsv(): Testing using various arguments
+--FILE--
+<?php
+
+// string input[, string delimiter[, string enclosure[, string escape]]]
+var_dump(str_getcsv('"f", "o", ""'));
+print "-----\n";
+var_dump(str_getcsv('foo||bar', '|'));
+print "-----\n";
+var_dump(str_getcsv('foo|bar', '|'));
+print "-----\n";
+var_dump(str_getcsv('|foo|-|bar|', '-', '|'));
+print "-----\n";
+var_dump(str_getcsv('|f.|.|bar|.|-|-.|', '.', '|', '-'));
+print "-----\n";
+var_dump(str_getcsv('.foo..bar.', '.', '.', '.'));
+print "-----\n";
+var_dump(str_getcsv('.foo. .bar.', ' ', '.', '.'));
+print "-----\n";
+var_dump(str_getcsv((binary)'1foo1 1bar111', (binary)' ', (binary)'1 ', (binary) '\ '));
+print "-----\n";
+var_dump(str_getcsv('.foo . . bar .', ' ', '.', ''));
+print "-----\n";
+var_dump(str_getcsv('" "" "', ' '));
+print "-----\n";
+var_dump(str_getcsv(NULL));
+print "-----\n";
+var_dump(str_getcsv(''));
+print "-----\n";
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ string(1) "f"
+ [1]=>
+ string(1) "o"
+ [2]=>
+ string(0) ""
+}
+-----
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(3) "bar"
+}
+-----
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+}
+-----
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+}
+-----
+array(3) {
+ [0]=>
+ string(2) "f."
+ [1]=>
+ string(3) "bar"
+ [2]=>
+ string(4) "-|-."
+}
+-----
+array(1) {
+ [0]=>
+ string(7) "foo.bar"
+}
+-----
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+}
+-----
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(4) "bar1"
+}
+-----
+array(2) {
+ [0]=>
+ string(5) "foo "
+ [1]=>
+ string(7) " bar "
+}
+-----
+array(1) {
+ [0]=>
+ string(3) " " "
+}
+-----
+array(1) {
+ [0]=>
+ NULL
+}
+-----
+array(1) {
+ [0]=>
+ NULL
+}
+-----
diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt
new file mode 100644
index 0000000..b127424
--- /dev/null
+++ b/ext/standard/tests/strings/str_ireplace.phpt
@@ -0,0 +1,101 @@
+--TEST--
+str_ireplace() tests
+--FILE--
+<?php
+
+var_dump(str_ireplace());
+var_dump(str_ireplace(""));
+var_dump(str_ireplace("", ""));
+var_dump(str_ireplace("", "", ""));
+
+var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "a", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "aa", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace("tt", "aaa", "ttttTttttttttTT", $count));
+var_dump($count);
+
+var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));
+
+var_dump(str_ireplace(array("tt", "tt"), "aaa", "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "tt"), array("aaa"), "ttttTttttttttTT"));
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), "ttttTttttttttTT"));
+
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("ttttTttttttttTT", "aayyaayasdayYahsdYYY")));
+var_dump(str_ireplace(array("tt", "y"), array("aaa", "bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
+var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY")));
+
+/* separate testcase for str_ireplace() off-by-one */
+
+$Data = "Change tracking and management software designed to watch
+ for abnormal system behavior.\nSuggest features, report bugs, or ask
+ questions here.";
+var_dump($Data = str_ireplace("\r\n", "<br>", $Data));
+var_dump($Data = str_ireplace("\n", "<br>", $Data));
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d
+NULL
+
+Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d
+NULL
+string(0) ""
+string(8) "aaaaaaaT"
+string(8) "aaaaaaaT"
+int(7)
+string(15) "aaaaaaaaaaaaaaT"
+string(15) "aaaaaaaaaaaaaaT"
+int(7)
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+int(7)
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+int(7)
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+array(2) {
+ [0]=>
+ string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+ [1]=>
+ string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
+}
+array(2) {
+ ["key"]=>
+ string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+ ["test"]=>
+ string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
+}
+array(2) {
+ ["key"]=>
+ string(22) "aaaaaaaaaaaaaaaaaaaaaT"
+ ["test"]=>
+ string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
+}
+string(143) "Change tracking and management software designed to watch
+ for abnormal system behavior.
+Suggest features, report bugs, or ask
+ questions here."
+string(152) "Change tracking and management software designed to watch<br> for abnormal system behavior.<br>Suggest features, report bugs, or ask<br> questions here."
+Done
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
new file mode 100644
index 0000000..645d8ff
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt
new file mode 100644
index 0000000..aff89f5
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation1.phpt
@@ -0,0 +1,140 @@
+--TEST--
+Test str_pad() function : usage variations - unexpected inputs for '$input' argument
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$input'
+ * and expected type for '$pad_length'
+*/
+
+echo "*** Testing str_pad() function: with unexpected inputs for 'input' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // 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
+);
+
+//defining '$pad_length' argument
+$pad_length = "20";
+
+// loop through with each element of the $inputs array to test str_pad() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( str_pad($input, $pad_length) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_pad() function: with unexpected inputs for 'input' argument ***
+-- Iteration 1 --
+string(20) "0 "
+-- Iteration 2 --
+string(20) "1 "
+-- Iteration 3 --
+string(20) "-2 "
+-- Iteration 4 --
+string(20) "2147483647 "
+-- Iteration 5 --
+string(20) "-2147483648 "
+-- Iteration 6 --
+string(20) "10.5 "
+-- Iteration 7 --
+string(20) "-20.5 "
+-- Iteration 8 --
+string(20) "101234567000 "
+-- Iteration 9 --
+
+Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+string(20) "1 "
+-- Iteration 13 --
+string(20) " "
+-- Iteration 14 --
+string(20) "1 "
+-- Iteration 15 --
+string(20) " "
+-- Iteration 16 --
+string(20) " "
+-- Iteration 17 --
+string(20) " "
+-- Iteration 18 --
+string(20) "sample object "
+-- Iteration 19 --
+
+Warning: str_pad() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 20 --
+string(20) " "
+-- Iteration 21 --
+string(20) " "
+===DONE===
diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt
new file mode 100644
index 0000000..2bc6990
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation2.phpt
@@ -0,0 +1,139 @@
+--TEST--
+Test str_pad() function : usage variations - unexpected inputs for '$pad_length' argument
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$pad_length'
+ * and expected type for '$input'
+*/
+
+echo "*** Testing str_pad() function: with unexpected inputs for 'pad_length' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$pad_lengths = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 255,
+
+ // float values
+/*5*/ 10.5,
+ -20.5,
+ 10.12345e2,
+
+ // array values
+/*8*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*15*/ NULL,
+ null,
+
+ // objects
+/*17*/ new sample(),
+
+ // resource
+/*18*/ $file_handle,
+
+ // undefined variable
+/*19*/ @$undefined_var,
+
+ // unset variable
+/*20*/ @$unset_var
+);
+
+//defining '$input' argument
+$input = "Test string";
+
+// loop through with each element of the $pad_lengths array to test str_pad() function
+$count = 1;
+foreach($pad_lengths as $pad_length) {
+ echo "-- Iteration $count --\n";
+ var_dump( str_pad($input, $pad_length) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_pad() function: with unexpected inputs for 'pad_length' argument ***
+-- Iteration 1 --
+string(11) "Test string"
+-- Iteration 2 --
+string(11) "Test string"
+-- Iteration 3 --
+string(11) "Test string"
+-- Iteration 4 --
+string(255) "Test string "
+-- Iteration 5 --
+string(11) "Test string"
+-- Iteration 6 --
+string(11) "Test string"
+-- Iteration 7 --
+string(1012) "Test string "
+-- Iteration 8 --
+
+Warning: str_pad() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: str_pad() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: str_pad() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+string(11) "Test string"
+-- Iteration 12 --
+string(11) "Test string"
+-- Iteration 13 --
+string(11) "Test string"
+-- Iteration 14 --
+string(11) "Test string"
+-- Iteration 15 --
+string(11) "Test string"
+-- Iteration 16 --
+string(11) "Test string"
+-- Iteration 17 --
+
+Warning: str_pad() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: str_pad() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+-- Iteration 19 --
+string(11) "Test string"
+-- Iteration 20 --
+string(11) "Test string"
+===DONE===
diff --git a/ext/standard/tests/strings/str_pad_variation3.phpt b/ext/standard/tests/strings/str_pad_variation3.phpt
new file mode 100644
index 0000000..c277eb7
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation3.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test str_pad() function : usage variations - unexpected inputs for '$pad_string' argument
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$pad_string'
+ * and expected type for '$input' and '$pad_length'
+*/
+
+echo "*** Testing str_pad() function: with unexpected inputs for 'pad_string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$pad_strings = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // 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
+);
+
+//defining '$input' argument
+$input = "Test string";
+$pad_length = 20;
+
+// loop through with each element of the $pad_strings array to test str_pad() function
+$count = 1;
+foreach($pad_strings as $pad_string) {
+ echo "-- Iteration $count --\n";
+ var_dump( str_pad($input, $pad_length, $pad_string) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_pad() function: with unexpected inputs for 'pad_string' argument ***
+-- Iteration 1 --
+string(20) "Test string000000000"
+-- Iteration 2 --
+string(20) "Test string111111111"
+-- Iteration 3 --
+string(20) "Test string-2-2-2-2-"
+-- Iteration 4 --
+string(20) "Test string214748364"
+-- Iteration 5 --
+string(20) "Test string-21474836"
+-- Iteration 6 --
+string(20) "Test string10.510.51"
+-- Iteration 7 --
+string(20) "Test string-20.5-20."
+-- Iteration 8 --
+string(20) "Test string101234567"
+-- Iteration 9 --
+
+Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+string(20) "Test string111111111"
+-- Iteration 13 --
+
+Warning: str_pad(): Padding string cannot be empty in %s on line %d
+NULL
+-- Iteration 14 --
+string(20) "Test string111111111"
+-- Iteration 15 --
+
+Warning: str_pad(): Padding string cannot be empty in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: str_pad(): Padding string cannot be empty in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: str_pad(): Padding string cannot be empty in %s on line %d
+NULL
+-- Iteration 18 --
+string(20) "Test stringsample ob"
+-- Iteration 19 --
+
+Warning: str_pad() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: str_pad(): Padding string cannot be empty in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: str_pad(): Padding string cannot be empty in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/str_pad_variation4.phpt b/ext/standard/tests/strings/str_pad_variation4.phpt
new file mode 100644
index 0000000..a622304
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation4.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test str_pad() function : usage variations - unexpected inputs for '$pad_type' argument
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$pad_type'
+ * and expected type for '$input', '$pad_length' and '$pad_string'
+*/
+
+echo "*** Testing str_pad() function: with unexpected inputs for 'pad_type' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+// array with different values for $input
+$pad_types = array (
+
+ // integer values
+/*1*/ 0, // == STR_PAD_LEFT
+ 1, // == STR_PAD_RIGHT
+ 2, // == STR_PAD_BOTH
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // string data
+/*10*/ "abc",
+ "STR_PAD_LEFT",
+ "2",
+ "0x2",
+ "02",
+
+ // array values
+/*15*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*18*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*22*/ NULL,
+ null,
+
+ // objects
+/*24*/ new sample(),
+
+ // undefined variable
+/*25*/ @$undefined_var,
+
+ // unset variable
+/*26*/ @$unset_var
+);
+
+//defining '$input' argument
+$input = "Test string";
+$pad_length = 20;
+$pad_string = "*";
+
+// loop through with each element of the $pad_types array to test str_pad() function
+$count = 1;
+foreach($pad_types as $pad_type) {
+ echo "-- Iteration $count --\n";
+ var_dump( str_pad($input, $pad_length, $pad_string, $pad_type) );
+ $count ++;
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_pad() function: with unexpected inputs for 'pad_type' argument ***
+-- Iteration 1 --
+string(20) "*********Test string"
+-- Iteration 2 --
+string(20) "Test string*********"
+-- Iteration 3 --
+string(20) "****Test string*****"
+-- Iteration 4 --
+
+Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: str_pad() expects parameter 4 to be long, string given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: str_pad() expects parameter 4 to be long, string given in %s on line %d
+NULL
+-- Iteration 12 --
+string(20) "****Test string*****"
+-- Iteration 13 --
+string(20) "****Test string*****"
+-- Iteration 14 --
+string(20) "****Test string*****"
+-- Iteration 15 --
+
+Warning: str_pad() expects parameter 4 to be long, array given in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: str_pad() expects parameter 4 to be long, array given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: str_pad() expects parameter 4 to be long, array given in %s on line %d
+NULL
+-- Iteration 18 --
+string(20) "Test string*********"
+-- Iteration 19 --
+string(20) "*********Test string"
+-- Iteration 20 --
+string(20) "Test string*********"
+-- Iteration 21 --
+string(20) "*********Test string"
+-- Iteration 22 --
+string(20) "*********Test string"
+-- Iteration 23 --
+string(20) "*********Test string"
+-- Iteration 24 --
+
+Warning: str_pad() expects parameter 4 to be long, object given in %s on line %d
+NULL
+-- Iteration 25 --
+string(20) "*********Test string"
+-- Iteration 26 --
+string(20) "*********Test string"
+===DONE===
diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt
new file mode 100644
index 0000000..cd979a1
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test str_pad() function : usage variations - unexpected large value for '$pad_length' argument
+--INI--
+memory_limit=128M
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$pad_length'
+ * and expected type for '$input'
+*/
+
+echo "*** Testing str_pad() function: with large value for for 'pad_length' argument ***\n";
+
+//defining '$input' argument
+$input = "Test string";
+$pad_length = PHP_INT_MAX;
+var_dump( str_pad($input, $pad_length) );
+
+?>
+--EXPECTF--
+*** Testing str_pad() function: with large value for for 'pad_length' argument ***
+
+Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate 2147483648 bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
new file mode 100644
index 0000000..73c193b
--- /dev/null
+++ b/ext/standard/tests/strings/str_repeat.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt
new file mode 100644
index 0000000..830378b
--- /dev/null
+++ b/ext/standard/tests/strings/str_replace.phpt
@@ -0,0 +1,957 @@
+--TEST--
+Test str_replace() function
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+ Prototype: mixed str_replace(mixed $search, mixed $replace,
+ mixed $subject [, int &$count]);
+ Description: Replace all occurrences of the search string with
+ the replacement string
+*/
+
+echo "\n*** Testing str_replace() on basic operations ***\n";
+
+var_dump( str_replace("", "", "") );
+
+var_dump( str_replace("e", "b", "test") );
+
+var_dump( str_replace("", "", "", $count) );
+var_dump( $count );
+
+var_dump( str_replace("q", "q", "q", $count) );
+var_dump( $count );
+
+var_dump( str_replace("long string here", "", "", $count) );
+var_dump( $count );
+
+$fp = fopen( __FILE__, "r" );
+$fp_copy = $fp;
+var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
+var_dump( $fp_copy );
+fclose($fp);
+
+echo "\n*** Testing str_replace() with various search values ***";
+$search_arr = array( TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL,
+ array(), "php", "");
+
+$i = 0;
+/* loop through to replace the matched elements in the array */
+foreach( $search_arr as $value ) {
+ echo "\n-- Iteration $i --\n";
+ /* replace the string in array */
+ var_dump( str_replace($value, "FOUND", $search_arr, $count) );
+ var_dump( $count );
+ $i++;
+}
+
+echo "\n*** Testing str_replace() with various subjects ***";
+$subject = "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE\000
+ \x000\xABCD\0abcd \xXYZ\tabcd $$@#%^&*!~,.:;?: !!Hello, World
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)";
+
+/* needles in an array to be compared in the string $string */
+$search_str = array (
+ "Hello, World",
+ 'Hello, World',
+ '!!Hello, World',
+ "??Hello, World",
+ "$@#%^&*!~,.:;?",
+ "123",
+ 123,
+ "-1.2345",
+ -1.2344,
+ "abcd",
+ 'XYZ',
+ NULL,
+ "NULL",
+ "0",
+ 0,
+ "",
+ " ",
+ "\0",
+ "\x000",
+ "\xABC",
+ "\0000",
+ ".3",
+ TRUE,
+ "TRUE",
+ "1",
+ 1,
+ FALSE,
+ "FALSE",
+ " ",
+ " ",
+ 'b',
+ '\t',
+ "\t",
+ chr(128).chr(234).chr(65).chr(255).chr(256),
+ $subject
+);
+
+/* loop through to get the $string */
+for( $i = 0; $i < count($search_str); $i++ ) {
+ echo "\n--- Iteration $i ---";
+ echo "\n-- String after replacing the search value is => --\n";
+ var_dump( str_replace($search_str[$i], "FOUND", $subject, $count) );
+ echo "-- search string has found '$count' times\n";
+}
+
+
+echo "\n*** Testing Miscelleneous input data ***\n";
+/* If replace has fewer values than search, then an empty
+ string is used for the rest of replacement values */
+var_dump( str_replace(array("a", "a", "b"),
+ array("q", "q"),
+ "aaabb", $count
+ )
+ );
+var_dump($count);
+var_dump( str_replace(array("a", "a", "b"),
+ array("q", "q"),
+ array("aaa", "bbb", "ccc"),
+ $count
+ )
+ );
+var_dump($count);
+
+
+echo "\n-- Testing objects --\n";
+/* we get "Catchable fatal error: saying Object of class could not be converted
+ to string" by default, when an object is passed instead of string:
+The error can be avoided by chosing the __toString magix method as follows: */
+
+class subject
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_subject = new subject;
+
+class search
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_search = new search;
+
+class replace
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_replace = new replace;
+
+var_dump(str_replace("$obj_search", "$obj_replace", "$obj_subject", $count));
+var_dump($count);
+
+
+echo "\n-- Testing arrays --\n";
+var_dump(str_replace(array("a", "a", "b"), "multi", "aaa", $count));
+var_dump($count);
+
+var_dump(str_replace( array("a", "a", "b"),
+ array("q", "q", "c"),
+ "aaa", $count
+ )
+);
+var_dump($count);
+
+var_dump(str_replace( array("a", "a", "b"),
+ array("q", "q", "c"),
+ array("aaa", "bbb"),
+ $count
+ )
+);
+var_dump($count);
+
+var_dump(str_replace("a", array("q", "q", "c"), array("aaa", "bbb"), $count));
+var_dump($count);
+
+var_dump(str_replace("a", 1, array("aaa", "bbb"), $count));
+var_dump($count);
+
+var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count));
+var_dump($count);
+
+
+echo "\n-- Testing Resources --\n";
+$resource1 = fopen( __FILE__, "r" );
+$resource2 = opendir( "." );
+var_dump(str_replace("stream", "FOUND", $resource1, $count));
+var_dump($count);
+var_dump(str_replace("stream", "FOUND", $resource2, $count));
+var_dump($count);
+
+
+echo "\n-- Testing a longer and heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+
+var_dump( str_replace("abcdef", "FOUND", $string, $count) );
+var_dump( $count );
+
+echo "\n-- Testing a heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump( str_replace("", "FOUND", $str, $count) );
+var_dump( $count );
+
+
+echo "\n-- Testing simple and complex syntax strings --\n";
+$str = 'world';
+
+/* Simple syntax */
+var_dump( str_replace("world", "FOUND", "$str") );
+var_dump( str_replace("world'S", "FOUND", "$str'S") );
+var_dump( str_replace("worldS", "FOUND", "$strS") );
+
+/* String with curly braces, complex syntax */
+var_dump( str_replace("worldS", "FOUND", "${str}S") );
+var_dump( str_replace("worldS", "FOUND", "{$str}S") );
+
+
+echo "\n*** Testing error conditions ***";
+/* Invalid arguments */
+var_dump( str_replace() );
+var_dump( str_replace("") );
+var_dump( str_replace(NULL) );
+var_dump( str_replace(1, 2) );
+var_dump( str_replace(1,2,3,$var,5) );
+
+fclose($resource1);
+closedir($resource2);
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing str_replace() on basic operations ***
+string(0) ""
+string(4) "tbst"
+string(0) ""
+int(0)
+string(1) "q"
+int(1)
+string(0) ""
+int(0)
+string(%d) "Resource id #%d"
+int(1)
+
+*** Testing str_replace() with various search values ***
+-- Iteration 0 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 1 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 2 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 3 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "FOUND"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(5) "FOUND"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 4 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(5) "FOUND"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(5) "FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 5 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 6 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "FOUND"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(5) "FOUND"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 7 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(5) "FOUND"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(5) "FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 8 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 9 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 10 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(5) "FOUND"
+ [11]=>
+ string(0) ""
+}
+int(1)
+
+-- Iteration 11 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+*** Testing str_replace() with various subjects ***
+--- Iteration 0 ---
+-- String after replacing the search value is => --
+string(177) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 1 ---
+-- String after replacing the search value is => --
+string(177) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 2 ---
+-- String after replacing the search value is => --
+string(182) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 3 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 4 ---
+-- String after replacing the search value is => --
+string(182) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 5 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 6 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 7 ---
+-- String after replacing the search value is => --
+string(189) "Hello, world,0120333.3445FOUND67 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 8 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 9 ---
+-- String after replacing the search value is => --
+string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 10 ---
+-- String after replacing the search value is => --
+string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 11 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 12 ---
+-- String after replacing the search value is => --
+string(192) "Hello, world,0120333.3445-1.234567 FOUND TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 13 ---
+-- String after replacing the search value is => --
+string(207) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '4' times
+
+--- Iteration 14 ---
+-- String after replacing the search value is => --
+string(207) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '4' times
+
+--- Iteration 15 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 16 ---
+-- String after replacing the search value is => --
+string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
+FOUND FOUNDFOUNDFOUNDFOUND
+ FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '29' times
+
+--- Iteration 17 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSEFOUND
+ FOUND0«CDFOUNDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 18 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+ FOUND«CD
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 19 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 20 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+ FOUND«CD
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 21 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333FOUND445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 22 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 23 ---
+-- String after replacing the search value is => --
+string(192) "Hello, world,0120333.3445-1.234567 NULL FOUND FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 24 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 25 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 26 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 27 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FOUND
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 28 ---
+-- String after replacing the search value is => --
+string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
+FOUND FOUNDFOUNDFOUNDFOUND
+ FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '29' times
+
+--- Iteration 29 ---
+-- String after replacing the search value is => --
+string(186) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 30 ---
+-- String after replacing the search value is => --
+string(199) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 31 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 32 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+ FOUND
+FOUND ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 33 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 34 ---
+-- String after replacing the search value is => --
+string(5) "FOUND"
+-- search string has found '1' times
+
+*** Testing Miscelleneous input data ***
+string(3) "qqq"
+int(5)
+array(3) {
+ [0]=>
+ string(3) "qqq"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(3) "ccc"
+}
+int(6)
+
+-- Testing objects --
+string(12) "Hello, world"
+int(1)
+
+-- Testing arrays --
+string(15) "multimultimulti"
+int(3)
+string(3) "qqq"
+int(3)
+array(2) {
+ [0]=>
+ string(3) "qqq"
+ [1]=>
+ string(3) "ccc"
+}
+int(6)
+
+Notice: Array to string conversion in %s on line %d
+array(2) {
+ [0]=>
+ string(15) "ArrayArrayArray"
+ [1]=>
+ string(3) "bbb"
+}
+int(3)
+array(2) {
+ [0]=>
+ string(3) "111"
+ [1]=>
+ string(3) "bbb"
+}
+int(3)
+array(2) {
+ [0]=>
+ string(4) "aaa3"
+ [1]=>
+ string(4) "2bbb"
+}
+int(1)
+
+-- Testing Resources --
+string(%d) "Resource id #%d"
+int(0)
+string(%d) "Resource id #%d"
+int(0)
+
+-- Testing a longer and heredoc string --
+string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789"
+int(16)
+
+-- Testing a heredoc null string --
+string(0) ""
+int(0)
+
+-- Testing simple and complex syntax strings --
+string(5) "FOUND"
+string(5) "FOUND"
+
+Notice: Undefined variable: strS in %s on line %d
+string(0) ""
+string(5) "FOUND"
+string(5) "FOUND"
+
+*** Testing error conditions ***
+Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
+NULL
+
+Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
+NULL
+
+Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d
+NULL
+
+Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_replace_basic.phpt b/ext/standard/tests/strings/str_replace_basic.phpt
new file mode 100644
index 0000000..10bf542
--- /dev/null
+++ b/ext/standard/tests/strings/str_replace_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test str_replace() function basic function
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+ Prototype: mixed str_replace(mixed $search, mixed $replace,
+ mixed $subject [, int &$count]);
+ Description: Replace all occurrences of the search string with
+ the replacement string
+*/
+
+echo "\n*** Testing str_replace() on basic operations ***\n";
+
+var_dump( str_replace("", "", "") );
+
+var_dump( str_replace("e", "b", "test") );
+
+var_dump( str_replace("", "", "", $count) );
+var_dump( $count );
+
+var_dump( str_replace("q", "q", "q", $count) );
+var_dump( $count );
+
+var_dump( str_replace("long string here", "", "", $count) );
+var_dump( $count );
+
+$fp = fopen( __FILE__, "r" );
+$fp_copy = $fp;
+var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
+var_dump( $fp_copy );
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_replace() on basic operations ***
+string(0) ""
+string(4) "tbst"
+string(0) ""
+int(0)
+string(1) "q"
+int(1)
+string(0) ""
+int(0)
+string(%d) "Resource id #%d"
+int(1)
+===DONE===
diff --git a/ext/standard/tests/strings/str_replace_error.phpt b/ext/standard/tests/strings/str_replace_error.phpt
new file mode 100644
index 0000000..9fafc57
--- /dev/null
+++ b/ext/standard/tests/strings/str_replace_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test str_replace() function error conditions
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+ Prototype: mixed str_replace(mixed $search, mixed $replace,
+ mixed $subject [, int &$count]);
+ Description: Replace all occurrences of the search string with
+ the replacement string
+*/
+
+
+echo "\n*** Testing str_replace error conditions ***";
+/* Invalid arguments */
+var_dump( str_replace() );
+var_dump( str_replace("") );
+var_dump( str_replace(NULL) );
+var_dump( str_replace(1, 2) );
+var_dump( str_replace(1,2,3,$var,5) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_replace error conditions ***
+Warning: str_replace() expects at least 3 parameters, 0 given in %sstr_replace_error.php on line 12
+NULL
+
+Warning: str_replace() expects at least 3 parameters, 1 given in %sstr_replace_error.php on line 13
+NULL
+
+Warning: str_replace() expects at least 3 parameters, 1 given in %sstr_replace_error.php on line 14
+NULL
+
+Warning: str_replace() expects at least 3 parameters, 2 given in %sstr_replace_error.php on line 15
+NULL
+
+Warning: str_replace() expects at most 4 parameters, 5 given in %sstr_replace_error.php on line 16
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_replace_variation1.phpt b/ext/standard/tests/strings/str_replace_variation1.phpt
new file mode 100644
index 0000000..279fb22
--- /dev/null
+++ b/ext/standard/tests/strings/str_replace_variation1.phpt
@@ -0,0 +1,392 @@
+--TEST--
+Test str_replace() function - test search values
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+ Prototype: mixed str_replace(mixed $search, mixed $replace,
+ mixed $subject [, int &$count]);
+ Description: Replace all occurrences of the search string with
+ the replacement string
+*/
+
+
+echo "\n*** Testing str_replace() with various search values ***";
+$search_arr = array( TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL,
+ array(), "php", "");
+
+$i = 0;
+/* loop through to replace the matched elements in the array */
+foreach( $search_arr as $value ) {
+ echo "\n-- Iteration $i --\n";
+ /* replace the string in array */
+ var_dump( str_replace($value, "FOUND", $search_arr, $count) );
+ var_dump( $count );
+ $i++;
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing str_replace() with various search values ***
+-- Iteration 0 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 1 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 2 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 3 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "FOUND"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(5) "FOUND"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 4 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(5) "FOUND"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(5) "FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 5 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 6 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "FOUND"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(5) "FOUND"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 7 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(5) "FOUND"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(5) "FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 8 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 9 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 10 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(5) "FOUND"
+ [11]=>
+ string(0) ""
+}
+int(1)
+
+-- Iteration 11 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+===DONE===
diff --git a/ext/standard/tests/strings/str_replace_variation2.phpt b/ext/standard/tests/strings/str_replace_variation2.phpt
new file mode 100644
index 0000000..5534341
--- /dev/null
+++ b/ext/standard/tests/strings/str_replace_variation2.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_replace_variation3.phpt b/ext/standard/tests/strings/str_replace_variation3.phpt
new file mode 100644
index 0000000..9b19153
--- /dev/null
+++ b/ext/standard/tests/strings/str_replace_variation3.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test str_replace() function
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+ Prototype: mixed str_replace(mixed $search, mixed $replace,
+ mixed $subject [, int &$count]);
+ Description: Replace all occurrences of the search string with
+ the replacement string
+*/
+
+
+echo "\n*** Testing Miscelleneous input data ***\n";
+/* If replace has fewer values than search, then an empty
+ string is used for the rest of replacement values */
+var_dump( str_replace(array("a", "a", "b"),
+ array("q", "q"),
+ "aaabb", $count
+ )
+ );
+var_dump($count);
+var_dump( str_replace(array("a", "a", "b"),
+ array("q", "q"),
+ array("aaa", "bbb", "ccc"),
+ $count
+ )
+ );
+var_dump($count);
+
+
+echo "\n-- Testing objects --\n";
+/* we get "Catchable fatal error: saying Object of class could not be converted
+ to string" by default, when an object is passed instead of string:
+The error can be avoided by chosing the __toString magix method as follows: */
+
+class subject
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_subject = new subject;
+
+class search
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_search = new search;
+
+class replace
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_replace = new replace;
+
+var_dump(str_replace("$obj_search", "$obj_replace", "$obj_subject", $count));
+var_dump($count);
+
+
+echo "\n-- Testing arrays --\n";
+var_dump(str_replace(array("a", "a", "b"), "multi", "aaa", $count));
+var_dump($count);
+
+var_dump(str_replace( array("a", "a", "b"),
+ array("q", "q", "c"),
+ "aaa", $count
+ )
+);
+var_dump($count);
+
+var_dump(str_replace( array("a", "a", "b"),
+ array("q", "q", "c"),
+ array("aaa", "bbb"),
+ $count
+ )
+);
+var_dump($count);
+
+var_dump(str_replace("a", array("q", "q", "c"), array("aaa"), $count));
+var_dump($count);
+
+var_dump(str_replace("a", 1, array("aaa", "bbb"), $count));
+var_dump($count);
+
+var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count));
+var_dump($count);
+
+
+echo "\n-- Testing Resources --\n";
+$resource1 = fopen( __FILE__, "r" );
+$resource2 = opendir( "." );
+var_dump(str_replace("stream", "FOUND", $resource1, $count));
+var_dump($count);
+var_dump(str_replace("stream", "FOUND", $resource2, $count));
+var_dump($count);
+
+
+echo "\n-- Testing a longer and heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+
+var_dump( str_replace("abcdef", "FOUND", $string, $count) );
+var_dump( $count );
+
+echo "\n-- Testing a heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump( str_replace("", "FOUND", $str, $count) );
+var_dump( $count );
+
+
+echo "\n-- Testing simple and complex syntax strings --\n";
+$str = 'world';
+
+/* Simple syntax */
+var_dump( str_replace("world", "FOUND", "$str") );
+var_dump( str_replace("world'S", "FOUND", "$str'S") );
+var_dump( str_replace("worldS", "FOUND", "$strS") );
+
+/* String with curly braces, complex syntax */
+var_dump( str_replace("worldS", "FOUND", "${str}S") );
+var_dump( str_replace("worldS", "FOUND", "{$str}S") );
+
+
+fclose($resource1);
+closedir($resource2);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing Miscelleneous input data ***
+string(3) "qqq"
+int(5)
+array(3) {
+ [0]=>
+ string(3) "qqq"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(3) "ccc"
+}
+int(6)
+
+-- Testing objects --
+string(12) "Hello, world"
+int(1)
+
+-- Testing arrays --
+string(15) "multimultimulti"
+int(3)
+string(3) "qqq"
+int(3)
+array(2) {
+ [0]=>
+ string(3) "qqq"
+ [1]=>
+ string(3) "ccc"
+}
+int(6)
+
+Notice: Array to string conversion in %s on line %d
+array(1) {
+ [0]=>
+ string(15) "ArrayArrayArray"
+}
+int(3)
+array(2) {
+ [0]=>
+ string(3) "111"
+ [1]=>
+ string(3) "bbb"
+}
+int(3)
+array(2) {
+ [0]=>
+ string(4) "aaa3"
+ [1]=>
+ string(4) "2bbb"
+}
+int(1)
+
+-- Testing Resources --
+string(%d) "Resource id #%d"
+int(0)
+string(%d) "Resource id #%d"
+int(0)
+
+-- Testing a longer and heredoc string --
+string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789"
+int(16)
+
+-- Testing a heredoc null string --
+string(0) ""
+int(0)
+
+-- Testing simple and complex syntax strings --
+string(5) "FOUND"
+string(5) "FOUND"
+
+Notice: Undefined variable: strS in %s on line %d
+string(0) ""
+string(5) "FOUND"
+string(5) "FOUND"
+===DONE===
diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt
new file mode 100644
index 0000000..949d725
--- /dev/null
+++ b/ext/standard/tests/strings/str_rot13_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test soundex() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string str_rot13 ( string $str )
+ * Description: Perform the rot13 transform on a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_rot13() : basic functionality ***\n";
+
+echo "\nBasic tests\n";
+var_dump(str_rot13("str_rot13() tests starting"));
+var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));
+
+echo "\nEnsure numeric characters are left untouched\n";
+if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+
+echo "\nEnsure non-alphabetic characters are left untouched\n";
+if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+
+echo "\nEnsure strings round trip\n";
+$str = "str_rot13() tests starting";
+$encode = str_rot13($str);
+$decode = str_rot13($encode);
+if (strcmp($str, $decode) == 0) {
+ echo "Strings equal : TEST PASSED\n";
+} else {
+ echo "Strings unequal : TEST FAILED\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_rot13() : basic functionality ***
+
+Basic tests
+string(26) "fge_ebg13() grfgf fgnegvat"
+string(26) "nopqrstuvwxyzabcdefghijklm"
+
+Ensure numeric characters are left untouched
+Strings equal : TEST PASSED
+
+Ensure non-alphabetic characters are left untouched
+Strings unequal : TEST FAILED
+
+Ensure strings round trip
+Strings equal : TEST PASSED
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_rot13_error.phpt b/ext/standard/tests/strings/str_rot13_error.phpt
new file mode 100644
index 0000000..99a99f2
--- /dev/null
+++ b/ext/standard/tests/strings/str_rot13_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test str_rot13() function : error conditions
+--FILE--
+<?php
+/* Prototype : string str_rot13 ( string $str )
+ * Description: Perform the rot13 transform on a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_rot13() : error conditions ***\n";
+
+echo "-- Testing str_rot13() function with Zero arguments --\n";
+var_dump( str_rot13() );
+
+echo "\n\n-- Testing str_rot13() function with more than expected no. of arguments --\n";
+$str = "str_rot13() tests starting";
+$extra_arg = 10;
+var_dump( str_rot13( $str, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_rot13() : error conditions ***
+-- Testing str_rot13() function with Zero arguments --
+
+Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+
+-- Testing str_rot13() function with more than expected no. of arguments --
+
+Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_shuffle.phpt b/ext/standard/tests/strings/str_shuffle.phpt
new file mode 100644
index 0000000..32f3872
--- /dev/null
+++ b/ext/standard/tests/strings/str_shuffle.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Testing str_shuffle.
+--FILE--
+<?php
+/* Do not change this test it is a README.TESTING example. */
+$s = '123';
+var_dump(str_shuffle($s));
+var_dump($s);
+?>
+--EXPECTF--
+string(3) %s
+string(3) "123" \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_shuffle_basic.phpt b/ext/standard/tests/strings/str_shuffle_basic.phpt
new file mode 100644
index 0000000..b60a35f
--- /dev/null
+++ b/ext/standard/tests/strings/str_shuffle_basic.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test str_shuffle() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string str_shuffle ( string $str )
+ * Description: Randomly shuffles a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing str_shuffle() : basic functionality
+*/
+
+echo "*** Testing str_shuffle() : basic functionality ***\n";
+
+// Initialize all required variables
+$str = 'This testcase tests the str_shuffle() function.';
+var_dump(str_shuffle($str));
+
+
+// For a given i/p string ensure that all combinations are
+// generated given a reasonable sample of calls
+$a = array();
+$trys = 1000;
+$ip = 'abcd';
+$len_ip = strlen($ip);
+
+for ($i = 0; $i < $trys; $i++) {
+ $op = str_shuffle($ip);
+
+ if (!is_string($op) || strlen($op) != $len_ip) {
+ echo "TEST FAILED\n";
+ }
+
+ // Combination already hit ?
+ if (empty($a[$op])) {
+ // No first time init
+ $a[$op] = 0;
+ }
+
+ // Increment count for this combination
+ $a[$op]++;
+}
+
+$combinations = count($a);
+
+if ($combinations != 24) {
+ echo "TEST FAILED.. Only $combinations out of a possible 24 combinations used\n";
+} else {
+ echo "TEST PASSED\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_shuffle() : basic functionality ***
+string(47) "%s"
+TEST PASSED
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_shuffle_error.phpt b/ext/standard/tests/strings/str_shuffle_error.phpt
new file mode 100644
index 0000000..d802429
--- /dev/null
+++ b/ext/standard/tests/strings/str_shuffle_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test str_shuffle() function : error conditions
+--FILE--
+<?php
+
+/* Prototype : string str_shuffle ( string $str )
+ * Description: Randomly shuffles a string
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing str_shuffle() : error conditions ***\n";
+
+echo "\n-- Testing str_shuffle() function with no arguments --\n";
+var_dump( str_shuffle() );
+
+echo "\n-- Testing str_shuffle() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( str_shuffle("Hello World", $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_shuffle() : error conditions ***
+
+-- Testing str_shuffle() function with no arguments --
+
+Warning: str_shuffle() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing str_shuffle() function with more than expected no. of arguments --
+
+Warning: str_shuffle() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_shuffle_variation1.phpt b/ext/standard/tests/strings/str_shuffle_variation1.phpt
new file mode 100644
index 0000000..a6b663d
--- /dev/null
+++ b/ext/standard/tests/strings/str_shuffle_variation1.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test str_shuffle() function : usage variations - test values for $haystack argument
+--FILE--
+<?php
+
+/* Prototype : string str_shuffle ( string $str )
+ * Description: Randomly shuffles a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing str_shuffle() function: with unexpected inputs for 'string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // 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 $inputs array to test str_shuffle() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( str_shuffle($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing str_shuffle() function: with unexpected inputs for 'string' argument ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(2) "%s"
+-- Iteration 4 --
+string(10) "%s"
+-- Iteration 5 --
+string(11) "%s"
+-- Iteration 6 --
+string(4) "%s"
+-- Iteration 7 --
+string(5) "%s"
+-- Iteration 8 --
+string(12) "%s"
+-- Iteration 9 --
+
+Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- 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(13) "%s"
+-- Iteration 19 --
+
+Warning: str_shuffle() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 20 --
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_split_basic.phpt b/ext/standard/tests/strings/str_split_basic.phpt
new file mode 100644
index 0000000..3a38b9d
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_basic.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test str_split() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : basic functionality ***\n";
+
+// Initialise all required variables
+$str = 'This is basic testcase';
+$split_length = 5;
+
+// Calling str_split() with all possible arguments
+echo "-- With all possible arguments --\n";
+var_dump( str_split($str,$split_length) );
+
+// Calling str_split() with default arguments
+echo "-- With split_length as default argument --\n";
+var_dump( str_split($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : basic functionality ***
+-- With all possible arguments --
+array(5) {
+ [0]=>
+ string(5) "This "
+ [1]=>
+ string(5) "is ba"
+ [2]=>
+ string(5) "sic t"
+ [3]=>
+ string(5) "estca"
+ [4]=>
+ string(2) "se"
+}
+-- With split_length as default argument --
+array(22) {
+ [0]=>
+ string(1) "T"
+ [1]=>
+ string(1) "h"
+ [2]=>
+ string(1) "i"
+ [3]=>
+ string(1) "s"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) "i"
+ [6]=>
+ string(1) "s"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(1) "b"
+ [9]=>
+ string(1) "a"
+ [10]=>
+ string(1) "s"
+ [11]=>
+ string(1) "i"
+ [12]=>
+ string(1) "c"
+ [13]=>
+ string(1) " "
+ [14]=>
+ string(1) "t"
+ [15]=>
+ string(1) "e"
+ [16]=>
+ string(1) "s"
+ [17]=>
+ string(1) "t"
+ [18]=>
+ string(1) "c"
+ [19]=>
+ string(1) "a"
+ [20]=>
+ string(1) "s"
+ [21]=>
+ string(1) "e"
+}
+Done
diff --git a/ext/standard/tests/strings/str_split_error.phpt b/ext/standard/tests/strings/str_split_error.phpt
new file mode 100644
index 0000000..c7075ec
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test str_split() function : error conditions
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing str_split() function with Zero arguments --\n";
+var_dump( str_split() );
+
+//Test str_split with one more than the expected number of arguments
+echo "-- Testing str_split() function with more than expected no. of arguments --\n";
+$str = 'This is error testcase';
+$split_length = 4;
+$extra_arg = 10;
+var_dump( str_split( $str, $split_length, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : error conditions ***
+-- Testing str_split() function with Zero arguments --
+
+Warning: str_split() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing str_split() function with more than expected no. of arguments --
+
+Warning: str_split() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation1.phpt b/ext/standard/tests/strings/str_split_variation1.phpt
new file mode 100644
index 0000000..46406f5
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation1.phpt
@@ -0,0 +1,241 @@
+--TEST--
+Test str_split() function : usage variations - unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : unexpected values for 'str' ***\n";
+
+// Initialise function arguments
+$split_length = 3;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'str' argument
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ $fp
+);
+
+// loop through each element of $values for 'str' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( str_split($values[$count], $split_length) );
+}
+
+//closing resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing str_split() : unexpected values for 'str' ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ string(3) "123"
+ [1]=>
+ string(2) "45"
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ string(3) "-23"
+ [1]=>
+ string(2) "45"
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(3) "10."
+ [1]=>
+ string(1) "5"
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ string(3) "-10"
+ [1]=>
+ string(2) ".5"
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ string(3) "105"
+ [1]=>
+ string(3) "000"
+ [2]=>
+ string(3) "000"
+ [3]=>
+ string(3) "000"
+}
+-- Iteration 8 --
+array(3) {
+ [0]=>
+ string(3) "1.0"
+ [1]=>
+ string(3) "6E-"
+ [2]=>
+ string(1) "9"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+-- Iteration 10 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 16 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 19 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 20 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 21 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 22 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 23 --
+array(2) {
+ [0]=>
+ string(3) "obj"
+ [1]=>
+ string(3) "ect"
+}
+-- Iteration 24 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 25 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 26 --
+
+Warning: str_split() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation2.phpt b/ext/standard/tests/strings/str_split_variation2.phpt
new file mode 100644
index 0000000..ba1297b
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation2.phpt
@@ -0,0 +1,290 @@
+--TEST--
+Test str_split() function : usage variations - unexpected values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : unexpected values for 'split_length' ***\n";
+
+// Initialise function arguments
+$str = 'variation2:split_length';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'split_length'
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.6E10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ $fp
+);
+
+// loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "--Iteration ".($count+1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+
+//closing resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing str_split() : unexpected values for 'split_length' ***
+--Iteration 1 --
+array(3) {
+ [0]=>
+ string(10) "variation2"
+ [1]=>
+ string(10) ":split_len"
+ [2]=>
+ string(3) "gth"
+}
+--Iteration 2 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 4 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 5 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 6 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 7 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 8 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 9 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 10 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 11 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 12 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 13 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 14 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 15 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 16 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 17 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 18 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 19 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 20 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 21 --
+
+Warning: str_split() expects parameter 2 to be long, object given in %sstr_split_variation2.php on line %d
+NULL
+--Iteration 22 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 23 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d
+bool(false)
+--Iteration 24 --
+
+Warning: str_split() expects parameter 2 to be long, resource given in %sstr_split_variation2.php on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation2_64bit.phpt b/ext/standard/tests/strings/str_split_variation2_64bit.phpt
new file mode 100644
index 0000000..7aeaf0f
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation2_64bit.phpt
@@ -0,0 +1,291 @@
+--TEST--
+Test str_split() function : usage variations - unexpected values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : unexpected values for 'split_length' ***\n";
+
+// Initialise function arguments
+$str = 'variation2:split_length';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'split_length'
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.6E10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ $fp
+);
+
+// loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "--Iteration ".($count+1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+
+//closing resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing str_split() : unexpected values for 'split_length' ***
+--Iteration 1 --
+array(3) {
+ [0]=>
+ string(10) "variation2"
+ [1]=>
+ string(10) ":split_len"
+ [2]=>
+ string(3) "gth"
+}
+--Iteration 2 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 3 --
+array(1) {
+ [0]=>
+ string(23) "variation2:split_length"
+}
+--Iteration 4 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 5 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 6 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 7 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 8 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 9 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 10 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 11 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 12 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 13 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 14 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 15 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 16 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 17 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 18 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 19 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 20 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 21 --
+
+Warning: str_split() expects parameter 2 to be long, object given in %s on line %d
+NULL
+--Iteration 22 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 23 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 24 --
+
+Warning: str_split() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation3.phpt b/ext/standard/tests/strings/str_split_variation3.phpt
new file mode 100644
index 0000000..1e7be76
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_split_variation4.phpt b/ext/standard/tests/strings/str_split_variation4.phpt
new file mode 100644
index 0000000..617e932
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation4.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test str_split() function : usage variations - different single quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different single quoted strings as 'str' argument to str_split()
+* split_length is set to 5
+*/
+
+echo "*** Testing str_split() : single quoted strings for 'str' ***\n";
+
+//Initialize variables
+$split_length = 5;
+
+// different values for 'str'
+$values = array(
+ '', //empty
+ ' ', //space
+ '1234', //with only numbers
+ 'simple string', //regular string
+ 'It\'s string with quote', //string containing single quote
+ 'string\tcontains\rwhite space\nchars',
+ 'containing @ # $ % ^ & chars',
+ 'with 1234 numbers',
+ 'with \0 and ".chr(0)."null chars', //for binary safe
+ 'with multiple space char',
+ 'Testing invalid \k and \m escape char',
+ 'to check with \\n and \\t' //ignoring \n and \t results
+);
+
+//loop through each element of $values for 'str' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( str_split($values[$count], $split_length) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : single quoted strings for 'str' ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) " "
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(4) "1234"
+}
+-- Iteration 4 --
+array(3) {
+ [0]=>
+ string(5) "simpl"
+ [1]=>
+ string(5) "e str"
+ [2]=>
+ string(3) "ing"
+}
+-- Iteration 5 --
+array(5) {
+ [0]=>
+ string(5) "It's "
+ [1]=>
+ string(5) "strin"
+ [2]=>
+ string(5) "g wit"
+ [3]=>
+ string(5) "h quo"
+ [4]=>
+ string(2) "te"
+}
+-- Iteration 6 --
+array(8) {
+ [0]=>
+ string(5) "strin"
+ [1]=>
+ string(5) "g\tco"
+ [2]=>
+ string(5) "ntain"
+ [3]=>
+ string(5) "s\rwh"
+ [4]=>
+ string(5) "ite s"
+ [5]=>
+ string(5) "pace\"
+ [6]=>
+ string(5) "nchar"
+ [7]=>
+ string(1) "s"
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(5) "conta"
+ [1]=>
+ string(5) "ining"
+ [2]=>
+ string(5) " @ # "
+ [3]=>
+ string(5) "$ % ^"
+ [4]=>
+ string(5) " & ch"
+ [5]=>
+ string(3) "ars"
+}
+-- Iteration 8 --
+array(4) {
+ [0]=>
+ string(5) "with "
+ [1]=>
+ string(5) "1234 "
+ [2]=>
+ string(5) "numbe"
+ [3]=>
+ string(2) "rs"
+}
+-- Iteration 9 --
+array(7) {
+ [0]=>
+ string(5) "with "
+ [1]=>
+ string(5) "\0 an"
+ [2]=>
+ string(5) "d ".c"
+ [3]=>
+ string(5) "hr(0)"
+ [4]=>
+ string(5) "."nul"
+ [5]=>
+ string(5) "l cha"
+ [6]=>
+ string(2) "rs"
+}
+-- Iteration 10 --
+array(7) {
+ [0]=>
+ string(5) "with "
+ [1]=>
+ string(5) " mu"
+ [2]=>
+ string(5) "ltipl"
+ [3]=>
+ string(5) "e "
+ [4]=>
+ string(5) " spac"
+ [5]=>
+ string(5) "e cha"
+ [6]=>
+ string(1) "r"
+}
+-- Iteration 11 --
+array(8) {
+ [0]=>
+ string(5) "Testi"
+ [1]=>
+ string(5) "ng in"
+ [2]=>
+ string(5) "valid"
+ [3]=>
+ string(5) " \k a"
+ [4]=>
+ string(5) "nd \m"
+ [5]=>
+ string(5) " esca"
+ [6]=>
+ string(5) "pe ch"
+ [7]=>
+ string(2) "ar"
+}
+-- Iteration 12 --
+array(5) {
+ [0]=>
+ string(5) "to ch"
+ [1]=>
+ string(5) "eck w"
+ [2]=>
+ string(5) "ith \"
+ [3]=>
+ string(5) "n and"
+ [4]=>
+ string(3) " \t"
+}
+Done
diff --git a/ext/standard/tests/strings/str_split_variation5.phpt b/ext/standard/tests/strings/str_split_variation5.phpt
new file mode 100644
index 0000000..4e4df4f
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation5.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test str_split() function : usage variations - different heredoc strings as 'str' argument
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length] )
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Passing different heredoc strings as 'str' argument to the str_split()
+* with 'split_length' 10
+*/
+
+echo "*** Testing str_split() : heredoc strings as 'str' argument ***\n";
+
+// Initializing required variables
+$split_length = 10;
+
+// Null heredoc string
+$heredoc_null = <<<EOT1
+EOT1;
+
+// heredoc string with single character
+$heredoc_char = <<<EOT2
+a
+EOT2;
+
+// simple heredoc string
+$heredoc_str = <<<EOT3
+This is simple heredoc string
+EOT3;
+
+// heredoc with special characters
+$heredoc_spchar = <<<EOT4
+This checks heredoc with $, %, &, chars
+EOT4;
+
+// blank heredoc string
+$heredoc_blank = <<<EOT5
+
+EOT5;
+
+// heredoc with different white space characters
+$heredoc_escchar = <<<EOT6
+This checks\t str_split()\nEscape\rchars
+EOT6;
+
+// heredoc with multiline
+$heredoc_multiline= <<<EOT7
+This is to check str_split
+function with multiline
+heredoc
+EOT7;
+
+// heredoc with quotes and slashes
+$heredoc_quote_slash = <<<EOT8
+"To check " in heredoc"
+I'm sure it'll work also with \
+which is single slash
+EOT8;
+
+//different heredoc strings for 'str'
+$heredoc_array = array(
+ $heredoc_null,
+ $heredoc_blank,
+ $heredoc_char,
+ $heredoc_str,
+ $heredoc_multiline,
+ $heredoc_spchar,
+ $heredoc_escchar,
+ $heredoc_quote_slash
+);
+
+
+// loop through each element of the 'heredoc_array' for 'str'
+$count = 0;
+foreach($heredoc_array as $str) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( str_split($str, $split_length) );
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : heredoc strings as 'str' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+-- Iteration 4 --
+array(3) {
+ [0]=>
+ string(10) "This is si"
+ [1]=>
+ string(10) "mple hered"
+ [2]=>
+ string(9) "oc string"
+}
+-- Iteration 5 --
+array(6) {
+ [0]=>
+ string(10) "This is to"
+ [1]=>
+ string(10) " check str"
+ [2]=>
+ string(10) "_split
+fun"
+ [3]=>
+ string(10) "ction with"
+ [4]=>
+ string(10) " multiline"
+ [5]=>
+ string(8) "
+heredoc"
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(10) "This check"
+ [1]=>
+ string(10) "s heredoc "
+ [2]=>
+ string(10) "with $, %,"
+ [3]=>
+ string(9) " &, chars"
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ string(10) "This check"
+ [1]=>
+ string(10) "s str_spl"
+ [2]=>
+ string(10) "it()
+Escap"
+ [3]=>
+ string(7) "e chars"
+}
+-- Iteration 8 --
+array(8) {
+ [0]=>
+ string(10) ""To check "
+ [1]=>
+ string(10) "" in hered"
+ [2]=>
+ string(10) "oc"
+I'm su"
+ [3]=>
+ string(10) "re it'll w"
+ [4]=>
+ string(10) "ork also w"
+ [5]=>
+ string(10) "ith \
+whic"
+ [6]=>
+ string(10) "h is singl"
+ [7]=>
+ string(7) "e slash"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt
new file mode 100644
index 0000000..6d751bb
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation6.phpt
@@ -0,0 +1,166 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+//Initialise variables
+$str = 'This is a string with 123 & escape char \t';
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(42) {
+ [0]=>
+ string(1) "T"
+ [1]=>
+ string(1) "h"
+ [2]=>
+ string(1) "i"
+ [3]=>
+ string(1) "s"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) "i"
+ [6]=>
+ string(1) "s"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(1) "a"
+ [9]=>
+ string(1) " "
+ [10]=>
+ string(1) "s"
+ [11]=>
+ string(1) "t"
+ [12]=>
+ string(1) "r"
+ [13]=>
+ string(1) "i"
+ [14]=>
+ string(1) "n"
+ [15]=>
+ string(1) "g"
+ [16]=>
+ string(1) " "
+ [17]=>
+ string(1) "w"
+ [18]=>
+ string(1) "i"
+ [19]=>
+ string(1) "t"
+ [20]=>
+ string(1) "h"
+ [21]=>
+ string(1) " "
+ [22]=>
+ string(1) "1"
+ [23]=>
+ string(1) "2"
+ [24]=>
+ string(1) "3"
+ [25]=>
+ string(1) " "
+ [26]=>
+ string(1) "&"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) "e"
+ [29]=>
+ string(1) "s"
+ [30]=>
+ string(1) "c"
+ [31]=>
+ string(1) "a"
+ [32]=>
+ string(1) "p"
+ [33]=>
+ string(1) "e"
+ [34]=>
+ string(1) " "
+ [35]=>
+ string(1) "c"
+ [36]=>
+ string(1) "h"
+ [37]=>
+ string(1) "a"
+ [38]=>
+ string(1) "r"
+ [39]=>
+ string(1) " "
+ [40]=>
+ string(1) "\"
+ [41]=>
+ string(1) "t"
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "This is a string with 123 "
+ [1]=>
+ string(16) "& escape char \t"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 7 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_split_variation6_64bit.phpt b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
new file mode 100644
index 0000000..39c3a85
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+//Initialise variables
+$str = 'This is a string with 123 & escape char \t';
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(42) {
+ [0]=>
+ string(1) "T"
+ [1]=>
+ string(1) "h"
+ [2]=>
+ string(1) "i"
+ [3]=>
+ string(1) "s"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) "i"
+ [6]=>
+ string(1) "s"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(1) "a"
+ [9]=>
+ string(1) " "
+ [10]=>
+ string(1) "s"
+ [11]=>
+ string(1) "t"
+ [12]=>
+ string(1) "r"
+ [13]=>
+ string(1) "i"
+ [14]=>
+ string(1) "n"
+ [15]=>
+ string(1) "g"
+ [16]=>
+ string(1) " "
+ [17]=>
+ string(1) "w"
+ [18]=>
+ string(1) "i"
+ [19]=>
+ string(1) "t"
+ [20]=>
+ string(1) "h"
+ [21]=>
+ string(1) " "
+ [22]=>
+ string(1) "1"
+ [23]=>
+ string(1) "2"
+ [24]=>
+ string(1) "3"
+ [25]=>
+ string(1) " "
+ [26]=>
+ string(1) "&"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) "e"
+ [29]=>
+ string(1) "s"
+ [30]=>
+ string(1) "c"
+ [31]=>
+ string(1) "a"
+ [32]=>
+ string(1) "p"
+ [33]=>
+ string(1) "e"
+ [34]=>
+ string(1) " "
+ [35]=>
+ string(1) "c"
+ [36]=>
+ string(1) "h"
+ [37]=>
+ string(1) "a"
+ [38]=>
+ string(1) "r"
+ [39]=>
+ string(1) " "
+ [40]=>
+ string(1) "\"
+ [41]=>
+ string(1) "t"
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "This is a string with 123 "
+ [1]=>
+ string(16) "& escape char \t"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt
new file mode 100644
index 0000000..455c5b8
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation7.phpt
@@ -0,0 +1,144 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' with heredoc 'str'
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+//Initialise variables
+$str = <<<EOT
+string with 123,escape char \t.
+EOT;
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(30) {
+ [0]=>
+ string(1) "s"
+ [1]=>
+ string(1) "t"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "n"
+ [5]=>
+ string(1) "g"
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "w"
+ [8]=>
+ string(1) "i"
+ [9]=>
+ string(1) "t"
+ [10]=>
+ string(1) "h"
+ [11]=>
+ string(1) " "
+ [12]=>
+ string(1) "1"
+ [13]=>
+ string(1) "2"
+ [14]=>
+ string(1) "3"
+ [15]=>
+ string(1) ","
+ [16]=>
+ string(1) "e"
+ [17]=>
+ string(1) "s"
+ [18]=>
+ string(1) "c"
+ [19]=>
+ string(1) "a"
+ [20]=>
+ string(1) "p"
+ [21]=>
+ string(1) "e"
+ [22]=>
+ string(1) " "
+ [23]=>
+ string(1) "c"
+ [24]=>
+ string(1) "h"
+ [25]=>
+ string(1) "a"
+ [26]=>
+ string(1) "r"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) " "
+ [29]=>
+ string(1) "."
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "string with 123,escape cha"
+ [1]=>
+ string(4) "r ."
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 7 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_split_variation7_64bit.phpt b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
new file mode 100644
index 0000000..1f324b2
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
@@ -0,0 +1,145 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' with heredoc 'str'
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+//Initialise variables
+$str = <<<EOT
+string with 123,escape char \t.
+EOT;
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(30) {
+ [0]=>
+ string(1) "s"
+ [1]=>
+ string(1) "t"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "n"
+ [5]=>
+ string(1) "g"
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "w"
+ [8]=>
+ string(1) "i"
+ [9]=>
+ string(1) "t"
+ [10]=>
+ string(1) "h"
+ [11]=>
+ string(1) " "
+ [12]=>
+ string(1) "1"
+ [13]=>
+ string(1) "2"
+ [14]=>
+ string(1) "3"
+ [15]=>
+ string(1) ","
+ [16]=>
+ string(1) "e"
+ [17]=>
+ string(1) "s"
+ [18]=>
+ string(1) "c"
+ [19]=>
+ string(1) "a"
+ [20]=>
+ string(1) "p"
+ [21]=>
+ string(1) "e"
+ [22]=>
+ string(1) " "
+ [23]=>
+ string(1) "c"
+ [24]=>
+ string(1) "h"
+ [25]=>
+ string(1) "a"
+ [26]=>
+ string(1) "r"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) " "
+ [29]=>
+ string(1) "."
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "string with 123,escape cha"
+ [1]=>
+ string(4) "r ."
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt
new file mode 100644
index 0000000..11e1bb6
--- /dev/null
+++ b/ext/standard/tests/strings/str_word_count.phpt
@@ -0,0 +1,249 @@
+--TEST--
+str_word_count()
+--FILE--
+<?php
+error_reporting(E_ALL);
+$str = "Hello friend, you're
+ looking good today!";
+$b =& $str;
+var_dump(str_word_count($str, 1));
+var_dump(str_word_count($str, 2));
+var_dump(str_word_count($str));
+var_dump(str_word_count($str, 3));
+var_dump(str_word_count($str, 123));
+var_dump(str_word_count($str, -1));
+var_dump(str_word_count($str, 999999999));
+var_dump(str_word_count($str, array()));
+var_dump(str_word_count($str, $b));
+var_dump($str);
+
+$str2 = "F0o B4r 1s bar foo";
+var_dump(str_word_count($str2, NULL, "04"));
+var_dump(str_word_count($str2, NULL, "01"));
+var_dump(str_word_count($str2, NULL, "014"));
+var_dump(str_word_count($str2, NULL, array()));
+var_dump(str_word_count($str2, NULL, new stdClass));
+var_dump(str_word_count($str2, NULL, ""));
+var_dump(str_word_count($str2, 1, "04"));
+var_dump(str_word_count($str2, 1, "01"));
+var_dump(str_word_count($str2, 1, "014"));
+var_dump(str_word_count($str2, 1, array()));
+var_dump(str_word_count($str2, 1, new stdClass));
+var_dump(str_word_count($str2, 1, ""));
+var_dump(str_word_count($str2, 2, "04"));
+var_dump(str_word_count($str2, 2, "01"));
+var_dump(str_word_count($str2, 2, "014"));
+var_dump(str_word_count($str2, 2, array()));
+var_dump(str_word_count($str2, 2, new stdClass));
+var_dump(str_word_count($str2, 2, ""));
+var_dump(str_word_count("foo'0 bar-0var", 2, "0"));
+var_dump(str_word_count("'foo'", 2));
+var_dump(str_word_count("'foo'", 2, "'"));
+var_dump(str_word_count("-foo-", 2));
+var_dump(str_word_count("-foo-", 2, "-"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(6) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(6) "friend"
+ [2]=>
+ string(6) "you're"
+ [3]=>
+ string(7) "looking"
+ [4]=>
+ string(4) "good"
+ [5]=>
+ string(5) "today"
+}
+array(6) {
+ [0]=>
+ string(5) "Hello"
+ [6]=>
+ string(6) "friend"
+ [14]=>
+ string(6) "you're"
+ [27]=>
+ string(7) "looking"
+ [44]=>
+ string(4) "good"
+ [49]=>
+ string(5) "today"
+}
+int(6)
+
+Warning: str_word_count(): Invalid format value 3 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value 123 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value -1 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value 999999999 in %s on line %d
+bool(false)
+
+Warning: str_word_count() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: str_word_count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+string(55) "Hello friend, you're
+ looking good today!"
+int(5)
+int(6)
+int(5)
+
+Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
+NULL
+int(7)
+array(5) {
+ [0]=>
+ string(3) "F0o"
+ [1]=>
+ string(3) "B4r"
+ [2]=>
+ string(1) "s"
+ [3]=>
+ string(3) "bar"
+ [4]=>
+ string(3) "foo"
+}
+array(6) {
+ [0]=>
+ string(3) "F0o"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(2) "1s"
+ [4]=>
+ string(3) "bar"
+ [5]=>
+ string(3) "foo"
+}
+array(5) {
+ [0]=>
+ string(3) "F0o"
+ [1]=>
+ string(3) "B4r"
+ [2]=>
+ string(2) "1s"
+ [3]=>
+ string(3) "bar"
+ [4]=>
+ string(3) "foo"
+}
+
+Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
+NULL
+array(7) {
+ [0]=>
+ string(1) "F"
+ [1]=>
+ string(1) "o"
+ [2]=>
+ string(1) "B"
+ [3]=>
+ string(1) "r"
+ [4]=>
+ string(1) "s"
+ [5]=>
+ string(3) "bar"
+ [6]=>
+ string(3) "foo"
+}
+array(5) {
+ [0]=>
+ string(3) "F0o"
+ [4]=>
+ string(3) "B4r"
+ [9]=>
+ string(1) "s"
+ [11]=>
+ string(3) "bar"
+ [15]=>
+ string(3) "foo"
+}
+array(6) {
+ [0]=>
+ string(3) "F0o"
+ [4]=>
+ string(1) "B"
+ [6]=>
+ string(1) "r"
+ [8]=>
+ string(2) "1s"
+ [11]=>
+ string(3) "bar"
+ [15]=>
+ string(3) "foo"
+}
+array(5) {
+ [0]=>
+ string(3) "F0o"
+ [4]=>
+ string(3) "B4r"
+ [8]=>
+ string(2) "1s"
+ [11]=>
+ string(3) "bar"
+ [15]=>
+ string(3) "foo"
+}
+
+Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
+NULL
+array(7) {
+ [0]=>
+ string(1) "F"
+ [2]=>
+ string(1) "o"
+ [4]=>
+ string(1) "B"
+ [6]=>
+ string(1) "r"
+ [9]=>
+ string(1) "s"
+ [11]=>
+ string(3) "bar"
+ [15]=>
+ string(3) "foo"
+}
+array(2) {
+ [0]=>
+ string(5) "foo'0"
+ [6]=>
+ string(8) "bar-0var"
+}
+array(1) {
+ [1]=>
+ string(4) "foo'"
+}
+array(1) {
+ [0]=>
+ string(5) "'foo'"
+}
+array(1) {
+ [1]=>
+ string(3) "foo"
+}
+array(1) {
+ [0]=>
+ string(5) "-foo-"
+}
+Done
diff --git a/ext/standard/tests/strings/str_word_count1.phpt b/ext/standard/tests/strings/str_word_count1.phpt
new file mode 100644
index 0000000..5f49fcf
--- /dev/null
+++ b/ext/standard/tests/strings/str_word_count1.phpt
@@ -0,0 +1,26 @@
+--TEST--
+str_word_count() and invalid arguments
+--FILE--
+<?php
+
+var_dump(str_word_count(""));
+var_dump(str_word_count("", -1));
+var_dump(str_word_count("", -1, $a));
+var_dump($a);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(0)
+
+Warning: str_word_count(): Invalid format value -1 in %s on line %d
+bool(false)
+
+Notice: Undefined variable: a in %s on line %d
+
+Warning: str_word_count(): Invalid format value -1 in %s on line %d
+bool(false)
+
+Notice: Undefined variable: a in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt
new file mode 100644
index 0000000..33694f9
--- /dev/null
+++ b/ext/standard/tests/strings/strcasecmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt
new file mode 100644
index 0000000..0693880
--- /dev/null
+++ b/ext/standard/tests/strings/strcmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcoll.phpt b/ext/standard/tests/strings/strcoll.phpt
new file mode 100644
index 0000000..6fbfa04
--- /dev/null
+++ b/ext/standard/tests/strings/strcoll.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing Basic behaviour of strcoll()
+--CREDITS--
+Sebastian SchÃŒrmann
+sebs@php.net
+Testfest 2009 Munich
+--FILE--
+<?php
+
+ $a = 'a';
+ $b = 'A';
+
+setlocale (LC_COLLATE, 'C');
+$result = strcoll($a, $b);
+if($result > 0) {
+ echo "Pass\n";
+}
+?>
+--EXPECT--
+Pass
+
diff --git a/ext/standard/tests/strings/strcoll_error.phpt b/ext/standard/tests/strings/strcoll_error.phpt
new file mode 100644
index 0000000..7eda981
--- /dev/null
+++ b/ext/standard/tests/strings/strcoll_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test strcoll() function : error conditions
+--FILE--
+<?php
+/* Prototype: int strcoll ( string $str1 , string $str2 )
+ Description: Locale based string comparison
+*/
+
+echo "*** Testing strcoll() : error conditions ***\n";
+
+echo "\n-- Testing strcoll() function with no arguments --\n";
+var_dump( strcoll() );
+var_dump( strcoll("") );
+
+echo "\n-- Testing strcoll() function with one argument --\n";
+var_dump( strcoll("Hello World") );
+
+echo "\n-- Testing strcoll() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( strcoll("Hello World", "World", $extra_arg) );
+
+?>
+===Done===
+--EXPECTF--
+*** Testing strcoll() : error conditions ***
+
+-- Testing strcoll() function with no arguments --
+
+Warning: strcoll() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: strcoll() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+-- Testing strcoll() function with one argument --
+
+Warning: strcoll() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+-- Testing strcoll() function with more than expected no. of arguments --
+
+Warning: strcoll() 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/strcspn.phpt b/ext/standard/tests/strings/strcspn.phpt
new file mode 100644
index 0000000..d948655
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test strcspn() behavior
+--FILE--
+<?php
+$a = "22222222aaaa bbb1111 cccc";
+$b = "1234";
+var_dump($a);
+var_dump($b);
+var_dump(strcspn($a,$b));
+var_dump(strcspn($a,$b,9));
+var_dump(strcspn($a,$b,9,6));
+var_dump(strcspn('a', 'B', 1, 2147483647));
+?>
+--EXPECT--
+string(25) "22222222aaaa bbb1111 cccc"
+string(4) "1234"
+int(0)
+int(7)
+int(6)
+int(0)
diff --git a/ext/standard/tests/strings/strcspn_basic.phpt b/ext/standard/tests/strings/strcspn_basic.phpt
new file mode 100644
index 0000000..232b105
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test strcspn() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided, it works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : basic functionality
+*/
+
+echo "*** Testing strcspn() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = "this is the test string";
+$mask = "es";
+$start = 15;
+$len = 30;
+
+// Calling strcspn() with all possible arguments
+var_dump( strcspn($str, $mask, $start, $len) );
+
+// Calling strcspn() with three arguments
+var_dump( strcspn($str, $mask, $start) );
+
+// Calling strcspn() with default arguments
+var_dump( strcspn($str, $mask) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : basic functionality ***
+int(2)
+int(2)
+int(3)
+Done
diff --git a/ext/standard/tests/strings/strcspn_error.phpt b/ext/standard/tests/strings/strcspn_error.phpt
new file mode 100644
index 0000000..03b4f2d
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test strcspn() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Test strcspn() : for error conditons
+*/
+
+echo "*** Testing strcspn() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing strcspn() function with Zero arguments --\n";
+var_dump( strcspn() );
+
+//Test strcspn with one more than the expected number of arguments
+echo "\n-- Testing strcspn() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$mask = 'string_val';
+$start = 2;
+$len = 20;
+
+
+$extra_arg = 10;
+var_dump( strcspn($str,$mask,$start,$len, $extra_arg) );
+
+// Testing strcspn withone less than the expected number of arguments
+echo "\n-- Testing strcspn() function with less than expected no. of arguments --\n";
+$str = 'string_val';
+var_dump( strcspn($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : error conditions ***
+
+-- Testing strcspn() function with Zero arguments --
+
+Warning: strcspn() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing strcspn() function with more than expected no. of arguments --
+
+Warning: strcspn() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+
+-- Testing strcspn() function with less than expected no. of arguments --
+
+Warning: strcspn() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation1.phpt b/ext/standard/tests/strings/strcspn_variation1.phpt
new file mode 100644
index 0000000..219a12c
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation1.phpt
@@ -0,0 +1,273 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values for str argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strspn() : with different unexpected values for str argument
+*/
+
+echo "*** Testing strcspn() : with unexpected values for str argument ***\n";
+
+// Initialise function arguments not being substititued (if any)
+$mask = 'abons1234567890';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample,
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\n-- Iteration with str value as \"$value\"\n";
+ var_dump( strcspn($value,$mask) ); // with default args
+ var_dump( strcspn($value,$mask,$start) ); // with default len value
+ var_dump( strcspn($value,$mask,$start,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with unexpected values for str argument ***
+
+-- Iteration with str value as "0"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "1"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "12345"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "-2345"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "10.5"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "-10.5"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "101234567000"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "1.07654321E-9"
+int(0)
+int(1)
+int(1)
+
+-- Iteration with str value as "0.5"
+int(0)
+int(1)
+int(1)
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "object"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "Resource id #%d"
+
+Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation10.phpt b/ext/standard/tests/strings/strcspn_variation10.phpt
new file mode 100644
index 0000000..37bb00e
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation10.phpt
@@ -0,0 +1,272 @@
+--TEST--
+Test strcspn() function : usage variations - with varying mask & default start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with varying mask and default start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different mask strings and default start and len arguments ***\n";
+
+// initialing required variables
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xa"
+ );
+
+
+// loop through each element of the array for mask argument
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Itearation $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strcspn($str,$mask) );
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different mask strings and default start and len arguments ***
+
+-- Itearation 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Itearation 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Itearation 3 --
+int(1)
+int(1)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+
+-- Itearation 4 --
+int(2)
+int(2)
+int(0)
+int(0)
+int(2)
+int(0)
+int(0)
+int(0)
+int(2)
+int(0)
+
+-- Itearation 5 --
+int(24)
+int(24)
+int(2)
+int(2)
+int(5)
+int(24)
+int(24)
+int(5)
+int(5)
+int(5)
+
+-- Itearation 6 --
+int(28)
+int(28)
+int(2)
+int(2)
+int(28)
+int(5)
+int(5)
+int(5)
+int(28)
+int(5)
+
+-- Itearation 7 --
+int(20)
+int(20)
+int(6)
+int(6)
+int(16)
+int(20)
+int(20)
+int(16)
+int(16)
+int(16)
+
+-- Itearation 8 --
+int(21)
+int(21)
+int(6)
+int(6)
+int(21)
+int(16)
+int(16)
+int(16)
+int(21)
+int(16)
+
+-- Itearation 9 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(12)
+int(12)
+int(12)
+int(12)
+int(12)
+int(11)
+
+-- Itearation 10 --
+int(16)
+int(16)
+int(2)
+int(2)
+int(16)
+int(5)
+int(5)
+int(5)
+int(16)
+int(5)
+
+-- Itearation 11 --
+int(0)
+int(0)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+
+-- Itearation 12 --
+int(0)
+int(0)
+int(3)
+int(3)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+
+-- Itearation 13 --
+int(0)
+int(0)
+int(3)
+int(3)
+int(14)
+int(6)
+int(6)
+int(6)
+int(14)
+int(6)
+
+-- Itearation 14 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+
+-- Itearation 15 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+
+-- Itearation 16 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(14)
+int(14)
+int(14)
+int(14)
+int(14)
+int(6)
+
+-- Itearation 17 --
+int(21)
+int(21)
+int(2)
+int(2)
+int(21)
+int(5)
+int(5)
+int(5)
+int(21)
+int(5)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation11.phpt b/ext/standard/tests/strings/strcspn_variation11.phpt
new file mode 100644
index 0000000..28f1dbe
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation11.phpt
@@ -0,0 +1,1306 @@
+--TEST--
+Test strcspn() function : usage variations - with varying start and default len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with varying start and default len arguments
+*/
+
+echo "*** Testing strcspn() : with different start and default len values ***\n";
+
+// initialing required variables
+// initialing required variables
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xa"
+ );
+
+//defining array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for str,mask and start arguments
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strcspn($str,$mask,$start) );
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : 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(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+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(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+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)
+
+-- Iteration 4 --
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(1)
+int(0)
+int(1)
+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(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 5 --
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(2)
+int(1)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+
+-- Iteration 6 --
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+
+-- Iteration 7 --
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+
+-- Iteration 8 --
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+
+-- Iteration 9 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(11)
+int(10)
+int(9)
+int(0)
+int(1)
+bool(false)
+int(11)
+
+-- Iteration 10 --
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+
+-- 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(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+
+-- Iteration 12 --
+int(0)
+int(5)
+int(4)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(0)
+int(5)
+int(4)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+
+-- Iteration 13 --
+int(0)
+int(12)
+int(11)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(0)
+int(12)
+int(11)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+
+-- Iteration 14 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+
+-- Iteration 15 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+
+-- Iteration 16 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+
+-- Iteration 17 --
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation12.phpt b/ext/standard/tests/strings/strcspn_variation12.phpt
new file mode 100644
index 0000000..b6f8cac
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation12.phpt
@@ -0,0 +1,2482 @@
+--TEST--
+Test strcspn() function : usage variations - with varying start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with varying start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different start and len values ***\n";
+
+// initialing required variables
+// initialing required variables
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ "1234hello45world\t123",
+ "hello\0world\012",
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ "hello".chr(0)."world",
+ "hello\0\100\xaworld",
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ "\t",
+ "t\ ",
+ "\t\i\100\xa"
+ );
+
+//defining array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648 // min negative integer
+ );
+
+//defining array of len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648 // min negative integer
+ );
+
+
+// loop through each element of the arrays for str,mask,start and len arguments
+
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strcspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : 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)
+
+-- 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)
+
+-- Iteration 3 --
+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(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(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(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)
+
+-- Iteration 4 --
+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(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(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(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(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(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(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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 5 --
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+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(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+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(23)
+int(24)
+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(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+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(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(1)
+int(2)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 6 --
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(18)
+int(19)
+int(0)
+int(0)
+int(1)
+int(2)
+int(17)
+int(18)
+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(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(18)
+int(19)
+int(0)
+int(0)
+int(1)
+int(2)
+int(17)
+int(18)
+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(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(16)
+int(16)
+int(0)
+int(0)
+int(1)
+int(2)
+int(15)
+int(15)
+int(0)
+int(0)
+int(1)
+int(2)
+int(14)
+int(14)
+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(16)
+int(16)
+int(0)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(18)
+int(19)
+int(0)
+int(0)
+int(1)
+int(2)
+int(17)
+int(18)
+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(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(16)
+int(16)
+int(0)
+int(0)
+int(1)
+int(2)
+int(15)
+int(15)
+int(0)
+int(0)
+int(1)
+int(2)
+int(14)
+int(14)
+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(16)
+int(16)
+int(0)
+
+-- Iteration 7 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+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(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+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(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+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(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(9)
+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(11)
+int(11)
+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(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(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(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(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)
+
+-- Iteration 9 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(3)
+int(3)
+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(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(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+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(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+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(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+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(12)
+int(13)
+int(0)
+
+-- Iteration 10 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+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(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(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(9)
+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(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(9)
+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(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(9)
+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(10)
+int(11)
+int(0)
+
+-- Iteration 11 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+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(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(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+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(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+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(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(6)
+int(6)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation2.phpt b/ext/standard/tests/strings/strcspn_variation2.phpt
new file mode 100644
index 0000000..cb7544c
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation2.phpt
@@ -0,0 +1,272 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values for mask argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strcspn() : with different unexpected values for mask argument
+*/
+
+echo "*** Testing strcspn() : with diferent unexpected values of mask argument ***\n";
+
+$str = 'string_val';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for mask
+
+foreach($values as $value) {
+ echo "\n-- Iteration with mask value as \"$value\" --\n";
+ var_dump( strcspn($str,$value) ); // with defalut args
+ var_dump( strcspn($str,$value,$start) ); // with default len value
+ var_dump( strcspn($str,$value,$start,$len) ); // with all args
+};
+
+// close the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with diferent unexpected values of mask argument ***
+
+-- Iteration with mask value as "0" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "12345" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "-2345" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "10.5" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "-10.5" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "101234567000" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1.07654321E-9" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "0.5" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "object" --
+int(1)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "Resource id #%d" --
+
+Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation3.phpt b/ext/standard/tests/strings/strcspn_variation3.phpt
new file mode 100644
index 0000000..8b1923e
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation3.phpt
@@ -0,0 +1,243 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values of start argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strcspn() : with unexpected values of start argument
+*/
+
+echo "*** Testing strcspn() : with unexpected values of start argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$len = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with start value as \"$value\" --\n";
+ var_dump( strcspn($str,$mask,$value) ); // with default len value
+ var_dump( strcspn($str,$mask,$value,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : 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(0)
+int(0)
+
+-- Iteration with start value as "1012345670" --
+bool(false)
+bool(false)
+
+-- Iteration with start value as "1.07654321E-7" --
+int(0)
+int(0)
+
+-- Iteration with start value as "0.5" --
+int(0)
+int(0)
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "1" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "1" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "string" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "string" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "object" --
+
+Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "Resource id #%d" --
+
+Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+
+Warning: strcspn() 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/strcspn_variation4.phpt b/ext/standard/tests/strings/strcspn_variation4.phpt
new file mode 100644
index 0000000..d456a23
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation4.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values of len argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strcspn() : with unexpected values of len argument
+*/
+
+echo "*** Testing strcspn() : with unexpected values of len argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$start = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with len value as \"$value\" --\n";
+ var_dump( strcspn($str,$mask,$start,$value) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with unexpected values of len argument ***
+
+-- Iteration with len value as "10.5" --
+int(0)
+
+-- Iteration with len value as "-10.5" --
+int(0)
+
+-- Iteration with len value as "101234567000" --
+int(0)
+
+-- Iteration with len value as "1.07654321E-9" --
+int(0)
+
+-- Iteration with len value as "0.5" --
+int(0)
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "1" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "1" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "string" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "string" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "object" --
+
+Warning: strcspn() expects parameter 4 to be long, object given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "Resource id #%d" --
+
+Warning: strcspn() expects parameter 4 to be long, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation5.phpt b/ext/standard/tests/strings/strcspn_variation5.phpt
new file mode 100644
index 0000000..a3dfa51
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcspn_variation6.phpt b/ext/standard/tests/strings/strcspn_variation6.phpt
new file mode 100644
index 0000000..92fa3d0
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation6.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test strcspn() function : usage variations - with heredoc strings, varying mask & default start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with heredoc string, varying mask and default start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different mask strings ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xaa"
+ );
+
+
+// loop through each element of the arrays for string and mask arguments
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strcspn($str,$mask) ); // with default start and len value
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : 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(2)
+int(2)
+int(0)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+
+-- Iteration 3 --
+int(86)
+int(86)
+int(1)
+int(1)
+int(86)
+int(4)
+int(4)
+int(5)
+int(5)
+int(1)
+
+-- Iteration 4 --
+int(24)
+int(24)
+int(2)
+int(2)
+int(5)
+int(24)
+int(24)
+int(5)
+int(5)
+int(5)
+
+-- Iteration 5 --
+int(31)
+int(31)
+int(2)
+int(2)
+int(26)
+int(31)
+int(31)
+int(26)
+int(26)
+int(26)
+
+-- Iteration 6 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(25)
+int(25)
+int(25)
+int(25)
+int(25)
+int(25)
+
+-- Iteration 7 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(27)
+int(27)
+int(27)
+int(27)
+int(27)
+int(6)
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation7.phpt b/ext/standard/tests/strings/strcspn_variation7.phpt
new file mode 100644
index 0000000..ae01f91
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation7.phpt
@@ -0,0 +1,612 @@
+--TEST--
+Test strcspn() function : usage variations - with heredoc strings, varying start and default len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with heredoc string, varying start and default len arguments
+*/
+
+echo "*** Testing strcspn() : with different start values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+
+// defining array of mask strings
+
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xaa"
+ );
+
+// definig array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for str, mask and start arguments
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strcspn($str,$mask,$start) ); // with default len value
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : 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(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+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(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+
+-- Iteration 3 --
+int(86)
+int(85)
+int(84)
+int(1)
+int(2)
+bool(false)
+int(86)
+int(86)
+int(85)
+int(84)
+int(1)
+int(2)
+bool(false)
+int(86)
+int(1)
+int(0)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(86)
+int(85)
+int(84)
+int(1)
+int(2)
+bool(false)
+int(86)
+int(4)
+int(3)
+int(2)
+int(1)
+int(2)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(1)
+int(2)
+bool(false)
+int(4)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(1)
+int(0)
+int(5)
+int(1)
+int(2)
+bool(false)
+int(1)
+
+-- Iteration 4 --
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(2)
+int(1)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+
+-- Iteration 5 --
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+
+-- Iteration 6 --
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+
+-- Iteration 7 --
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation8.phpt b/ext/standard/tests/strings/strcspn_variation8.phpt
new file mode 100644
index 0000000..6b662ec
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation8.phpt
@@ -0,0 +1,1892 @@
+--TEST--
+Test strcspn() function : usage variations - with heredoc strings, varying start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with heredoc string, varying start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different start and len values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ "\t",
+ "t\ ",
+ " \t",
+ "\t\i\100\xaa"
+ );
+
+// definig array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+// defining array of len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for all arguments
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strcspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : 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(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(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(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(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(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(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)
+
+-- Iteration 3 --
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(84)
+int(85)
+int(0)
+int(0)
+int(1)
+int(2)
+int(83)
+int(84)
+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(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(84)
+int(85)
+int(0)
+int(0)
+int(1)
+int(2)
+int(83)
+int(84)
+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(85)
+int(86)
+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(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(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(84)
+int(85)
+int(0)
+int(0)
+int(1)
+int(2)
+int(83)
+int(84)
+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(85)
+int(86)
+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(5)
+int(5)
+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(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(5)
+int(5)
+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(1)
+int(2)
+int(5)
+int(5)
+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(1)
+int(1)
+int(1)
+int(0)
+
+-- Iteration 4 --
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+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(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+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(23)
+int(24)
+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(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+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(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(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(5)
+int(5)
+int(0)
+
+-- Iteration 5 --
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(29)
+int(30)
+int(0)
+int(0)
+int(1)
+int(2)
+int(28)
+int(29)
+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(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(29)
+int(30)
+int(0)
+int(0)
+int(1)
+int(2)
+int(28)
+int(29)
+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(30)
+int(31)
+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(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(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(24)
+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(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(29)
+int(30)
+int(0)
+int(0)
+int(1)
+int(2)
+int(28)
+int(29)
+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(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(24)
+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(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(24)
+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(26)
+int(26)
+int(0)
+
+-- Iteration 6 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(1)
+int(2)
+int(5)
+int(5)
+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(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(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+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(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+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(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+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(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+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(24)
+int(25)
+int(0)
+
+-- Iteration 7 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+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(1)
+int(2)
+int(5)
+int(5)
+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(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(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+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(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+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(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+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(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(6)
+int(6)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation9.phpt b/ext/standard/tests/strings/strcspn_variation9.phpt
new file mode 100644
index 0000000..e765084
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strings001.phpt b/ext/standard/tests/strings/strings001.phpt
new file mode 100644
index 0000000..70b7092
--- /dev/null
+++ b/ext/standard/tests/strings/strings001.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test whether strstr() and strrchr() are binary safe.
+--FILE--
+<?php
+/* Do not change this test it is a README.TESTING example. */
+$s = "alabala nica".chr(0)."turska panica";
+var_dump(strstr($s, "nic"));
+var_dump(strrchr($s," nic"));
+?>
+--EXPECTREGEX--
+string\(18\) \"nica\x00turska panica\"
+string\(7\) \" panica\"
diff --git a/ext/standard/tests/strings/strip_tags.phpt b/ext/standard/tests/strings/strip_tags.phpt
new file mode 100644
index 0000000..7beebf1
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags.phpt
@@ -0,0 +1,27 @@
+--TEST--
+strip_tags() function
+--FILE--
+<?php
+ echo strip_tags('NEAT <? cool < blah ?> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <? cool > blah ?> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <!-- cool < blah --> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <!-- cool > blah --> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <? echo \"\\\"\"?> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <? echo \'\\\'\'?> STUFF');
+ echo "\n";
+ echo strip_tags('TESTS ?!!?!?!!!?!!');
+ echo "\n";
+?>
+--EXPECT--
+NEAT STUFF
+NEAT STUFF
+NEAT STUFF
+NEAT STUFF
+NEAT STUFF
+NEAT STUFF
+TESTS ?!!?!?!!!?!!
diff --git a/ext/standard/tests/strings/strip_tags_basic1.phpt b/ext/standard/tests/strings/strip_tags_basic1.phpt
new file mode 100644
index 0000000..6d98f47
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_basic1.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test strip_tags() function : basic functionality - with default arguments
+--INI--
+short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strip_tags() : basic functionality ***\n";
+
+// array of arguments
+$string_array = array (
+ "<html>hello</html>",
+ '<html>hello</html>',
+ "<?php echo hello ?>",
+ '<?php echo hello ?>',
+ "<? echo hello ?>",
+ '<? echo hello ?>',
+ "<% echo hello %>",
+ '<% echo hello %>',
+ "<script language=\"PHP\"> echo hello </script>",
+ '<script language=\"PHP\"> echo hello </script>',
+ "<html><b>hello</b><p>world</p></html>",
+ '<html><b>hello</b><p>world</p></html>',
+ "<html><!-- COMMENT --></html>",
+ '<html><!-- COMMENT --></html>'
+);
+
+
+// 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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strip_tags() : basic functionality ***\n";
+
+// Calling strip_tags() with all possible arguments
+$string = "<html><p>hello</p><b>world</b><a href=\"#fragment\">Other text</a></html><?php echo hello ?>";
+
+$allowed_tags_array=array(
+ "<html>",
+ '<html>',
+ "<p>",
+ '<p>',
+ "<a>",
+ '<a>',
+ "<?php",
+ '<?php',
+ "<html><p><a><?php"
+);
+
+// loop through the $string with various $allowed_tags_array to test strip_tags
+// on various allowed tags
+$iteration = 1;
+foreach($allowed_tags_array as $tags)
+{
+ echo "-- Iteration $iteration --\n";
+ var_dump( strip_tags($string, $tags) );
+ $iteration++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : basic functionality ***
+-- Iteration 1 --
+string(33) "<html>helloworldOther text</html>"
+-- Iteration 2 --
+string(33) "<html>helloworldOther text</html>"
+-- Iteration 3 --
+string(27) "<p>hello</p>worldOther text"
+-- Iteration 4 --
+string(27) "<p>hello</p>worldOther text"
+-- Iteration 5 --
+string(44) "helloworld<a href="#fragment">Other text</a>"
+-- Iteration 6 --
+string(44) "helloworld<a href="#fragment">Other text</a>"
+-- Iteration 7 --
+string(20) "helloworldOther text"
+-- Iteration 8 --
+string(20) "helloworldOther text"
+-- Iteration 9 --
+string(64) "<html><p>hello</p>world<a href="#fragment">Other text</a></html>"
+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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing strip_tags() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing strip_tags() function with Zero arguments --\n";
+var_dump( strip_tags() );
+
+//Test strip_tags with one more than the expected number of arguments
+echo "\n-- Testing strip_tags() function with more than expected no. of arguments --\n";
+$str = "<html>hello</html>";
+$allowable_tags = "<html>";
+$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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving unexpected input values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // 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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving single quoted strings as values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+
+$single_quote_string = array (
+ '<html> \$ -> This represents the dollar sign</html><?php echo hello ?>',
+ '<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>',
+ '<a>This is a hyper text tag</a>',
+ '<? <html>hello world\\t</html>?>',
+ '<p>This is a paragraph</p>',
+ '<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>'
+);
+
+$quotes = "<html><a><p><b><?php";
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($single_quote_string 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(51) "<html> \$ -> This represents the dollar sign</html>"
+-- Iteration 2 --
+string(63) "<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>"
+-- Iteration 3 --
+string(31) "<a>This is a hyper text tag</a>"
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(26) "<p>This is a paragraph</p>"
+-- Iteration 6 --
+string(65) "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
+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--
+<?php
+
+echo "*** Testing strip_tags() : obscure functionality ***\n";
+
+// array of arguments
+$string_array = array (
+ 'hello <img title="<"> world',
+ 'hello <img title=">"> world',
+ 'hello <img title=">_<"> world',
+ "hello <img title='>_<'> 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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving unexpected values for $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// Initialise function argument
+$string = "<html><a>hello</a></html><p>world</p><!-- COMMENT --><?php echo hello ?>";
+
+//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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving unexpected values for $str and $allowable_tags arguments
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// get a resource
+$fp=fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new 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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving invalid values for $str and valid values for $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// unexpected values for $string
+$strings = array (
+ "<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>",
+ '<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>',
+ "<%?php hello\t world?%>",
+ '<%?php hello\t world?%>',
+ "<<htmL>>hello<</htmL>>",
+ '<<htmL>>hello<</htmL>>',
+ "<a.>HtMl text</.a>",
+ '<a.>HtMl text</.a>',
+ "<nnn>I am not a valid html text</nnn>",
+ '<nnn>I am not a valid html text</nnn>',
+ "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>",
+ '<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>',
+);
+
+//valid html and php tags
+$quotes = "<p><a><?php<html>";
+
+//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) "<htmL>hello</htmL>"
+-- Iteration 6 --
+string(18) "<htmL>hello</htmL>"
+-- 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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+
+/*
+ * testing functionality of strip_tags() by giving heredoc strings as values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// null here doc string
+$null_string = <<<EOT
+EOT;
+
+// heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// here doc with multiline string
+$multiline_string = <<<EOT
+<html>hello world</html>
+<p>13 &lt; 25</p>
+<?php 1111 &amp; 0000 = 0000 ?>
+<b>This is a double quoted string</b>
+EOT;
+
+// here doc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+<html>hello\r world\t
+1111\t\t != 2222\v\v</html>
+<? heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces ?>
+EOT;
+
+// here doc with numeric values
+$numeric_string = <<<EOT
+<html>11 < 12. 123 >22</html>
+<p>string</p> 1111\t <b>0000\t = 0000\n</b>
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+<html>This's a string with quotes:</html>
+"strings in double quote";
+'strings in single quote';
+<html>this\line is single quoted /with\slashes </html>
+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 = "<html><a><?php";
+
+// loop through $res_heredoc_strings element and check the working on strip_tags()
+$count = 1;
+for($index =0; $index < count($res_heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strip_tags($res_heredoc_strings[$index], $quotes) );
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(67) "<html>hello world</html>
+13 &lt; 25
+
+This is a double quoted string"
+-- Iteration 4 --
+string(44) "<html>hello world
+1111 != 2222 </html>
+"
+-- Iteration 5 --
+string(56) "<html>11 < 12. 123 >22</html>
+string 1111 0000 = 0000
+"
+-- Iteration 6 --
+string(150) "<html>This's a string with quotes:</html>
+"strings in double quote";
+'strings in single quote';
+<html>this\line is single quoted /with\slashes </html>"
+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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing whether strip_tags() is binary safe or not
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+//various string inputs
+$strings = array (
+ "<html> I am html string </html>".chr(0)."<?php I am php string ?>",
+ "<html> I am html string\0 </html><?php I am php string ?>",
+ b"<a>I am html string</a>",
+ "<html>I am html string</html>".decbin(65)."<?php I am php string?>"
+);
+
+//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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving invalid values for $str and $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+$strings = array (
+ "<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>",
+ '<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>',
+ "<%?php hello\t world?%>",
+ '<%?php hello\t world?%>',
+ "<<htmL>>hello<</htmL>>",
+ '<<htmL>>hello<</htmL>>',
+ "<a.>HtMl text</.a>",
+ '<a.>HtMl text</.a>',
+ "<nnn>I am not a valid html text</nnn>",
+ '<nnn>I am not a valid html text</nnn>',
+ "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>",
+ '<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>',
+);
+
+$quotes = "<nnn><abc><%?<<html>>";
+
+//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) "<abc>hello</abc> world... strip_tags_test"
+-- Iteration 2 --
+string(45) "<abc>hello</abc> \t\tworld... strip_tags_test"
+-- Iteration 3 --
+string(0) ""
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(18) "<htmL>hello</htmL>"
+-- Iteration 6 --
+string(18) "<htmL>hello</htmL>"
+-- Iteration 7 --
+string(9) "HtMl text"
+-- Iteration 8 --
+string(9) "HtMl text"
+-- Iteration 9 --
+string(37) "<nnn>I am not a valid html text</nnn>"
+-- Iteration 10 --
+string(37) "<nnn>I am not a valid html text</nnn>"
+-- Iteration 11 --
+string(73) "<nnn>I am a quoted (") string with special chars like $,\!,\@,\%,\&</nnn>"
+-- Iteration 12 --
+string(75) "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>"
+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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving valid value for $str and invalid values for $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+$strings = "<html>hello</html> \tworld... <p>strip_tags_test\v\f</p><?php hello\t wo\rrld?>";
+
+$quotes = array (
+ "<nnn>",
+ '<nnn>',
+ "<abc>",
+ '<abc>',
+ "<%?php",
+ '<%?php',
+ "<<html>>",
+ '<<html>>'
+);
+
+//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) "<html>hello</html> world... strip_tags_test "
+-- Iteration 8 --
+string(46) "<html>hello</html> 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--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving double quoted strings as values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+$double_quote_string = array (
+ "<html> \$ -> This represents the dollar sign</html><?php echo hello ?>",
+ "<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>",
+ "<a>This is a hyper text tag</a>",
+ "<? <html>hello world\\t</html>?>",
+ "<p>This is a paragraph</p>",
+ "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
+);
+
+$quotes = "<html><a><p><b><?php";
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($double_quote_string 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(50) "<html> $ -> This represents the dollar sign</html>"
+-- Iteration 2 --
+string(59) "<html> The quick brown fo x jumped over the lazy dog</p>"
+-- Iteration 3 --
+string(31) "<a>This is a hyper text tag</a>"
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(26) "<p>This is a paragraph</p>"
+-- Iteration 6 --
+string(62) "<b>This is a text in bold letters \s\malong with slashes
+</b>"
+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--
+<?php
+
+/* Prototype : string stripcslashes ( string $str )
+ * Description: Returns a string with backslashes stripped off. Recognizes C-like \n, \r ...,
+ * octal and hexadecimal representation.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripcslashes() : basic functionality ***\n";
+var_dump(stripcslashes('\H\e\l\l\o \W\or\l\d'));
+var_dump(stripcslashes('Hello World\\r\\n'));
+var_dump(stripcslashes('\x48\x65\x6c\x6c\x6f \x57\x6f\x72\x6c\x64'));
+var_dump(stripcslashes('\110\145\154\154\157 \127\157\162\154\144'));
+
+?>
+===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--
+<?php
+
+/* Prototype : string stripcslashes ( string $str )
+ * Description: Returns a string with backslashes stripped off. Recognizes C-like \n, \r ...,
+ * octal and hexadecimal representation.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripcslashes() : unexpected number of arguments ***";
+
+
+echo "\n-- Testing stripcslashes() function with no arguments --\n";
+var_dump( stripcslashes() );
+
+echo "\n-- Testing stripcslashes() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( stripcslashes("abc def", $extra_arg) );
+?>
+===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--
+<?php
+/* Prototype : string stripcslashes ( string $str )
+ * Description: Returns a string with backslashes stripped off. Recognizes C-like \n, \r ...,
+ * octal and hexadecimal representation.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripcslashes() with non-string type argument such as int, float, etc
+*/
+
+echo "*** Testing stripcslashes() : with non-string type argument ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj'ct";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+ var_dump(stripos("test string", "TEST"));
+ var_dump(stripos("test string", "strIng"));
+ var_dump(stripos("test string", "stRin"));
+ var_dump(stripos("test string", "t S"));
+ var_dump(stripos("test string", "G"));
+ var_dump(stripos("te".chr(0)."st", chr(0)));
+ var_dump(stripos("tEst", "test"));
+ var_dump(stripos("teSt", "test"));
+ var_dump(stripos("", ""));
+ var_dump(stripos("a", ""));
+ var_dump(stripos("", "a"));
+ var_dump(stripos("a", " "));
+ var_dump(stripos("a", "a"));
+ var_dump(stripos("", 1));
+ var_dump(stripos("", false));
+ var_dump(stripos("", true));
+ var_dump(stripos("a", 1));
+ var_dump(stripos("a", false));
+ var_dump(stripos("a", true));
+ var_dump(stripos("1", 1));
+ var_dump(stripos("0", false));
+ var_dump(stripos("1", true));
+ var_dump(stripos("\\\\a", "\\a"));
+
+ echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripos() function: basic functionality ***\n";
+$heredoc_str = <<<Identifier
+Hello, World
+Identifier;
+
+echo "-- With default arguments --\n";
+//regular string for haystack & needle
+var_dump( stripos("Hello, World", "Hello") );
+var_dump( stripos('Hello, World', "hello") );
+var_dump( stripos("Hello, World", 'World') );
+var_dump( stripos('Hello, World', 'WORLD') );
+
+//single char for needle
+var_dump( stripos("Hello, World", "o") );
+var_dump( stripos("Hello, World", ",") );
+
+//heredoc string for haystack & needle
+var_dump( stripos($heredoc_str, "Hello, World") );
+var_dump( stripos($heredoc_str, 'Hello') );
+var_dump( stripos($heredoc_str, $heredoc_str) );
+
+//non-existing needle in haystack
+var_dump( stripos("Hello, World", "ooo") );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripos() function: basic functionality ***\n";
+$heredoc_str = <<<Identifier
+Hello, World
+Identifier;
+
+echo "-- With all arguments --\n";
+//regular string for haystack & needle, with various offsets
+var_dump( stripos("Hello, World", "Hello", 0) );
+var_dump( stripos("Hello, World", 'Hello', 1) );
+var_dump( stripos('Hello, World', 'WORLD', 1) );
+var_dump( stripos('Hello, World', "WoRld", 5) );
+
+//heredoc string for haystack & needle, with various offsets
+var_dump( stripos($heredoc_str, "Hello, World", 0) );
+var_dump( stripos($heredoc_str, 'Hello', 0) );
+var_dump( stripos($heredoc_str, 'Hello', 1) );
+var_dump( stripos($heredoc_str, $heredoc_str, 0) );
+var_dump( stripos($heredoc_str, $heredoc_str, 1) );
+
+//various offsets
+var_dump( stripos("Hello, World", "o", 3) );
+var_dump( stripos("Hello, World", "O", 5) );
+var_dump( stripos("Hello, World", "o", 6) );
+var_dump( stripos("Hello, World", "o", 10) );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripos() function: error conditions ***\n";
+echo "\n-- With Zero arguments --";
+var_dump( stripos() );
+
+echo "\n-- With less than expected number of arguments --";
+var_dump( stripos("String") );
+
+echo "\n-- With more than expected number of arguments --";
+var_dump( stripos("string", "String", 1, 'extra_arg') );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing double quoted strings for 'haystack' & 'needle' arguments */
+
+echo "*** Testing stripos() function: with double quoted strings ***\n";
+$haystack = "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@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<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( stripos($haystack, $needle[$index]) );
+ var_dump( stripos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'needle' and
+ * an expected type of input for 'haystack' argument
+*/
+
+echo "*** Testing stripos() function with unexpected values for needle ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
+
+// array with different values
+$needles = 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 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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'haystack' and 'needle' arguments */
+
+echo "*** Testing stripos() function with unexpected values for haystack and needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', '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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with null terminated strings for 'haystack' argument
+ * in order to check the binary safe
+*/
+
+echo "*** Test stripos() function: binary safe ***\n";
+$haystacks = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello World",
+ "Hello World".chr(0),
+ chr(0).chr(0).chr(0),
+ "Hello\0world",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($haystacks); $index++ ) {
+ var_dump( stripos($haystacks[$index], "\0") );
+ var_dump( stripos($haystacks[$index], "\0", $index) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with null terminated strings for 'needle' argument
+ * in order to check binary safe
+*/
+
+echo "*** Test stripos() function: binary safe ***\n";
+$haystack = "\0Hello\0World\0";
+
+$needles = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello World",
+ "Hello World".chr(0),
+ chr(0).chr(0).chr(0),
+ "Hello\0world",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($needles); $index++ ) {
+ var_dump( stripos($haystack, $needles[$index]) );
+ var_dump( stripos($haystack, $needles[$index], $index) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'offset' argument */
+
+echo "*** Testing stripos() function with unexpected values for offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//definition of input args
+$haystack = "hello world";
+$needle = "world";
+
+// array with different values
+$offsets = array (
+
+ // float values
+ 1.5,
+ -1.5,
+ 1.5e10,
+ 1.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new 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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */
+
+echo "*** Testing stripos() function with unexpected values for haystack, needle & offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', '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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing single quoted strings to 'haystack' & 'needle' arguments */
+
+echo "*** Testing stripos() function: with single quoted strings ***\n";
+$haystack = 'Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@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<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( stripos($haystack, $needle[$index]) );
+ var_dump( stripos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing multi-line heredoc string for haystack and
+ * with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing multi lines --\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+var_dump( stripos($multi_line_str, "ing", 0) );
+var_dump( stripos($multi_line_str, "ing", 15) );
+var_dump( stripos($multi_line_str, "ing", 22) );
+var_dump( stripos($multi_line_str, "") );
+var_dump( stripos($multi_line_str, " ") );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing heredoc string containing special chars for haystack
+ * and with various needles & offets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing special chars --\n";
+$special_chars_str = <<<EOD
+Ex'ple of h'doc st'g, contains
+$#%^*&*_("_")!#@@!$#$^^&$*(special)
+chars.
+EOD;
+var_dump( stripos($special_chars_str, "Ex'ple", 0) );
+var_dump( stripos($special_chars_str, "!@@!", 23) );
+var_dump( stripos($special_chars_str, '_') );
+var_dump( stripos($special_chars_str, '("_")') );
+var_dump( stripos($special_chars_str, "$*") );
+var_dump( stripos($special_chars_str, "$*", 10) );
+var_dump( stripos($special_chars_str, "(special)") );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing heredoc string containing escape chars for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing escape characters --\n";
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\tWorld
+EOD;
+var_dump( stripos($control_char_str, "\n") );
+var_dump( stripos($control_char_str, "\t") );
+var_dump( stripos($control_char_str, "\n", 12) );
+var_dump( stripos($control_char_str, "\t", 15) );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing heredoc string containing quotes for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing quote & slash chars --\n";
+$quote_char_str = <<<EOD
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOD;
+var_dump( stripos($quote_char_str, "line") );
+var_dump( stripos($quote_char_str, 'things') );
+var_dump( stripos($quote_char_str, 'things', 0) );
+var_dump( stripos($quote_char_str, "things", 20) );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing empty heredoc string for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With empty heredoc string --\n";
+$empty_string = <<<EOD
+EOD;
+var_dump( stripos($empty_string, "") );
+var_dump( stripos($empty_string, "", 1) );
+var_dump( stripos($empty_string, FALSE) );
+var_dump( stripos($empty_string, NULL) );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with strings containing repetitive chars for haystak
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: strings repetitive chars ***\n";
+$haystack = "aBAbaBAbaBabAbAbaBa";
+$needles = array(
+ "aba",
+ "aBA",
+ "ABA",
+ "Aba",
+ "BAb",
+ "bab",
+ "bAb",
+ "BAB"
+);
+
+/* loop through to consider various offsets in getting the position of the needle in haystack string */
+$count = 1;
+for($index = 0; $index < count($needles); $index++) {
+ echo "\n-- Iteration $count --\n";
+ for($offset = 0; $offset <= strlen($haystack); $offset++ ) {
+ var_dump( stripos($haystack, $needles[$index], $offset) );
+ }
+ $count++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for haystack argument */
+
+echo "*** Testing stripos() function with unexpected values for haystack ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$haystacks = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new 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
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_basic.phpt
Binary files 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--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing stripslashes() for error conditions
+*/
+
+echo "*** Testing stripslashes() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing stripslashes() function with Zero arguments --\n";
+var_dump( stripslashes() );
+
+// More than expected number of arguments
+echo "\n-- Testing stripslashes() function with more than expected no. of arguments --\n";
+$str = '\"hello\"\"world\"';
+$extra_arg = 10;
+
+var_dump( stripslashes($str, $extra_arg) );
+var_dump( $str );
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripslashes() with non-string type argument such as int, float, etc
+*/
+
+echo "*** Testing stripslashes() : with non-string type argument ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj\'ct";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_variation2.phpt
Binary files 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--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripslashes() with strings containing newline and tab characters.
+*/
+
+echo "*** Testing stripslashes() : with strings containing newline and tab characters ***\n";
+
+// initialising heredoc strings
+$heredoc_string_with_newline = <<<EOT
+This is line 1 \nof 'heredoc' string
+This is line 2 \nof "heredoc" string
+EOT;
+
+$heredoc_string_with_tab = <<<EOT
+This is line 1 \tof 'heredoc' string
+This is line 2 \tof "heredoc" string
+EOT;
+// initialising the string array
+
+$str_array = array(
+ // string with newline character
+ "\n",
+ "\\n",
+ "Hello \nworld",
+ "Hello \\nworld",
+ '\n',
+ '\\n',
+ 'Hello \nworld',
+ 'Hello \\nworld',
+ $heredoc_string_with_newline,
+
+ // string with tab character
+ "\t",
+ "\\t",
+ "Hello \tworld",
+ "Hello \\tworld",
+ '\t',
+ '\\t',
+ 'Hello \tworld',
+ 'Hello \\tworld',
+ $heredoc_string_with_tab
+ );
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $str ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( stripslashes($str) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripslashes() with double dimensional arrays
+*/
+
+echo "*** Testing stripslashes() : with double dimensional arrays ***\n";
+
+// initialising the string array
+
+$str_array = array(
+ array("", array()),
+ array("", array("")),
+ array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar")),
+ array("f\\'oo", "b\\'ar", array("")),
+ array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar", array(""))),
+ array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar", array("fo\\'o", "b\\'ar")))
+ );
+function stripslashes_deep($value) {
+ $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
+ return $value;
+}
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $arr ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( stripslashes_deep($arr) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+ var_dump(stristr());
+ var_dump(stristr(array(), ""));
+ var_dump(stristr("", array()));
+ var_dump(stristr(array(), array()));
+ var_dump(stristr("tEsT sTrInG", "tEsT"));
+ var_dump(stristr("tEsT sTrInG", "stRiNg"));
+ var_dump(stristr("tEsT sTrInG", "stRiN"));
+ var_dump(stristr("tEsT sTrInG", "t S"));
+ var_dump(stristr("tEsT sTrInG", "g"));
+ var_dump(md5(stristr("te".chr(0)."st", chr(0))));
+ var_dump(@stristr("", ""));
+ var_dump(@stristr("a", ""));
+ var_dump(@stristr("", "a"));
+ var_dump(md5(@stristr("\\\\a\\", "\\a")));
+ var_dump(stristr("tEsT sTrInG", " "));
+?>
+--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--
+<?php
+
+$email = 'AbcCdEfGh';
+var_dump(stristr($email, 'c'));
+var_dump(stristr($email, 'c', 1));
+
+$email = 'AbCdeEfGh';
+var_dump(stristr($email, 'E'));
+var_dump(stristr($email, 'E', 1));
+
+$email = 'wazAbCdeEfGh';
+var_dump(stristr($email, 97));
+var_dump(stristr($email, 97, 1));
+
+?>
+--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--
+<?php
+/* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] )
+ Description: Case-insensitive strstr().
+*/
+
+echo "*** Testing stristr() : basic functionality ***\n";
+
+var_dump( stristr("Test string", "teSt") );
+var_dump( stristr("test stRIng", "striNG") );
+var_dump( stristr("teST StrinG", "stRIn") );
+var_dump( stristr("tesT string", "t S") );
+var_dump( stristr("test strinG", "g") );
+var_dump( bin2hex(stristr(b"te".chr(0).b"St", chr(0))) );
+var_dump( stristr("tEst", "test") );
+var_dump( stristr("teSt", "test") );
+
+var_dump( stristr("Test String", "String", false) );
+var_dump( stristr("Test String", "String", true) );
+?>
+===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--
+<?php
+
+/* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] )
+ Description: Case-insensitive strstr()
+*/
+echo "*** Testing stristr() : error conditions ***\n";
+
+echo "\n-- Testing stristr() function with no arguments --\n";
+var_dump( stristr() );
+var_dump( stristr("") );
+
+echo "\n-- Testing stristr() function with no needle --\n";
+var_dump( stristr("Hello World") ); // without "needle"
+
+echo "\n-- Testing stristr() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( stristr("Hello World", "World", true, $extra_arg) );
+
+echo "\n-- Testing stristr() function with empty haystack --\n";
+var_dump( stristr(NULL, "") );
+
+echo "\n-- Testing stristr() function with empty needle --\n";
+var_dump( stristr("Hello World", "") );
+
+?>
+===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--
+<?php
+
+/* Prototype: string stristr ( string $haystack, string $needle );
+ Description: Case-insensitive strstr().
+*/
+
+echo "*** Testing stristr() function: with unexpected inputs for 'string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ -PHP_INT_MAX,
+
+ // float values
+/*5*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*8*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*15*/ NULL,
+ null,
+
+ // objects
+/*17*/ new sample(),
+
+ // resource
+/*18*/ $file_handle,
+
+ // undefined variable
+/*19*/ @$undefined_var,
+
+ // unset variable
+/*20*/ @$unset_var
+);
+
+//defining '$pad_length' argument
+$pad_length = "20";
+
+// loop through with each element of the $inputs array to test stristr() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( stristr($input, " ") );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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--
+<?php
+
+/* Prototype: string stristr ( string $haystack, string $needle );
+ Description: Case-insensitive strstr().
+*/
+
+echo "*** Testing stristr() function: with unexpected inputs for 'needle' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ -PHP_INT_MAX,
+
+ // float values
+/*5*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*8*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*15*/ NULL,
+ null,
+
+ // objects
+/*17*/ new sample(),
+
+ // resource
+/*18*/ $file_handle,
+
+ // undefined variable
+/*19*/ @$undefined_var,
+
+ // unset variable
+/*20*/ @$unset_var
+);
+
+//defining '$pad_length' argument
+$pad_length = "20";
+
+// loop through with each element of the $inputs array to test stristr() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( stristr("Hello World", $input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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
--- /dev/null
+++ b/ext/standard/tests/strings/strlen.phpt
Binary files 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--
+<?php
+
+/* Prototype : int strlen ( string $string )
+ * Description: Get string length
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strlen() : basic functionality ***\n";
+var_dump(strlen("abcdef"));
+var_dump(strlen(" ab de "));
+var_dump(strlen(""));
+var_dump(strlen("\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"));
+?>
+===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--
+<?php
+
+/* Prototype : int strlen ( string $string )
+ * Description: Get string length
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strlen() : unexpected number of arguments ***";
+
+
+echo "\n-- Testing strlen() function with no arguments --\n";
+var_dump( strlen() );
+
+echo "\n-- Testing strlen() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( strlen("abc def", $extra_arg) );
+?>
+===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--
+<?php
+
+/* Prototype : int strlen ( string $string )
+ * Description: Get string length
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strlen() : with unexpected input for 'string' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*6*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*9*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*16*/ NULL,
+ null,
+
+ // objects
+/*18*/ new sample(),
+
+ // resource
+/*19*/ $file_handle,
+
+ // undefined variable
+/*20*/ @$undefined_var,
+
+ // unset variable
+/*21*/ @$unset_var
+);
+
+//defining '$pad_length' argument
+$pad_length = "20";
+
+// loop through with each element of the $inputs array to test strlen() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( strlen($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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 <felix.devliegher@gmail.com>
+--FILE--
+<?php
+/* Prototype : int strnatcasecmp(string s1, string s2)
+ * Description: Returns the result of case-insensitive string comparison using 'natural' algorithm
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+function str_dump($one, $two) {
+ var_dump(strnatcasecmp($one, $two));
+}
+
+echo "*** Testing strnatcasecmp() : basic functionality ***\n";
+
+// Calling strnatcasecmp() with all possible arguments
+str_dump('A', 'a');
+str_dump('a10', 'A20');
+str_dump('A1b', 'a');
+str_dump('x2-y7', 'x8-y8');
+str_dump('1.010', '1.001');
+str_dump(' ab', ' aB');
+str_dump('acc ', 'acc');
+str_dump(11.5, 10.5);
+str_dump(10.5, 10.5E1);
+str_dump('Rfc822.txt', 'rfc2086.txt');
+str_dump('Rfc822.txt', 'rfc822.TXT');
+str_dump('pIc 6', 'pic 7');
+str_dump(0xFFF, 0Xfff);
+
+?>
+===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--
+<?php
+/* Prototype : int strnatcasecmp ( string $str1 , string $str2 )
+ * Description: Case insensitive string comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcasecmp() : error conditions ***\n";
+
+echo "-- Testing strnatcmp() function with Zero arguments --\n";
+var_dump( strnatcasecmp() );
+
+echo "\n\n-- Testing strnatcasecmp() function with more than expected no. of arguments --\n";
+$str1 = "abc1";
+$str2 = "ABC1";
+$extra_arg = 10;
+var_dump( strnatcasecmp( $str1, $str2, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing strnatcasecmp() : error conditions ***
+-- Testing strnatcmp() function with Zero arguments --
+
+Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+
+-- Testing strnatcasecmp() function with more than expected no. of arguments --
+
+Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/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 <felix.devliegher@gmail.com>
+--FILE--
+<?php
+/* Prototype : int strnatcasecmp(string s1, string s2)
+ * Description: Returns the result of case-insensitive string comparison using 'natural' algorithm
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+/* Preparation */
+class a
+{
+ function __toString()
+ {
+ return "Hello WORLD";
+ }
+}
+
+class b
+{
+ function __toString()
+ {
+ return "HELLO world";
+ }
+}
+
+$a = new a();
+$b = new b();
+
+function str_dump($a, $b) {
+ var_dump(strnatcasecmp($a, $b));
+}
+
+echo "*** Testing strnatcasecmp() : variation ***\n";
+
+str_dump('0', false);
+str_dump('fooBar', '');
+str_dump('', -1);
+str_dump("Hello\0world", "Helloworld");
+str_dump("\x0", "\0");
+str_dump($a, $b);
+
+?>
+===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--
+<?php
+/* Prototype : int strnatcmp ( string $str1 , string $str2 )
+ * Description: String comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcmp() : basic functionality ***\n";
+
+$a1 = "abc1";
+$b1 = "abc10";
+$c1 = "abc15";
+$d1 = "abc2";
+
+$a2 = "ABC1";
+$b2 = "ABC10";
+$c2 = "ABC15";
+$d2 = "ABC2";
+
+echo "Less than tests\n";
+var_dump(strnatcmp($a1, $b1));
+var_dump(strnatcmp($a1, $c1));
+var_dump(strnatcmp($a1, $d1));
+var_dump(strnatcmp($b1, $c1));
+var_dump(strnatcmp($d1, $c1));
+
+var_dump(strnatcmp($a1, $b2));
+var_dump(strnatcmp($a1, $c2));
+var_dump(strnatcmp($a1, $d2));
+var_dump(strnatcmp($b1, $c2));
+var_dump(strnatcmp($d1, $c2));
+
+
+echo "Equal too tests\n";
+var_dump(strnatcmp($b1, $b1));
+var_dump(strnatcmp($b1, $b2));
+
+echo "Greater than tests\n";
+var_dump(strnatcmp($b1, $a1));
+var_dump(strnatcmp($c1, $a1));
+var_dump(strnatcmp($d1, $a1));
+var_dump(strnatcmp($c1, $b1));
+var_dump(strnatcmp($c1, $d1));
+
+var_dump(strnatcmp($b1, $a2));
+var_dump(strnatcmp($c1, $a2));
+var_dump(strnatcmp($d1, $a2));
+var_dump(strnatcmp($c1, $b2));
+var_dump(strnatcmp($c1, $d2));
+?>
+===DONE===
+--EXPECT--
+*** Testing strnatcmp() : basic functionality ***
+Less than tests
+int(-1)
+int(-1)
+int(-1)
+int(-1)
+int(-1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+Equal too tests
+int(0)
+int(1)
+Greater than tests
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/strings/strnatcmp_error.phpt b/ext/standard/tests/strings/strnatcmp_error.phpt
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--
+<?php
+/* Prototype : int strnatcmp ( string $str1 , string $str2 )
+ * Description: String comparisons using a "natural order" algorithm
+ * Source code: ext/standard/string.c
+*/
+echo "*** Testing strnatcmp() : error conditions ***\n";
+
+echo "-- Testing strnatcmp() function with Zero arguments --\n";
+var_dump( strnatcmp() );
+
+echo "\n\n-- Testing strnatcmp() function with more than expected no. of arguments --\n";
+$str1 = "abc1";
+$str2 = "ABC1";
+$extra_arg = 10;
+var_dump( strnatcmp( $str1, $str2, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing strnatcmp() : error conditions ***
+-- Testing strnatcmp() function with Zero arguments --
+
+Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+
+-- Testing strnatcmp() function with more than expected no. of arguments --
+
+Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/strings/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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+echo "*** Testing strncasecmp() function: basic functionality ***\n";
+
+echo "-- Testing strncasecmp() with single 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 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 = <<<HEREDOC
+Hello
+HEREDOC;
+var_dump( strncasecmp($str, "Hello", 5) ); //expected: int(0)
+var_dump( strncasecmp($str, "Hi", 5) ); //expected: value < 0
+var_dump( strncasecmp("Hi", $str, 5) ); //expected: value > 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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+echo "*** Testing strncasecmp() function: error conditions ***\n";
+$str1 = 'string_val';
+$str2 = 'string_val';
+$len = 10;
+$extra_arg = 10;
+
+echo "\n-- Testing strncasecmp() function with Zero arguments --";
+var_dump( strncasecmp() );
+
+echo "\n-- Testing strncasecmp() function with less than expected number of arguments --";
+var_dump( strncasecmp($str1) );
+var_dump( strncasecmp($str1, $str2) );
+
+echo "\n-- Testing strncasecmp() function with more than expected number of arguments --";
+var_dump( strncasecmp($str1, $str2, $len, $extra_arg) );
+
+echo "\n-- Testing strncasecmp() function with invalid argument --";
+$len = -10;
+var_dump( strncasecmp($str1, $str2, $len) );
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
+
+echo "*** Test strncasecmp() function: with alphabets ***\n";
+echo "-- Passing upper-case letters for 'str1' --\n";
+for($ASCII = 65; $ASCII <= 90; $ASCII++) {
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase letter with corresponding uppercase letter; exp: int(0)
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing uppercase letter with corresponding lowercase letter; exp: int(0)
+}
+
+echo "\n-- Passing lower-case letters for 'str1' --\n";
+for($ASCII = 97; $ASCII <= 122; $ASCII++) {
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase letter with corresponding lowercase letter; exp: int(0)
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing lowercase letter with corresponding uppercase letter; exp: int(0)
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected inputs for 'str1' */
+
+echo "*** Testing strncasecmp() function: with unexpected values for 'str1' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected inputs for 'str2' */
+
+echo "*** Testing strncasecmp() function: with unexpected values for 'str2' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with various double quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncasecmp() function: with double quoted strings ***\n";
+$strings = array(
+ "Hello, World",
+ "hello, world",
+ "HELLO, WORLD",
+ "Hello, World\n",
+ "Hello".chr(0)."World"
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() with various lengths */
+
+echo "*** Test strncasecmp() function: with different lengths ***\n";
+/* definitions of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, world\n";
+
+/* loop through to compare the strings, for various length values */
+for($len = strlen($str1); $len >= 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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected inputs for 'str1' and 'str2' */
+
+echo "*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected values, and giving the same strings for 'str1' and 'str2' */
+
+echo "*** Test strncasecmp() function: unexpected values for 'len' ***\n";
+
+/* definition of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, World\n";
+
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$lengths = array (
+
+ /* float values */
+ 10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+
+ /* octal values */
+ 012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with binary values passed to 'str1' & 'str2' */
+
+echo "*** Test strncasecmp() function: with binary inputs ***\n";
+
+/* A binary function should work with all 256 characters that a character(8-bit) can take */
+echo "\n-- Checking with all 256 characters given, in binary format --\n";
+/* loop through to get all 256 character's equivelent binary value, and check working of strncasecmp() */
+$count = 1;
+for($ASCII = 0; $ASCII <= 255; $ASCII++) {
+ $str1 = decbin($ASCII); //ASCII value in binary form
+ $str2 = decbin( ord( chr($ASCII) ) ); //Getting equivelent ASCII value for the character in binary form
+ echo "-- Iteration $count --\n";
+ var_dump( strncasecmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0)
+ var_dump( strncasecmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0)
+ $count++;
+}
+
+echo "\n-- Checking with out of character's range, given in binary format --\n";
+$str1 = decbin(256);
+$str2 = decbin( ord( chr(256) ));
+var_dump( strncasecmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1)
+
+echo "\n*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with null terminated strings and binary values passed to 'str1' & 'str2' */
+
+echo "*** Test strncasecmp() function: with null terminated strings and binary inputs ***\n";
+
+/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
+$str1 = "Hello\0world";
+$str2 = "Hello\0";
+$str3 = "Hello,".chr(0)."world";
+var_dump( strncasecmp($str1, $str2, 12) );
+var_dump( strncasecmp($str3, "Hello,world", 12) );
+
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with various single quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncasecmp() function: with single quoted strings ***\n";
+$strings = array(
+ 'Hello, World',
+ 'hello, world',
+ 'HELLO, WORLD',
+ 'Hello, World\n'
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with here-doc strings for 'str1', 'str2' */
+
+echo "*** Test strncasecmp() function: with here-doc strings ***\n";
+
+/* multi line heredoc string */
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+/* identifier name contains underscore */
+$identifier_str1 = <<<identifier_str1
+Example of heredoc
+string, whose identifier
+having underscore("_")
+& numeric value.
+identifier_str1;
+
+/* identifier name starts with underscore */
+$identifier_str2 = <<<_identifier_str2
+Hello, World
+hello, world
+_identifier_str2;
+
+/* string containing control character */
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\0World
+EOD;
+
+/* heredoc string with quote chars & slash */
+$quote_char_string = <<<EOD
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOD;
+
+/* heredoc string with blank line */
+$blank_line = <<<EOD
+
+EOD;
+
+/* empty heredoc string */
+$empty_string = <<<EOD
+EOD;
+
+$strings = array(
+ $multi_line_str,
+ $identifier_str1,
+ $identifier_str2,
+ $control_char_str,
+ $quote_char_string,
+ $blank_line,
+ $empty_string
+);
+/* loop through to compare the strings */
+$index2 = count($strings);
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ $index2--;
+ var_dump( strncasecmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
+ var_dump( strncasecmp( $strings[$index1], $strings[$index2], strlen($strings[$index1]) ) );
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+echo "*** Testing strncmp() function: basic functionality ***\n";
+
+echo "-- Testing strncmp() with single 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 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 = <<<HEREDOC
+Hello
+HEREDOC;
+var_dump( strncmp($str, "Hello", 5) ); //expected: int(0)
+var_dump( strncmp($str, "Hi", 5) ); //expected: value < 0
+var_dump( strncmp("Hi", $str, 5) ); //expected: value > 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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with more/less number of args and invalid args */
+
+echo "*** Testing strncmp() function: error conditions ***\n";
+$str1 = 'string_val';
+$str2 = 'string_val';
+$len = 10;
+$extra_arg = 10;
+
+var_dump( strncmp() ); //Zero argument
+var_dump( strncmp($str1) ); //One argument, less than expected no. of args
+var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args
+var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args
+
+/* Invalid argument for $len */
+$len = -10;
+var_dump( strncmp($str1, $str2, $len) );
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
+
+echo "*** Test strncmp() function: with alphabets ***\n";
+echo "-- Passing upper-case letters for 'str1' --\n";
+for($ASCII = 65; $ASCII <= 90; $ASCII++) {
+ var_dump( strncmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase letters with uppercase letters; exp: int(0)
+ var_dump( strncmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing uppercase letters with lowercase letters; exp: value < 0
+}
+
+echo "\n-- Passing lower-case letters for 'str1' --\n";
+for($ASCII = 97; $ASCII <= 122; $ASCII++) {
+ var_dump( strncmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase letters with lowercase letters; exp: int(0)
+ var_dump( strncmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing lowercase letters with uppercase letters; exp: value > 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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with double quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncmp() function: with double quoted strings ***\n";
+$strings = array(
+ "Hello, World",
+ "hello, world",
+ "HELLO, WORLD",
+ "Hello, World\n",
+ "Hello".chr(0)."World"
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() with various lengths */
+
+echo "*** Test strncmp() function: with different lengths ***\n";
+/* definitions of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, world\n";
+
+/* loop through to compare the strings, for various length values */
+for($len = strlen($str1); $len >= 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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with the input strings are of all types */
+
+echo "*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with the length as all types, and giving the same strings for 'str1' and 'str2' */
+
+echo "*** Test strncmp() function: by supplying all types for 'len' ***\n";
+
+/* definition of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, World\n";
+
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$lengths = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+
+ /* float values */
+ 10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+
+ /* octal values */
+ 012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */
+
+echo "*** Test strncmp() function: with binary inputs ***\n";
+
+echo "\n-- Checking with all 256 characters given, in binary format --\n";
+/* A binary function should work with all 256 characters that a character(8-bit) can take */
+/* loop through to get all 256 character's equivelent binary value, and check working of strncmp() */
+$count = 1;
+for($ASCII = 0; $ASCII <= 255; $ASCII++) {
+ $str1 = decbin($ASCII); //ASCII value in binary form
+ $str2 = decbin( ord( chr($ASCII) ) ); //Getting equivelent ASCII value for the character in binary form
+ echo "-- Iteration $count --\n";
+ var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0)
+ var_dump( strncmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0)
+ $count++;
+}
+
+echo "\n-- Checking with out of character's range, given in binary format --\n";
+/* Checking with the out of range ASCII value(given in binary format) */
+$str1 = decbin(256);
+$str2 = decbin( ord( chr(256) ));
+var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1)
+
+echo "\n*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */
+
+echo "*** Test strncmp() function: Checking with the null terminated strings ***\n";
+
+/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
+$str1 = "Hello\0world";
+$str2 = "Hello\0";
+var_dump( strncmp($str1, $str2, 12) ); //expected: int(5);
+
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with single quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncmp() function: with single quoted strings ***\n";
+$strings = array(
+ 'Hello, World',
+ 'hello, world',
+ 'HELLO, WORLD',
+ 'Hello, World\n'
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with different strings for 'str1', 'str2' and considering case sensitive */
+
+echo "*** Test strncmp() function: with different input strings ***\n";
+
+/* heredoc string */
+$str1 = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+/* identifier name contains underscore */
+$str2 = <<<identifier_str2
+Example of heredoc
+string, whose identifier
+having underscore("_")
+& numeric value.
+identifier_str2;
+
+/* identifier name starts with underscore */
+$str3 = <<<_identifier_str3
+Hello, World
+hello, world
+_identifier_str3;
+
+/* string containing control characters */
+$str4 = <<<identifier_str4
+Hello, World\n
+Hello\0World
+identifier_str4;
+
+$strings = array(
+ $str1,
+ $str2,
+ $str3,
+ $str4
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ var_dump( strncmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--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--
+<?php
+/* Prototype : array strpbrk(string haystack, string char_list)
+ * Description: Search a string for any of a set of characters
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strpbrk() : basic functionality ***\n";
+
+// Initialise all required variables
+$text = 'This is a Simple text.';
+var_dump( strpbrk($text, 'mi') );
+var_dump( strpbrk($text, 'ZS') );
+var_dump( strpbrk($text, 'Z') );
+var_dump( strpbrk($text, 'H') );
+
+$text = '';
+var_dump( strpbrk($text, 'foo') );
+
+$text = " aaa aaaSLR";
+var_dump( strpbrk($text, ' ') );
+
+var_dump( strpbrk(5, 5) );
+var_dump( strpbrk(5, "5") );
+
+?>
+===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--
+<?php
+/* Prototype : array strpbrk(string haystack, string char_list)
+ * Description: Search a string for any of a set of characters
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+ */
+
+echo "*** Testing strpbrk() : error conditions ***\n";
+
+$haystack = 'This is a Simple text.';
+$char_list = 'string_val';
+$extra_arg = 10;
+
+echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n";
+var_dump( strpbrk($haystack, $char_list, $extra_arg) );
+
+echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n";
+var_dump( strpbrk($haystack) );
+
+echo "\n-- Testing strpbrk() function with empty second argument --\n";
+var_dump( strpbrk($haystack, '') );
+
+echo "\n-- Testing strpbrk() function with arrays --\n";
+var_dump( strpbrk($haystack, array('a', 'b', 'c') ) );
+var_dump( strpbrk(array('foo', 'bar'), 'b') );
+
+?>
+===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
--- /dev/null
+++ b/ext/standard/tests/strings/strpos.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt
new file mode 100644
index 0000000..73da095
--- /dev/null
+++ b/ext/standard/tests/strings/strpos_number.phpt
@@ -0,0 +1,15 @@
+--TEST--
+strpos() matching numbers
+--FILE--
+<?php
+// Integer is handles as an octal representation, so nothing to match
+var_dump(strpos("foo 11", 11));
+// int(111) is string("o") in octal. Match expected
+var_dump(strpos("foo bar", 111));
+// string("11") is contained
+var_dump(strpos("foo 11", "11"));
+?>
+--EXPECT--
+bool(false)
+int(1)
+int(4)
diff --git a/ext/standard/tests/strings/strrchr.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--
+<?php
+
+var_dump(strrchr("", ""));
+var_dump(strrchr("abc", ""));
+var_dump(strrchr("", "abc"));
+var_dump(strrchr("abc", "abc"));
+var_dump(strrchr("test ".chr(0)." test", " "));
+var_dump(strrchr("test".chr(0)."string", "t"));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrchr() function: basic functionality ***\n";
+var_dump( strrchr("Hello, World", "H") ); //needle as single char
+var_dump( strrchr("Hello, World", "Hello") ); //needle as a first word of haystack
+var_dump( strrchr('Hello, World', 'H') );
+var_dump( strrchr('Hello, World', 'Hello') );
+
+//considering case
+var_dump( strrchr("Hello, World", "h") );
+var_dump( strrchr("Hello, World", "hello") );
+
+//needle as second word of haystack
+var_dump( strrchr("Hello, World", "World") );
+var_dump( strrchr('Hello, World', 'World') );
+
+//needle as special char
+var_dump( strrchr("Hello, World", ",") );
+var_dump( strrchr('Hello, World', ',') );
+
+var_dump( strrchr("Hello, World", "Hello, World") ); //needle as haystack
+
+//needle string containing one existing and one non-existing char
+var_dump( strrchr("Hello, World", "Hi") );
+
+//multiple existance of needle in haystack
+var_dump( strrchr("Hello, World", "o") );
+var_dump( strrchr("Hello, World", "ooo") );
+
+var_dump( strrchr("Hello, World", "Zzzz") ); //non-existant needle in haystack
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrchr() function: error conditions ***\n";
+$haystack = "Hello";
+$needle = "Hello";
+$extra_arg = "Hello";
+
+echo "\n-- Testing strrchr() function with Zero arguments --";
+var_dump( strrchr() );
+
+echo "\n-- Testing strrchr() function with less than expected no. of arguments --";
+var_dump( strrchr($haystack) );
+
+echo "\n-- Testing strrchr() function with more than expected no. of arguments --";
+var_dump( strrchr($haystack, $needle, $extra_arg) );
+
+echo "*** Done ***";
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation1.phpt
Binary files 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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function: with unexpected inputs for needle
+ * and expected type for haystack
+*/
+
+echo "*** Testing strrchr() function with unexpected inputs for needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+$haystacks = 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"
+);
+
+// array with different values
+$needles = 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,
+
+ // 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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function with unexpected inputs for haystack and needle */
+
+echo "*** Testing strrchr() function: with unexpected inputs for haystack and needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', '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
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation12.phpt
Binary files 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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing various single quoted strings to 'haystack' & 'needle' */
+
+echo "*** Testing strrchr() function: with various single quoted strings ***";
+$haystack = 'Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@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<count($needle); $index++) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( strrchr($haystack, $needle[$index]) );
+ $count ++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing multi-line heredoc string for haystack and
+ * with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+$needles = array(
+ "ing",
+ "",
+ " ",
+ $multi_line_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($multi_line_str, $needle) );
+}
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing special chars for haystack
+ * and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$special_chars_str = <<<EOD
+Example of heredoc string contains
+$#%^*&*_("_")!#@@!$#$^^&*(special)
+chars.
+EOD;
+
+$heredoc_needle = <<<EOD
+^^&*(
+EOD;
+
+$needles = array(
+ "!@@!",
+ '_',
+ '("_")',
+ "$*",
+ "(special)",
+ $heredoc_needle, //needle as heredoc string
+ $special_chars_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($special_chars_str, $needle) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing
+ * escape sequences for haystack and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$escape_char_str = <<<EOD
+\tes\t st\r\rch\r using
+\escape \\seque\nce
+EOD;
+
+$needles = array(
+ "\t",
+ '\n',
+ "\r",
+ "\\",
+ $escape_char_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($escape_char_str, $needle) );
+}
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing quote chars for haystack
+ * and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$quote_char_str = <<<EOD
+"things" "in" "double" "quote"
+'things' 'in' 'single' 'quote'
+EOD;
+
+$needles = array(
+ "things",
+ "\"things\"",
+ "\'things\'",
+ "in",
+ "quote",
+ $quote_char_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($quote_char_str, $needle) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing
+ * blank-line for haystack and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$blank_line = <<<EOD
+
+EOD;
+
+$needles = array(
+ "\n",
+ '\n',
+ "\r",
+ "\r\n",
+ "\t",
+ "",
+ $blank_line //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($blank_line, $needle) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing empty heredoc string for haystack
+ * and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$empty_str = <<<EOD
+EOD;
+
+$needles = array(
+ "",
+ '',
+ FALSE,
+ NULL,
+ "\0",
+ $empty_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($empty_str, $needle) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function with unexpected inputs for haystack
+ * and expected type for 'needle'
+*/
+
+echo "*** Testing strrchr() function: with unexpected inputs for haystack ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$haystacks = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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--
+<?php
+ $i = 0;
+ $str = '';
+
+ while ($i<256) {
+ $str .= chr($i++);
+ }
+
+ var_dump(md5(strrev($str)));
+ var_dump(strrev(NULL));
+ var_dump(strrev(""));
+?>
+--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--
+<?php
+/* Prototype : string strrev(string $str);
+ * Description: Reverse a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrev() : basic functionality ***\n";
+$heredoc = <<<EOD
+Hello, world
+EOD;
+
+//regular string
+var_dump( strrev("Hello, World") );
+var_dump( strrev('Hello, World') );
+
+//single character
+var_dump( strrev("H") );
+var_dump( strrev('H') );
+
+//string containing simalr chars
+var_dump( strrev("HHHHHH") );
+var_dump( strrev("HhhhhH") );
+
+//string containing escape char
+var_dump( strrev("Hello, World\n") );
+var_dump( strrev('Hello, World\n') );
+
+//heredoc string
+var_dump( strrev($heredoc) );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strrev(string $str);
+ * Description: Reverse a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrev() : error conditions ***\n";
+echo "-- Testing strrev() function with Zero arguments --";
+var_dump( strrev() );
+
+echo "\n-- Testing strrev() function with more than expected no. of arguments --";
+var_dump( strrev("string", 'extra_arg') );
+echo "*** Done ***";
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation1.phpt
Binary files 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
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation2.phpt
Binary files 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
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation3.phpt
Binary files 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--
+<?php
+/* Prototype : string strrev(string $str);
+ * Description: Reverse a string
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strrev() function with unexpected inputs for 'str' */
+
+echo "*** Testing strrev() : unexpected inputs for 'str' ***\n";
+//class declaration
+class sample {
+ public function __toString(){
+ return "object";
+ }
+}
+
+//get the resource
+$resource = fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // 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--
+<?php
+ var_dump(strripos("test test string", "test"));
+ var_dump(strripos("test string sTring", "string"));
+ var_dump(strripos("test strip string strand", "str"));
+ var_dump(strripos("I am what I am and that's all what I am", "am", -3));
+ var_dump(strripos("test string", "g"));
+ var_dump(strripos("te".chr(0)."st", chr(0)));
+ var_dump(strripos("tEst", "test"));
+ var_dump(strripos("teSt", "test"));
+ var_dump(@strripos("foo", "f", 1));
+ var_dump(@strripos("", ""));
+ var_dump(@strripos("a", ""));
+ var_dump(@strripos("", "a"));
+ var_dump(@strripos("\\\\a", "\\a"));
+?>
+--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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strripos() function: basic functionality ***\n";
+$heredoc_str = <<<EOD
+Hello, World
+EOD;
+
+echo "\n-- regular string for haystack & needle --\n";
+var_dump( strripos("Hello, World", "HeLLo") );
+var_dump( strripos('Hello, World', "hello") );
+var_dump( strripos("Hello, World", 'WoRLd') );
+var_dump( strripos('Hello, World', 'WORLD') );
+var_dump( strripos('Hello, World', 'foo') );
+
+echo "\n-- single char for needle --\n";
+var_dump( strripos("Hello, World", "O") );
+var_dump( strripos("Hello, World", ",") );
+
+echo "\n-- heredoc string for haystack & needle --\n";
+var_dump( strripos($heredoc_str, "Hello, WoRLd") );
+var_dump( strripos($heredoc_str, 'HelLO') );
+var_dump( strripos($heredoc_str, $heredoc_str) );
+
+?>
+===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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strripos() function: basic functionality ***\n";
+$heredoc_str = <<<EOD
+Hello, World
+EOD;
+
+echo "\n-- regular string for haystack & needle, with various offsets --\n";
+var_dump( strripos("Hello, World", "HeLLo", 0) );
+var_dump( strripos("Hello, World", 'Hello', 1) );
+var_dump( strripos('Hello, World', 'world', 1) );
+var_dump( strripos('Hello, World', "WorLD", 5) );
+
+echo "\n-- heredoc string for haystack & needle, with various offsets --\n";
+var_dump( strripos($heredoc_str, "Hello, WORLD", 0) );
+var_dump( strripos($heredoc_str, 'HelLo', 0) );
+var_dump( strripos($heredoc_str, 'HeLLo', 1) );
+var_dump( strripos($heredoc_str, $heredoc_str, 0) );
+var_dump( strripos($heredoc_str, $heredoc_str, 1) );
+
+echo "\n-- various +ve offsets --\n";
+var_dump( strripos("Hello, World", "O", 3) );
+var_dump( strripos("Hello, World", "O", 6) );
+var_dump( strripos("Hello, World", "O", 10) );
+
+echo "\n-- various -ve offsets --\n";
+var_dump( strripos("Hello, World", "O", -1) );
+var_dump( strripos("Hello, World", "O", -5) );
+var_dump( strripos("Hello, World", "O", -9) );
+?>
+===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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strripos() function: error conditions ***";
+echo "\n-- With Zero arguments --";
+var_dump( strripos() );
+
+echo "\n-- With less than expected number of arguments --";
+var_dump( strripos("String") );
+
+echo "\n-- With more than expected number of arguments --";
+var_dump( strripos("string", "String", 1, 'extra_arg') );
+?>
+===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--
+<?php
+
+var_dump(strripos("t", "t", PHP_INT_MAX+1));
+var_dump(strripos("tttt", "tt", PHP_INT_MAX+1));
+var_dump(strripos(100, 101, PHP_INT_MAX+1));
+var_dump(strripos(1024, 1024, PHP_INT_MAX+1));
+var_dump(strripos(array(), array(), PHP_INT_MAX+1));
+var_dump(strripos(1024, 1024, -PHP_INT_MAX));
+var_dump(strripos(1024, "te", -PHP_INT_MAX));
+var_dump(strripos(1024, 1024, -PHP_INT_MAX-1));
+var_dump(strripos(1024, "te", -PHP_INT_MAX-1));
+
+echo "Done\n";
+?>
+--EXPECTF--
+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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strripos() function by passing double quoted strings for 'haystack' & 'needle' arguments */
+
+echo "*** Testing strripos() function: with double quoted strings ***\n";
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strripos() function by passing single quoted strings to 'haystack' & 'needle' arguments */
+
+echo "*** Testing strripos() function: with single quoted strings ***\n";
+$haystack = 'Hello,\t\n\0\n $&!#%()*<=>?@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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strripos() function by passing multi-line heredoc string for haystack and
+ * with various needles & offsets
+*/
+
+echo "*** Testing strripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing multi lines --\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+echo "\n-- Multi line strings with +ve offsets -- \n";
+var_dump( strripos($multi_line_str, "iNg", 0) );
+var_dump( strripos($multi_line_str, "inG", 15) );
+var_dump( strripos($multi_line_str, "Ing", 22) );
+
+echo "\n-- Multi line strings with +ve offsets -- \n";
+var_dump( strripos($multi_line_str, "Ing", -1) );
+var_dump( strripos($multi_line_str, "Ing", -17) );
+var_dump( strripos($multi_line_str, "Ing", -50) );
+
+echo "\n-- Multi line strings with no offset -- \n";
+var_dump( strripos($multi_line_str, "spAn") );
+var_dump( strripos($multi_line_str, "IPlE") );
+var_dump( strripos($multi_line_str, "") );
+var_dump( strripos($multi_line_str, " ") );
+
+?>
+===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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strripos() function by passing heredoc string containing special chars for haystack
+ * and with various needles & offets
+*/
+
+echo "*** Testing strripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing special chars --\n";
+$special_chars_str = <<<EOD
+Ex'ple of h'doc st'g, contains
+$#%^*&*_("_")!#@@!$#$^^&$*(special)
+chars.
+EOD;
+var_dump( strripos($special_chars_str, "Ex'pLE", 0) );
+var_dump( strripos($special_chars_str, "!@@!", 23) );
+var_dump( strripos($special_chars_str, '_') );
+var_dump( strripos($special_chars_str, '("_")') );
+var_dump( strripos($special_chars_str, "$*") );
+var_dump( strripos($special_chars_str, "$*", 10) );
+var_dump( strripos($special_chars_str, "(speCIal)") );
+
+?>
+===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--
+<?php
+/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strripos() function by passing heredoc string containing escape chars for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing escape characters --\n";
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\tWorld
+EOD;
+var_dump( strripos($control_char_str, "\n") );
+var_dump( strripos($control_char_str, "\t") );
+var_dump( strripos($control_char_str, "\n", 12) );
+var_dump( strripos($control_char_str, "\t", 15) );
+
+?>
+===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--
+<?php
+ var_dump(strrpos("test test string", "test"));
+ var_dump(strrpos("test string sTring", "string"));
+ var_dump(strrpos("test strip string strand", "str"));
+ var_dump(strrpos("I am what I am and that's all what I am", "am", -3));
+ var_dump(strrpos("test string", "g"));
+ var_dump(strrpos("te".chr(0)."st", chr(0)));
+ var_dump(strrpos("tEst", "test"));
+ var_dump(strrpos("teSt", "test"));
+ var_dump(@strrpos("foo", "f", 1));
+ var_dump(@strrpos("", ""));
+ var_dump(@strrpos("a", ""));
+ var_dump(@strrpos("", "a"));
+ var_dump(@strrpos("\\\\a", "\\a"));
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrpos() function: basic functionality ***\n";
+$heredoc_str = <<<EOD
+Hello, World
+EOD;
+
+echo "-- With default arguments --\n";
+//regular string for haystack & needle
+var_dump( strrpos("Hello, World", "Hello") );
+var_dump( strrpos('Hello, World', "hello") );
+var_dump( strrpos("Hello, World", 'World') );
+var_dump( strrpos('Hello, World', 'WORLD') );
+
+//single char for needle
+var_dump( strrpos("Hello, World", "o") );
+var_dump( strrpos("Hello, World", ",") );
+
+//heredoc string for haystack & needle
+var_dump( strrpos($heredoc_str, "Hello, World") );
+var_dump( strrpos($heredoc_str, 'Hello') );
+var_dump( strrpos($heredoc_str, $heredoc_str) );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrpos() function: basic functionality ***\n";
+$heredoc_str = <<<EOD
+Hello, World
+EOD;
+
+echo "-- With all arguments --\n";
+//regular string for haystack & needle, with various offsets
+var_dump( strrpos("Hello, World", "Hello", 0) );
+var_dump( strrpos("Hello, World", 'Hello', 1) );
+var_dump( strrpos('Hello, World', 'World', 1) );
+var_dump( strrpos('Hello, World', "World", 5) );
+
+//heredoc string for haystack & needle, with various offsets
+var_dump( strrpos($heredoc_str, "Hello, World", 0) );
+var_dump( strrpos($heredoc_str, 'Hello', 0) );
+var_dump( strrpos($heredoc_str, 'Hello', 1) );
+var_dump( strrpos($heredoc_str, $heredoc_str, 0) );
+var_dump( strrpos($heredoc_str, $heredoc_str, 1) );
+
+//various offsets
+var_dump( strrpos("Hello, World", "o", 3) );
+var_dump( strrpos("Hello, World", "o", 6) );
+var_dump( strrpos("Hello, World", "o", 10) );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrpos() function: error conditions ***";
+echo "\n-- With Zero arguments --";
+var_dump( strrpos() );
+
+echo "\n-- With less than expected number of arguments --";
+var_dump( strrpos("String") );
+
+echo "\n-- With more than expected number of arguments --";
+var_dump( strrpos("string", "String", 1, 'extra_arg') );
+echo "*** Done ***";
+?>
+--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--
+<?php
+
+var_dump(strrpos("t", "t", PHP_INT_MAX+1));
+var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1));
+var_dump(strrpos(100, 101, PHP_INT_MAX+1));
+var_dump(strrpos(1024, 1024, PHP_INT_MAX+1));
+var_dump(strrpos(1024, 1024, -PHP_INT_MAX));
+var_dump(strrpos(1024, "te", -PHP_INT_MAX));
+var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1));
+var_dump(strrpos(1024, "te", -PHP_INT_MAX-1));
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing double quoted strings for 'haystack' & 'needle' arguments */
+
+echo "*** Testing strrpos() function: with double quoted strings ***\n";
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@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<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrpos($haystack, $needle[$index]) );
+ var_dump( strrpos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'needle' and
+ * an expected type of input for 'haystack' argument
+*/
+
+echo "*** Testing strrpos() function with unexpected values for needle ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
+
+// array with different values
+$needles = 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 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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'haystack' and 'needle' arguments */
+
+echo "*** Testing strrpos() function with unexpected values for haystack and needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', '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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with null terminated strings for 'haystack' argument
+ * in order to check the binary safe
+*/
+
+echo "*** Test strrpos() function: binary safe ***\n";
+$haystacks = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello World",
+ "Hello World".chr(0),
+ chr(0).chr(0).chr(0),
+ "Hello\0world",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($haystacks); $index++ ) {
+ var_dump( strrpos($haystacks[$index], "\0") );
+ var_dump( strrpos($haystacks[$index], "\0", $index) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with null terminated strings for 'needle' argument
+ * in order to check binary safe
+*/
+
+echo "*** Test strrpos() function: binary safe ***\n";
+$haystack = "\0Hello\0World\0";
+
+$needles = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello\0",
+ chr(0),
+ "Hello\0world",
+ "\0Hello\0world\0",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($needles); $index++ ) {
+ var_dump( strrpos($haystack, $needles[$index]) );
+ var_dump( strrpos($haystack, $needles[$index], $index) );
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'offset' argument */
+
+echo "*** Testing strrpos() function: with unexpected values for offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//definition of input args
+$haystack = "hello world";
+$needle = "world";
+
+// array with different values
+$offsets = array (
+
+ // float values
+ 1.5,
+ -1.5,
+ 1.5e10,
+ 1.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new 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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */
+
+echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', '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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing single quoted strings to 'haystack' & 'needle' arguments */
+
+echo "*** Testing strrpos() function: with single quoted strings ***\n";
+$haystack = 'Hello,\t\n\0\n $&!#%()*<=>?@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<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrpos($haystack, $needle[$index]) );
+ var_dump( strrpos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing multi-line heredoc string for haystack and
+ * with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing multi lines --\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+var_dump( strrpos($multi_line_str, "ing", 0) );
+var_dump( strrpos($multi_line_str, "ing", 15) );
+var_dump( strrpos($multi_line_str, "ing", 22) );
+var_dump( strrpos($multi_line_str, "") );
+var_dump( strrpos($multi_line_str, " ") );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing heredoc string containing special chars for haystack
+ * and with various needles & offets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing special chars --\n";
+$special_chars_str = <<<EOD
+Ex'ple of h'doc st'g, contains
+$#%^*&*_("_")!#@@!$#$^^&$*(special)
+chars.
+EOD;
+var_dump( strrpos($special_chars_str, "Ex'ple", 0) );
+var_dump( strrpos($special_chars_str, "!@@!", 23) );
+var_dump( strrpos($special_chars_str, '_') );
+var_dump( strrpos($special_chars_str, '("_")') );
+var_dump( strrpos($special_chars_str, "$*") );
+var_dump( strrpos($special_chars_str, "$*", 10) );
+var_dump( strrpos($special_chars_str, "(special)") );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing heredoc string containing escape chars for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing escape characters --\n";
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\tWorld
+EOD;
+var_dump( strrpos($control_char_str, "\n") );
+var_dump( strrpos($control_char_str, "\t") );
+var_dump( strrpos($control_char_str, "\n", 12) );
+var_dump( strrpos($control_char_str, "\t", 15) );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing heredoc string containing quotes for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing quote & slash chars --\n";
+$quote_char_str = <<<EOD
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOD;
+var_dump( strrpos($quote_char_str, "line") );
+var_dump( strrpos($quote_char_str, 'things') );
+var_dump( strrpos($quote_char_str, 'things', 0) );
+var_dump( strrpos($quote_char_str, "things", 20) );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing empty heredoc string for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With empty heredoc string --\n";
+$empty_string = <<<EOD
+EOD;
+var_dump( strrpos($empty_string, "") );
+var_dump( strrpos($empty_string, "", 1) );
+var_dump( strrpos($empty_string, FALSE) );
+var_dump( strrpos($empty_string, NULL) );
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with strings containing multiple occurrences of 'needle' in the 'haystack'
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: strings repetitive chars ***\n";
+$haystack = "ababababAbaBa";
+$needle = "aba";
+
+/* loop through to consider various offsets in getting the position of the needle in haystack string */
+$count = 1;
+for($offset = -1; $offset <= strlen($haystack); $offset++ ) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrpos($haystack, $needle, $offset) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for haystack argument */
+
+echo "*** Testing strrpos() function with unexpected values for haystack ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$haystacks = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new 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--
+<?php
+$a = "22222222aaaa bbb1111 cccc";
+$b = "1234";
+var_dump($a);
+var_dump($b);
+var_dump(strspn($a,$b));
+var_dump(strspn($a,$b,2));
+var_dump(strspn($a,$b,2,3));
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided, it works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : basic functionality
+*/
+
+echo "*** Testing strspn() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = "this is the test string";
+$mask = "htes ";
+$start = 8;
+$len = 30;
+
+// Calling strspn() with all possible arguments
+var_dump( strspn($str, $mask, $start, $len) );
+
+// Calling strspn() with three arguments and default len argument
+var_dump( strspn($str, $mask, $start) );
+
+// Calling strspn() with default arguments
+var_dump( strspn($str, $mask) );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Test strspn() : for error conditons
+*/
+
+echo "*** Testing strspn() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing strspn() function with Zero arguments --\n";
+var_dump( strspn() );
+
+//Test strspn with one more than the expected number of arguments
+echo "\n-- Testing strspn() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$mask = 'string_val';
+$start = 2;
+$len = 20;
+
+
+$extra_arg = 10;
+var_dump( strspn($str,$mask,$start,$len, $extra_arg) );
+
+// Testing strspn withone less than the expected number of arguments
+echo "\n-- Testing strspn() function with less than expected no. of arguments --\n";
+$str = 'string_val';
+var_dump( strspn($str) );
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strspn() : with different unexpected values for str argument
+*/
+
+echo "*** Testing strspn() : with unexpected values for str argument ***\n";
+
+// Initialise function arguments not being substititued (if any)
+$mask = 'abons1234567890';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample,
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\n-- Iteration with str value as \"$value\"\n";
+ var_dump( strspn($value,$mask) ); // with default args
+ var_dump( strspn($value,$mask,$start) ); // with default len value
+ var_dump( strspn($value,$mask,$start,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with unexpected values for str argument ***
+
+-- Iteration with str value as "0"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "1"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "12345"
+int(5)
+int(4)
+int(4)
+
+-- Iteration with str value as "-2345"
+int(0)
+int(4)
+int(4)
+
+-- Iteration with str value as "10.5"
+int(2)
+int(1)
+int(1)
+
+-- Iteration with str value as "-10.5"
+int(0)
+int(2)
+int(2)
+
+-- Iteration with str value as "101234567000"
+int(12)
+int(11)
+int(10)
+
+-- Iteration with str value as "1.07654321E-9"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "0.5"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "object"
+int(2)
+int(1)
+int(1)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "Resource id #%d"
+
+Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with varying mask and default start and len arguments
+*/
+
+echo "*** Testing strspn() : with different mask strings and default start and len arguments ***\n";
+
+// initialing required variables
+// defining different strings
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// define the array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "t\ ",
+ '\telh',
+ "felh\t\ ",
+ " \t",
+ "fhel\t\i\100\xa"
+ );
+
+
+// loop through each element of the array for mask argument
+
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strspn($str,$mask) );
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with varying start and default len arguments
+*/
+
+echo "*** Testing strspn() : with different start and default len values ***\n";
+
+// initialing required variables
+// defining different strings
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// define the array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "t\ ",
+ '\telh',
+ "felh\t\ ",
+ " \t",
+ "fhel\t\i\100\xa"
+ );
+
+// defining the array for start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for str, mask and start argument
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strspn($str,$mask,$start) );
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with varying start and len arguments
+*/
+
+echo "*** Testing strspn() : with different start and len values ***\n";
+
+// initialing required variables
+// defining different strings
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ "1234hello45world\t123",
+ "hello\0world\012",
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ "hello".chr(0)."world",
+ "hello\0\100\xaaaworld",
+ );
+
+// define the array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "felh\t\ ",
+ "fhel\t\i\100\xa"
+ );
+
+// defining the array for start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+// defining an array of len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the array for len argument
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strspn() : with different unexpected values for mask argument
+*/
+
+echo "*** Testing strspn() : with diferent unexpected values of mask argument ***\n";
+
+$str = 'string_val';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for mask
+
+foreach($values as $value) {
+ echo "\n-- Iteration with mask value as \"$value\" --\n";
+ var_dump( 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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strspn() : with unexpected values of start argument
+*/
+
+echo "*** Testing strspn() : with unexpected values of start argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$len = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with 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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* Testing strspn() : with unexpected values of len argument
+*/
+
+echo "*** Testing strspn() : with unexpected values of len argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$start = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with len value as \"$value\" --\n";
+ var_dump( 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
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation5.phpt
Binary files 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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with heredoc string, varying mask and default start and len arguments
+*/
+
+echo "*** Testing strspn() : with different mask strings ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+// defining array of different heredoc strings
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of different mask strings
+$mask_array = array(
+ "",
+ '',
+ "fh\ne\trlsti \l",
+ 'fieh\n\trlsti \l',
+ "\t",
+ "lt\ ",
+ 'l\t',
+ "fl\t\eh ",
+ "l \te",
+ "lf\the\i\100\xaa"
+ );
+
+
+// loop through each element of the array for different heredoc and mask strings
+
+$count = 1;
+
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strspn($str,$mask) ); // with default start and len value
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with heredoc string, varying start and default len arguments
+*/
+
+echo "*** Testing strspn() : with different start values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+// defining array of different heredoc strings
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of different mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\nh\trstie \l",
+ 'f\n\thrstei \l',
+ "\t",
+ "t\ e",
+ '\t',
+ "f\te\h ",
+ " \t",
+ "f\t\ih\100e\xa"
+ );
+
+// defining array of different start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the array for heredoc strings, mask strings and start values
+
+$count = 1;
+
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strspn($str,$mask,$start) ); // with default len value
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with heredoc string, varying start and len arguments
+*/
+
+echo "*** Testing strspn() : with different start and len values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+// defining array of different heredoc strings
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of different mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\\0htersti \l",
+ "\t",
+ "het\ ",
+ "fel\th\ ",
+ "f\t\hiel\100\xaa"
+ );
+
+// defining array of different start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+// defining array of different len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the array for heredoc str, mask str , start values and len values
+
+$count = 1;
+
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+};
+
+echo "Done"
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
new file mode 100644
index 0000000..1c8d753
--- /dev/null
+++ b/ext/standard/tests/strings/strstr.phpt
Binary files 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--
+<?php
+
+$email = 'aexample.com';
+var_dump(strstr($email, '@'));
+var_dump(strstr($email, '@', 1));
+$email = 'a@example.com';
+var_dump(strstr($email, '@'));
+var_dump(strstr($email, '@', 1));
+$email = 'asdfasdfas@e';
+var_dump(strstr($email, '@'));
+var_dump(strstr($email, '@', 1));
+$email = '@';
+var_dump(strstr($email, '@'));
+var_dump(strstr($email, '@', 1));
+$email = 'eE@fF';
+var_dump(strstr($email, 'e'));
+var_dump(strstr($email, 'e', 1));
+var_dump(strstr($email, 'E'));
+var_dump(strstr($email, 'E', 1));
+
+var_dump(strstr('', ' ', ''));
+
+?>
+--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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : basic functionality
+*/
+
+echo "*** Testing strtok() : basic functionality ***\n";
+
+// Initialize all required variables
+$str = 'This testcase test strtok() function.';
+$token = ' ().';
+
+echo "\nThe Input string is:\n\"$str\"\n";
+echo "\nThe token string is:\n\"$token\"\n";
+
+// using strtok() with $str argument
+echo "\n--- Token 1 ---\n";
+var_dump( strtok($str, $token) );
+
+for( $i = 2; $i <=7; $i++ ) {
+ echo "\n--- Token $i ---\n";
+ var_dump( strtok($token) );
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strtok ( string $str, string $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() for error conditions
+*/
+
+echo "*** Testing strtok() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing strtok() function with Zero arguments --\n";
+var_dump( strtok() );
+
+// More than expected number of arguments
+echo "\n-- Testing strtok() function with more than expected no. of arguments --\n";
+$str = 'sample string';
+$token = ' ';
+$extra_arg = 10;
+
+var_dump( strtok($str, $token, $extra_arg) );
+var_dump( $str );
+
+// Less than expected number of arguments
+echo "\n-- Testing strtok() with less than expected no. of arguments --\n";
+$str = 'string val';
+
+var_dump( strtok($str));
+var_dump( $str );
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strtok ( string $str, string $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with first argument as non-string
+*/
+
+echo "*** Testing strtok() : with first argument as non-string ***\n";
+// initialize all required variables
+$token = '-';
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj-ect";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red-color', 'item' => 'pen-color'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+
+// loop through each element of the array and check the working of strtok()
+// when $str arugment is supplied with different values
+
+echo "\n--- Testing strtok() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( strtok($str, $token) );
+
+ $counter ++;
+}
+
+//closing the resource
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with first argument as non-string ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing strtok() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(4) "2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(4) "10.5"
+-- Iteration 7 --
+string(12) "101234567000"
+-- Iteration 8 --
+string(11) "1.07654321E"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with different token strings
+*/
+
+echo "*** Testing strtok() : with different token strings ***\n";
+// initialize all required variables
+$str = 'this testcase test strtok() function ';
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj-ect";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', '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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with heredoc strings
+*/
+
+echo "*** Testing strtok() : with heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string values
+
+$count = 1;
+foreach($heredoc_strings as $string) {
+ echo "\n--- Iteration $count ---\n";
+ var_dump( strtok($string, "5o\0\n\t") );
+ for($counter = 1; $counter <= 10; $counter++) {
+ var_dump( strtok("5o\0\n\t") );
+ }
+ $count++;
+}
+
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with embedded nulls in the strings
+*/
+
+echo "*** Testing strtok() : with embedded nulls in the strings ***\n";
+
+// defining varous strings with embedded nulls
+$strings_with_nulls = array(
+ "\0",
+ '\0',
+ "hello\0world",
+ "\0hel\0lo",
+ "hello\0",
+ "\0\0hello\tworld\0\0",
+ "\\0he\0llo\\0",
+ 'hello\0\0'
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string values
+
+$counter = 1;
+foreach( $strings_with_nulls as $string ) {
+ echo "\n--- Iteration $counter ---\n";
+ var_dump( strtok($string, "\0") );
+ for($count = 1; $count <= 5; $count++) {
+ var_dump( strtok("\0") );
+ }
+ $counter++;
+}
+
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with miscellaneous combinations of string and token
+*/
+
+echo "*** Testing strtok() : with miscellaneous inputs ***\n";
+
+// defining arrays for input strings and tokens
+$string_array = array(
+ "HELLO WORLD",
+ "hello world",
+ "_HELLO_WORLD_",
+ "/thello/t/wor/ttld",
+ "hel/lo/t/world",
+ "one:$:two:!:three:#:four",
+ "\rhello/r/wor\rrld",
+ chr(0),
+ chr(0).chr(0),
+ chr(0).'hello'.chr(0),
+ 'hello'.chr(0).'world'
+ );
+$token_array = array(
+ "wr",
+ "hello world",
+ "__",
+ "t/",
+ '/t',
+ ":",
+ "\r",
+ "\0",
+ "\0",
+ "\0",
+ "\0",
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string and token values
+
+$counter =1;
+foreach( $string_array as $string ) {
+ echo "\n--- Iteration $counter ---\n";
+ var_dump( strtok($string, $token_array[$counter-1]) );
+ for( $count = 1; $count <=5; $count++ ) {
+ var_dump( strtok($token_array[$counter-1]) );
+ }
+ $counter++;
+}
+
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with invalid escape sequences in token
+*/
+
+echo "*** Testing strtok() : with invalid escape sequences in token ***\n";
+
+// defining arrays for input strings and tokens
+$string_array = array(
+ "khellok worldk",
+ "\khello\k world\k",
+ "/khello\k world/k",
+ "/hellok/ world"
+ );
+$token_array = array(
+ "k",
+ "/ ",
+ "/k",
+ "\k",
+ "\\\\\\\k\h\\e\l\o\w\r\l\d"
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string and token values
+
+$counter =1;
+foreach( $string_array as $string ) {
+ echo "\n--- Iteration $counter ---\n";
+ foreach( $token_array as $token ) {
+ var_dump( strtok($string, $token) );
+ for( $count = 1; $count <=3; $count++ ) {
+ var_dump( strtok($token) );
+ }
+ echo "\n";
+ }
+ $counter++;
+}
+
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : modifying the input string while it is getting tokenised
+*/
+
+echo "*** Testing strtok() : with modification of input string in between tokenising ***\n";
+
+$str = "this is a sample string";
+$token = " ";
+
+echo "\n*** Testing strtok() when string being tokenised is prefixed with another string in between the process ***\n";
+var_dump( strtok($str, $token) );
+// adding a string to the input string which is being tokenised
+$str = "extra string ".$str;
+for( $count = 1; $count <=6; $count++ ) {
+ echo "\n-- Token $count is --\n";
+ var_dump( strtok($token) );
+ echo "\n-- Input str is \"$str\" --\n";
+}
+
+echo "\n*** Testing strtok() when string being tokenised is suffixed with another string in between the process ***\n";
+var_dump( strtok($str, $token) );
+// adding a string to the input string which is being tokenised
+$str = $str." extra string";
+for( $count = 1; $count <=10; $count++ ) {
+ echo "\n-- Token $count is --\n";
+ var_dump( strtok($token) );
+}
+
+echo "Done\n";
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/strings/strtolower-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt
new file mode 100644
index 0000000..166b5cc
--- /dev/null
+++ b/ext/standard/tests/strings/strtolower.phpt
Binary files 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--
+<?php
+if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
+ die("skip locale needed for this test is not supported on this platform");
+}
+?>
+--FILE--
+<?php
+$chars = "äöü";
+// Not sure which is most portable. BSD's answer to
+// this one. A small array based on PHP_OS should
+// cover a majority of systems and makes the problem
+// of locales transparent for the end user.
+setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
+echo strtoupper($chars)."\n";
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/strings/strtoupper1-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt
new file mode 100644
index 0000000..b83a8a3
--- /dev/null
+++ b/ext/standard/tests/strings/strtoupper1.phpt
Binary files 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--
+<?php
+/* Do not change this test it is a README.TESTING example. */
+$trans = array("hello"=>"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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ * Description: Translates characters in str using given translation pairs
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strtr() : basic functionality ***\n";
+//definitions of required input variables
+$trans1_arr = array("t" => "T", "e" => "E", "st" => "ST");
+$trans2_arr = array('t' => 'T', 'e' => 'E', 'st' => 'ST');
+$heredoc_str = <<<EOD
+test strtr
+EOD;
+
+//translating single char
+var_dump( strtr("test strtr", "t", "T") );
+var_dump( strtr('test strtr', 't', 'T') );
+var_dump( strtr($heredoc_str, "t", "T") );
+
+//translating set of chars
+//$from and $to are of same length
+var_dump( strtr("test strtr", "test", "TEST") );
+var_dump( strtr('test strtr', 'test', 'TEST') );
+var_dump( strtr($heredoc_str, "test", "TEST") );
+
+//$from and $to are of different lengths, extra chars in the longer one are ignored
+var_dump( strtr("test strtr", "test", "TESTz") );
+var_dump( strtr('test strtr', 'testz', 'TEST') );
+var_dump( strtr($heredoc_str, "test", "TESTz") );
+
+//by using replace_pairs array
+var_dump( strtr("test strtr", $trans1_arr) );
+var_dump( strtr('test strtr', $trans2_arr) );
+var_dump( strtr($heredoc_str, $trans1_arr) );
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strtr(string str, string from[, string to])
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strtr() : error conditions ***\n";
+$str = "string";
+$from = "string";
+$to = "STRING";
+$extra_arg = "extra_argument";
+
+echo "\n-- Testing strtr() function with Zero arguments --";
+var_dump( strtr() );
+
+echo "\n-- Testing strtr() function with less than expected no. of arguments --";
+var_dump( strtr($str) );
+
+echo "\n-- Testing strtr() function with more than expected no. of arguments --";
+var_dump( strtr($str, $from, $to, $extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * combination of numeric & regular strings for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : numeric & regular double quoted strings ***\n";
+/* definitions of required input variables */
+$count = 1;
+$heredoc_str = <<<EOD
+123
+abc
+1a2b3c
+EOD;
+//array of string inputs for $str
+$str_arr = array(
+ //double quoted strings
+ "123",
+ "abc",
+ "1a2b3c",
+
+ //single quoted strings
+ '123',
+ 'abc',
+ '1a2b3c',
+
+ //heredoc string
+ $heredoc_str
+);
+$from = "123abc";
+$to = "abc123";
+$replace_pairs = array("1" => "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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * string containing various special characters for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : string containing special chars for 'str' arg ***\n";
+
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+%
+#$*&
+text & @()
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+ //double quoted strings
+ "%",
+ "#$*",
+ "text & @()",
+
+ //single quoted strings
+ '%',
+ '#$*',
+ 'text & @()',
+
+ //heredoc string
+ $heredoc_str
+);
+
+$from = "%#$*&@()";
+$to = "specials";
+$replace_pairs = array("$" => "%", "%" => "$", "#*&@()" => "()@&*#");
+
+/* 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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * string containing various escape sequences for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : string containing escape sequences for 'str' arg ***\n";
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+\tes\t\\stt\r
+\\test\\\strtr
+\ntest\r\nstrtr
+\$variable
+\"quotes
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+ //double quoted strings
+ "\tes\t\\stt\r",
+ "\\test\\\strtr",
+ "\ntest\r\nstrtr",
+ "\$variable",
+ "\"quotes",
+
+ //single quoted strings
+ '\tes\t\\stt\r',
+ '\\test\\\strtr',
+ '\ntest\r\nstrtr',
+ '\$variable',
+ '\"quotes',
+
+ //heredoc string
+ $heredoc_str
+);
+
+$from = "\n\r\t\\";
+$to = "TEST";
+$replace_pairs = array("\n" => "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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * empty string & null for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : empty string & null for 'str' arg ***\n";
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+ "",
+ '',
+ NULL,
+ null,
+ FALSE,
+ false,
+ $heredoc_str
+);
+
+$from = "";
+$to = "TEST";
+$replace_pairs = array("" => "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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'str'
+ * and expected type for 'from' & 'to' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'str' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$strings = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+
+ // float values
+/*4*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*7*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*10*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*14*/ NULL,
+ null,
+
+ // objects
+/*16*/ new sample(),
+
+ // resource
+/*17*/ $file_handle,
+
+ // undefined variable
+/*18*/ @$undefined_var,
+
+ // unset variable
+/*19*/ @$unset_var
+);
+
+//defining 'from' argument
+$from = "012atm";
+
+//defining 'to' argument
+$to = "atm012";
+
+// loop through with each element of the $strings array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($strings); $index++) {
+ echo "-- Iteration $count --\n";
+ $str = $strings[$index];
+ var_dump( strtr($str, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'from'
+ * and expected type for 'str' & 'to' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'from' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining 'str' argument
+$str = "012atm";
+
+// array of values for 'from'
+$from_arr = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+
+ // float values
+/*4*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*7*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*10*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*14*/ NULL,
+ null,
+
+ // objects
+/*16*/ new sample(),
+
+ // resource
+/*17*/ $file_handle,
+
+ // undefined variable
+/*18*/ @$undefined_var,
+
+ // unset variable
+/*19*/ @$unset_var
+);
+
+//defining 'to' argument
+$to = "atm012";
+
+// loop through with each element of the $from array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($from_arr); $index++) {
+ echo "-- Iteration $count --\n";
+ $from = $from_arr[$index];
+ var_dump( strtr($str, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+?>
+===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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'to'
+ * and expected types for 'str' & 'from' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'to' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining 'str' argument
+$str = "012atm";
+
+//defining 'from' argument
+$from = "atm012";
+
+// array of values for 'to' argument
+$to_arr = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+
+ // float values
+/*4*/ 10.5,
+ -20.5,
+ 10.12345675e10,
+
+ // array values
+/*7*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*10*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+/*14*/ NULL,
+ null,
+
+ // objects
+/*16*/ new sample(),
+
+ // resource
+/*17*/ $file_handle,
+
+ // undefined variable
+/*18*/ @$undefined_var,
+
+ // unset variable
+/*19*/ @$unset_var
+);
+
+// loop through with each element of the $to array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($to_arr); $index++) {
+ echo "\n-- Iteration $count --\n";
+ $to = $to_arr[$index];
+ var_dump( strtr($str, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'replace_pairs'
+ * and expected type for 'str' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining 'str' argument
+$str = "012atm";
+
+// array of inputs for 'replace_pairs' argument
+$replace_pairs_arr = array (
+
+ // integer values
+ 0,
+ 1,
+ -2,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.5e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $replace_pairs array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($replace_pairs_arr); $index++) {
+ echo "\n-- Iteration $count --\n";
+ $replace_pairs = $replace_pairs_arr[$index];
+ var_dump( strtr($str, $replace_pairs) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--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--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'str', 'from', 'to' & 'replace_pairs' arguments */
+
+echo "*** Testing strtr() function: with unexpected inputs for all arguments ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ -2,
+
+ // float values
+/*4*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*7*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => '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--
+<?php
+$foo = 'bar';
+var_dump(strval($foo));
+define('FOO', 'BAR');
+var_dump(strval(FOO));
+var_dump(strval('foobar'));
+var_dump(strval(1));
+var_dump(strval(1.1));
+var_dump(strval(true));
+var_dump(strval(false));
+var_dump(strval(array('foo')));
+?>
+--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--
+<?php
+/* Prototype : string strval ( mixed $var )
+ * Description: Get the string value of a variable.
+ * Source code: ext/standard/string.c
+ */
+
+echo "*** Testing strval() : basic variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+$simple_heredoc =<<<EOT
+Simple HEREDOC string
+EOT;
+
+
+//array of values to iterate over
+$values = array(
+ // Simple strings
+/*1*/ "Hello World",
+ 'Hello World',
+
+ // String with control chars
+/*3*/ "String\nwith\ncontrol\ncharacters\r\n",
+
+ // String with quotes
+/*4*/ "String with \"quotes\"",
+
+ //Numeric String
+/*5*/ "123456",
+
+ // Hexadecimal string
+/*6*/ "0xABC",
+
+ //Heredoc String
+/*7*/ $simple_heredoc
+);
+
+// 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() : 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--
+<?php
+/* Prototype : string strval ( mixed $var )
+ * Description: Get the string value of a variable.
+ * Source code: ext/standard/string.c
+ */
+
+echo "*** Testing strval() : error conditions ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+class MyClass
+{
+ // no toString() method defined
+}
+
+$string = "Hello";
+$extra_arg = 10;
+
+//Test strval with one more than the expected number of arguments
+echo "\n-- Testing strval() function with more than expected no. of arguments --\n";
+var_dump( strval($string, $extra_arg) );
+
+// Testing strval with one less than the expected number of arguments
+echo "\n-- Testing strval() function with less than expected no. of arguments --\n";
+var_dump( strval() );
+
+// Testing strval with a object which has no toString() method
+echo "\n-- Testing strval() function with object which has not toString() method --\n";
+var_dump( strval(new MyClass()) );
+
+?>
+===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--
+<?php
+/* Prototype : string strval ( mixed $var )
+ * Description: Get the string value of a variable.
+ * Source code: ext/standard/string.c
+ */
+
+echo "*** Testing strval() : usage variations ***\n";
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+class MyClass
+{
+ function __toString() {
+ return "MyClass";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+ //Decimal values
+/*1*/ 0,
+ 1,
+ 12345,
+ -12345,
+
+ //Octal values
+/*5*/ 02,
+ 010,
+ 030071,
+ -030071,
+
+ //Hexadecimal values
+/*9*/ 0x0,
+ 0x1,
+ 0xABCD,
+ -0xABCD,
+
+ // float data
+/*13*/ 100.5,
+ -100.5,
+ 100.1234567e10,
+ 100.7654321E-10,
+ .5,
+
+ // array data
+/*18*/ array(),
+ array('color' => '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--
+<?php
+/* Prototype : string strval ( mixed $var )
+ * Description: Get the string value of a variable.
+ * Source code: ext/standard/string.c
+ */
+
+echo "*** Testing strval() : usage variations - Pass all valid char codes ***\n";
+
+$s0 = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f";
+$s1 = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f";
+$s2 = "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f";
+$s3 = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f";
+$s4 = "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f";
+$s5 = "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f";
+$s6 = "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f";
+$s7 = "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f";
+$s8 = "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f";
+$s9 = "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f";
+$sa = "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf";
+$sb = "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf";
+$sc = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf";
+$sd = "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf";
+$se = "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef";
+$sf = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
+
+echo bin2hex(strval($s0));
+echo "\n";
+echo bin2hex(strval($s1));
+echo "\n";
+echo bin2hex(strval($s2));
+echo "\n";
+echo bin2hex(strval($s3));
+echo "\n";
+echo bin2hex(strval($s4));
+echo "\n";
+echo bin2hex(strval($s5));
+echo "\n";
+echo bin2hex(strval($s6));
+echo "\n";
+echo bin2hex(strval($s7));
+echo "\n";
+echo bin2hex(strval($s8));
+echo "\n";
+echo bin2hex(strval($s9));
+echo "\n";
+echo bin2hex(strval($sa));
+echo "\n";
+echo bin2hex(strval($sb));
+echo "\n";
+echo bin2hex(strval($sc));
+echo "\n";
+echo bin2hex(strval($sd));
+echo "\n";
+echo bin2hex(strval($se));
+echo "\n";
+echo bin2hex(strval($sf));
+echo "\n";
+
+?>
+===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
--- /dev/null
+++ b/ext/standard/tests/strings/substr.phpt
Binary files 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--
+<?php
+
+var_dump(substr_compare("abcde", "bc", 1, 2));
+var_dump(substr_compare("abcde", "bcg", 1, 2));
+var_dump(substr_compare("abcde", "BC", 1, 2, true));
+var_dump(substr_compare("abcde", "bc", 1, 3));
+var_dump(substr_compare("abcde", "cd", 1, 2));
+var_dump(substr_compare("abcde", "abc", 5, 1));
+var_dump(substr_compare("abcde", "abcdef", -10, 10));
+
+var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass));
+echo "Test\n";
+var_dump(substr_compare("abcde", "abc", -1, NULL, -5));
+var_dump(substr_compare("abcde", -1, 0, "str", new stdClass));
+
+echo "Done\n";
+?>
+--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--
+<?php
+
+echo "***Testing basic operations ***\n";
+var_dump(@substr_count("", ""));
+var_dump(@substr_count("a", ""));
+var_dump(@substr_count("", "a"));
+var_dump(@substr_count("", "a"));
+var_dump(@substr_count("", chr(0)));
+$a = str_repeat("abcacba", 100);
+var_dump(@substr_count($a, "bca"));
+$a = str_repeat("abcacbabca", 100);
+var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca", 200));
+var_dump(substr_count($a, "bca", 200, 50));
+
+echo "Done\n";
+
+?>
+--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--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+/* Zero argument */
+var_dump( substr_count() );
+
+/* more than expected no. of args */
+var_dump( substr_count($str, "t", 0, 15, 30) );
+
+/* offset as negative value */
+var_dump(substr_count($str, "t", -5));
+
+/* offset > size of the string */
+var_dump(substr_count($str, "t", 25));
+
+/* Using offset and length to go beyond the size of the string:
+ Warning message expected, as length+offset > length of string */
+var_dump( substr_count($str, "i", 5, 15) );
+
+/* length as Null */
+var_dump( substr_count($str, "t", "", "") );
+var_dump( substr_count($str, "i", NULL, NULL) );
+
+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--
+<?php
+
+echo "\n*** Testing possible variations ***\n";
+echo "-- 3rd or 4th arg as string --\n";
+$str = "this is a string";
+var_dump( substr_count($str, "t", "5") );
+var_dump( substr_count($str, "t", "5", "10") );
+var_dump( substr_count($str, "i", "5t") );
+var_dump( substr_count($str, "i", "5t", "10t") );
+
+echo "\n-- 3rd or 4th arg as NULL --\n";
+var_dump( substr_count($str, "t", "") );
+var_dump( substr_count($str, "T", "") );
+var_dump( substr_count($str, "t", "", 15) );
+var_dump( substr_count($str, "I", NULL) );
+var_dump( substr_count($str, "i", NULL, 10) );
+
+echo "\n-- overlapped substrings --\n";
+var_dump( substr_count("abcabcabcabcabc", "abca") );
+var_dump( substr_count("abcabcabcabcabc", "abca", 2) );
+
+echo "\n-- complex strings containing other than 7-bit chars --\n";
+$str = chr(128).chr(129).chr(128).chr(256).chr(255).chr(254).chr(255);
+var_dump(substr_count($str, chr(128)));
+var_dump(substr_count($str, chr(255)));
+var_dump(substr_count($str, chr(256)));
+
+echo "\n-- heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+var_dump(substr_count($string, "abcd"));
+var_dump(substr_count($string, "1234"));
+
+echo "\n-- heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump(substr_count($str, "\0"));
+var_dump(substr_count($str, "\x000"));
+var_dump(substr_count($str, "0"));
+
+echo "Done\n";
+
+?>
+--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--
+<?php
+
+echo "\n*** Testing possible variations ***\n";
+echo "\n-- complex strings containing other than 7-bit chars --\n";
+$str = chr(128).chr(129).chr(128).chr(256).chr(255).chr(254).chr(255);
+var_dump(substr_count($str, chr(128)));
+var_dump(substr_count($str, chr(255)));
+var_dump(substr_count($str, chr(256)));
+
+echo "\n-- heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+var_dump(substr_count($string, "abcd"));
+var_dump(substr_count($string, "1234"));
+
+echo "\n-- heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump(substr_count($str, "\0"));
+var_dump(substr_count($str, "\x000"));
+var_dump(substr_count($str, "0"));
+
+echo "Done\n";
+
+?>
+--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--
+<?php
+$str = "try this";
+$repl = "bala ";
+$start = 2;
+echo "\n";
+
+
+echo "substr_replace('$str', '$repl', $start)\n";
+var_dump(substr_replace($str, $repl, $start));
+echo "\n";
+
+$len = 3;
+echo "substr_replace('$str', '$repl', $start, $len)\n";
+var_dump(substr_replace($str, $repl, $start, $len));
+echo "\n";
+
+$len = 0;
+echo "substr_replace('$str', '$repl', $start, $len)\n";
+var_dump(substr_replace($str, $repl, $start, $len));
+echo "\n";
+
+$len = -2;
+echo "substr_replace('$str', '$repl', $start, $len)\n";
+var_dump(substr_replace($str, $repl, $start, $len));
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+$str = "try this";
+$repl = array("bala ");
+$start = 4;
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+
+$str = array("ala portokala");
+$repl = array("bala ");
+$start = array(4);
+$len = array(3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+
+$len = array(3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$len = array(0);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$len = array(-2);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+
+
+$str = array("ala portokala");
+$repl = "bala ";
+$start = 4;
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+echo "\n";
+
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = 4;
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = 4;
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = 4;
+$len = 0;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = 4;
+$len = 0;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = 4;
+$len = -2;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = 4;
+$len = -2;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+
+
+$str = array("ala portokala");
+$repl = "bala ";
+$start = array(4);
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+echo "\n";
+
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4);
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4);
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4);
+$len = 0;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4);
+$len = 0;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4);
+$len = -2;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4);
+$len = -2;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala");
+$repl = "bala ";
+$start = array(4,2);
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+echo "\n";
+
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = 3;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = 0;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = 0;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = -2;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = -2;
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+echo "\n";
+
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = array(3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = array(0);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(0);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = array(-2);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(-2);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(3,2);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start))."\n";
+echo "\n";
+echo "\n";
+
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = array(3,2);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(3,2);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = array(0,0);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(0,0);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+$str = array("ala portokala", "try this");
+$repl = array("bala ");
+$start = array(4,2);
+$len = array(-2,-3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+echo "\n";
+
+
+$str = array("ala portokala", "try this");
+$repl = "bala ";
+$start = array(4,2);
+$len = array(-2,-3);
+echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
+var_dump(substr_replace($str, $repl, $start, $len))."\n";
+echo "\n";
+
+
+
+
+?>
+--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--
+<?php
+
+$arr = array('abc' => '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--
+<?php
+/* Prototype : mixed substr_replace ( mixed $string , string $replacement , int $start [, int $length ] )
+ * Description: Replace text within a portion of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing substr_replace() for error conditions
+*/
+
+echo "*** Testing substr_replace() : error conditions ***\n";
+
+$s1 = "Good morning";
+
+echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n";
+var_dump(substr_replace());
+var_dump(substr_replace($s1, "evening"));
+
+echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n";
+var_dump(substr_replace($s1, "evening", 5, 7, true));
+
+echo "\n-- Testing substr_replace() function with start and length different types --\n";
+var_dump(substr_replace($s1, "evening", array(5)));
+var_dump(substr_replace($s1, "evening", 5, array(8)));
+
+echo "\n-- Testing substr_replace() function with start and length with a different number of elments --\n";
+var_dump(substr_replace($s1, "evening", array(5, 1), array(8)));
+
+echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n";
+var_dump(substr_replace($s1, "evening", array(5), array(8)));
+
+?>
+===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--
+<?php
+
+$tests = <<<TESTS
+'ABC' === trim('ABC')
+'ABC' === ltrim('ABC')
+'ABC' === rtrim('ABC')
+'ABC' === trim(" \\0\\t\\nABC \\0\\t\\n")
+"ABC \\0\\t\\n" === ltrim(" \\0\\t\\nABC \\0\\t\\n")
+" \\0\\t\\nABC" === rtrim(" \\0\\t\\nABC \\0\\t\\n")
+" \\0\\t\\nABC \\0\\t\\n" === trim(" \\0\\t\\nABC \\0\\t\\n",'')
+" \\0\\t\\nABC \\0\\t\\n" === ltrim(" \\0\\t\\nABC \\0\\t\\n",'')
+" \\0\\t\\nABC \\0\\t\\n" === rtrim(" \\0\\t\\nABC \\0\\t\\n",'')
+"ABC\\x50\\xC1" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC0")
+"ABC\\x50" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC1")
+"ABC" === trim("ABC\\x50\\xC1\\x60\\x90","\\x50..\\xC1")
+"ABC\\x50\\xC1" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC0")
+"ABC\\x50" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC1")
+"ABC" === trim("ABC\\x50\\xC1\\x60\\x90","\\x50..\\xC1")
+TESTS;
+
+include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+
+--EXPECT--
+OK
diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt
new file mode 100644
index 0000000..b9323af
--- /dev/null
+++ b/ext/standard/tests/strings/trim1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/trim_basic.phpt b/ext/standard/tests/strings/trim_basic.phpt
new file mode 100644
index 0000000..501b477
--- /dev/null
+++ b/ext/standard/tests/strings/trim_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test trim() function : basic functionality
+--FILE--
+<?php
+
+/* Prototype : string trim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the beginning and end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing trim() : basic functionality ***\n";
+
+$text = " \t\r\n\0\x0B ---These are a few words--- \t\r\n\0\x0B ";
+$hello = "!===Hello World===!";
+$binary = "\x0A\x0DExample string\x0A\x0D";
+
+echo "\n-- Trim string with all white space characters --\n";
+var_dump(trim($text));
+
+echo "\n-- Trim non-whitespace from a string --\n";
+var_dump(trim($hello, "=!"));
+
+echo "\n-- Trim some non-white space characters from a string --\n";
+var_dump(trim($hello, "Hdle"));
+
+echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
+var_dump(trim($binary, "\x00..\x1F"));
+
+?>
+===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--
+<?php
+
+/* Prototype : string trim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the begining and end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing trim() : error conditions ***\n";
+
+echo "\n-- Testing trim() function with no arguments --\n";
+var_dump( trim() );
+
+echo "\n-- Testing trim() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( trim("Hello World", "Heo", $extra_arg) );
+
+
+$hello = " Hello World\n";
+echo "\n-- Test trim function with various invalid charlists --\n";
+var_dump(trim($hello, "..a"));
+var_dump(trim($hello, "a.."));
+var_dump(trim($hello, "z..a"));
+var_dump(trim($hello, "a..b..c"));
+
+?>
+===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--
+<?php
+
+/* Prototype : string trim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the begining and end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing trim() function: with unexpected inputs for 'str' argument ***\n";
+
+//get an unset variable
+$unset_var = ' !--string_val--! ';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return " !---sample object---! ";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test trim() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ // strip white space and any "minus" signs
+ var_dump( trim($input, " !-") );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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--
+<?php
+
+/* Prototype : string trim ( string $str [, string $charlist ] )
+ * Description: Strip whitespace (or other characters) from the begining and end of a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing trim() function: with unexpected inputs for 'charlist' argument ***\n";
+
+//get an unset variable
+$unset_var = ' string_val ';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return " sample object ";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $input
+$inputs = array (
+
+ // integer values
+/*1*/ 0,
+ 1,
+ 255,
+ 256,
+ 2147483647,
+ -2147483648,
+
+ // float values
+/*7*/ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+/*10*/ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+/*17*/ NULL,
+ null,
+
+ // objects
+/*19*/ new sample(),
+
+ // resource
+/*20*/ $file_handle,
+
+ // undefined variable
+/*21*/ @$undefined_var,
+
+ // unset variable
+/*22*/ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test trim() function
+$count = 1;
+foreach($inputs as $charlist) {
+ echo "-- Iteration $count --\n";
+ // strip white space and any "minus" signs
+ var_dump( trim("!---Hello World---!", $charlist) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===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
--- /dev/null
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files 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--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ucwords() : basic functionality ***\n";
+
+// lines with different whitespace charecter
+$str_array = array(
+ "testing ucwords",
+ 'testing ucwords',
+ 'testing\tucwords',
+ "testing\tucwords",
+ "testing\nucwords",
+ 'testing\nucwords',
+ "testing\vucwords",
+ 'testing\vucwords',
+ "testing",
+ 'testing',
+ ' testing',
+ " testing",
+ "testing ucwords",
+ 'testing ucwords',
+ 'testing\rucwords',
+ "testing\rucwords",
+ 'testing\fucwords',
+ "testing\fucwords"
+);
+
+// loop through the $strings array to test ucwords on each element
+$iteration = 1;
+for($index = 0; $index < count($str_array); $index++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( ucwords($str_array[$index]) );
+ $iteration++;
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ucwords() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing ucwords() function with Zero arguments --\n";
+var_dump( ucwords() );
+
+// More than expected number of arguments
+echo "\n-- Testing ucwords() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+
+var_dump( ucwords($str, $extra_arg) );
+
+// check if there were any changes made to $str
+var_dump($str);
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test ucwords() by passing different values including scalar and non scalar values
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+$fp = fopen(__FILE__, "r");
+
+class my
+{
+ function __toString() {
+ return "myString";
+ }
+}
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // hex values
+ 0x10,
+ 0X20,
+ 0xAA,
+ -0XF5,
+
+ // octal values
+ 0123,
+ -0342,
+
+ // 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 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--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using heredoc
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// Null here doc string
+$null_string = <<<EOT
+EOT;
+
+// Heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// here doc with multiline string
+$multiline_string = <<<EOT
+testing ucword() with
+multiline string using
+heredoc
+EOT;
+
+// here doc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+testing\rucword(str)\twith
+multiline string\t\tusing
+heredoc\nstring.with\vdifferent\fwhite\vspaces
+EOT;
+
+// here doc with numeric values
+$numeric_string = <<<EOT
+12sting 123string 4567
+string\t123string\r12 test\n5test
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOT;
+
+$heredoc_strings = array(
+ $null_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// loop through $heredoc_strings element and check the working on ucwords()
+$count = 1;
+for($index =0; $index < count($heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( ucwords($heredoc_strings[$index]) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using single quote
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// different strings containing regular chars and special chars
+$str_array = array(
+ // multiple spaces
+ 'testing ucwords',
+ 't e s t i n g u c w o r d s ',
+
+ // brackets in sentence
+ 'testing function(ucwords)',
+ '(testing ( function (ucwords) )a )test',
+ '(t)',
+ ' ( t )t',
+
+ // using quote chars in sentence
+ '"testing",ucword,"test"',
+ '"t""t",test, t',
+ '\'t \'t\',test',
+
+ // using other white spaces
+ '\ttesting\ttesting\tucwords',
+ 'testing\rucwords testing ucwords',
+ 'testing\fucwords \f testing \nucwords',
+ '\ntesting\nucwords\n testing \n ucwords',
+ 'using\vvertical\vtab',
+
+ //using special chars in sentence
+ 't@@#$% %test ^test &test *test +test -test',
+ '!test ~test `test` =test= @test@test.com',
+ '/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/',
+
+ //only special chars
+ '!@#$%^&*()_+=-`~'
+);
+
+// loop through the $str_array array to test ucwords on each element
+$iteration = 1;
+for($index = 0; $index < count($str_array); $index++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( ucwords($str_array[$index]) );
+ $iteration++;
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using double quote
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// different strings containing regular chars and special chars
+$str_array = array(
+ // multiple spaces
+ "testing ucwords",
+ "t e s t i n g u c w o r d s ",
+
+ // brackets in sentence
+ "testing function(ucwords)",
+ "(testing ( function (ucwords) )a )test",
+ "(t)",
+ " ( t )t",
+
+ // using quote chars in sentence
+ "\"testing\",ucwords,\"test\"",
+ "\"t\"\"t\",test, t",
+ "\'t \'t\',test",
+ "Jack's pen",
+ "P't'y 't it's ",
+
+ // using other white spaces
+ "\ttesting\ttesting\tucwords",
+ "\\ttesting\\ttesting\tucwords",
+ "testing\rucwords testing ucwords",
+ "testing\\rucwords testing ucwords",
+ "testing\fucwords \f testing \nucwords",
+ "testing\\fucwords \\f testing \nucwords",
+ "\ntesting\nucwords\n testing \n ucwords",
+ "\\ntesting\\nucwords\\n testing \\n ucwords",
+ "using\vvertical\vtab",
+ "using\\vvertical\\vtab",
+
+ //using special chars in sentence
+ "t@@#$% %test ^test &test *test +test -test",
+ "!test ~test `test` =test= @test@test.com",
+ "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/",
+
+ //only special chars
+ "!@#$%^&*()_+=-`~"
+);
+
+// loop through the $str_array array to test ucwords on each element
+$iteration = 1;
+for($index = 0; $index < count($str_array); $index++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( ucwords($str_array[$index]) );
+ $iteration++;
+}
+
+echo "Done\n";
+?>
+--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--
+<?php
+ var_dump(unpack("-2222", 1));
+ echo "Done\n";
+?>
+--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--
+<?php
+
+/* Prototype : array unpack ( string $format , string $data )
+ * Description: Unpack data from binary string
+ * Source code: ext/standard/pack.c
+*/
+
+echo "*** Testing unpack() : error conditions ***\n";
+
+echo "\n-- Testing unpack() function with no arguments --\n";
+var_dump( unpack() );
+
+echo "\n-- Testing unpack() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump(unpack("I", pack("I", 65534), $extra_arg));
+
+echo "\n-- Testing unpack() function with invalid format character --\n";
+$extra_arg = 10;
+var_dump(unpack("Z", pack("I", 65534)));
+?>
+===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--
+<?php
+$sample_urls = array (
+'',
+'64.246.30.37',
+'http://64.246.30.37',
+'http://64.246.30.37/',
+'64.246.30.37/',
+'64.246.30.37:80/',
+'php.net',
+'php.net/',
+'http://php.net',
+'http://php.net/',
+'www.php.net',
+'www.php.net/',
+'http://www.php.net',
+'http://www.php.net/',
+'www.php.net:80',
+'http://www.php.net:80',
+'http://www.php.net:80/',
+'http://www.php.net/index.php',
+'www.php.net/?',
+'www.php.net:80/?',
+'http://www.php.net/?',
+'http://www.php.net:80/?',
+'http://www.php.net:80/index.php',
+'http://www.php.net:80/foo/bar/index.php',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
+'http://www.php.net:80/this/../a/../deep/directory',
+'http://www.php.net:80/this/../a/../deep/directory/',
+'http://www.php.net:80/this/is/a/very/deep/directory/../file.php',
+'http://www.php.net:80/index.php',
+'http://www.php.net:80/index.php?',
+'http://www.php.net:80/#foo',
+'http://www.php.net:80/?#',
+'http://www.php.net:80/?test=1',
+'http://www.php.net/?test=1&',
+'http://www.php.net:80/?&',
+'http://www.php.net:80/index.php?test=1&',
+'http://www.php.net/index.php?&',
+'http://www.php.net:80/index.php?foo&',
+'http://www.php.net/index.php?&foo',
+'http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI',
+'www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'nntp://news.php.net',
+'ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz',
+'zlib:http://foo@bar',
+'zlib:filename.txt',
+'zlib:/path/to/my/file/file.txt',
+'foo://foo@bar',
+'mailto:me@mydomain.com',
+'/foo.php?a=b&c=d',
+'foo.php?a=b&c=d',
+'http://user:passwd@www.example.com:8080?bar=1&boom=0',
+'file:///path/to/file',
+'file://path/to/file',
+'file:/path/to/file',
+'http://1.2.3.4:/abc.asp?a=1&b=2',
+'http://foo.com#bar',
+'scheme:',
+'foo+bar://baz@bang/bla',
+'gg:9130731',
+'http://user:@pass@host/path?argument?value#etc',
+);
+
+ foreach ($sample_urls as $url) {
+ var_dump(@parse_url($url));
+ }
+
+ $url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+ foreach (array(PHP_URL_SCHEME,PHP_URL_HOST,PHP_URL_PORT,PHP_URL_USER,PHP_URL_PASS,PHP_URL_PATH,PHP_URL_QUERY,PHP_URL_FRAGMENT) as $v) {
+ var_dump(parse_url($url, $v));
+ }
+?>
+--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&parameters=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--
+<?php
+
+var_dump(convert_uuencode(array()));
+var_dump(convert_uudecode(array()));
+
+var_dump(convert_uuencode(""));
+var_dump(convert_uudecode(""));
+var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ"));
+var_dump(convert_uudecode("!@#$%^YUGFDFGHJKLUYTFBNMLOYT"));
+var_dump(convert_uudecode($enc));
+var_dump($enc = convert_uuencode("not very sophisticated"));
+var_dump(convert_uudecode($enc));
+var_dump(convert_uudecode(substr($enc, 0, -10)));
+
+echo "Done\n";
+?>
+--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:<MNBVCXZ"
+string(36) "6;F]T('9E<GD@<V]P:&ES=&EC871E9```
+`
+"
+string(22) "not very sophisticated"
+
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/vfprintf_basic.phpt b/ext/standard/tests/strings/vfprintf_basic.phpt
new file mode 100644
index 0000000..8189aaf
--- /dev/null
+++ b/ext/standard/tests/strings/vfprintf_basic.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test vfprintf() function : basic functionality
+--CREDITS--
+Felix De Vliegher <felix.devliegher@gmail.com>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : int vfprintf(resource stream, string format, array args)
+ * Description: Output a formatted string into a stream
+ * Source code: ext/standard/formatted_print.c
+ * Alias to functions:
+ */
+
+function writeAndDump($fp, $format, $args)
+{
+ ftruncate( $fp, 0 );
+ $length = vfprintf( $fp, $format, $args );
+ rewind( $fp );
+ $content = stream_get_contents( $fp );
+ var_dump( $content );
+ var_dump( $length );
+}
+
+echo "*** Testing vfprintf() : basic functionality ***\n";
+
+// Open handle
+$file = 'vfprintf_test.txt';
+$fp = fopen( $file, "a+" );
+
+// Test vfprintf()
+writeAndDump( $fp, "Foo is %d and %s", array( 30, 'bar' ) );
+writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) );
+writeAndDump( $fp, "%d digit", array( '54' ) );
+writeAndDump( $fp, "%b %b", array( true, false ) );
+writeAndDump( $fp, "%c %c %c", array( 65, 66, 67 ) );
+writeAndDump( $fp, "%e %E %e", array( 1000, 2e4, +2e2 ) );
+writeAndDump( $fp, "%02d", array( 50 ) );
+writeAndDump( $fp, "Testing %b %d %f %s %x %X", array( 9, 6, 2.5502, "foobar", 15, 65 ) );
+
+// Close handle
+fclose( $fp );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = 'vfprintf_test.txt';
+unlink( $file );
+
+?>
+--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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s\n";
+$format2 = "%s %s\n";
+$format3 = "%s %s %s\n";
+$arg1 = array("one");
+$arg2 = array("one","two");
+$arg3 = array("one","two","three");
+
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$result = vfprintf($fp, $format1, $arg1);
+var_dump($result);
+$result = vfprintf($fp, $format2, $arg2);
+var_dump($result);
+$result = vfprintf($fp, $format3, $arg3);
+var_dump($result);
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Testing vfprintf() : basic functionality - using integer format
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using integer format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = array(111);
+$arg2 = array(111,222);
+$arg3 = array(111,222,333);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1, $arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2, $arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3, $arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using float format ***\n";
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = array(11.11);
+$arg2 = array(11.11,22.22);
+$arg3 = array(11.11,22.22,33.33);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp,$format11,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp,$format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp,$format22,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp,$format3,$arg3);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format33,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using bool format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = array(TRUE);
+$arg2 = array(TRUE,FALSE);
+$arg3 = array(TRUE,FALSE,TRUE);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using char format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = array(65);
+$arg2 = array(65,66);
+$arg3 = array(65,66,67);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+
+echo "*** Testing vfprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%e %e";
+$format3 = "%e %e %e";
+$arg1 = array(1000);
+$arg2 = array(1000,2000);
+$arg3 = array(1000,2000,3000);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = array(021);
+$arg2 = array(021,0347);
+$arg3 = array(021,0347,05678);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1,$arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2,$arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3,$arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf) : basic functionality - using hexadecimal format ***\n";
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = array(11);
+$arg2 = array(11,132);
+$arg3 = array(11,132,177);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+vfprintf($fp, $format1, $arg1);
+fprintf($fp, "\n");
+vfprintf($fp, $format11, $arg1);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format2, $arg2);
+fprintf($fp, "\n");
+vfprintf($fp, $format22, $arg2);
+fprintf($fp, "\n");
+
+vfprintf($fp, $format3, $arg3);
+fprintf($fp, "\n");
+vfprintf($fp, $format33, $arg3);
+fprintf($fp, "\n");
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+
+unlink($data_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 <felix.devliegher@gmail.com>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : int vfprintf(resource stream, string format, array args)
+ * Description: Output a formatted string into a stream
+ * Source code: ext/standard/formatted_print.c
+ * Alias to functions:
+ */
+
+// Open handle
+$file = 'vfprintf_test.txt';
+$fp = fopen( $file, "a+" );
+
+echo "\n-- Testing vfprintf() function with more than expected no. of arguments --\n";
+$format = 'string_val';
+$args = array( 1, 2 );
+$extra_arg = 10;
+var_dump( vfprintf( $fp, $format, $args, $extra_arg ) );
+var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) );
+
+// Close handle
+fclose($fp);
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = 'vfprintf_test.txt';
+unlink( $file );
+
+?>
+--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 <felix.devliegher@gmail.com>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : int vfprintf(resource stream, string format, array args)
+ * Description: Output a formatted string into a stream
+ * Source code: ext/standard/formatted_print.c
+ * Alias to functions:
+ */
+
+// Open handle
+$file = 'vfprintf_test.txt';
+$fp = fopen( $file, "a+" );
+
+echo "\n-- Testing vfprintf() function with less than expected no. of arguments --\n";
+$format = 'string_val';
+var_dump( vfprintf($fp, $format) );
+var_dump( vfprintf( $fp ) );
+var_dump( vfprintf() );
+
+// Close handle
+fclose($fp);
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = 'vfprintf_test.txt';
+unlink( $file );
+
+?>
+--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 <felix.devliegher@gmail.com>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : int vfprintf(resource stream, string format, array args)
+ * Description: Output a formatted string into a stream
+ * Source code: ext/standard/formatted_print.c
+ * Alias to functions:
+ */
+
+// Open handle
+$file = 'vfprintf_test.txt';
+$fp = fopen( $file, "a+" );
+
+echo "\n-- Testing vfprintf() function with wrong variable types as argument --\n";
+var_dump( vfprintf( $fp, array( 'foo %d', 'bar %s' ), 3.55552 ) );
+
+rewind( $fp );
+var_dump( stream_get_contents( $fp ) );
+ftruncate( $fp, 0 );
+rewind( $fp );
+
+var_dump( vfprintf( $fp, "Foo %y fake", "not available" ) );
+
+rewind( $fp );
+var_dump( stream_get_contents( $fp ) );
+ftruncate( $fp, 0 );
+rewind( $fp );
+
+// Close handle
+fclose( $fp );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = 'vfprintf_test.txt';
+unlink( $file );
+
+?>
+--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 <felix.devliegher@gmail.com>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : int vfprintf(resource stream, string format, array args)
+ * Description: Output a formatted string into a stream
+ * Source code: ext/standard/formatted_print.c
+ * Alias to functions:
+ */
+
+// Open handle
+$file = 'vfprintf_test.txt';
+$fp = fopen( $file, "a+" );
+
+echo "\n-- Testing vfprintf() function with other strangeties --\n";
+var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) );
+var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) );
+
+// Close handle
+fclose( $fp );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = 'vfprintf_test.txt';
+unlink( $file );
+
+?>
+--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 <felix.devliegher@gmail.com>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : int vfprintf(resource stream, string format, array args)
+ * Description: Output a formatted string into a stream
+ * Source code: ext/standard/formatted_print.c
+ * Alias to functions:
+ */
+
+echo "*** Testing vfprintf() : variation functionality ***\n";
+
+// Open handle
+$file = 'vfprintf_test.txt';
+$fp = fopen( $file, 'a+' );
+
+$funset = fopen( __FILE__, 'r' );
+unset( $funset );
+
+class FooClass
+{
+ public function __toString()
+ {
+ return "Object";
+ }
+}
+
+// Output facilitating function
+function writeAndDump($fp, $format, $args)
+{
+ ftruncate( $fp, 0 );
+ $length = vfprintf( $fp, $format, $args );
+ rewind( $fp );
+ $content = stream_get_contents( $fp );
+ var_dump( $content );
+ var_dump( $length );
+}
+
+// Test vfprintf()
+writeAndDump( $fp, "format", null );
+writeAndDump( $fp, "Foo is %d and %s", array( 30, 'bar' ) );
+writeAndDump( $fp, "Foobar testing", array() );
+writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) );
+writeAndDump( $fp, "%02d", array( 50 ) );
+writeAndDump( $fp, "", array() );
+writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) );
+@writeAndDump( $funset, "Foo with %s", array( 'string' ) );
+@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) );
+
+// Close handle
+fclose( $fp );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+
+$file = 'vfprintf_test.txt';
+unlink( $file );
+
+?>
+--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
--- /dev/null
+++ b/ext/standard/tests/strings/vfprintf_variation10.phpt
Binary files 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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+/* 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 $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+/* 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 $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+// looping to test vfprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+// looping to test vfprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10.1234567e10, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+/* 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($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10.1234567e10, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+/* 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($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different scientific formats and scientific values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : scientific formats and scientific values ***\n";
+
+// defining array of scientific formats
+$formats = array(
+ '%e %+e %-e',
+ '%le %Le %4e %-4e',
+ '%10.4e %-10.4e %.4e',
+ '%\'#20e %\'20e %\'$20e %\'_20e',
+ '%3$e %4$e %1$e %2$e'
+);
+
+// Arrays of scientific values for the format defined in $format.
+// Each sub array contains scientific values which correspond to each format string in $format
+$args_array = array(
+ array(0, 1e0, "10e2" ),
+ array(2.2e2, 10e10, 1000e-2, 1000e7),
+ array(-22e12, 10e20, 1.2e2),
+ array(1e1, +1e2, -1e3, "1e2_"),
+ array(3e3, 4e3, 1e3, 2e3)
+);
+
+/* 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 signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different scientific formats and non-scientific values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : scientific formats and non-scientific values ***\n";
+
+// defining array of non-scientific formats
+$formats =
+ '%e %+e %-e
+ %le %Le %4e %-4e
+ %10.4e %-10.4e %04e %04.4e
+ %\'#2e %\'2e %\'$2e %\'_2e
+ %3$e %4$e %1$e %2$e';
+
+// Arrays of non scientific values for the format defined in $format.
+// Each sub array contains non scientific values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 20.00, +212.2, -411000000000, 2212.000000000001,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+
+/* 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($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp,$format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vfprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+
+/* 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($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp,$format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different unexpected format strings are passed to
+ * the '$format' argument of the function
+*/
+
+echo "*** Testing vfprintf() : with unexpected values for format argument ***\n";
+
+// initialising the required variables
+$args = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1,2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // 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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different unexpected values are passed to
+ * the '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : with unexpected values for args argument ***\n";
+
+// initialising the required variables
+$format = '%s';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new sample(),
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+ // resource data
+/*23*/ $file_handle
+);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+fprintf($fp, "\n*** Testing vprintf() with unexpected values for args argument ***\n");
+
+$counter = 1;
+foreach( $values as $value ) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $value);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different int formats and int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : int formats with int values ***\n";
+
+
+// defining array of int formats
+$formats = array(
+ "%d",
+ "%+d %-d %D",
+ "%ld %Ld, %4d %-4d",
+ "%10.4d %-10.4d %04d %04.4d",
+ "%'#2d %'2d %'$2d %'_2d",
+ "%d %d %d %d",
+ "% %%d d%",
+ '%3$d %4$d %1$d %2$d'
+);
+
+// Arrays of int values for the format defined in $format.
+// Each sub array contains int values which correspond to each format string in $format
+$args_array = array(
+ array(0),
+ array(-1, 1, +22),
+ array(2147483647, -2147483648, +2147483640, -2147483640),
+ array(123456, 12345678, -1234567, 1234567),
+ array(111, 2222, 333333, 44444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234, -5678, 2345),
+ array(3, 4, 1, 2)
+
+);
+
+// looping to test vfprintf() with different int formats from the above $format array
+// and with int values from the above $args_array array
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different float formats and float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : int formats with float values ***\n";
+
+
+// defining array of float formats
+$formats = array(
+ "%f",
+ "%+f %-f %F",
+ "%lf %Lf, %4f %-4f",
+ "%10.4f %-10.4F %04f %04.4f",
+ "%'#2f %'2f %'$2f %'_2f",
+ "%f %f %f %f",
+ "% %%f f%",
+ '%3$f %4$f %1$f %2$f'
+);
+
+// Arrays of float values for the format defined in $format.
+// Each sub array contains float values which correspond to each format string in $format
+$args_array = array(
+ array(0.0),
+ array(-0.1, +0.1, +10.0000006),
+ array(2147483649, -2147483647, +2147483640, -2147483640),
+ array(2e5, 2e-5, -2e5, -2e-5),
+ array(0.2E5, -0.2e40, 0.2E-20, 0.2E+20),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234.1234, -5678.5678, 2345.2345),
+ array(3.33, 4.44, 1.11, 2.22)
+
+);
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+ return;
+
+// looping to test vprintf() with different float formats from the above $format array
+// and with float values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ fprintf($fp, "\n-- Iteration %d --\n",$counter);
+ vfprintf($fp, $format, $args_array[$counter-1]);
+ $counter++;
+}
+
+fclose($fp);
+print_r(file_get_contents($data_file));
+echo "\n";
+
+unlink($data_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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different float formats and non-float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vfprintf() : float formats and non-float values ***\n";
+
+// defining array of float formats
+$formats =
+ '%f %+f %-f
+ %lf %Lf %4f %-4f
+ %10.4f %-10.4f %04f %04.4f
+ %\'#2f %\'2f %\'$2f %\'_2f
+ %3$f %4$f %1$f %2$f';
+
+// Arrays of non float values for the format defined in $format.
+// Each sub array contains non float values which correspond to each format in $format
+$args_array = array(
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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
--- /dev/null
+++ b/ext/standard/tests/strings/vfprintf_variation7.phpt
Binary files 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--
+<?php
+/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
+ * Description: Write a formatted string to a stream
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vfprintf() when different string formats and non-string values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+echo "*** Testing vfprintf() : string formats and non-string values ***\n";
+
+// defining array of string formats
+$formats =
+ '%s %+s %-s
+ %ls %Ls %4s %-4s
+ %10.4s %-10.4s %04s %04.4s
+ %\'#2s %\'2s %\'$2s %\'_2s
+ %3$s %4$s %1$s %2$s';
+
+// Arrays of non string values for the format defined in $format.
+// Each sub array contains non string values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2.1234567e10, +2.7654321e10, -2.7654321e10,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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
--- /dev/null
+++ b/ext/standard/tests/strings/vfprintf_variation9.phpt
Binary files 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--
+<?php
+/* Prototype : int vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = array("one");
+$arg2 = array("one","two");
+$arg3 = array("one","two","three");
+
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Testing vprintf() : basic functionality - using integer format
+*/
+
+echo "*** Testing vprintf() : basic functionality - using integer format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = array(111);
+$arg2 = array(111,222);
+$arg3 = array(111,222,333);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using float format ***\n";
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = array(11.11);
+$arg2 = array(11.11,22.22);
+$arg3 = array(11.11,22.22,33.33);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format11,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format22,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format33,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using bool format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = array(TRUE);
+$arg2 = array(TRUE,FALSE);
+$arg3 = array(TRUE,FALSE,TRUE);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using char format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = array(65);
+$arg2 = array(65,66);
+$arg3 = array(65,66,67);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%e %e";
+$format3 = "%e %e %e";
+$arg1 = array(1000);
+$arg2 = array(1000,2000);
+$arg3 = array(1000,2000,3000);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string $format , aaray $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string $format , aaray $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = array(021);
+$arg2 = array(021,0347);
+$arg3 = array(021,0347,05678);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = array(11);
+$arg2 = array(11,132);
+$arg3 = array(11,132,177);
+
+$result = vprintf($format1,$arg1);
+echo "\n";
+var_dump($result);
+$result = vprintf($format11,$arg1);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format2,$arg2);
+echo "\n";
+var_dump($result);
+$result = vprintf($format22,$arg2);
+echo "\n";
+var_dump($result);
+
+$result = vprintf($format3,$arg3);echo "\n";
+var_dump($result);
+$result = vprintf($format33,$arg3);
+echo "\n";
+var_dump($result);
+
+?>
+===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--
+<?php
+/* Prototype : int vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing vprintf() : error conditions ***\n";
+
+// initialising the required variables
+$format = "%s";
+$args = array("hello");
+$extra_arg = "extra arg";
+
+// Zero arguments
+echo "\n-- Testing vprintf() function with Zero arguments --\n";
+var_dump( vprintf() );
+
+echo "\n-- Testing vprintf() function with less than expected no. of arguments --\n";
+var_dump( vprintf($format) );
+
+echo "\n-- testing vprintf() function with more than expected no. of arguments --\n";
+var_dump( vprintf($format, $args, $extra_arg) );
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string $format, array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different unexpected format strings are passed to
+ * the '$format' argument of the function
+*/
+
+echo "*** Testing vprintf() : with unexpected values for format argument ***\n";
+
+// initialising the required variables
+$args = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1,2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // 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
--- /dev/null
+++ b/ext/standard/tests/strings/vprintf_variation10.phpt
Binary files 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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+// looping to test vprintf() with different octal formats from the above $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+// looping to test vprintf() with different octal formats from the above $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+// looping to test vprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+// looping to test vprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10.1234567e10, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+// 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($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10e20, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+// 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($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different scientific formats and scientific values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : scientific formats and scientific values ***\n";
+
+// defining array of scientific formats
+$formats = array(
+ '%e %+e %-e',
+ '%le %Le %4e %-4e',
+ '%10.4e %-10.4e %.4e',
+ '%\'#20e %\'20e %\'$20e %\'_20e',
+ '%3$e %4$e %1$e %2$e'
+);
+
+// Arrays of scientific values for the format defined in $format.
+// Each sub array contains scientific values which correspond to each format string in $format
+$args_array = array(
+ array(0, 1e0, "10e2" ),
+ array(2.2e2, 10e10, 1000e-2, 1000e7),
+ array(-22e12, 10e20, 1.2e2),
+ array(1e1, +1e2, -1e3, "1e2_"),
+ array(3e3, 4e3, 1e3, 2e3)
+);
+
+// looping to test vprintf() with different scientific formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different scientific formats and non-scientific values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : scientific formats and non-scientific values ***\n";
+
+// defining array of non-scientific formats
+$formats =
+ '%e %+e %-e
+ %le %Le %4e %-4e
+ %10.4e %-10.4e %04e %04.4e
+ %\'#2e %\'2e %\'$2e %\'_2e
+ %3$e %4$e %1$e %2$e';
+
+// Arrays of non scientific values for the format defined in $format.
+// Each sub array contains non scientific values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 20.00, +212.2, -411000000000, 2212.000000000001,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+$counter = 1;
+foreach($formats as $format) {
+ echo"\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string $format , array $args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+$counter = 1;
+foreach($formats as $format) {
+ echo"\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different unexpected values are passed to
+ * the '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : with unexpected values for args argument ***\n";
+
+// initialising the required variables
+$format = '%s';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new sample(),
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+ // resource data
+/*23*/ $file_handle
+);
+
+// loop through each element of the array for args
+$counter = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format,$value);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different int formats and int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : int formats with int values ***\n";
+
+
+// defining array of int formats
+$formats = array(
+ "%d",
+ "%+d %-d %D",
+ "%ld %Ld, %4d %-4d",
+ "%10.4d %-10.4d %04d %04.4d",
+ "%'#2d %'2d %'$2d %'_2d",
+ "%d %d %d %d",
+ "% %%d d%",
+ '%3$d %4$d %1$d %2$d'
+);
+
+// Arrays of int values for the format defined in $format.
+// Each sub array contains int values which correspond to each format string in $format
+$args_array = array(
+ array(0),
+ array(-1, 1, +22),
+ array(2147483647, -2147483648, +2147483640, -2147483640),
+ array(123456, 12345678, -1234567, 1234567),
+ array(111, 2222, 333333, 44444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234, -5678, 2345),
+ array(3, 4, 1, 2)
+
+);
+
+// looping to test vprintf() with different int formats from the above $format array
+// and with int values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different float formats and float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : int formats with float values ***\n";
+
+
+// defining array of float formats
+$formats = array(
+ "%f",
+ "%+f %-f %F",
+ "%lf %Lf, %4f %-4f",
+ "%10.4f %-10.4F %04f %04.4f",
+ "%'#2f %'2f %'$2f %'_2f",
+ "%f %f %f %f",
+ "% %%f f%",
+ '%3$f %4$f %1$f %2$f'
+);
+
+// Arrays of float values for the format defined in $format.
+// Each sub array contains float values which correspond to each format string in $format
+$args_array = array(
+ array(0.0),
+ array(-0.1, +0.1, +10.0000006),
+ array(2147483649, -2147483647, +2147483640, -2147483640),
+ array(2e5, 2e-5, -2e5, -2e-5),
+ array(0.2E5, -0.2e40, 0.2E-20, 0.2E+20),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234.1234, -5678.5678, 2345.2345),
+ array(3.33, 4.44, 1.11, 2.22)
+
+);
+
+// looping to test vprintf() with different float formats from the above $format array
+// and with float values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ $result = vprintf($format, $args_array[$counter-1]);
+ echo "\n";
+ var_dump($result);
+ $counter++;
+}
+
+?>
+===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--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Output a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different float formats and non-float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vprintf() : float formats and non-float values ***\n";
+
+// defining array of float formats
+$formats =
+ '%f %+f %-f
+ %lf %Lf %4f %-4f
+ %10.4f %-10.4f %04f %04.4f
+ %\'#2f %\'2f %\'$2f %\'_2f
+ %3$f %4$f %1$f %2$f';
+
+// Arrays of non float values for the format defined in $format.
+// Each sub array contains non float values which correspond to each format in $format
+$args_array = array(
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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
--- /dev/null
+++ b/ext/standard/tests/strings/vprintf_variation7.phpt
Binary files 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--
+<?php
+/* Prototype : string vprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vprintf() when different string formats and non-string values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+echo "*** Testing vprintf() : string formats and non-string values ***\n";
+
+// defining array of string formats
+$formats =
+ '%s %+s %-s
+ %ls %Ls %4s %-4s
+ %10.4s %-10.4s %04s %04.4s
+ %\'#2s %\'2s %\'$2s %\'_2s
+ %3$s %4$s %1$s %2$s';
+
+// Arrays of non string values for the format defined in $format.
+// Each sub array contains non string values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2.1234567e10, +2.7654321e10, -2.7654321e10,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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
--- /dev/null
+++ b/ext/standard/tests/strings/vprintf_variation9.phpt
Binary files 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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = array("one");
+$arg2 = array("one","two");
+$arg3 = array("one","two","three");
+
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Testing vsprintf() : basic functionality - using integer format
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using integer format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = array(111);
+$arg2 = array(111,222);
+$arg3 = array(111,222,333);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using float format ***\n";
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = array(11.11);
+$arg2 = array(11.11,22.22);
+$arg3 = array(11.11,22.22,33.33);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format11,$arg1) );
+
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format22,$arg2) );
+
+var_dump( vsprintf($format3,$arg3) );
+var_dump( vsprintf($format33,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using bool format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = array(TRUE);
+$arg2 = array(TRUE,FALSE);
+$arg3 = array(TRUE,FALSE,TRUE);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using char format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = array(65);
+$arg2 = array(65,66);
+$arg3 = array(65,66,67);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%e %e";
+$format3 = "%e %e %e";
+$arg1 = array(1000);
+$arg2 = array(1000,2000);
+$arg3 = array(1000,2000,3000);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , aaray $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , aaray $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = array(021);
+$arg2 = array(021,0347);
+$arg3 = array(021,0347,05678);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = array(11);
+$arg2 = array(11,132);
+$arg3 = array(11,132,177);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format11,$arg1) );
+
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format22,$arg2) );
+
+var_dump( vsprintf($format3,$arg3) );
+var_dump( vsprintf($format33,$arg3) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing vsprintf() : error conditions ***\n";
+
+// initialising the required variables
+$format = "%s";
+$args = array("hello");
+$extra_arg = "extra arg";
+
+// Zero arguments
+echo "\n-- Testing vsprintf() function with Zero arguments --\n";
+var_dump( vsprintf() );
+
+echo "\n-- Testing vsprintf() function with less than expected no. of arguments --\n";
+var_dump( vsprintf($format) );
+
+echo "\n-- testing vsprintf() function with more than expected no. of arguments --\n";
+var_dump( vsprintf($format, $args, $extra_arg) );
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string $format, array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unexpected format strings are passed to
+ * the '$format' argument of the function
+*/
+
+echo "*** Testing vsprintf() : with unexpected values for format argument ***\n";
+
+// initialising the required variables
+$args = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1,2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource 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
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation10.phpt
Binary files 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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+// looping to test vsprintf() with different octal formats from the above $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+// looping to test vsprintf() with different octal formats from the above $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+// looping to test vsprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+// looping to test vsprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10.1234567e5, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+// 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($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+?>
+===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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10e20, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+// 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($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different scientific formats and scientific values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : scientific formats and scientific values ***\n";
+
+// defining array of scientific formats
+$formats = array(
+ '%e %+e %-e',
+ '%le %Le %4e %-4e',
+ '%10.4e %-10.4e %.4e',
+ '%\'#20e %\'20e %\'$20e %\'_20e',
+ '%3$e %4$e %1$e %2$e'
+);
+
+// Arrays of scientific values for the format defined in $format.
+// Each sub array contains scientific values which correspond to each format string in $format
+$args_array = array(
+ array(0, 1e0, "10e2" ),
+ array(2.2e2, 10e10, 1000e-2, 1000e7),
+ array(-22e12, 10e20, 1.2e2),
+ array(1e1, +1e2, -1e3, "1e2_"),
+ array(3e3, 4e3, 1e3, 2e3)
+);
+
+// looping to test vsprintf() with different scientific formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different scientific formats and non-scientific values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : scientific formats and non-scientific values ***\n";
+
+// defining array of non-scientific formats
+$formats =
+ '%e %+e %-e
+ %le %Le %4e %-4e
+ %10.4e %-10.4e %04e %04.4e
+ %\'#2e %\'2e %\'$2e %\'_2e
+ %3$e %4$e %1$e %2$e';
+
+// Arrays of non scientific values for the format defined in $format.
+// Each sub array contains non scientific values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 20.00, +212.2, -411000000000, 2212.000000000001,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+$counter = 1;
+foreach($formats as $format) {
+ echo"\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+$counter = 1;
+foreach($formats as $format) {
+ echo"\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unexpected values are passed to
+ * the '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : with unexpected values for args argument ***\n";
+
+// initialising the required variables
+$format = '%s';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // 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 data
+ $file_handle
+);
+
+// loop through each element of the array for args
+$counter = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format,$value) );
+ $counter++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different int formats and int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats with int values ***\n";
+
+
+// defining array of int formats
+$formats = array(
+ "%d",
+ "%+d %-d %D",
+ "%ld %Ld, %4d %-4d",
+ "%10.4d %-10.4d %04d %04.4d",
+ "%'#2d %'2d %'$2d %'_2d",
+ "%d %d %d %d",
+ "% %%d d%",
+ '%3$d %4$d %1$d %2$d'
+);
+
+// Arrays of int values for the format defined in $format.
+// Each sub array contains int values which correspond to each format string in $format
+$args_array = array(
+ array(0),
+ array(-1, 1, +22),
+ array(2147483647, -2147483648, +2147483640, -2147483640),
+ array(123456, 12345678, -1234567, 1234567),
+ array(111, 2222, 333333, 44444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234, -5678, 2345),
+ array(3, 4, 1, 2)
+
+);
+
+// looping to test vsprintf() with different int formats from the above $format array
+// and with int values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--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--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different float formats and float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats with float values ***\n";
+
+
+// defining array of float formats
+$formats = array(
+ "%f",
+ "%+f %-f %F",
+ "%lf %Lf, %4f %-4f",
+ "%10.4f %-10.4F %04f %04.4f",
+ "%'#2f %'2f %'$2f %'_2f",
+ "%f %f %f %f",
+ "% %%f f%",
+ '%3$f %4$f %1$f %2$f'
+);
+
+// Arrays of float values for the format defined in $format.
+// Each sub array contains float values which correspond to each format string in $format
+$args_array = array(
+ array(0.0),
+ array(-0.1, +0.1, +10.0000006),
+ array(2147483649, -2147483647, +2147483640, -2147483640),
+ array(2e5, 2e-5, -2e5, -2e-5),
+ array(0.2E5, -0.2e40, 0.2E-20, 0.2E+20),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234.1234, -5678.5678, 2345.2345),
+ array(3.33, 4.44, 1.11, 2.22)
+
+);
+
+// looping to test vsprintf() with different float formats from the above $format array
+// and with float values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different float formats and non-float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : float formats and non-float values ***\n";
+
+// defining array of float formats
+$formats =
+ '%f %+f %-f
+ %lf %Lf %4f %-4f
+ %10.4f %-10.4f %04f %04.4f
+ %\'#2f %\'2f %\'$2f %\'_2f
+ %3$f %4$f %1$f %2$f';
+
+// Arrays of non float values for the format defined in $format.
+// Each sub array contains non float values which correspond to each format in $format
+$args_array = array(
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation7.phpt
Binary files 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--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different string formats and non-string values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+echo "*** Testing vsprintf() : string formats and non-string values ***\n";
+
+// defining array of string formats
+$formats =
+ '%s %+s %-s
+ %ls %4s %-4s
+ %10.4s %-10.4s %04s %04.4s
+ %\'#2s %\'2s %\'$2s %\'_2s
+ %3$s %4$s %1$s %2$s';
+
+// Arrays of non string values for the format defined in $format.
+// Each sub array contains non string values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, -1234.6789, +1234.6789,
+ 2.1234567e10, +2.7654321e10, -2.7654321e10, 2.1234567e10,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"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
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation9.phpt
Binary files 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--
+<?php
+
+$tests = <<<TESTS
+"12345 12345 12345 12345" === wordwrap("12345 12345 12345 12345")
+"12345 12345\\n1234567890\\n1234567890" === wordwrap("12345 12345 1234567890 1234567890",12)
+"12345\\n12345\\n12345\\n12345" === wordwrap("12345 12345 12345 12345",0)
+"12345ab12345ab12345ab12345" === wordwrap("12345 12345 12345 12345",0,"ab")
+"12345 12345ab1234567890ab1234567890" === wordwrap("12345 12345 1234567890 1234567890",12,"ab")
+"123ab123ab123" === wordwrap("123ab123ab123", 3, "ab")
+"123ab123ab123" === wordwrap("123ab123ab123", 5, "ab")
+"123ab 123ab123" === wordwrap("123 123ab123", 3, "ab")
+"123ab123ab123" === wordwrap("123 123ab123", 5, "ab")
+"123 123ab123" === wordwrap("123 123 123", 10, "ab")
+
+"123ab123ab123" === wordwrap("123ab123ab123", 3, "ab", 1)
+"123ab123ab123" === wordwrap("123ab123ab123", 5, "ab", 1)
+"123ab 12ab3ab123" === wordwrap("123 123ab123", 3, "ab", 1)
+"123 ab123ab123" === wordwrap("123 123ab123", 5, "ab", 1)
+"123 123ab 123" === wordwrap("123 123 123", 8, "ab", 1)
+"123 ab12345 ab123" === wordwrap("123 12345 123", 8, "ab", 1)
+"1ab2ab3ab4" === wordwrap("1234", 1, "ab", 1)
+
+"12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", 1)
+
+"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
+
+FALSE === @wordwrap(chr(0), 0, "")
+
+TESTS;
+
+include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+
+--EXPECT--
+OK
diff --git a/ext/standard/tests/strings/wordwrap_basic.phpt b/ext/standard/tests/strings/wordwrap_basic.phpt
new file mode 100644
index 0000000..84a7f73
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test wordwrap() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing wordwrap() : basic functionality ***\n";
+
+// Initialize all required variables
+$str = "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy doooooooooooooooooooooog.";
+$width = 80;
+$break = '<br />\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<br />\ndoooooooooooooooooooooog."
+string(178) "The quick<br />\nbrown<br />\nfooooooooo<br />\nox<br />\njummmmmmmm<br />\nmmmmped<br />\nover the<br />\nlazzzzzzzz<br />\nzzzy<br />\ndooooooooo<br />\noooooooooo<br />\nooog."
+string(138) "The quick<br />\nbrown<br />\nfoooooooooox<br />\njummmmmmmmmmmmped<br />\nover the<br />\nlazzzzzzzzzzzy<br />\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--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing wordwrap() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing wordwrap() function with Zero arguments --\n";
+var_dump( wordwrap() );
+
+// More than expected number of arguments
+echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n";
+$str = 'testing wordwrap function';
+$width = 10;
+$break = '<br />\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<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+-- width = -10 & cut = true --
+string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\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--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing wordwrap() by providing different values for str argument
+*/
+
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$width = 3;
+$break = '<br />\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<br />\n45"
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+string(13) "-23<br />\n45"
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+string(12) "10.<br />\n5"
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+string(13) "-10<br />\n.5"
+-- Iteration 7 --
+string(12) "101234567000"
+string(12) "101234567000"
+string(12) "101234567000"
+string(12) "101234567000"
+string(36) "101<br />\n234<br />\n567<br />\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<br />\n765<br />\n432<br />\n1E-<br />\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--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test wordwrap by passing different values for width argument
+*/
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$str = 'testing wordwrap function';
+$break = '<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 3 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 10 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 12 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\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--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test wordwrap by passing different values for break argument
+*/
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$str = 'testing wordwrap function';
+$width = 10;
+$cut = true;
+
+// resource var
+$fp = fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+
+// array with different values for break arg
+$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(),
+
+ // 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--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test wordwrap() by supplying different values for cut argument
+*/
+
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$str = 'testing wordwrap function';
+$width = 10;
+$break = '<br />\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<br />\nwordwrap<br />\nfunction"
+-- Iteration 2 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 3 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 4 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 5 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 6 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 7 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 8 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 9 --
+string(39) "testing<br />\nwordwrap<br />\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<br />\nwordwrap<br />\nfunction"
+-- Iteration 16 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 17 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, object given in %s on line %d
+NULL
+-- Iteration 18 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 19 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 20 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 21 --
+string(39) "testing<br />\nwordwrap<br />\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--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ *test wordwrap() with break arguments as single spaces
+*/
+
+echo "*** Testing wordwrap() : usage variations ***\n";
+
+// Initialize all required variables
+$str = "Testing wordrap function";
+$width = 1;
+$cut = false;
+
+echo "\n-- Testing wordwrap() with default break value and single space as value --\n";
+echo "-- with default break and cut value --\n";
+var_dump( wordwrap($str, $width) ); // default break and cut value
+
+echo "-- with default cut value --\n";
+$break = ' ';
+$break1 = " ";
+var_dump( wordwrap($str, $width, $break) );
+var_dump( wordwrap($str, $width, $break1) );
+
+echo "-- with cut value as false --\n";
+$cut = false;
+var_dump( wordwrap($str, $width, $break, $cut) );
+var_dump( wordwrap($str, $width, $break1, $cut) );
+
+echo "-- with cut value as true --\n";
+$cut = true;
+var_dump( wordwrap($str, $width, $break, $cut) );
+var_dump( wordwrap($str, $width, $break1, $cut) );
+
+echo "Done\n";
+?>
+--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--
+<?php
+ if (!function_exists('microtime')) die('skip microtime() not available');
+ die('warn system dependent');
+?>
+--FILE--
+<?php
+$passed = 0;
+$failed = 0;
+$last_m = 0;
+$last_t = 0;
+$result = '';
+
+set_time_limit(0);
+
+for ($i=1;$i<=100000;$i++) {
+ list($micro,$time)=explode(" ",microtime());
+ if ($time > $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--
+<?php if (!function_exists('strptime')) echo "SKIP"; ?>
+--FILE--
+<?php
+ var_dump(strptime('2006-08-20', '%Y-%m-%d'));
+?>
+===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--
+<?php
+ var_dump(time_nanosleep(-1, 0));
+ var_dump(time_nanosleep(0, -1));
+?>
+===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--
+<?php
+date_default_timezone_set('GMT0');
+$tmp = "UYzymndjHGhgistwLBIW";
+for($a = 0;$a < strlen($tmp); $a++){
+ echo $tmp[$a], ': ', idate($tmp[$a], 1043324459)."\n";
+}
+?>
+--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--
+<?php
+ if (!function_exists('strptime')) {
+ die("skip - strptime() function not available in this build");
+ }
+ if(PHP_OS == 'Darwin') die("skip - strptime() behaves differently on Darwin");
+?>
+
+--FILE--
+<?php
+/* Prototype : array strptime ( string $date , string $format )
+ * Description: Parse a time/date generated with strftime()
+ * Source code: ext/standard/datetime.c
+*/
+
+$orig = setlocale(LC_ALL, 'C');
+date_default_timezone_set("GMT");
+
+echo "*** Testing strptime() : basic functionality ***\n";
+
+$input = "10:00:00 AM July 2 1963";
+$tstamp = strtotime($input);
+
+$str = strftime("%r %B%e %Y %Z", $tstamp);
+var_dump(strptime($str, '%H:%M:%S %p %B %d %Y %Z'));
+
+$str = strftime("%T %D", $tstamp);
+var_dump(strptime($str, '%H:%M:%S %m/%d/%y'));
+
+$str = strftime("%A %B %e %R", $tstamp);
+var_dump(strptime($str, '%A %B %e %R'));
+
+setlocale(LC_ALL, $orig);
+?>
+===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--
+<?php
+if (!function_exists('strptime')) {
+ echo "SKIP strptime function not available in build";
+}
+?>
+--FILE--
+<?php
+/* Prototype : array strptime ( string $date , string $format )
+ * Description: Parse a time/date generated with strftime()
+ * Source code: ext/standard/datetime.c
+ * Alias to functions:
+ */
+
+//Set the default time zone
+date_default_timezone_set("Europe/London");
+
+echo "*** Testing strptime() : error conditions ***\n";
+
+echo "\n-- Testing strptime() function with Zero arguments --\n";
+var_dump( strptime() );
+
+echo "\n-- Testing strptime() function with less than expected no. of arguments --\n";
+$format = '%b %d %Y %H:%M:%S';
+$timestamp = mktime(8, 8, 8, 8, 8, 2008);
+$date = strftime($format, $timestamp);
+var_dump( strptime($date) );
+
+echo "\n-- Testing strptime() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( strptime($date, $format, $extra_arg) );
+
+?>
+===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--
+<?php
+ if (!function_exists('strptime')) {
+ die("skip - strptime() function not available in this build");
+ }
+?>
+
+--FILE--
+<?php
+/* Prototype : array strptime ( string $date , string $format )
+ * Description: Parse a time/date generated with strftime()
+ * Source code: ext/standard/datetime.c
+*/
+
+$orig = setlocale(LC_ALL, 'C');
+date_default_timezone_set("GMT");
+putenv("TZ=GMT");
+
+echo "*** Testing strptime() : basic functionality ***\n";
+
+$input = "10:01:20 AM July 2 1963";
+$tstamp = strtotime($input);
+
+$str = strftime("%r %B%e %Y %Z", $tstamp);
+$res = strptime($str, '%H:%M:%S %p %B %d %Y %Z');
+var_dump($res["tm_sec"]);
+var_dump($res["tm_min"]);
+var_dump($res["tm_hour"]);
+var_dump($res["tm_mday"]);
+var_dump($res["tm_mon"]);
+var_dump($res["tm_year"]);
+
+$str = strftime("%T %D", $tstamp);
+$res = strptime($str, '%H:%M:%S %m/%d/%y');
+var_dump($res["tm_sec"]);
+var_dump($res["tm_min"]);
+var_dump($res["tm_hour"]);
+var_dump($res["tm_mday"]);
+var_dump($res["tm_mon"]);
+var_dump($res["tm_year"]);
+
+$str = strftime("%A %B %e %R", $tstamp);
+$res = strptime($str, '%A %B %e %R');
+var_dump($res["tm_sec"]);
+var_dump($res["tm_min"]);
+var_dump($res["tm_hour"]);
+var_dump($res["tm_mday"]);
+var_dump($res["tm_mon"]);
+var_dump($res["tm_year"]);
+
+setlocale(LC_ALL, $orig);
+?>
+===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--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "Decode an input string containing the whole base64 alphabet:\n";
+$allbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+var_dump(bin2hex(base64_decode($allbase64)));
+var_dump(bin2hex(base64_decode($allbase64, false)));
+var_dump(bin2hex(base64_decode($allbase64, true)));
+
+echo "Done";
+?>
+--EXPECTF--
+Decode an input string containing the whole base64 alphabet:
+string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf"
+string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf"
+string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "Decode 'hello world!':\n";
+$noWhiteSpace = "aGVsbG8gd29ybGQh";
+var_dump(base64_decode($noWhiteSpace));
+var_dump(base64_decode($noWhiteSpace, false));
+var_dump(base64_decode($noWhiteSpace, true));
+
+echo "\nWhitespace does not affect base64_decode, even with \$strict===true:\n";
+$withWhiteSpace = "a GVs bG8gd2
+ 9ybGQh";
+var_dump(base64_decode($withWhiteSpace));
+var_dump(base64_decode($withWhiteSpace, false));
+var_dump(base64_decode($withWhiteSpace, true));
+
+echo "\nOther chars outside the base64 alphabet are ignored when \$strict===false, but cause failure with \$strict===true:\n";
+$badChars = $noWhiteSpace . '*';
+var_dump(base64_decode($badChars));
+var_dump(base64_decode($badChars, false));
+var_dump(base64_decode($badChars, true));
+
+echo "Done";
+?>
+--EXPECTF--
+Decode 'hello world!':
+string(12) "hello world!"
+string(12) "hello world!"
+string(12) "hello world!"
+
+Whitespace does not affect base64_decode, even with $strict===true:
+string(12) "hello world!"
+string(12) "hello world!"
+string(12) "hello world!"
+
+Other chars outside the base64 alphabet are ignored when $strict===false, but cause failure with $strict===true:
+string(12) "hello world!"
+string(12) "hello world!"
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_decode_error_001.phpt b/ext/standard/tests/url/base64_decode_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "*** Testing base64_decode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing base64_decode() function with Zero arguments --\n";
+var_dump( base64_decode() );
+
+//Test base64_decode with one more than the expected number of arguments
+echo "\n-- Testing base64_decode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$strict = true;
+$extra_arg = 10;
+var_dump( base64_decode($str, $strict, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_decode() : error conditions ***
+
+-- Testing base64_decode() function with Zero arguments --
+
+Warning: base64_decode() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing base64_decode() function with more than expected no. of arguments --
+
+Warning: base64_decode() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+Done
diff --git a/ext/standard/tests/url/base64_decode_variation_001.phpt b/ext/standard/tests/url/base64_decode_variation_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing base64_decode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$strict = true;
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array (
+ // int data
+ "0" => 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--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing base64_decode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$str = 'aGVsbG8gd29ybGQh!';
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array (
+ // int data
+ "0" => 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--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+/*
+ * Test base64_encode with single byte values.
+ */
+
+echo "*** Testing base64_encode() : basic functionality ***\n";
+
+for ($i=0; $i<256; $i++) {
+ $str = pack("c", $i);
+ $enc = base64_encode($str);
+ printf("0x%X: %s\n", $i, $enc);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_encode() : basic functionality ***
+0x0: AA==
+0x1: AQ==
+0x2: Ag==
+0x3: Aw==
+0x4: BA==
+0x5: BQ==
+0x6: Bg==
+0x7: Bw==
+0x8: CA==
+0x9: CQ==
+0xA: Cg==
+0xB: Cw==
+0xC: DA==
+0xD: DQ==
+0xE: Dg==
+0xF: Dw==
+0x10: EA==
+0x11: EQ==
+0x12: Eg==
+0x13: Ew==
+0x14: FA==
+0x15: FQ==
+0x16: Fg==
+0x17: Fw==
+0x18: GA==
+0x19: GQ==
+0x1A: Gg==
+0x1B: Gw==
+0x1C: HA==
+0x1D: HQ==
+0x1E: Hg==
+0x1F: Hw==
+0x20: IA==
+0x21: IQ==
+0x22: Ig==
+0x23: Iw==
+0x24: JA==
+0x25: JQ==
+0x26: Jg==
+0x27: Jw==
+0x28: KA==
+0x29: KQ==
+0x2A: Kg==
+0x2B: Kw==
+0x2C: LA==
+0x2D: LQ==
+0x2E: Lg==
+0x2F: Lw==
+0x30: MA==
+0x31: MQ==
+0x32: Mg==
+0x33: Mw==
+0x34: NA==
+0x35: NQ==
+0x36: Ng==
+0x37: Nw==
+0x38: OA==
+0x39: OQ==
+0x3A: Og==
+0x3B: Ow==
+0x3C: PA==
+0x3D: PQ==
+0x3E: Pg==
+0x3F: Pw==
+0x40: QA==
+0x41: QQ==
+0x42: Qg==
+0x43: Qw==
+0x44: RA==
+0x45: RQ==
+0x46: Rg==
+0x47: Rw==
+0x48: SA==
+0x49: SQ==
+0x4A: Sg==
+0x4B: Sw==
+0x4C: TA==
+0x4D: TQ==
+0x4E: Tg==
+0x4F: Tw==
+0x50: UA==
+0x51: UQ==
+0x52: Ug==
+0x53: Uw==
+0x54: VA==
+0x55: VQ==
+0x56: Vg==
+0x57: Vw==
+0x58: WA==
+0x59: WQ==
+0x5A: Wg==
+0x5B: Ww==
+0x5C: XA==
+0x5D: XQ==
+0x5E: Xg==
+0x5F: Xw==
+0x60: YA==
+0x61: YQ==
+0x62: Yg==
+0x63: Yw==
+0x64: ZA==
+0x65: ZQ==
+0x66: Zg==
+0x67: Zw==
+0x68: aA==
+0x69: aQ==
+0x6A: ag==
+0x6B: aw==
+0x6C: bA==
+0x6D: bQ==
+0x6E: bg==
+0x6F: bw==
+0x70: cA==
+0x71: cQ==
+0x72: cg==
+0x73: cw==
+0x74: dA==
+0x75: dQ==
+0x76: dg==
+0x77: dw==
+0x78: eA==
+0x79: eQ==
+0x7A: eg==
+0x7B: ew==
+0x7C: fA==
+0x7D: fQ==
+0x7E: fg==
+0x7F: fw==
+0x80: gA==
+0x81: gQ==
+0x82: gg==
+0x83: gw==
+0x84: hA==
+0x85: hQ==
+0x86: hg==
+0x87: hw==
+0x88: iA==
+0x89: iQ==
+0x8A: ig==
+0x8B: iw==
+0x8C: jA==
+0x8D: jQ==
+0x8E: jg==
+0x8F: jw==
+0x90: kA==
+0x91: kQ==
+0x92: kg==
+0x93: kw==
+0x94: lA==
+0x95: lQ==
+0x96: lg==
+0x97: lw==
+0x98: mA==
+0x99: mQ==
+0x9A: mg==
+0x9B: mw==
+0x9C: nA==
+0x9D: nQ==
+0x9E: ng==
+0x9F: nw==
+0xA0: oA==
+0xA1: oQ==
+0xA2: og==
+0xA3: ow==
+0xA4: pA==
+0xA5: pQ==
+0xA6: pg==
+0xA7: pw==
+0xA8: qA==
+0xA9: qQ==
+0xAA: qg==
+0xAB: qw==
+0xAC: rA==
+0xAD: rQ==
+0xAE: rg==
+0xAF: rw==
+0xB0: sA==
+0xB1: sQ==
+0xB2: sg==
+0xB3: sw==
+0xB4: tA==
+0xB5: tQ==
+0xB6: tg==
+0xB7: tw==
+0xB8: uA==
+0xB9: uQ==
+0xBA: ug==
+0xBB: uw==
+0xBC: vA==
+0xBD: vQ==
+0xBE: vg==
+0xBF: vw==
+0xC0: wA==
+0xC1: wQ==
+0xC2: wg==
+0xC3: ww==
+0xC4: xA==
+0xC5: xQ==
+0xC6: xg==
+0xC7: xw==
+0xC8: yA==
+0xC9: yQ==
+0xCA: yg==
+0xCB: yw==
+0xCC: zA==
+0xCD: zQ==
+0xCE: zg==
+0xCF: zw==
+0xD0: 0A==
+0xD1: 0Q==
+0xD2: 0g==
+0xD3: 0w==
+0xD4: 1A==
+0xD5: 1Q==
+0xD6: 1g==
+0xD7: 1w==
+0xD8: 2A==
+0xD9: 2Q==
+0xDA: 2g==
+0xDB: 2w==
+0xDC: 3A==
+0xDD: 3Q==
+0xDE: 3g==
+0xDF: 3w==
+0xE0: 4A==
+0xE1: 4Q==
+0xE2: 4g==
+0xE3: 4w==
+0xE4: 5A==
+0xE5: 5Q==
+0xE6: 5g==
+0xE7: 5w==
+0xE8: 6A==
+0xE9: 6Q==
+0xEA: 6g==
+0xEB: 6w==
+0xEC: 7A==
+0xED: 7Q==
+0xEE: 7g==
+0xEF: 7w==
+0xF0: 8A==
+0xF1: 8Q==
+0xF2: 8g==
+0xF3: 8w==
+0xF4: 9A==
+0xF5: 9Q==
+0xF6: 9g==
+0xF7: 9w==
+0xF8: +A==
+0xF9: +Q==
+0xFA: +g==
+0xFB: +w==
+0xFC: /A==
+0xFD: /Q==
+0xFE: /g==
+0xFF: /w==
+Done
diff --git a/ext/standard/tests/url/base64_encode_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--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+/*
+ * Test base64_encode with single byte values.
+ */
+
+echo "*** Testing base64_encode() : basic functionality ***\n";
+
+$values = array(
+ "Hello World",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]",
+ "\n\t Line with control characters\r\n",
+ "\xC1\xC2\xC3\xC4\xC5\xC6",
+ "\75\76\77\78\79\80"
+);
+
+echo "\n--- Testing base64_encode() with binary string input ---\n";
+
+$counter = 1;
+foreach($values as $str) {
+ echo "-- Iteration $counter --\n";
+
+ $enc = base64_encode($str);
+ $dec = base64_decode($enc);
+
+ if ($dec != $str) {
+ echo "TEST FAILED\n";
+ } else {
+ echo "TEST PASSED\n";
+ }
+
+ $counter ++;
+}
+
+?>
+===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--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "*** Testing base64_encode() : error conditions - wrong number of args ***\n";
+
+// Zero arguments
+echo "\n-- Testing base64_encode() function with Zero arguments --\n";
+var_dump( base64_encode() );
+
+//Test base64_encode with one more than the expected number of arguments
+echo "\n-- Testing base64_encode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( base64_encode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_encode() : error conditions - wrong number of args ***
+
+-- Testing base64_encode() function with Zero arguments --
+
+Warning: base64_encode() expects exactly 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing base64_encode() function with more than expected no. of arguments --
+
+Warning: base64_encode() expects exactly 1 parameter, 2 given in %s on line 18
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_encode_variation_001.phpt b/ext/standard/tests/url/base64_encode_variation_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "*** Testing base64_encode() : usage variations ***\n";
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( base64_encode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_encode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(63)
+Error: 8 - Undefined variable: unset_var, %s(66)
+
+Arg value 0
+string(4) "MA=="
+
+Arg value 1
+string(4) "MQ=="
+
+Arg value 12345
+string(8) "MTIzNDU="
+
+Arg value -2345
+string(8) "LTIzNDU="
+
+Arg value 10.5
+string(8) "MTAuNQ=="
+
+Arg value -10.5
+string(8) "LTEwLjU="
+
+Arg value 101234567000
+string(16) "MTAxMjM0NTY3MDAw"
+
+Arg value 1.07654321E-9
+string(20) "MS4wNzY1NDMyMUUtOQ=="
+
+Arg value 0.5
+string(4) "MC41"
+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--
+<?php
+if (base64_decode(b"dGVzdA==") == base64_decode(b"dGVzdA==CRAP")) {
+ echo "Same octect data - Signature Valid\n";
+} else {
+ echo "Invalid Signature\n";
+}
+
+$in = base64_encode(b"foo") . b'==' . base64_encode(b"bar");
+var_dump($in, base64_decode($in));
+
+?>
+--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--
+<?php
+var_dump(
+ base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'),
+ base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true)
+);
+?>
+--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--
+<?php
+
+var_dump(rawurlencode('A1_-.~'));
+var_dump(rawurldecode('%41%31%5F%2D%2E%7E'));
+
+?>
+--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--
+<?php
+
+var_dump(parse_url("http://example.com/path/script.html?t=1#fragment?data"));
+var_dump(parse_url("http://example.com/path/script.html#fragment?data"));
+
+?>
+--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--
+<?php
+function test($s) {
+ $v = chunk_split(base64_encode($s));
+ $r = base64_decode($v, True);
+ var_dump($v, $r);
+}
+
+test('PHP');
+test('PH');
+test('P');
+
+?>
+--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--
+<?php
+
+var_dump(parse_url(":"));
+
+?>
+--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--
+<?php
+var_dump(parse_url('http://user:pass@host'));
+var_dump(parse_url('//user:pass@host'));
+var_dump(parse_url('//user@host'));
+?>
+--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 <juneih@redpill-linpro.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--FILE--
+<?php
+/* Prototype : proto array get_headers(string url[, int format])
+ * Description: Fetches all the headers sent by the server in response to a HTTP request
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_headers() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_headers() function with Zero arguments --\n";
+var_dump( get_headers() );
+
+//Test get_headers with one more than the expected number of arguments
+echo "\n-- Testing get_headers() function with more than expected no. of arguments --\n";
+$url = 'string_val';
+$format = 1;
+$extra_arg = 10;
+var_dump( get_headers($url, $format, $extra_arg) );
+
+echo "Done";
+?>
+--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 <juneih@redpill-linpro.com>
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--FILE--
+<?php
+/* Prototype : proto array get_headers(string url[, int format])
+ * Description: Fetches all the headers sent by the server in response to a HTTP request
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_headers() : error conditions ***\n";
+$url = 'http://php.net';
+
+// Format argument as type String
+echo "\n-- Testing get_headers() function with format argument as type string --\n";
+var_dump( get_headers($url, "#PHPTestFest2009 Norway") );
+
+// Format argument as type Array
+echo "\n-- Testing get_headers() function with format argument as type array --\n";
+var_dump( get_headers($url, array()) );
+
+// Format argument as type Object
+class testObject
+{
+}
+
+$object = new testObject();
+echo "\n-- Testing get_headers() function with format argument as type object --\n";
+var_dump( get_headers($url, $object) );
+
+
+echo "Done"
+?>
+--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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying the component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "\n--> $url: ";
+ var_dump(parse_url($url));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+
+--> 64.246.30.37: array(1) {
+ ["path"]=>
+ string(12) "64.246.30.37"
+}
+
+--> http://64.246.30.37: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(12) "64.246.30.37"
+}
+
+--> http://64.246.30.37/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(12) "64.246.30.37"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> 64.246.30.37/: array(1) {
+ ["path"]=>
+ string(13) "64.246.30.37/"
+}
+
+--> 64.246.30.37:80/: array(3) {
+ ["host"]=>
+ string(12) "64.246.30.37"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> php.net: array(1) {
+ ["path"]=>
+ string(7) "php.net"
+}
+
+--> php.net/: array(1) {
+ ["path"]=>
+ string(8) "php.net/"
+}
+
+--> http://php.net: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "php.net"
+}
+
+--> http://php.net/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> www.php.net: array(1) {
+ ["path"]=>
+ string(11) "www.php.net"
+}
+
+--> www.php.net/: array(1) {
+ ["path"]=>
+ string(12) "www.php.net/"
+}
+
+--> http://www.php.net: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+}
+
+--> http://www.php.net/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> www.php.net:80: array(2) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+}
+
+--> http://www.php.net:80: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+}
+
+--> http://www.php.net:80/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net/index.php: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> www.php.net/?: array(1) {
+ ["path"]=>
+ string(12) "www.php.net/"
+}
+
+--> www.php.net:80/?: array(3) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net/?: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/?: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/foo/bar/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(18) "/foo/bar/index.php"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+ ["query"]=>
+ string(37) "lots=1&of=2&parameters=3&too=4&here=5"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(45) "/this/is/a/very/deep/directory/structure/and/"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+}
+
+--> http://www.php.net:80/this/../a/../deep/directory: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(28) "/this/../a/../deep/directory"
+}
+
+--> http://www.php.net:80/this/../a/../deep/directory/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(29) "/this/../a/../deep/directory/"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(42) "/this/is/a/very/deep/directory/../file.php"
+}
+
+--> http://www.php.net:80/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/index.php?: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/#foo: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["fragment"]=>
+ string(3) "foo"
+}
+
+--> http://www.php.net:80/?#: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/?test=1: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(6) "test=1"
+}
+
+--> http://www.php.net/?test=1&: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(7) "test=1&"
+}
+
+--> http://www.php.net:80/?&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(1) "&"
+}
+
+--> http://www.php.net:80/index.php?test=1&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(7) "test=1&"
+}
+
+--> http://www.php.net/index.php?&: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(1) "&"
+}
+
+--> http://www.php.net:80/index.php?foo&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(4) "foo&"
+}
+
+--> http://www.php.net/index.php?&foo: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(4) "&foo"
+}
+
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+}
+
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["user"]=>
+ string(6) "secret"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(14) "secret@hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hid:out"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> nntp://news.php.net: array(2) {
+ ["scheme"]=>
+ string(4) "nntp"
+ ["host"]=>
+ string(12) "news.php.net"
+}
+
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) {
+ ["scheme"]=>
+ string(3) "ftp"
+ ["host"]=>
+ string(11) "ftp.gnu.org"
+ ["path"]=>
+ string(22) "/gnu/glic/glibc.tar.gz"
+}
+
+--> zlib:http://foo@bar: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(14) "http://foo@bar"
+}
+
+--> zlib:filename.txt: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(12) "filename.txt"
+}
+
+--> zlib:/path/to/my/file/file.txt: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(25) "/path/to/my/file/file.txt"
+}
+
+--> foo://foo@bar: array(3) {
+ ["scheme"]=>
+ string(3) "foo"
+ ["host"]=>
+ string(3) "bar"
+ ["user"]=>
+ string(3) "foo"
+}
+
+--> mailto:me@mydomain.com: array(2) {
+ ["scheme"]=>
+ string(6) "mailto"
+ ["path"]=>
+ string(15) "me@mydomain.com"
+}
+
+--> /foo.php?a=b&c=d: array(2) {
+ ["path"]=>
+ string(8) "/foo.php"
+ ["query"]=>
+ string(7) "a=b&c=d"
+}
+
+--> foo.php?a=b&c=d: array(2) {
+ ["path"]=>
+ string(7) "foo.php"
+ ["query"]=>
+ string(7) "a=b&c=d"
+}
+
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(15) "www.example.com"
+ ["port"]=>
+ int(8080)
+ ["user"]=>
+ string(4) "user"
+ ["pass"]=>
+ string(6) "passwd"
+ ["query"]=>
+ string(12) "bar=1&boom=0"
+}
+
+--> file:///path/to/file: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(13) "/path/to/file"
+}
+
+--> file://path/to/file: array(3) {
+ ["scheme"]=>
+ string(4) "file"
+ ["host"]=>
+ string(4) "path"
+ ["path"]=>
+ string(8) "/to/file"
+}
+
+--> file:/path/to/file: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(13) "/path/to/file"
+}
+
+--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "1.2.3.4"
+ ["path"]=>
+ string(8) "/abc.asp"
+ ["query"]=>
+ string(7) "a=1&b=2"
+}
+
+--> http://foo.com#bar: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "foo.com"
+ ["fragment"]=>
+ string(3) "bar"
+}
+
+--> scheme:: array(1) {
+ ["scheme"]=>
+ string(6) "scheme"
+}
+
+--> foo+bar://baz@bang/bla: array(4) {
+ ["scheme"]=>
+ string(7) "foo+bar"
+ ["host"]=>
+ string(4) "bang"
+ ["user"]=>
+ string(3) "baz"
+ ["path"]=>
+ string(4) "/bla"
+}
+
+--> gg:9130731: array(2) {
+ ["scheme"]=>
+ string(2) "gg"
+ ["path"]=>
+ string(7) "9130731"
+}
+
+--> http://user:@pass@host/path?argument?value#etc: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(4) "host"
+ ["user"]=>
+ string(4) "user"
+ ["pass"]=>
+ string(5) "@pass"
+ ["path"]=>
+ string(5) "/path"
+ ["query"]=>
+ string(14) "argument?value"
+ ["fragment"]=>
+ string(3) "etc"
+}
+
+--> http://10.10.10.10/:80: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "10.10.10.10"
+ ["path"]=>
+ string(4) "/:80"
+}
+
+--> http://x:?: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) "x"
+}
+
+--> x:blah.com: array(2) {
+ ["scheme"]=>
+ string(1) "x"
+ ["path"]=>
+ string(8) "blah.com"
+}
+
+--> x:/blah.com: array(2) {
+ ["scheme"]=>
+ string(1) "x"
+ ["path"]=>
+ string(9) "/blah.com"
+}
+
+--> x://::abc/?: 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_SCHEME as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_SCHEME));
+
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : string(4) "http"
+--> http://64.246.30.37/ : string(4) "http"
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : string(4) "http"
+--> http://php.net/ : string(4) "http"
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : string(4) "http"
+--> http://www.php.net/ : string(4) "http"
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : string(4) "http"
+--> http://www.php.net:80/ : string(4) "http"
+--> http://www.php.net/index.php : string(4) "http"
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : string(4) "http"
+--> http://www.php.net:80/? : string(4) "http"
+--> http://www.php.net:80/index.php : string(4) "http"
+--> http://www.php.net:80/foo/bar/index.php : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http"
+--> http://www.php.net:80/this/../a/../deep/directory : string(4) "http"
+--> http://www.php.net:80/this/../a/../deep/directory/ : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(4) "http"
+--> http://www.php.net:80/index.php : string(4) "http"
+--> http://www.php.net:80/index.php? : string(4) "http"
+--> http://www.php.net:80/#foo : string(4) "http"
+--> http://www.php.net:80/?# : string(4) "http"
+--> http://www.php.net:80/?test=1 : string(4) "http"
+--> http://www.php.net/?test=1& : string(4) "http"
+--> http://www.php.net:80/?& : string(4) "http"
+--> http://www.php.net:80/index.php?test=1& : string(4) "http"
+--> http://www.php.net/index.php?& : string(4) "http"
+--> http://www.php.net:80/index.php?foo& : string(4) "http"
+--> http://www.php.net/index.php?&foo : string(4) "http"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(4) "http"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> nntp://news.php.net : string(4) "nntp"
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(3) "ftp"
+--> zlib:http://foo@bar : string(4) "zlib"
+--> zlib:filename.txt : string(4) "zlib"
+--> zlib:/path/to/my/file/file.txt : string(4) "zlib"
+--> foo://foo@bar : string(3) "foo"
+--> mailto:me@mydomain.com : string(6) "mailto"
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "http"
+--> file:///path/to/file : string(4) "file"
+--> file://path/to/file : string(4) "file"
+--> file:/path/to/file : string(4) "file"
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(4) "http"
+--> http://foo.com#bar : string(4) "http"
+--> scheme: : string(6) "scheme"
+--> foo+bar://baz@bang/bla : string(7) "foo+bar"
+--> gg:9130731 : string(2) "gg"
+--> http://user:@pass@host/path?argument?value#etc : string(4) "http"
+--> http://10.10.10.10/:80 : string(4) "http"
+--> http://x:? : string(4) "http"
+--> x:blah.com : string(1) "x"
+--> x:/blah.com : string(1) "x"
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_HOST as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_HOST));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : string(12) "64.246.30.37"
+--> http://64.246.30.37/ : string(12) "64.246.30.37"
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : string(12) "64.246.30.37"
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : string(7) "php.net"
+--> http://php.net/ : string(7) "php.net"
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : string(11) "www.php.net"
+--> http://www.php.net/ : string(11) "www.php.net"
+--> www.php.net:80 : string(11) "www.php.net"
+--> http://www.php.net:80 : string(11) "www.php.net"
+--> http://www.php.net:80/ : string(11) "www.php.net"
+--> http://www.php.net/index.php : string(11) "www.php.net"
+--> www.php.net/? : NULL
+--> www.php.net:80/? : string(11) "www.php.net"
+--> http://www.php.net/? : string(11) "www.php.net"
+--> http://www.php.net:80/? : string(11) "www.php.net"
+--> http://www.php.net:80/index.php : string(11) "www.php.net"
+--> http://www.php.net:80/foo/bar/index.php : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net"
+--> http://www.php.net:80/this/../a/../deep/directory : string(11) "www.php.net"
+--> http://www.php.net:80/this/../a/../deep/directory/ : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(11) "www.php.net"
+--> http://www.php.net:80/index.php : string(11) "www.php.net"
+--> http://www.php.net:80/index.php? : string(11) "www.php.net"
+--> http://www.php.net:80/#foo : string(11) "www.php.net"
+--> http://www.php.net:80/?# : string(11) "www.php.net"
+--> http://www.php.net:80/?test=1 : string(11) "www.php.net"
+--> http://www.php.net/?test=1& : string(11) "www.php.net"
+--> http://www.php.net:80/?& : string(11) "www.php.net"
+--> http://www.php.net:80/index.php?test=1& : string(11) "www.php.net"
+--> http://www.php.net/index.php?& : string(11) "www.php.net"
+--> http://www.php.net:80/index.php?foo& : string(11) "www.php.net"
+--> http://www.php.net/index.php?&foo : string(11) "www.php.net"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(11) "www.php.net"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> nntp://news.php.net : string(12) "news.php.net"
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org"
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : string(3) "bar"
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(15) "www.example.com"
+--> file:///path/to/file : NULL
+--> file://path/to/file : string(4) "path"
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "1.2.3.4"
+--> http://foo.com#bar : string(7) "foo.com"
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : string(4) "bang"
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(4) "host"
+--> http://10.10.10.10/:80 : string(11) "10.10.10.10"
+--> http://x:? : string(1) "x"
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_PORT as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PORT));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : int(80)
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : int(80)
+--> http://www.php.net:80 : int(80)
+--> http://www.php.net:80/ : int(80)
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : int(80)
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : int(80)
+--> http://www.php.net:80/index.php : int(80)
+--> http://www.php.net:80/foo/bar/index.php : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80)
+--> http://www.php.net:80/this/../a/../deep/directory : int(80)
+--> http://www.php.net:80/this/../a/../deep/directory/ : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : int(80)
+--> http://www.php.net:80/index.php : int(80)
+--> http://www.php.net:80/index.php? : int(80)
+--> http://www.php.net:80/#foo : int(80)
+--> http://www.php.net:80/?# : int(80)
+--> http://www.php.net:80/?test=1 : int(80)
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : int(80)
+--> http://www.php.net:80/index.php?test=1& : int(80)
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : int(80)
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : int(80)
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : int(8080)
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : NULL
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_USER as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_USER));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : NULL
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : NULL
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : NULL
+--> http://www.php.net:80/index.php?test=1& : NULL
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : NULL
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : string(3) "foo"
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "user"
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : string(3) "baz"
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(4) "user"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_PASS as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PASS));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : NULL
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : NULL
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : NULL
+--> http://www.php.net:80/index.php?test=1& : NULL
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : NULL
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hid:out"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(6) "passwd"
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(5) "@pass"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_PATH as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PATH));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : string(12) "64.246.30.37"
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : string(1) "/"
+--> 64.246.30.37/ : string(13) "64.246.30.37/"
+--> 64.246.30.37:80/ : string(1) "/"
+--> php.net : string(7) "php.net"
+--> php.net/ : string(8) "php.net/"
+--> http://php.net : NULL
+--> http://php.net/ : string(1) "/"
+--> www.php.net : string(11) "www.php.net"
+--> www.php.net/ : string(12) "www.php.net/"
+--> http://www.php.net : NULL
+--> http://www.php.net/ : string(1) "/"
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : string(1) "/"
+--> http://www.php.net/index.php : string(10) "/index.php"
+--> www.php.net/? : string(12) "www.php.net/"
+--> www.php.net:80/? : string(1) "/"
+--> http://www.php.net/? : string(1) "/"
+--> http://www.php.net:80/? : string(1) "/"
+--> http://www.php.net:80/index.php : string(10) "/index.php"
+--> http://www.php.net:80/foo/bar/index.php : string(18) "/foo/bar/index.php"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(45) "/this/is/a/very/deep/directory/structure/and/"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+--> http://www.php.net:80/this/../a/../deep/directory : string(28) "/this/../a/../deep/directory"
+--> http://www.php.net:80/this/../a/../deep/directory/ : string(29) "/this/../a/../deep/directory/"
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(42) "/this/is/a/very/deep/directory/../file.php"
+--> http://www.php.net:80/index.php : string(10) "/index.php"
+--> http://www.php.net:80/index.php? : string(10) "/index.php"
+--> http://www.php.net:80/#foo : string(1) "/"
+--> http://www.php.net:80/?# : string(1) "/"
+--> http://www.php.net:80/?test=1 : string(1) "/"
+--> http://www.php.net/?test=1& : string(1) "/"
+--> http://www.php.net:80/?& : string(1) "/"
+--> http://www.php.net:80/index.php?test=1& : string(10) "/index.php"
+--> http://www.php.net/index.php?& : string(10) "/index.php"
+--> http://www.php.net:80/index.php?foo& : string(10) "/index.php"
+--> http://www.php.net/index.php?&foo : string(10) "/index.php"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(10) "/index.php"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(22) "/gnu/glic/glibc.tar.gz"
+--> zlib:http://foo@bar : string(14) "http://foo@bar"
+--> zlib:filename.txt : string(12) "filename.txt"
+--> zlib:/path/to/my/file/file.txt : string(25) "/path/to/my/file/file.txt"
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : string(15) "me@mydomain.com"
+--> /foo.php?a=b&c=d : string(8) "/foo.php"
+--> foo.php?a=b&c=d : string(7) "foo.php"
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL
+--> file:///path/to/file : string(13) "/path/to/file"
+--> file://path/to/file : string(8) "/to/file"
+--> file:/path/to/file : string(13) "/path/to/file"
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(8) "/abc.asp"
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : string(4) "/bla"
+--> gg:9130731 : string(7) "9130731"
+--> http://user:@pass@host/path?argument?value#etc : string(5) "/path"
+--> http://10.10.10.10/:80 : string(4) "/:80"
+--> http://x:? : NULL
+--> x:blah.com : string(8) "blah.com"
+--> x:/blah.com : string(9) "/blah.com"
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_QUERY as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_QUERY));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(37) "lots=1&of=2&parameters=3&too=4&here=5"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : NULL
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : string(6) "test=1"
+--> http://www.php.net/?test=1& : string(7) "test=1&"
+--> http://www.php.net:80/?& : string(1) "&"
+--> http://www.php.net:80/index.php?test=1& : string(7) "test=1&"
+--> http://www.php.net/index.php?& : string(1) "&"
+--> http://www.php.net:80/index.php?foo& : string(4) "foo&"
+--> http://www.php.net/index.php?&foo : string(4) "&foo"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(31) "test=1&test2=char&test3=mixesCI"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : string(7) "a=b&c=d"
+--> foo.php?a=b&c=d : string(7) "a=b&c=d"
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(12) "bar=1&boom=0"
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "a=1&b=2"
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(14) "argument?value"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_FRAGMENT));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : string(3) "foo"
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : NULL
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : NULL
+--> http://www.php.net:80/index.php?test=1& : NULL
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : NULL
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : string(3) "bar"
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(3) "etc"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * check values of URL related constants
+ */
+foreach(get_defined_constants() as $constantName => $constantValue) {
+ if (strpos($constantName, 'PHP_URL')===0) {
+ echo "$constantName: $constantValue \n";
+ }
+}
+
+echo "Done";
+?>
+--EXPECTF--
+PHP_URL_SCHEME: 0
+PHP_URL_HOST: 1
+PHP_URL_PORT: 2
+PHP_URL_USER: 3
+PHP_URL_PASS: 4
+PHP_URL_PATH: 5
+PHP_URL_QUERY: 6
+PHP_URL_FRAGMENT: 7
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_error_001.phpt b/ext/standard/tests/url/parse_url_error_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_url() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing parse_url() function with Zero arguments --\n";
+var_dump( parse_url() );
+
+//Test parse_url with one more than the expected number of arguments
+echo "\n-- Testing parse_url() function with more than expected no. of arguments --\n";
+$url = 'string_val';
+$url_component = 10;
+$extra_arg = 10;
+var_dump( parse_url($url, $url_component, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : error conditions ***
+
+-- Testing parse_url() function with Zero arguments --
+
+Warning: parse_url() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing parse_url() function with more than expected no. of arguments --
+
+Warning: parse_url() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_error_002.phpt b/ext/standard/tests/url/parse_url_error_002.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_url() : error conditions: url component specifier out of range ***\n";
+$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+
+echo "--> Below range:";
+var_dump(parse_url($url, -1));
+
+echo "\n\n--> Above range:";
+var_dump(parse_url($url, 99));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing parse_url() : error conditions: url component specifier out of range ***
+--> Below range:array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+
+--> Above range:
+Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_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--
+<?php
+var_dump(parse_url('//example.org'));
+--EXPECT--
+array(1) {
+ ["host"]=>
+ 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--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing parse_url() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for url
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( parse_url($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(60)
+Error: 8 - Undefined variable: unset_var, %s(63)
+
+Arg value 0
+array(1) {
+ ["path"]=>
+ string(1) "0"
+}
+
+Arg value 1
+array(1) {
+ ["path"]=>
+ string(1) "1"
+}
+
+Arg value 12345
+array(1) {
+ ["path"]=>
+ string(5) "12345"
+}
+
+Arg value -2345
+array(1) {
+ ["path"]=>
+ string(5) "-2345"
+}
+
+Arg value 10.5
+array(1) {
+ ["path"]=>
+ string(4) "10.5"
+}
+
+Arg value -10.5
+array(1) {
+ ["path"]=>
+ string(5) "-10.5"
+}
+
+Arg value 101234567000
+array(1) {
+ ["path"]=>
+ string(12) "101234567000"
+}
+
+Arg value 1.07654321E-9
+array(1) {
+ ["path"]=>
+ string(13) "1.07654321E-9"
+}
+
+Arg value 0.5
+array(1) {
+ ["path"]=>
+ string(3) "0.5"
+}
+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--
+<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); ?>
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing parse_url() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for url_component
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( parse_url($url, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 10.5
+Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71)
+bool(false)
+
+Arg value -10.5
+array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+Arg value 101234567000
+array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+Arg value 1.07654321E-9
+string(4) "http"
+
+Arg value 0.5
+string(4) "http"
+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--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing parse_url() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for url_component
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( parse_url($url, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 10.5
+Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71)
+bool(false)
+
+Arg value -10.5
+array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+Arg value 101234567000
+Error: 2 - parse_url(): Invalid URL component identifier %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--
+<?php
+/* Prototype : proto string rawurldecode(string str)
+ * Description: Decodes URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing rawurldecode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing rawurldecode() function with Zero arguments --\n";
+var_dump( rawurldecode() );
+
+//Test rawurldecode with one more than the expected number of arguments
+echo "\n-- Testing rawurldecode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( rawurldecode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurldecode() : error conditions ***
+
+-- Testing rawurldecode() function with Zero arguments --
+
+Warning: rawurldecode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing rawurldecode() function with more than expected no. of arguments --
+
+Warning: rawurldecode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done
diff --git a/ext/standard/tests/url/rawurldecode_variation_001.phpt b/ext/standard/tests/url/rawurldecode_variation_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string rawurldecode(string str)
+ * Description: Decodes URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing rawurldecode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( rawurldecode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurldecode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+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--
+<?php
+/* Prototype : proto string rawurlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing rawurlencode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing rawurlencode() function with Zero arguments --\n";
+var_dump( rawurlencode() );
+
+//Test rawurlencode with one more than the expected number of arguments
+echo "\n-- Testing rawurlencode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( rawurlencode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurlencode() : error conditions ***
+
+-- Testing rawurlencode() function with Zero arguments --
+
+Warning: rawurlencode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing rawurlencode() function with more than expected no. of arguments --
+
+Warning: rawurlencode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/rawurlencode_variation_001.phpt b/ext/standard/tests/url/rawurlencode_variation_001.phpt
new file mode 100644
index 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--
+<?php
+/* Prototype : proto string rawurlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing rawurlencode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( rawurlencode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurlencode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+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--
+<?php
+/* Prototype : proto string urldecode(string str)
+ * Description: Decodes URL-encoded string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing urldecode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing urldecode() function with Zero arguments --\n";
+var_dump( urldecode() );
+
+//Test urldecode with one more than the expected number of arguments
+echo "\n-- Testing urldecode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( urldecode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urldecode() : error conditions ***
+
+-- Testing urldecode() function with Zero arguments --
+
+Warning: urldecode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing urldecode() function with more than expected no. of arguments --
+
+Warning: urldecode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urldecode_variation_001.phpt b/ext/standard/tests/url/urldecode_variation_001.phpt
new file mode 100644
index 0000000..42026d1
--- /dev/null
+++ b/ext/standard/tests/url/urldecode_variation_001.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test urldecode() function : usage variations - <type here specifics of this variation>
+--FILE--
+<?php
+/* Prototype : proto string urldecode(string str)
+ * Description: Decodes URL-encoded string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing urldecode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( urldecode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urldecode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+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--
+<?php
+/* Prototype : proto string urlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing urlencode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing urlencode() function with Zero arguments --\n";
+var_dump( urlencode() );
+
+//Test urlencode with one more than the expected number of arguments
+echo "\n-- Testing urlencode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( urlencode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urlencode() : error conditions ***
+
+-- Testing urlencode() function with Zero arguments --
+
+Warning: urlencode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing urlencode() function with more than expected no. of arguments --
+
+Warning: urlencode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urlencode_variation_001.phpt b/ext/standard/tests/url/urlencode_variation_001.phpt
new file mode 100644
index 0000000..04d0921
--- /dev/null
+++ b/ext/standard/tests/url/urlencode_variation_001.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test urlencode() function : usage variations - <type here specifics of this variation>
+--FILE--
+<?php
+/* Prototype : proto string urlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing urlencode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( urlencode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urlencode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+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 @@
+<?php
+$urls = array(
+// Parsable URLs:
+'64.246.30.37',
+'http://64.246.30.37',
+'http://64.246.30.37/',
+'64.246.30.37/',
+'64.246.30.37:80/',
+'php.net',
+'php.net/',
+'http://php.net',
+'http://php.net/',
+'www.php.net',
+'www.php.net/',
+'http://www.php.net',
+'http://www.php.net/',
+'www.php.net:80',
+'http://www.php.net:80',
+'http://www.php.net:80/',
+'http://www.php.net/index.php',
+'www.php.net/?',
+'www.php.net:80/?',
+'http://www.php.net/?',
+'http://www.php.net:80/?',
+'http://www.php.net:80/index.php',
+'http://www.php.net:80/foo/bar/index.php',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
+'http://www.php.net:80/this/../a/../deep/directory',
+'http://www.php.net:80/this/../a/../deep/directory/',
+'http://www.php.net:80/this/is/a/very/deep/directory/../file.php',
+'http://www.php.net:80/index.php',
+'http://www.php.net:80/index.php?',
+'http://www.php.net:80/#foo',
+'http://www.php.net:80/?#',
+'http://www.php.net:80/?test=1',
+'http://www.php.net/?test=1&',
+'http://www.php.net:80/?&',
+'http://www.php.net:80/index.php?test=1&',
+'http://www.php.net/index.php?&',
+'http://www.php.net:80/index.php?foo&',
+'http://www.php.net/index.php?&foo',
+'http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI',
+'www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'nntp://news.php.net',
+'ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz',
+'zlib:http://foo@bar',
+'zlib:filename.txt',
+'zlib:/path/to/my/file/file.txt',
+'foo://foo@bar',
+'mailto:me@mydomain.com',
+'/foo.php?a=b&c=d',
+'foo.php?a=b&c=d',
+'http://user:passwd@www.example.com:8080?bar=1&boom=0',
+'file:///path/to/file',
+'file://path/to/file',
+'file:/path/to/file',
+'http://1.2.3.4:/abc.asp?a=1&b=2',
+'http://foo.com#bar',
+'scheme:',
+'foo+bar://baz@bang/bla',
+'gg:9130731',
+'http://user:@pass@host/path?argument?value#etc',
+'http://10.10.10.10/:80',
+'http://x:?',
+'x:blah.com',
+'x:/blah.com',
+'x://::abc/?',
+'http://::?',
+'x://::6.5',
+'http://?:/',
+'http://@?:/',
+'file:///:',
+'file:///a:/',
+'file:///ab:/',
+'file:///a:/',
+'file:///@:/',
+'file:///:80/',
+'[]',
+'http://[x:80]/',
+'',
+'/',
+
+// Severely malformed URLs that do not parse:
+'http:///blah.com',
+'http://:80',
+'http://user@:80',
+'http://user:pass@:80',
+'http://:',
+'http://@/',
+'http://@:/',
+'http://:/',
+'http://?',
+'http://?:',
+'http://:?',
+'http://blah.com:123456',
+'http://blah.com:abcdef',
+);
+
+
+?> \ No newline at end of file
diff --git a/ext/standard/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--
+<?php
+
+var_dump(php_sapi_name());
+
+--EXPECTF--
+%unicode|string%(3) "c%ci"
diff --git a/ext/standard/tests/versioning/php_sapi_name_variation001.phpt b/ext/standard/tests/versioning/php_sapi_name_variation001.phpt
new file mode 100644
index 0000000..4e45870
--- /dev/null
+++ b/ext/standard/tests/versioning/php_sapi_name_variation001.phpt
@@ -0,0 +1,14 @@
+--TEST--
+php_sapi_name() function when switching to webserver by using post
+--POST--
+foo=BAR
+--CREDITS--
+Sebastian SchÃŒrmann
+sebs@php.net
+Testfest 2009 Munich
+--FILE--
+<?php
+echo php_sapi_name();
+?>
+--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--
+<?php
+
+print "TESTING COMPARE\n";
+$special_forms = array("-dev", "a1", "b1", "RC1", "rc1", "", "pl1");
+$operators = array(
+ "lt", "<",
+ "le", "<=",
+ "gt", ">",
+ "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--
+<?php
+echo zend_logo_guid();
+?>
+--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 <rasmus@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include "php.h"
+
+#include <stdlib.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include <stdio.h>
+#ifdef PHP_WIN32
+#include "win32/time.h"
+#else
+#include <sys/time.h>
+#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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+
+#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 <jimw@php.net> |
+ +----------------------------------------------------------------------+
+ */
+/* $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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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 <form> or
+ * <fieldset>. 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, "<input type=\"hidden\" name=\"");
+ smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
+ smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
+ smart_str_append(&BG(url_adapt_state_ex).form_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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include "php.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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 <form> or
+ * <fieldset>. 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, "<input type=\"hidden\" name=\"");
+ smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
+ smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
+ smart_str_append(&BG(url_adapt_state_ex).form_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 <ilia@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $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 <math.h>
+
+#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 <jkl@njet.net> |
+ | Thies C. Arntzen <thies@thieso.net> |
+ | Sascha Schumann <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+/* {{{ includes
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $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 <ssb@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#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